WebKit Bugzilla
Attachment 343709 Details for
Bug 187097
: [LFC] Move formatting context root layout logic to a dedicated function.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187097-20180627074206.patch (text/plain), 5.99 KB, created by
zalan
on 2018-06-27 07:42:07 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-06-27 07:42:07 PDT
Size:
5.99 KB
patch
obsolete
>Subversion Revision: 233202 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 976923bbc04115d6bb3b0f1230a050ab6aae15e6..35b255efd29ee90d2be64b89d1fa11d6f1466c65 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,15 @@ >+2018-06-27 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Move formatting context root layout logic to a dedicated function. >+ https://bugs.webkit.org/show_bug.cgi?id=187097 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::layout const): >+ (WebCore::Layout::BlockFormattingContext::layoutFormattingContextRoot const): >+ * layout/blockformatting/BlockFormattingContext.h: >+ > 2018-06-26 Thibault Saunier <tsaunier@igalia.com> > > [GStreamer] Do not forget to set stream on track switching >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index 3125f241431d36148da1f60820a54250f59b9b0c..ecfb0a139ebebd039402e87b265bc7a2882ea512 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -77,16 +77,18 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > auto& layoutPair = *layoutQueue.last(); > auto& layoutBox = layoutPair.layoutBox; > auto& displayBox = layoutPair.displayBox; >+ >+ if (layoutBox.establishesFormattingContext()) { >+ layoutFormattingContextRoot(layoutContext, formattingState, layoutBox, displayBox); >+ layoutQueue.removeLast(); >+ // Since this box is a formatting context root, it takes care of its entire subtree. >+ break; >+ } > > LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Position][Border][Padding][Width][Margin] -> for layoutBox(" << &layoutBox << ")"); > computeStaticPosition(layoutContext, layoutBox, displayBox); > computeBorderAndPadding(layoutContext, layoutBox, displayBox); > computeWidthAndMargin(layoutContext, layoutBox, displayBox); >- if (layoutBox.establishesFormattingContext()) { >- auto formattingContext = layoutContext.formattingContext(layoutBox); >- formattingContext->layout(layoutContext, layoutContext.establishedFormattingState(layoutBox, *formattingContext)); >- break; >- } > if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild()) > break; > auto& firstChild = *downcast<Container>(layoutBox).firstInFlowOrFloatingChild(); >@@ -99,7 +101,10 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > auto layoutPair = layoutQueue.takeLast(); > auto& layoutBox = layoutPair->layoutBox; > auto& displayBox = layoutPair->displayBox; >+ > LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Height][Margin] -> for layoutBox(" << &layoutBox << ")"); >+ // Formatting root boxes are special-cased and they don't come here. >+ ASSERT(!layoutBox.establishesFormattingContext()); > > computeHeightAndMargin(layoutContext, layoutBox, displayBox); > // Adjust position now that we have all the previous floats placed in this context -if needed. >@@ -125,6 +130,25 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > LOG_WITH_STREAM(FormattingContextLayout, stream << "[End] -> block formatting context -> layout context(" << &layoutContext << ") formatting root(" << &root() << ")"); > } > >+void BlockFormattingContext::layoutFormattingContextRoot(LayoutContext& layoutContext, FormattingState& formattingState, const Box& layoutBox, Display::Box& displayBox) const >+{ >+ // Start laying out this formatting root in the formatting contenxt it lives in. >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Position][Border][Padding][Width][Margin] -> for layoutBox(" << &layoutBox << ")"); >+ computeStaticPosition(layoutContext, layoutBox, displayBox); >+ computeBorderAndPadding(layoutContext, layoutBox, displayBox); >+ computeWidthAndMargin(layoutContext, layoutBox, displayBox); >+ >+ // Swich over to the new formatting context (the one that the root creates). >+ auto formattingContext = layoutContext.formattingContext(layoutBox); >+ auto& establishedFormattingState = layoutContext.establishedFormattingState(layoutBox, *formattingContext); >+ formattingContext->layout(layoutContext, establishedFormattingState); >+ >+ // Come back and finalize the root's geometry. >+ FloatingContext(formattingState.floatingState()).computePosition(layoutBox, displayBox); >+ LOG_WITH_STREAM(FormattingContextLayout, stream << "[Compute] -> [Height][Margin] -> for layoutBox(" << &layoutBox << ")"); >+ computeHeightAndMargin(layoutContext, layoutBox, displayBox); >+} >+ > std::unique_ptr<FormattingState> BlockFormattingContext::createFormattingState(Ref<FloatingState>&& floatingState) const > { > return std::make_unique<BlockFormattingState>(WTFMove(floatingState)); >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >index 311b22908c7a9d303bdb30dcfc49594d56e98368..f33d755122f5af502a203490835398a45e950832 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.h >@@ -51,6 +51,8 @@ public: > Ref<FloatingState> createOrFindFloatingState(LayoutContext&) const override; > > private: >+ void layoutFormattingContextRoot(LayoutContext&, FormattingState&, const Box&, Display::Box&) const; >+ > void computeWidthAndMargin(LayoutContext&, const Box&, Display::Box&) const; > void computeHeightAndMargin(LayoutContext&, const Box&, Display::Box&) const; >
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 187097
: 343709