Set baseLevel and paraLevel properties on empty frames. Bug 489887, r+sr=roc, blocking1.9.1 via bug 332655
authorSimon Montagu <smontagu@smontagu.org>
Wed, 20 May 2009 11:49:04 -0700
changeset 25577 7f76080e8965b372fb576bd3e9e66e23172c6372
parent 25576 e28fcb15919c1927b957c5df0ca22d21e5f35ba6
child 25578 e7c612c86acc04e257c135c74c3df4eca79f60fd
push id1490
push usersmontagu@mozilla.com
push dateWed, 20 May 2009 18:50:58 +0000
bugs489887, 332655
milestone1.9.1b5pre
Set baseLevel and paraLevel properties on empty frames. Bug 489887, r+sr=roc, blocking1.9.1 via bug 332655
layout/base/nsBidiPresUtils.cpp
layout/reftests/bidi/489887-1-ref.html
layout/reftests/bidi/489887-1.html
layout/reftests/bidi/reftest.list
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -399,16 +399,23 @@ nsBidiPresUtils::Resolve(nsBlockFrame*  
         content = frame->GetContent();
         if (!content) {
           mSuccess = NS_OK;
           break;
         }
         contentTextLength = content->TextLength();
         if (contentTextLength == 0) {
           frame->AdjustOffsetsForBidi(0, 0);
+          // Set the base level and embedding level of the current run even
+          // on an empty frame. Otherwise frame reordering will not be correct.
+          propTable->SetProperty(frame, nsGkAtoms::embeddingLevel,
+                                 NS_INT32_TO_PTR(embeddingLevel),
+                                 nsnull, nsnull);
+          propTable->SetProperty(frame, nsGkAtoms::baseLevel,
+                                 NS_INT32_TO_PTR(paraLevel), nsnull, nsnull);
           continue;
         }
         PRInt32 start, end;
         frame->GetOffsets(start, end);
         fragmentLength = end - start;
         contentOffset = start;
         isTextFrame = PR_TRUE;
       } // if text frame
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bidi/489887-1-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script type="text/javascript">
+function boom()
+{
+  document.getElementById("w").firstChild.data = "";
+
+}
+</script>
+</head>
+<body onload="boom();">
+<div><span>&#x06cd;</span><span id="w"> </span><span>&#x06cb;</span></div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/bidi/489887-1.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script type="text/javascript">
+function boom()
+{
+  document.getElementById("w").firstChild.data = "";
+  document.documentElement.appendChild(document.body);
+}
+</script>
+</head>
+<body onload="boom();">
+<div><span>&#x06cd;</span><span id="w"> </span><span>&#x06cb;</span></div>
+</body>
+</html>
--- a/layout/reftests/bidi/reftest.list
+++ b/layout/reftests/bidi/reftest.list
@@ -28,8 +28,9 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") ==
 == 409375.html 409375-ref.html
 == 413542-1.html 413542-1-ref.html
 == 413542-2.html 413542-2-ref.html
 == 413928-1.html 413928-1-ref.html
 == 413928-2.html 413928-2-ref.html
 == 425338-1a.html 425338-1-ref.html
 == 425338-1b.html 425338-1-ref.html
 == 489517-1.html 489517-1-ref.html
+== 489887-1.html 489887-1-ref.html