Index: third_party/WebKit/Source/core/dom/Document.cpp |
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp |
index b41c5fd2076b51ac0628490cf9f6743aa9661a8d..d1a185e5527a3c99ea73004ace5e1bb2bd12e6ec 100644 |
--- a/third_party/WebKit/Source/core/dom/Document.cpp |
+++ b/third_party/WebKit/Source/core/dom/Document.cpp |
@@ -1568,6 +1568,8 @@ |
return false; |
if (!m_useElementsNeedingUpdate.isEmpty()) |
return true; |
+ if (!m_layerUpdateSVGFilterElements.isEmpty()) |
+ return true; |
if (needsStyleRecalc()) |
return true; |
if (needsStyleInvalidation()) |
@@ -1958,8 +1960,11 @@ |
if (Element* documentElement = this->documentElement()) { |
inheritHtmlAndBodyElementStyles(change); |
+ dirtyElementsForLayerUpdate(); |
if (documentElement->shouldCallRecalcStyle(change)) |
documentElement->recalcStyle(change); |
+ while (dirtyElementsForLayerUpdate()) |
+ documentElement->recalcStyle(NoChange); |
} |
view()->recalcOverflowAfterStyleChange(); |
@@ -2235,6 +2240,31 @@ |
setSecurityOrigin(SecurityOrigin::createUnique()); |
didUpdateSecurityOrigin(); |
+} |
+ |
+bool Document::dirtyElementsForLayerUpdate() { |
+ if (m_layerUpdateSVGFilterElements.isEmpty()) |
+ return false; |
+ |
+ for (Element* element : m_layerUpdateSVGFilterElements) |
+ element->setNeedsStyleRecalc(LocalStyleChange, |
+ StyleChangeReasonForTracing::create( |
+ StyleChangeReason::SVGFilterLayerUpdate)); |
+ m_layerUpdateSVGFilterElements.clear(); |
+ return true; |
+} |
+ |
+void Document::scheduleSVGFilterLayerUpdateHack(Element& element) { |
+ if (element.getStyleChangeType() == NeedsReattachStyleChange) |
+ return; |
+ element.setSVGFilterNeedsLayerUpdate(); |
+ m_layerUpdateSVGFilterElements.add(&element); |
+ scheduleLayoutTreeUpdateIfNeeded(); |
+} |
+ |
+void Document::unscheduleSVGFilterLayerUpdateHack(Element& element) { |
+ element.clearSVGFilterNeedsLayerUpdate(); |
+ m_layerUpdateSVGFilterElements.remove(&element); |
} |
void Document::scheduleUseShadowTreeUpdate(SVGUseElement& element) { |
@@ -6385,6 +6415,7 @@ |
visitor->trace(m_customElementMicrotaskRunQueue); |
visitor->trace(m_elementDataCache); |
visitor->trace(m_useElementsNeedingUpdate); |
+ visitor->trace(m_layerUpdateSVGFilterElements); |
visitor->trace(m_timers); |
visitor->trace(m_templateDocument); |
visitor->trace(m_templateDocumentHost); |