Bug 1150614: place floats correctly in vertical writing modes with dir="rtl", r=jfkthame
☠☠ backed out by e6d14970cb2b ☠ ☠
authorSimon Montagu <smontagu@smontagu.org>
Wed, 29 Apr 2015 22:07:30 -0700
changeset 273111 f6bd5a0a047dd63c128a40501c107038f6422089
parent 273110 caf50ec1dc7bd29835438fcd5a1af7f22ee04934
child 273112 2bbe38dcb529a5658a3b74542ff726f7403b821a
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1150614
milestone40.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 1150614: place floats correctly in vertical writing modes with dir="rtl", r=jfkthame
layout/generic/nsBlockReflowState.cpp
--- a/layout/generic/nsBlockReflowState.cpp
+++ b/layout/generic/nsBlockReflowState.cpp
@@ -844,17 +844,29 @@ nsBlockReflowState::FlowAndPlaceFloat(ns
 
   // We don't worry about the geometry of the prev in flow, let the continuation
   // place and size itself as required.
 
   // Assign inline and block dir coordinates to the float. We don't use
   // LineLeft() and LineRight() here, because we would only have to
   // convert the result back into this block's writing mode.
   LogicalPoint floatPos(wm);
-  if ((NS_STYLE_FLOAT_LEFT == floatDisplay->mFloats) == wm.IsBidiLTR()) {
+  bool leftFloat = NS_STYLE_FLOAT_LEFT == floatDisplay->mFloats;
+  bool ltr = wm.IsBidiLTR();
+  bool vertical = wm.IsVertical();
+
+  if (vertical) {
+    // IStart and IEnd should use the ContainerHeight in vertical modes
+    // with rtl direction. Since they don't yet (bug 1131451), we'll
+    // just put left floats at the top of the line and right floats at
+    // bottom.
+    floatPos.I(wm) = leftFloat
+                      ? floatAvailableSpace.mRect.Y(wm)
+                      : floatAvailableSpace.mRect.YMost(wm) - floatMarginISize;
+  } else if (leftFloat == ltr) {
     floatPos.I(wm) = floatAvailableSpace.mRect.IStart(wm);
   }
   else {
     if (!keepFloatOnSameLine) {
       floatPos.I(wm) = floatAvailableSpace.mRect.IEnd(wm) - floatMarginISize;
     }
     else {
       // this is the IE quirk (see few lines above)