WebKit Bugzilla
Attachment 343725 Details for
Bug 187082
: [LFC] Out-of-flow positioned element's height depends on its containing block's height.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187082-20180627104152.patch (text/plain), 9.62 KB, created by
zalan
on 2018-06-27 10:41:53 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-27 10:41:53 PDT
Size:
9.62 KB
patch
obsolete
>Subversion Revision: 233260 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 2be8419cace7739f6020b882f7ae8f4d6f7cbf5d..cb8c9aba81dcf91df991757ea5da6da815310a1b 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2018-06-27 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Out-of-flow positioned element's height depends on its containing block's height. >+ https://bugs.webkit.org/show_bug.cgi?id=187082 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We can't really compute the final height of an out-of-flow element until after its containing block's height is computed. >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): >+ * layout/FormattingContext.h: >+ * layout/LayoutContext.cpp: >+ (WebCore::Layout::LayoutContext::updateLayout): >+ (WebCore::Layout::LayoutContext::layoutFormattingContextSubtree): >+ * layout/LayoutContext.h: >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::layout const): >+ * layout/layouttree/LayoutContainer.h: >+ (WebCore::Layout::Container::outOfFlowDescendants const): >+ (WebCore::Layout::Container::outOfFlowDescendants): Deleted. >+ > 2018-06-27 Zalan Bujtas <zalan@apple.com> > > [LFC] Move formatting context root layout logic to a dedicated function. >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index 1acb1a1d8910f65d9f0100501e1f33f1afc9a65a..7c58b669219b2123e582c6baeeb00f679d2a747f 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -105,14 +105,22 @@ void FormattingContext::placeInFlowPositionedChildren(LayoutContext& layoutConte > LOG_WITH_STREAM(FormattingContextLayout, stream << "End: move in-flow positioned children -> context: " << &layoutContext << " parent: " << &container); > } > >-void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext) const >+void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext, const Box& layoutBox) const > { >- if (!is<Container>(m_root.get())) >+ // Initial containing block by definition is a containing block. >+ if (!layoutBox.isPositioned() && !layoutBox.isInitialContainingBlock()) >+ return; >+ >+ if (!is<Container>(layoutBox)) >+ return; >+ >+ auto& container = downcast<Container>(layoutBox); >+ if (!container.hasChild()) > return; > > LOG_WITH_STREAM(FormattingContextLayout, stream << "Start: layout out-of-flow descendants -> context: " << &layoutContext << " root: " << &root()); > >- for (auto& outOfFlowBox : downcast<Container>(*m_root).outOfFlowDescendants()) { >+ for (auto& outOfFlowBox : container.outOfFlowDescendants()) { > auto& layoutBox = *outOfFlowBox; > auto& displayBox = layoutContext.createDisplayBox(layoutBox); > >@@ -120,7 +128,6 @@ void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext) > // More precisely, the static position for 'top' is the distance from the top edge of the containing block to the top margin edge > // of a hypothetical box that would have been the first box of the element if its specified 'position' value had been 'static' and > // its specified 'float' had been 'none' and its specified 'clear' had been 'none'. >- computeStaticPosition(layoutContext, layoutBox, displayBox); > computeBorderAndPadding(layoutContext, layoutBox, displayBox); > computeOutOfFlowHorizontalGeometry(layoutContext, layoutBox, displayBox); > >@@ -129,6 +136,7 @@ void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext) > formattingContext->layout(layoutContext, layoutContext.establishedFormattingState(layoutBox, *formattingContext)); > > computeOutOfFlowVerticalGeometry(layoutContext, layoutBox, displayBox); >+ layoutOutOfFlowDescendants(layoutContext, layoutBox); > } > LOG_WITH_STREAM(FormattingContextLayout, stream << "End: layout out-of-flow descendants -> context: " << &layoutContext << " root: " << &root()); > } >diff --git a/Source/WebCore/layout/FormattingContext.h b/Source/WebCore/layout/FormattingContext.h >index 52bba414d82d26b83e69a0189bd64673fb3afde3..ea17c7bb1b82e9c09f7a7218f4dc4bf539ff265c 100644 >--- a/Source/WebCore/layout/FormattingContext.h >+++ b/Source/WebCore/layout/FormattingContext.h >@@ -51,6 +51,7 @@ public: > virtual ~FormattingContext(); > > virtual void layout(LayoutContext&, FormattingState&) const = 0; >+ void layoutOutOfFlowDescendants(LayoutContext&, const Box&) const; > virtual std::unique_ptr<FormattingState> createFormattingState(Ref<FloatingState>&&) const = 0; > virtual Ref<FloatingState> createOrFindFloatingState(LayoutContext&) const = 0; > >@@ -72,7 +73,6 @@ protected: > void computeBorderAndPadding(LayoutContext&, const Box&, Display::Box&) const; > > void placeInFlowPositionedChildren(LayoutContext&, const Container&) const; >- void layoutOutOfFlowDescendants(LayoutContext&s) const; > > #ifndef NDEBUG > virtual void validateGeometryConstraintsAfterLayout(const LayoutContext&) const; >diff --git a/Source/WebCore/layout/LayoutContext.cpp b/Source/WebCore/layout/LayoutContext.cpp >index 97379982447753a8e02f67102fb6ad2273dd7fe6..9999617da2d9d0f7fd68896223745edce55d3d03 100644 >--- a/Source/WebCore/layout/LayoutContext.cpp >+++ b/Source/WebCore/layout/LayoutContext.cpp >@@ -71,15 +71,20 @@ void LayoutContext::initializeRoot(const Container& root, const LayoutSize& cont > void LayoutContext::updateLayout() > { > ASSERT(!m_formattingContextRootListForLayout.isEmpty()); >- for (auto* layoutRoot : m_formattingContextRootListForLayout) { >- RELEASE_ASSERT(layoutRoot->establishesFormattingContext()); >- auto context = formattingContext(*layoutRoot); >- auto& state = establishedFormattingState(*layoutRoot, *context); >- context->layout(*this, state); >- } >+ for (auto* layoutRoot : m_formattingContextRootListForLayout) >+ layoutFormattingContextSubtree(*layoutRoot); > m_formattingContextRootListForLayout.clear(); > } > >+void LayoutContext::layoutFormattingContextSubtree(const Box& layoutRoot) >+{ >+ RELEASE_ASSERT(layoutRoot.establishesFormattingContext()); >+ auto formattingContext = this->formattingContext(layoutRoot); >+ auto& formattingState = establishedFormattingState(layoutRoot, *formattingContext); >+ formattingContext->layout(*this, formattingState); >+ formattingContext->layoutOutOfFlowDescendants(*this, layoutRoot); >+} >+ > Display::Box& LayoutContext::createDisplayBox(const Box& layoutBox) > { > std::unique_ptr<Display::Box> displayBox(new Display::Box(layoutBox.style())); >diff --git a/Source/WebCore/layout/LayoutContext.h b/Source/WebCore/layout/LayoutContext.h >index d83bc08aa407fca4b1696f36c734a26b0304c0eb..1f84ac6c38a4515e5e3726c340a292da14c0c599 100644 >--- a/Source/WebCore/layout/LayoutContext.h >+++ b/Source/WebCore/layout/LayoutContext.h >@@ -86,6 +86,8 @@ public: > void verifyAndOutputMismatchingLayoutTree(const RenderView&) const; > > private: >+ void layoutFormattingContextSubtree(const Box&); >+ > WeakPtr<Container> m_root; > HashSet<const Container*> m_formattingContextRootListForLayout; > HashMap<const Box*, std::unique_ptr<FormattingState>> m_formattingStates; >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 5682f21bf3d51c4e4a0e9d1ccb0768885a0e9c2b..f9dc7c62f3448ef5c1da79eba7c85735465bc8a1 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -114,6 +114,7 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > auto& container = downcast<Container>(layoutBox); > // Move in-flow positioned children to their final position. > placeInFlowPositionedChildren(layoutContext, container); >+ layoutOutOfFlowDescendants(layoutContext, container); > if (auto* nextSibling = container.nextInFlowOrFloatingSibling()) { > layoutQueue.append(std::make_unique<LayoutPair>(LayoutPair {*nextSibling, layoutContext.createDisplayBox(*nextSibling)})); > break; >@@ -122,11 +123,6 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > } > // Place the inflow positioned children. > placeInFlowPositionedChildren(layoutContext, formattingRoot); >- // And take care of out-of-flow boxes as the final step. >- layoutOutOfFlowDescendants(layoutContext); >-#ifndef NDEBUG >- validateGeometryConstraintsAfterLayout(layoutContext); >-#endif > LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> block formatting context -> layout context(" << &layoutContext << ") formatting root(" << &root() << ")"); > } > >diff --git a/Source/WebCore/layout/layouttree/LayoutContainer.h b/Source/WebCore/layout/layouttree/LayoutContainer.h >index ed04cfec0e152112b00ec76988c51f2d9df4a85f..000bd4c23f3b7cbe3a4b4e12b02746381a720244 100644 >--- a/Source/WebCore/layout/layouttree/LayoutContainer.h >+++ b/Source/WebCore/layout/layouttree/LayoutContainer.h >@@ -53,7 +53,7 @@ public: > bool hasInFlowChild() const { return firstInFlowChild(); } > bool hasInFlowOrFloatingChild() const { return firstInFlowOrFloatingChild(); } > >- const Vector<WeakPtr<Box>>& outOfFlowDescendants() { return m_outOfFlowDescendants; } >+ const Vector<WeakPtr<Box>>& outOfFlowDescendants() const { return m_outOfFlowDescendants; } > > protected: > Container(std::optional<ElementAttributes>, RenderStyle&&, BaseTypeFlags);
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 187082
:
343688
| 343725