WebKit Bugzilla
Attachment 341455 Details for
Bug 186036
: [LFC] Add formatting context testing codepath in FrameViewLayoutContext
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186036-20180528093433.patch (text/plain), 5.82 KB, created by
zalan
on 2018-05-28 09:34:34 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-05-28 09:34:34 PDT
Size:
5.82 KB
patch
obsolete
>Subversion Revision: 232226 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 6b088b9d834e3e0565973ecc1141071d89e052d3..3b938e9bc853fd1cb2445712cb6329b277e88481 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2018-05-28 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Add formatting context testing codepath in FrameViewLayoutContext >+ https://bugs.webkit.org/show_bug.cgi?id=186036 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This is to verify the formatting context layout correctness. >+ >+ * layout/LayoutContext.cpp: >+ (WebCore::Layout::LayoutContext::LayoutContext): >+ (WebCore::Layout::LayoutContext::initializeRoot): >+ * layout/LayoutContext.h: >+ (WebCore::Layout::LayoutContext::displayBoxForLayoutBox const): >+ * page/FrameViewLayoutContext.cpp: >+ (WebCore::layoutUsingFormattingContext): >+ (WebCore::FrameViewLayoutContext::layout): >+ > 2018-05-26 Zalan Bujtas <zalan@apple.com> > > [LFC] Implement margin computation >diff --git a/Source/WebCore/layout/LayoutContext.cpp b/Source/WebCore/layout/LayoutContext.cpp >index bc0de8631d7c20da0861442b39aa618afdca73ff..202b8e4cfaccd824ac114f27b6e10c6a65ad2ace 100644 >--- a/Source/WebCore/layout/LayoutContext.cpp >+++ b/Source/WebCore/layout/LayoutContext.cpp >@@ -45,11 +45,37 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(LayoutContext); > >-LayoutContext::LayoutContext(const Box& root) >- : m_root(makeWeakPtr(const_cast<Box&>(root))) >+LayoutContext::LayoutContext() > { > } > >+void LayoutContext::initializeRoot(const Container& root, const LayoutSize& containerSize) >+{ >+ m_root = makeWeakPtr(const_cast<Container&>(root)); >+ auto& displayBox = createDisplayBox(root); >+ // Root is always at 0 0 with no margin >+ displayBox.setTopLeft({ }); >+ displayBox.setWidth(containerSize.width()); >+ displayBox.setHeight(containerSize.height()); >+ displayBox.setMargin({ }); >+ >+ auto& style = root.style(); >+ // 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.setBorder({ >+ style.borderTop().width(), >+ style.borderLeft().width(), >+ style.borderBottom().width(), >+ style.borderRight().width() >+ >+ }); >+ displayBox.setPadding({ >+ valueForLength(style.paddingTop(), containerSize.width()), >+ valueForLength(style.paddingLeft(), containerSize.width()), >+ valueForLength(style.paddingBottom(), containerSize.width()), >+ valueForLength(style.paddingRight(), containerSize.width()) >+ }); >+} >+ > void LayoutContext::updateLayout() > { > ASSERT(!m_formattingContextRootListForLayout.isEmpty()); >diff --git a/Source/WebCore/layout/LayoutContext.h b/Source/WebCore/layout/LayoutContext.h >index 01d92da3ea413f259f3e80e42f41826dadb34fc8..74050604223d28bd194b82da955ac636f5b2f2b7 100644 >--- a/Source/WebCore/layout/LayoutContext.h >+++ b/Source/WebCore/layout/LayoutContext.h >@@ -54,13 +54,10 @@ class Container; > class LayoutContext { > WTF_MAKE_ISO_ALLOCATED(LayoutContext); > public: >- LayoutContext(const Box& root); >+ LayoutContext(); > >+ void initializeRoot(const Container&, const LayoutSize&); > void updateLayout(); >- >- Display::Box& createDisplayBox(const Box&); >- Display::Box* displayBoxForLayoutBox(const Box& layoutBox) const { return m_layoutToDisplayBox.get(&layoutBox); } >- > void styleChanged(const Box&, StyleDiff); > > enum class UpdateType { >@@ -76,8 +73,11 @@ public: > FormattingState& establishedFormattingState(const Box& formattingContextRoot, const FormattingContext&); > std::unique_ptr<FormattingContext> formattingContext(const Box& formattingContextRoot); > >+ Display::Box& createDisplayBox(const Box&); >+ Display::Box* displayBoxForLayoutBox(const Box& layoutBox) const { return m_layoutToDisplayBox.get(&layoutBox); } >+ > private: >- WeakPtr<Box> m_root; >+ 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; >diff --git a/Source/WebCore/page/FrameViewLayoutContext.cpp b/Source/WebCore/page/FrameViewLayoutContext.cpp >index a1d5d1224f0be22727a3e096d269ebe898f604e7..8e65016bc59e4f2834db7f991753b55491a86550 100644 >--- a/Source/WebCore/page/FrameViewLayoutContext.cpp >+++ b/Source/WebCore/page/FrameViewLayoutContext.cpp >@@ -31,6 +31,11 @@ > #include "Document.h" > #include "FrameView.h" > #include "InspectorInstrumentation.h" >+#if ENABLE(LAYOUT_FORMATTING_CONTEXT) >+#include "LayoutContainer.h" >+#include "LayoutContext.h" >+#include "LayoutTreeBuilder.h" >+#endif > #include "LayoutDisallowedScope.h" > #include "LayoutState.h" > #include "Logging.h" >@@ -45,6 +50,17 @@ > > namespace WebCore { > >+#if ENABLE(LAYOUT_FORMATTING_CONTEXT) >+static void layoutUsingFormattingContext(const RenderView& renderView) >+{ >+ auto initialContainingBlock = Layout::TreeBuilder::createLayoutTree(renderView); >+ auto layoutContext = std::make_unique<Layout::LayoutContext>(); >+ layoutContext->initializeRoot(*initialContainingBlock, renderView.size()); >+ layoutContext->updateLayout(); >+ layoutContext->verifyAndOutputMismatchingLayoutTree(renderView); >+} >+#endif >+ > static bool isObjectAncestorContainerOf(RenderElement& ancestor, RenderElement& descendant) > { > for (auto* renderer = &descendant; renderer; renderer = renderer->container()) { >@@ -189,6 +205,9 @@ void FrameViewLayoutContext::layout() > RenderTreeNeedsLayoutChecker checker(*layoutRoot); > #endif > layoutRoot->layout(); >+#if ENABLE(LAYOUT_FORMATTING_CONTEXT) >+ layoutUsingFormattingContext(*renderView()); >+#endif > ++m_layoutCount; > #if ENABLE(TEXT_AUTOSIZING) > applyTextSizingIfNeeded(*layoutRoot.get());
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186036
:
341455
|
341458