WebKit Bugzilla
Attachment 339544 Details for
Bug 185301
: [LFC] Set the invalidation root as the result of style change.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185301-20180504080129.patch (text/plain), 9.34 KB, created by
zalan
on 2018-05-04 08:01:31 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
zalan
Created:
2018-05-04 08:01:31 PDT
Size:
9.34 KB
patch
obsolete
>Subversion Revision: 231351 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d072cc5efe0f24028465d9cdb9584b8829c286e6..89844fead413a6f11b1e16fb781b8d6741002013 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2018-05-04 Zalan Bujtas <zalan@apple.com> >+ >+ [LFC] Set the invalidation root as the result of style change. >+ https://bugs.webkit.org/show_bug.cgi?id=185301 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Compute/propagate the update type on the ancestor chain and return the invalidation root >+ so that LayoutContext could use it as the entry point for the next layout frame. >+ >+ * layout/LayoutContext.cpp: >+ (WebCore::Layout::LayoutContext::updateLayout): >+ (WebCore::Layout::LayoutContext::styleChanged): >+ * layout/LayoutContext.h: order is not important. >+ * layout/blockformatting/BlockInvalidation.cpp: >+ (WebCore::Layout::invalidationStopsAtFormattingContextBoundary): >+ (WebCore::Layout::computeUpdateType): >+ (WebCore::Layout::computeUpdateTypeForAncestor): >+ (WebCore::Layout::BlockInvalidation::invalidate): >+ * layout/blockformatting/BlockInvalidation.h: >+ * layout/inlineformatting/InlineInvalidation.cpp: >+ (WebCore::Layout::InlineInvalidation::invalidate): >+ * layout/inlineformatting/InlineInvalidation.h: >+ > 2018-05-04 Yacine Bandou <yacine.bandou_ext@softathome.com> > > [MSE][GStreamer] Delete properly the stream from the WebKitMediaSource >diff --git a/Source/WebCore/layout/LayoutContext.cpp b/Source/WebCore/layout/LayoutContext.cpp >index 32d89cedf362f83641d768e1482e93aade3ab2a4..2577b4c357bc1320007e6e9385b0efb1e8f30bac 100644 >--- a/Source/WebCore/layout/LayoutContext.cpp >+++ b/Source/WebCore/layout/LayoutContext.cpp >@@ -52,8 +52,7 @@ LayoutContext::LayoutContext(const Box& root) > void LayoutContext::updateLayout() > { > ASSERT(!m_formattingContextRootListForLayout.isEmpty()); >- for (auto layoutRoot : m_formattingContextRootListForLayout) { >- RELEASE_ASSERT(layoutRoot.get()); >+ for (auto* layoutRoot : m_formattingContextRootListForLayout) { > RELEASE_ASSERT(layoutRoot->establishesFormattingContext()); > auto context = formattingContext(*layoutRoot); > auto& state = establishedFormattingState(*layoutRoot, *context); >@@ -73,12 +72,15 @@ Display::Box& LayoutContext::createDisplayBox(const Box& layoutBox) > void LayoutContext::styleChanged(const Box& layoutBox, StyleDiff styleDiff) > { > auto& formattingState = formattingStateForBox(layoutBox); >+ const Container* invalidationRoot = nullptr; > if (is<BlockFormattingState>(formattingState)) >- BlockInvalidation::invalidate(layoutBox, styleDiff, *this, downcast<BlockFormattingState>(formattingState)); >+ invalidationRoot = BlockInvalidation::invalidate(layoutBox, styleDiff, *this, downcast<BlockFormattingState>(formattingState)); > else if (is<InlineFormattingState>(formattingState)) >- InlineInvalidation::invalidate(layoutBox, styleDiff, *this, downcast<InlineFormattingState>(formattingState)); >+ invalidationRoot = InlineInvalidation::invalidate(layoutBox, styleDiff, *this, downcast<InlineFormattingState>(formattingState)); > else > ASSERT_NOT_REACHED(); >+ ASSERT(invalidationRoot); >+ m_formattingContextRootListForLayout.addVoid(invalidationRoot); > } > > void LayoutContext::markNeedsUpdate(const Box&, OptionSet<UpdateType>) >diff --git a/Source/WebCore/layout/LayoutContext.h b/Source/WebCore/layout/LayoutContext.h >index fe23062c94243215f77a7dbfe053b9d5923fb664..01d92da3ea413f259f3e80e42f41826dadb34fc8 100644 >--- a/Source/WebCore/layout/LayoutContext.h >+++ b/Source/WebCore/layout/LayoutContext.h >@@ -29,7 +29,7 @@ > > #include "FormattingContext.h" > #include "FormattingState.h" >-#include "LayoutBox.h" >+#include <wtf/HashSet.h> > #include <wtf/IsoMalloc.h> > #include <wtf/OptionSet.h> > >@@ -42,6 +42,8 @@ class Box; > namespace Layout { > > enum class StyleDiff; >+class Box; >+class Container; > > // LayoutContext is the entry point for layout. It takes a (formatting root)container which acts as the root of the layout context. > // LayoutContext::layout() generates the display tree for the root container's subtree (it does not run layout on the root though). >@@ -76,7 +78,7 @@ public: > > private: > WeakPtr<Box> m_root; >- Vector<WeakPtr<Box>> m_formattingContextRootListForLayout; >+ 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/layout/blockformatting/BlockInvalidation.cpp b/Source/WebCore/layout/blockformatting/BlockInvalidation.cpp >index 652afab51b348ca680af58cf1489ca85e92e88e7..9ea9a70420259d8d3d8b26ccb7fff47a1a64a3b5 100644 >--- a/Source/WebCore/layout/blockformatting/BlockInvalidation.cpp >+++ b/Source/WebCore/layout/blockformatting/BlockInvalidation.cpp >@@ -30,6 +30,7 @@ > > #include "BlockFormattingState.h" > #include "LayoutBox.h" >+#include "LayoutContainer.h" > #include "LayoutContext.h" > #include <wtf/IsoMallocInlines.h> > >@@ -38,9 +39,34 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(BlockInvalidation); > >-void BlockInvalidation::invalidate(const Box& layoutBox, StyleDiff, LayoutContext& layoutContext, BlockFormattingState&) >+static bool invalidationStopsAtFormattingContextBoundary(const Container& formattingContextRoot, const Box&, StyleDiff) > { >- layoutContext.markNeedsUpdate(layoutBox, LayoutContext::UpdateType::All); >+ ASSERT(formattingContextRoot.establishesFormattingContext()); >+ return true; >+} >+ >+static LayoutContext::UpdateType computeUpdateType(const Box&, StyleDiff, BlockFormattingState&) >+{ >+ return LayoutContext::UpdateType::All; >+} >+ >+static LayoutContext::UpdateType computeUpdateTypeForAncestor(const Container&, StyleDiff, BlockFormattingState&) >+{ >+ return LayoutContext::UpdateType::All; >+} >+ >+const Container* BlockInvalidation::invalidate(const Box& layoutBox, StyleDiff styleDiff, LayoutContext& layoutContext, BlockFormattingState& formattingState) >+{ >+ // Invalidate this box and the containing block chain all the way up to the formatting context root (and beyond if needed). >+ layoutContext.markNeedsUpdate(layoutBox, computeUpdateType(layoutBox, styleDiff, formattingState)); >+ for (auto* containingBlock = layoutBox.containingBlock(); containingBlock; containingBlock = containingBlock->containingBlock()) { >+ if (containingBlock->establishesFormattingContext() && invalidationStopsAtFormattingContextBoundary(*containingBlock, layoutBox, styleDiff)) >+ return containingBlock; >+ layoutContext.markNeedsUpdate(*containingBlock, computeUpdateTypeForAncestor(*containingBlock, styleDiff, formattingState)); >+ } >+ // Invalidation always stops at the initial containing block. >+ ASSERT_NOT_REACHED(); >+ return nullptr; > } > > } >diff --git a/Source/WebCore/layout/blockformatting/BlockInvalidation.h b/Source/WebCore/layout/blockformatting/BlockInvalidation.h >index 5ef1436106dbd546e8a05886ef4293545429e8ce..b2ad18bb0c28462bd2712b2ab32e4a650d2fca3e 100644 >--- a/Source/WebCore/layout/blockformatting/BlockInvalidation.h >+++ b/Source/WebCore/layout/blockformatting/BlockInvalidation.h >@@ -35,6 +35,7 @@ namespace Layout { > > class Box; > class BlockFormattingState; >+class Container; > class LayoutContext; > enum class StyleDiff; > >@@ -42,7 +43,7 @@ enum class StyleDiff; > class BlockInvalidation { > WTF_MAKE_ISO_ALLOCATED(BlockInvalidation); > public: >- static void invalidate(const Box&, StyleDiff, LayoutContext&, BlockFormattingState&); >+ static const Container* invalidate(const Box&, StyleDiff, LayoutContext&, BlockFormattingState&); > }; > > } >diff --git a/Source/WebCore/layout/inlineformatting/InlineInvalidation.cpp b/Source/WebCore/layout/inlineformatting/InlineInvalidation.cpp >index b18826fc2cbd5a19960f8d793786e1a06c9ea9f1..dfcdc05a85e10c3265bff27025f86e50f16f57f0 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineInvalidation.cpp >+++ b/Source/WebCore/layout/inlineformatting/InlineInvalidation.cpp >@@ -38,9 +38,10 @@ namespace Layout { > > WTF_MAKE_ISO_ALLOCATED_IMPL(InlineInvalidation); > >-void InlineInvalidation::invalidate(const Box& layoutBox, StyleDiff, LayoutContext& layoutContext, InlineFormattingState&) >+const Container* InlineInvalidation::invalidate(const Box& layoutBox, StyleDiff, LayoutContext& layoutContext, InlineFormattingState&) > { > layoutContext.markNeedsUpdate(layoutBox, LayoutContext::UpdateType::All); >+ return nullptr; > } > > } >diff --git a/Source/WebCore/layout/inlineformatting/InlineInvalidation.h b/Source/WebCore/layout/inlineformatting/InlineInvalidation.h >index 257c367be8cd3605691499450d1dff239134d8e9..28ffcb25ca62446896200375f8f439c32003b8e9 100644 >--- a/Source/WebCore/layout/inlineformatting/InlineInvalidation.h >+++ b/Source/WebCore/layout/inlineformatting/InlineInvalidation.h >@@ -34,6 +34,7 @@ namespace WebCore { > namespace Layout { > > class Box; >+class Container; > class InlineFormattingState; > class LayoutContext; > enum class StyleDiff; >@@ -42,7 +43,7 @@ enum class StyleDiff; > class InlineInvalidation { > WTF_MAKE_ISO_ALLOCATED(InlineInvalidation); > public: >- static void invalidate(const Box&, StyleDiff, LayoutContext&, InlineFormattingState&); >+ static const Container* invalidate(const Box&, StyleDiff, LayoutContext&, InlineFormattingState&); > }; > > }
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 185301
:
339544
|
339549