WebKit Bugzilla
Attachment 348967 Details for
Bug 189320
: [LFC] Construct the Display::Box objects on demand.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-189320-20180905150107.patch (text/plain), 8.65 KB, created by
zalan
on 2018-09-05 15:01:11 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-09-05 15:01:11 PDT
Size:
8.65 KB
patch
obsolete
>Subversion Revision: 235681 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 446e853844a6164617222bd185ef4013990c394c..1a7e8f73036104c2ee231f4b94c092df616b5edf 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-09-05 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Construct the Display::Box objects on demand. >+ https://bugs.webkit.org/show_bug.cgi?id=189320 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * layout/FormattingContext.cpp: >+ (WebCore::Layout::FormattingContext::layoutOutOfFlowDescendants const): >+ * layout/LayoutContext.cpp: >+ (WebCore::Layout::LayoutContext::initializeRoot): >+ (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const): >+ (WebCore::Layout::LayoutContext::createDisplayBox): Deleted. >+ * layout/LayoutContext.h: >+ (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const): Deleted. >+ * layout/Verification.cpp: >+ (WebCore::Layout::LayoutContext::verifyAndOutputMismatchingLayoutTree const): >+ * layout/blockformatting/BlockFormattingContext.cpp: >+ (WebCore::Layout::BlockFormattingContext::layout const): >+ * layout/displaytree/DisplayBox.h: >+ > 2018-09-05 Zalan Bujtas <zalan@apple.com> > > [LFC] LayoutContext::displayBoxForLayoutBox() should return a Display::Box& >diff --git a/Source/WebCore/layout/FormattingContext.cpp b/Source/WebCore/layout/FormattingContext.cpp >index 91b0d1de1222ac10280de291f3cb8b32d3ccc98c..1ab6f7128844d31a31daa6707633bf9cf5983c18 100644 >--- a/Source/WebCore/layout/FormattingContext.cpp >+++ b/Source/WebCore/layout/FormattingContext.cpp >@@ -113,7 +113,6 @@ void FormattingContext::layoutOutOfFlowDescendants(LayoutContext& layoutContext, > > for (auto& outOfFlowBox : container.outOfFlowDescendants()) { > auto& layoutBox = *outOfFlowBox; >- layoutContext.createDisplayBox(layoutBox); > > ASSERT(layoutBox.establishesFormattingContext()); > auto formattingContext = layoutContext.formattingContext(layoutBox); >diff --git a/Source/WebCore/layout/LayoutContext.cpp b/Source/WebCore/layout/LayoutContext.cpp >index 552a7794a3f87522b1cbfe39cecd4b3134922f0b..07398c9a12c1911524c29bc57a25266656dbdacd 100644 >--- a/Source/WebCore/layout/LayoutContext.cpp >+++ b/Source/WebCore/layout/LayoutContext.cpp >@@ -54,7 +54,7 @@ void LayoutContext::initializeRoot(const Container& root, const LayoutSize& cont > ASSERT(root.establishesFormattingContext()); > > m_root = makeWeakPtr(const_cast<Container&>(root)); >- auto& displayBox = createDisplayBox(root); >+ auto& displayBox = displayBoxForLayoutBox(root); > > // FIXME: m_root could very well be a formatting context root with ancestors and resolvable border and padding (as opposed to the topmost root) > displayBox.setHorizontalMargin({ }); >@@ -86,12 +86,11 @@ void LayoutContext::layoutFormattingContextSubtree(const Box& layoutRoot) > formattingContext->layoutOutOfFlowDescendants(*this, layoutRoot); > } > >-Display::Box& LayoutContext::createDisplayBox(const Box& layoutBox) >+Display::Box& LayoutContext::displayBoxForLayoutBox(const Box& layoutBox) const > { >- std::unique_ptr<Display::Box> displayBox(new Display::Box(layoutBox.style())); >- auto* displayBoxPtr = displayBox.get(); >- m_layoutToDisplayBox.add(&layoutBox, WTFMove(displayBox)); >- return *displayBoxPtr; >+ return *m_layoutToDisplayBox.ensure(&layoutBox, [&layoutBox] { >+ return std::make_unique<Display::Box>(layoutBox.style()); >+ }).iterator->value; > } > > void LayoutContext::styleChanged(const Box& layoutBox, StyleDiff styleDiff) >diff --git a/Source/WebCore/layout/LayoutContext.h b/Source/WebCore/layout/LayoutContext.h >index cc05b91507cf15e9939b296611b4fcadc8a67240..37b77b401bdb8e51167d2aa364ae20bc54330c15 100644 >--- a/Source/WebCore/layout/LayoutContext.h >+++ b/Source/WebCore/layout/LayoutContext.h >@@ -80,8 +80,7 @@ public: > FormattingState& formattingStateForBox(const Box&) const; > FormattingState& establishedFormattingState(const Box& formattingRoot); > >- Display::Box& createDisplayBox(const Box&); >- Display::Box& displayBoxForLayoutBox(const Box& layoutBox) const { return *m_layoutToDisplayBox.get(&layoutBox); } >+ Display::Box& displayBoxForLayoutBox(const Box& layoutBox) const; > > bool inQuirksMode() const { return m_inQuirksMode; } > // For testing purposes only >@@ -93,7 +92,7 @@ private: > WeakPtr<Container> m_root; > HashSet<const Container*> m_formattingContextRootListForLayout; > HashMap<const Box*, std::unique_ptr<FormattingState>> m_formattingStates; >- HashMap<const Box*, std::unique_ptr<Display::Box>> m_layoutToDisplayBox; >+ mutable HashMap<const Box*, std::unique_ptr<Display::Box>> m_layoutToDisplayBox; > bool m_inQuirksMode { false }; > }; > >diff --git a/Source/WebCore/layout/Verification.cpp b/Source/WebCore/layout/Verification.cpp >index e8bc435352ce36870a7e3ceed9ace8a3f6a62597..5cbc8cfebc07816ad6ea1522febd0aa43df9ffdc 100644 >--- a/Source/WebCore/layout/Verification.cpp >+++ b/Source/WebCore/layout/Verification.cpp >@@ -219,6 +219,7 @@ void LayoutContext::verifyAndOutputMismatchingLayoutTree(const RenderView& rende > showLayoutTree(*m_root.get(), this); > #endif > WTFLogAlways("%s", stream.release().utf8().data()); >+ ASSERT_NOT_REACHED(); > } > > } >diff --git a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >index a4c19de426ef8b2ad19d2877ed81d2a5f38f25db..bb1089ce2870f5c7d1a3bc4ca4d39ebb1b903750 100644 >--- a/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockFormattingContext.cpp >@@ -65,10 +65,8 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > FloatingContext floatingContext(formattingState.floatingState()); > // This is a post-order tree traversal layout. > // The root container layout is done in the formatting context it lives in, not that one it creates, so let's start with the first child. >- if (auto* firstChild = formattingRoot.firstInFlowOrFloatingChild()) { >+ if (auto* firstChild = formattingRoot.firstInFlowOrFloatingChild()) > layoutQueue.append(firstChild); >- layoutContext.createDisplayBox(*firstChild); >- } > // 1. Go all the way down to the leaf node > // 2. Compute static position and width as we traverse down > // 3. As we climb back on the tree, compute height and finialize position >@@ -85,9 +83,7 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > // Continue with next sibling if exists. > if (!layoutBox.nextInFlowOrFloatingSibling()) > break; >- auto* nextSibling = layoutBox.nextInFlowOrFloatingSibling(); >- layoutQueue.append(nextSibling); >- layoutContext.createDisplayBox(*nextSibling); >+ layoutQueue.append(layoutBox.nextInFlowOrFloatingSibling()); > continue; > } > >@@ -97,9 +93,7 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > computeWidthAndMargin(layoutContext, layoutBox); > if (!is<Container>(layoutBox) || !downcast<Container>(layoutBox).hasInFlowOrFloatingChild()) > break; >- auto* firstChild = downcast<Container>(layoutBox).firstInFlowOrFloatingChild(); >- layoutQueue.append(firstChild); >- layoutContext.createDisplayBox(*firstChild); >+ layoutQueue.append(downcast<Container>(layoutBox).firstInFlowOrFloatingChild()); > } > > // Climb back on the ancestors and compute height/final position. >@@ -121,7 +115,6 @@ void BlockFormattingContext::layout(LayoutContext& layoutContext, FormattingStat > placeInFlowPositionedChildren(layoutContext, container); > if (auto* nextSibling = container.nextInFlowOrFloatingSibling()) { > layoutQueue.append(nextSibling); >- layoutContext.createDisplayBox(*nextSibling); > break; > } > } >diff --git a/Source/WebCore/layout/displaytree/DisplayBox.h b/Source/WebCore/layout/displaytree/DisplayBox.h >index aef24e4797d00a3f7102b5813c5d402f9cbdd02f..3630ee2a70deddfaa590bf90fac47ee342b79b27 100644 >--- a/Source/WebCore/layout/displaytree/DisplayBox.h >+++ b/Source/WebCore/layout/displaytree/DisplayBox.h >@@ -56,6 +56,7 @@ public: > friend class Layout::FloatingContext; > friend class Layout::LayoutContext; > >+ Box(const RenderStyle&); > Box(const Box&); > > class Rect { >@@ -172,8 +173,6 @@ public: > Rect contentBox() const; > > private: >- Box(const RenderStyle&); >- > struct Style { > Style(const RenderStyle&); >
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 189320
: 348967