Bug 806284 - Resizing a RTL block with text-align:left does not reposition the lines. r=roc
authorMats Palmgren <matspal@gmail.com>
Wed, 05 Dec 2012 23:26:28 +0100
changeset 115125 e71b89c8cc841ac3340a93db57423b1ce4530624
parent 115124 77f529436f2b3779ee1071b65f4c8d900f20cb22
child 115126 16037c152c3602d037360406a16b881b03ffa7f8
push id23973
push useremorley@mozilla.com
push dateThu, 06 Dec 2012 10:04:18 +0000
treeherdermozilla-central@ddda5400c826 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs806284
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 806284 - Resizing a RTL block with text-align:left does not reposition the lines. r=roc
layout/generic/nsBlockFrame.cpp
layout/reftests/text/reftest.list
layout/reftests/text/text-align-left-in-rtl-block-iframe.html
layout/reftests/text/text-align-left-in-rtl-block-ref.html
layout/reftests/text/text-align-left-in-rtl-block.html
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -1567,24 +1567,26 @@ IsAlignedLeft(uint8_t aAlignment,
 
 nsresult
 nsBlockFrame::PrepareResizeReflow(nsBlockReflowState& aState)
 {
   const nsStyleText* styleText = GetStyleText();
   const nsStyleTextReset* styleTextReset = GetStyleTextReset();
   // See if we can try and avoid marking all the lines as dirty
   bool tryAndSkipLines =
-      // The text must be left-aligned.
+    // The block must be LTR (bug 806284)
+    GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR &&
+    // The text must be left-aligned.
     IsAlignedLeft(styleText->mTextAlign, 
                   aState.mReflowState.mStyleVisibility->mDirection,
                   styleTextReset->mUnicodeBidi,
                   this) &&
-      // The left content-edge must be a constant distance from the left
-      // border-edge.
-      !GetStylePadding()->mPadding.GetLeft().HasPercent();
+    // The left content-edge must be a constant distance from the left
+    // border-edge.
+    !GetStylePadding()->mPadding.GetLeft().HasPercent();
 
 #ifdef DEBUG
   if (gDisableResizeOpt) {
     tryAndSkipLines = false;
   }
   if (gNoisyReflow) {
     if (!tryAndSkipLines) {
       IndentBy(stdout, gNoiseIndent);
--- a/layout/reftests/text/reftest.list
+++ b/layout/reftests/text/reftest.list
@@ -93,16 +93,17 @@ HTTP(..) != synthetic-bold-metrics-01.ht
 != text-align-center-last-end.html text-align-center-last-justify.html
 != text-align-center-last-center.html text-align-center-last-justify.html
 != text-align-justify-last-start.html text-align-justify-last-end.html
 != text-align-justify-last-start.html text-align-justify-last-center.html
 != text-align-justify-last-start.html text-align-justify-last-justify.html
 != text-align-justify-last-end.html text-align-justify-last-center.html
 != text-align-justify-last-end.html text-align-justify-last-justify.html
 != text-align-justify-last-center.html text-align-justify-last-justify.html
+== text-align-left-in-rtl-block.html text-align-left-in-rtl-block-ref.html
 == variation-selector-unsupported-1.html variation-selector-unsupported-1-ref.html
 == white-space-1a.html white-space-1-ref.html
 == white-space-1b.html white-space-1-ref.html
 == white-space-2.html white-space-2-ref.html
 == wordbreak-1.html wordbreak-1-ref.html
 == wordbreak-2.html wordbreak-2-ref.html
 == wordbreak-3.html wordbreak-3-ref.html
 == wordbreak-4a.html wordbreak-4a-ref.html
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text/text-align-left-in-rtl-block-iframe.html
@@ -0,0 +1,17 @@
+<!DOCTYPE HTML>
+<html><head>
+    <meta charset="utf-8">
+    <title>Testcase for bug 806284</title>
+    <style type="text/css">
+        html,body {
+            color:black; background-color:white; font-size:16px; padding:0; margin:0;
+        }
+	body { text-align:left; }
+</style>
+</head>
+<body>
+<div dir="rtl">
+111111111111112222222222222233333333333334444444444
+</div>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text/text-align-left-in-rtl-block-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait"><head>
+    <meta charset="utf-8">
+    <title>Testcase for bug 806284</title>
+    <style type="text/css">
+        html,body {
+            color:black; background-color:white; font-size:16px; padding:0; margin:0;
+        }
+
+        #t { width:20em; border: 1px solid black; }
+    </style>
+</head>
+<body>
+<iframe id="t" src="text-align-left-in-rtl-block-iframe.html"></iframe>
+<script type="text/javascript">
+function test()
+{
+  document.documentElement.removeAttribute("class");
+}
+document.addEventListener("MozReftestInvalidate", test, false);
+</script>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/text/text-align-left-in-rtl-block.html
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML>
+<html class="reftest-wait"><head>
+    <meta charset="utf-8">
+    <title>Testcase for bug 806284</title>
+    <style type="text/css">
+        html,body {
+            color:black; background-color:white; font-size:16px; padding:0; margin:0;
+        }
+
+        #t { width:10em; border: 1px solid black; }
+    </style>
+</head>
+<body>
+<iframe id="t" src="text-align-left-in-rtl-block-iframe.html"></iframe>
+<script type="text/javascript">
+function test()
+{
+  var t = document.getElementById('t');
+  t.style.width = '20em';
+  document.documentElement.removeAttribute("class");
+}
+document.addEventListener("MozReftestInvalidate", test, false);
+</script>
+</body>
+</html>