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
--- 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.