Bug 1457602 Part 2: Correct shape-outside: image interval creation to correctly handle sideways-lr (with or without positive shape-margin.) draft
authorBrad Werth <bwerth@mozilla.com>
Thu, 03 May 2018 15:51:06 -0700
changeset 793381 1d411ba50a2f59948f6ab1c84402a07b533c1610
parent 793380 a2619c20432c57a515a9e1080e424684b572d498
child 793382 7012433204f6ddbb30fb12534d22f5f037fd9149
push id109362
push userbwerth@mozilla.com
push dateWed, 09 May 2018 22:24:06 +0000
bugs1457602
milestone62.0a1
Bug 1457602 Part 2: Correct shape-outside: image interval creation to correctly handle sideways-lr (with or without positive shape-margin.) MozReview-Commit-ID: F4fsRPajJfR
layout/generic/nsFloatManager.cpp
--- a/layout/generic/nsFloatManager.cpp
+++ b/layout/generic/nsFloatManager.cpp
@@ -2254,18 +2254,21 @@ nsFloatManager::ImageShapeInfo::CreateIn
   // Depending on the writing mode, we now move the origin.
   if (aWM.IsVerticalRL()) {
     // vertical-rl or sideways-rl.
     // These writing modes proceed from the top right, and each interval
     // moves in a positive inline direction and negative block direction.
     // That means that the intervals will be reversed after all have been
     // constructed. We add 1 to aB to capture the end of the block axis pixel.
     origin.MoveBy(aIMin * aAppUnitsPerDevPixel, (aB + 1) * -aAppUnitsPerDevPixel);
-  } else if (aWM.IsVerticalLR() && aWM.IsSideways()) {
+  } else if (aWM.IsVerticalLR() && !aWM.IsLineInverted()) {
     // sideways-lr.
+    // Checking IsLineInverted is the only reliable way to distinguish
+    // vertical-lr from sideways-lr. IsSideways and IsInlineReversed are both
+    // affected by bidi and text-direction, and so complicate detection.
     // These writing modes proceed from the bottom left, and each interval
     // moves in a negative inline direction and a positive block direction.
     // We add 1 to aIMax to capture the end of the inline axis pixel.
     origin.MoveBy((aIMax + 1) * -aAppUnitsPerDevPixel, aB * aAppUnitsPerDevPixel);
   } else {
     // horizontal-tb or vertical-lr.
     // These writing modes proceed from the top left and each interval
     // moves in a positive step in both inline and block directions.