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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGMPathElement.cpp

Issue 2633143002: SVG objects with same idrefs conflict when under different shadow root (Closed)
Patch Set: ensureSVGTreeScopedResources(); add comment Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public License 14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to 15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA. 17 * Boston, MA 02110-1301, USA.
18 */ 18 */
19 19
20 #include "core/svg/SVGMPathElement.h" 20 #include "core/svg/SVGMPathElement.h"
21 21
22 #include "core/dom/Document.h" 22 #include "core/dom/Document.h"
23 #include "core/svg/SVGAnimateMotionElement.h" 23 #include "core/svg/SVGAnimateMotionElement.h"
24 #include "core/svg/SVGDocumentExtensions.h"
25 #include "core/svg/SVGPathElement.h" 24 #include "core/svg/SVGPathElement.h"
25 #include "core/svg/SVGTreeScopeResources.h"
26 26
27 namespace blink { 27 namespace blink {
28 28
29 inline SVGMPathElement::SVGMPathElement(Document& document) 29 inline SVGMPathElement::SVGMPathElement(Document& document)
30 : SVGElement(SVGNames::mpathTag, document), SVGURIReference(this) { 30 : SVGElement(SVGNames::mpathTag, document), SVGURIReference(this) {
31 ASSERT(RuntimeEnabledFeatures::smilEnabled()); 31 ASSERT(RuntimeEnabledFeatures::smilEnabled());
32 } 32 }
33 33
34 DEFINE_TRACE(SVGMPathElement) { 34 DEFINE_TRACE(SVGMPathElement) {
35 SVGElement::trace(visitor); 35 SVGElement::trace(visitor);
36 SVGURIReference::trace(visitor); 36 SVGURIReference::trace(visitor);
37 } 37 }
38 38
39 DEFINE_NODE_FACTORY(SVGMPathElement) 39 DEFINE_NODE_FACTORY(SVGMPathElement)
40 40
41 SVGMPathElement::~SVGMPathElement() {} 41 SVGMPathElement::~SVGMPathElement() {}
42 42
43 void SVGMPathElement::buildPendingResource() { 43 void SVGMPathElement::buildPendingResource() {
44 clearResourceReferences(); 44 clearResourceReferences();
45 if (!isConnected()) 45 if (!isConnected())
46 return; 46 return;
47 47
48 AtomicString id; 48 AtomicString id;
49 Element* target = SVGURIReference::targetElementFromIRIString( 49 Element* target = SVGURIReference::targetElementFromIRIString(
50 hrefString(), treeScope(), &id); 50 hrefString(), treeScope(), &id);
51 if (!target) { 51 if (!target) {
52 // Do not register as pending if we are already pending this resource. 52 // Do not register as pending if we are already pending this resource.
53 if (document().accessSVGExtensions().isElementPendingResource(this, id)) 53 if (treeScope().ensureSVGTreeScopedResources().isElementPendingResource(
54 this, id))
54 return; 55 return;
55
56 if (!id.isEmpty()) { 56 if (!id.isEmpty()) {
57 document().accessSVGExtensions().addPendingResource(id, this); 57 treeScope().ensureSVGTreeScopedResources().addPendingResource(id, this);
58 ASSERT(hasPendingResources()); 58 DCHECK(hasPendingResources());
59 } 59 }
60 } else if (isSVGPathElement(target)) { 60 } else if (isSVGPathElement(target)) {
61 // Register us with the target in the dependencies map. Any change of 61 // Register us with the target in the dependencies map. Any change of
62 // hrefElement that leads to relayout/repainting now informs us, so we can 62 // hrefElement that leads to relayout/repainting now informs us, so we can
63 // react to it. 63 // react to it.
64 addReferenceTo(toSVGElement(target)); 64 addReferenceTo(toSVGElement(target));
65 } 65 }
66 66
67 targetPathChanged(); 67 targetPathChanged();
68 } 68 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void SVGMPathElement::targetPathChanged() { 104 void SVGMPathElement::targetPathChanged() {
105 notifyParentOfPathChange(parentNode()); 105 notifyParentOfPathChange(parentNode());
106 } 106 }
107 107
108 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) { 108 void SVGMPathElement::notifyParentOfPathChange(ContainerNode* parent) {
109 if (isSVGAnimateMotionElement(parent)) 109 if (isSVGAnimateMotionElement(parent))
110 toSVGAnimateMotionElement(parent)->updateAnimationPath(); 110 toSVGAnimateMotionElement(parent)->updateAnimationPath();
111 } 111 }
112 112
113 } // namespace blink 113 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698