WebKit Bugzilla
Attachment 343567 Details for
Bug 187000
: [LFC] Adjust static position for out-of-flow positioned boxes.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187000-20180625180135.patch (text/plain), 5.59 KB, created by
zalan
on 2018-06-25 18:01:36 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-25 18:01:36 PDT
Size:
5.59 KB
patch
obsolete
>Subversion Revision: 233176 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 4cb3fc556301218bd8ab7c0fe79c60e0797518be..386c34e54fcd8957b7f546012b60c9e2c2082f79 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,19 @@ >+2018-06-25 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Adjust static position for out-of-flow positioned boxes. >+ https://bugs.webkit.org/show_bug.cgi?id=187000 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ The static position of an out-of-flow positioned box is the the position where box would go >+ if it was in-flow positioned. This position needs to the resolved in the containing block's coordinate system. >+ >+ * layout/blockformatting/BlockFormattingContext.h: >+ * layout/blockformatting/BlockFormattingContextGeometry.cpp: >+ (WebCore::Layout::BlockFormattingContext::Geometry::inFlowReplacedWidthAndMargin): >+ (WebCore::Layout::BlockFormattingContext::Geometry::staticPositionForOutOfFlowPositioned): >+ (WebCore::Layout::BlockFormattingContext::Geometry::staticPosition): >+ > 2018-06-25 Brent Fulgham <bfulgham@apple.com> > > REGRESSION(r229722): WebKitLegacy clients can crash when loading alternate page >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index 5072851b880af20451cd274b0a0a5c0fabf2e1f7..311b22908c7a9d303bdb30dcfc49594d56e98368 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -72,6 +72,7 @@ private: > static FormattingContext::Geometry::HeightAndMargin inFlowNonReplacedHeightAndMargin(LayoutContext&, const Box&); > static FormattingContext::Geometry::WidthAndMargin inFlowNonReplacedWidthAndMargin(LayoutContext&, const Box&, std::optional<LayoutUnit> precomputedWidth = std::nullopt); > static FormattingContext::Geometry::WidthAndMargin inFlowReplacedWidthAndMargin(LayoutContext&, const Box&); >+ static FormattingContext::Geometry::Position staticPositionForOutOfFlowPositioned(const LayoutContext&, const Box&); > }; > > // This class implements margin collapsing for block formatting context. >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >index 5b71b49a3bf523a776c93214dfdb2fe831cd8324..345c800c50ff6e77049e25e4f0439b3ec4805de7 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContextGeometry.cpp >@@ -262,6 +262,32 @@ FormattingContext::Geometry::WidthAndMargin BlockFormattingContext::Geometry::in > return { width, margin }; > } > >+FormattingContext::Geometry::Position BlockFormattingContext::Geometry::staticPositionForOutOfFlowPositioned(const LayoutContext& layoutContext, const Box& layoutBox) >+{ >+ // FIXME: This is certainly only really needed when top/bottom left/right are auto. >+ ASSERT(layoutBox.isOutOfFlowPositioned()); >+ LayoutUnit top; >+ LayoutUnit left; >+ // Resolve top/left all the way up to the containing block. >+ auto* containingBlock = layoutBox.containingBlock(); >+ for (auto* parent = layoutBox.parent(); parent; parent = parent->parent()) { >+ auto& displayBox = *layoutContext.displayBoxForLayoutBox(*parent); >+ top += (displayBox.top() + displayBox.contentBoxTop()); >+ left += (displayBox.left() + displayBox.contentBoxLeft()); >+ if (parent == containingBlock) >+ break; >+ } >+ // Add sibling offset >+ if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) { >+ auto& previousInFlowDisplayBox = *layoutContext.displayBoxForLayoutBox(*previousInFlowSibling); >+ top += previousInFlowDisplayBox.bottom() + previousInFlowDisplayBox.marginBottom(); >+ } >+ >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position] -> out-of-flow -> static -> top(" << top << "px) left(" << left << "px) layoutBox(" << &layoutBox << ")"); >+ return { left, top }; >+} >+ >+ > FormattingContext::Geometry::Position BlockFormattingContext::Geometry::staticPosition(LayoutContext& layoutContext, const Box& layoutBox) > { > // https://www.w3.org/TR/CSS22/visuren.html#block-formatting >@@ -270,13 +296,17 @@ FormattingContext::Geometry::Position BlockFormattingContext::Geometry::staticPo > // Vertical margins between adjacent block-level boxes in a block formatting context collapse. > // In a block formatting context, each box's left outer edge touches the left edge of the containing block (for right-to-left formatting, right edges touch). > >- auto& containingBlockDisplayBox = *layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); >+ if (layoutBox.isOutOfFlowPositioned()) >+ return staticPositionForOutOfFlowPositioned(layoutContext, layoutBox); >+ > LayoutUnit top; >+ auto& containingBlockDisplayBox = *layoutContext.displayBoxForLayoutBox(*layoutBox.containingBlock()); > if (auto* previousInFlowSibling = layoutBox.previousInFlowSibling()) { > auto& previousInFlowDisplayBox = *layoutContext.displayBoxForLayoutBox(*previousInFlowSibling); > top = previousInFlowDisplayBox.bottom() + previousInFlowDisplayBox.marginBottom(); > } else > top = containingBlockDisplayBox.contentBoxTop(); >+ > auto left = containingBlockDisplayBox.contentBoxLeft(); > LOG_WITH_STREAM(FormattingContextLayout, stream << "[Position] -> static -> top(" << top << "px) left(" << left << "px) layoutBox(" << &layoutBox << ")"); > return { left, top };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
koivisto
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187000
: 343567