Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp

Issue 1717703002: Use invalidation sets to invalidate slotted elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed expected text Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp
diff --git a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp
index 67c96eb030947bd3827ab6aa8241d402359c5cb7..211ec34b5f8a3781a22d8c9d8062384713822511 100644
--- a/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp
+++ b/third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.cpp
@@ -10,6 +10,7 @@
#include "core/dom/ElementTraversal.h"
#include "core/dom/shadow/ElementShadow.h"
#include "core/dom/shadow/ShadowRoot.h"
+#include "core/html/HTMLSlotElement.h"
#include "core/inspector/InspectorTraceEvents.h"
#include "core/layout/LayoutObject.h"
@@ -121,6 +122,8 @@ void StyleInvalidator::RecursionData::pushInvalidationSet(const DescendantInvali
m_treeBoundaryCrossing = true;
if (invalidationSet.insertionPointCrossing())
m_insertionPointCrossing = true;
+ if (invalidationSet.invalidatesSlotted())
+ m_invalidatesSlotted = true;
m_invalidationSets.append(&invalidationSet);
m_invalidateCustomPseudo = invalidationSet.customPseudoInvalid();
}
@@ -143,6 +146,19 @@ ALWAYS_INLINE bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSe
return false;
}
+bool StyleInvalidator::RecursionData::matchesCurrentInvalidationSetsAsSlotted(Element& element) const
+{
+ ASSERT(m_invalidatesSlotted);
+
+ for (const auto& invalidationSet : m_invalidationSets) {
+ if (!invalidationSet->invalidatesSlotted())
+ continue;
+ if (invalidationSet->invalidatesElement(element))
+ return true;
+ }
+ return false;
+}
+
void StyleInvalidator::SiblingData::pushInvalidationSet(const SiblingInvalidationSet& invalidationSet)
{
unsigned invalidationLimit;
@@ -290,6 +306,8 @@ bool StyleInvalidator::invalidate(Element& element, RecursionData& recursionData
if (recursionData.insertionPointCrossing() && element.isInsertionPoint())
element.setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator));
+ if (recursionData.invalidatesSlotted() && isHTMLSlotElement(element))
+ invalidateSlotDistributedElements(toHTMLSlotElement(element), recursionData);
element.clearChildNeedsStyleInvalidation();
element.clearNeedsStyleInvalidation();
@@ -297,6 +315,18 @@ bool StyleInvalidator::invalidate(Element& element, RecursionData& recursionData
return thisElementNeedsStyleRecalc;
}
+void StyleInvalidator::invalidateSlotDistributedElements(HTMLSlotElement& slot, const RecursionData& recursionData) const
+{
+ for (auto& distributedNode : slot.getDistributedNodes()) {
+ if (distributedNode->needsStyleRecalc())
+ continue;
+ if (!distributedNode->isElementNode())
+ continue;
+ if (recursionData.matchesCurrentInvalidationSetsAsSlotted(toElement(*distributedNode)))
+ distributedNode->setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleInvalidator));
+ }
+}
+
DEFINE_TRACE(StyleInvalidator)
{
#if ENABLE(OILPAN)
« no previous file with comments | « third_party/WebKit/Source/core/css/invalidation/StyleInvalidator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698