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

Unified Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2251073002: CSS: SVG use elements replicate updates to style (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: layout tests Created 4 years, 4 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/LayoutTests/svg/css/use-replicates-changes-pseudo-expected.html ('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/dom/Node.cpp
diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp
index 49dbf9b8451b05d823c51a817960c9524f3005b2..a4d3370327286d3ab3f5f83be61315b2015751e1 100644
--- a/third_party/WebKit/Source/core/dom/Node.cpp
+++ b/third_party/WebKit/Source/core/dom/Node.cpp
@@ -89,6 +89,8 @@
#include "core/layout/LayoutBox.h"
#include "core/page/ContextMenuController.h"
#include "core/page/Page.h"
+#include "core/svg/SVGElement.h"
+#include "core/svg/SVGUseElement.h"
#include "core/svg/graphics/SVGImage.h"
#include "platform/EventDispatchForbiddenScope.h"
#include "platform/RuntimeEnabledFeatures.h"
@@ -700,11 +702,21 @@ void Node::setNeedsStyleRecalc(StyleChangeType changeType, const StyleChangeReas
if (changeType > existingChangeType)
setStyleChange(changeType);
- if (existingChangeType == NoStyleChange)
- markAncestorsWithChildNeedsStyleRecalc();
-
if (isElementNode() && hasRareData())
toElement(*this).setAnimationStyleChange(false);
+
+ if (existingChangeType != NoStyleChange)
+ return;
+ markAncestorsWithChildNeedsStyleRecalc();
+ if (!isSVGElement())
+ return;
rune 2016/08/18 21:15:28 I think I'd move the code below into a separate me
Eric Willigers 2016/08/18 22:27:00 Done.
+ const HeapHashSet<WeakMember<SVGElement>>& set = toSVGElement(this)->instancesForElement();
+ if (set.isEmpty())
+ return;
+ for (SVGElement* instance : set) {
+ if (SVGUseElement* element = instance->correspondingUseElement())
+ element->setNeedsStyleRecalc(SubtreeStyleChange, reason);
rune 2016/08/18 21:09:07 So there's an 1:n relationship between each svg el
fs 2016/08/18 21:21:17 Yes.
Eric Willigers 2016/08/18 22:27:00 Done. All my tests still pass. I should have tried
+ }
}
void Node::clearNeedsStyleRecalc()
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/css/use-replicates-changes-pseudo-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698