From 8e58b5c8fb937459a1ec72887a2b3ccb1f91e185 Mon Sep 17 00:00:00 2001 From: Cameron Kaiser Date: Sat, 6 May 2017 14:14:33 -0700 Subject: [PATCH] prerequisite for #375: M1347759 --- layout/generic/nsAbsoluteContainingBlock.cpp | 50 +++++++++++++------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/layout/generic/nsAbsoluteContainingBlock.cpp b/layout/generic/nsAbsoluteContainingBlock.cpp index 521a0cbc0..7c9d54d94 100644 --- a/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/layout/generic/nsAbsoluteContainingBlock.cpp @@ -262,22 +262,6 @@ nsAbsoluteContainingBlock::FrameDependsOnContainer(nsIFrame* f, !IsFixedMarginSize(margin->mMargin.GetIEnd(wm))) { return true; } - if (!wm.IsBidiLTR()) { - // Note that even if 'istart' is a length, our position can - // still depend on the containing block isze, because if - // 'iend' is also a length we will discard 'istart' and be - // positioned relative to the containing block iend edge. - // 'istart' length and 'iend' auto is the only combination - // we can be sure of. - if (!IsFixedOffset(pos->mOffset.GetIStart(wm)) || - pos->mOffset.GetIEndUnit(wm) != eStyleUnit_Auto) { - return true; - } - } else { - if (!IsFixedOffset(pos->mOffset.GetIStart(wm))) { - return true; - } - } } if (wm.IsVertical() ? aCBWidthChanged : aCBHeightChanged) { // See if f's block-size might have changed. @@ -302,10 +286,42 @@ nsAbsoluteContainingBlock::FrameDependsOnContainer(nsIFrame* f, !IsFixedMarginSize(margin->mMargin.GetBEnd(wm))) { return true; } - if (!IsFixedOffset(pos->mOffset.GetBStart(wm))) { + } + + // Since we store coordinates relative to top and left, the position + // of a frame depends on that of its container if it is fixed relative + // to the right or bottom, or if it is positioned using percentages + // relative to the left or top. Because of the dependency on the + // sides (left and top) that we use to store coordinates, these tests + // are easier to do using physical coordinates rather than logical. + if (aCBWidthChanged) { + if (!IsFixedOffset(pos->mOffset.GetLeft())) { + return true; + } + // Note that even if 'left' is a length, our position can still + // depend on the containing block width, because if our direction or + // writing-mode moves from right to left (in either block or inline + // progression) and 'right' is not 'auto', we will discard 'left' + // and be positioned relative to the containing block right edge. + // 'left' length and 'right' auto is the only combination we can be + // sure of. + if ((wm.GetInlineDir() == WritingMode::eInlineRTL || + wm.GetBlockDir() == WritingMode::eBlockRL) && + pos->mOffset.GetRightUnit() != eStyleUnit_Auto) { return true; } } + if (aCBHeightChanged) { + if (!IsFixedOffset(pos->mOffset.GetTop())) { + return true; + } + // See comment above for width changes. + if (wm.GetInlineDir() == WritingMode::eInlineBTT && + pos->mOffset.GetBottomUnit() != eStyleUnit_Auto) { + return true; + } + } + return false; }