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

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

Issue 2490163002: Reland of "Tracking reference filter mutation via SVGElementProxy" (Closed)
Patch Set: Fix double observer unregistration; simplify scope selection; add tests Created 4 years, 1 month 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) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
4 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "core/svg/SVGFilterElement.h" 24 #include "core/svg/SVGFilterElement.h"
25 25
26 #include "core/frame/UseCounter.h" 26 #include "core/frame/UseCounter.h"
27 #include "core/layout/svg/LayoutSVGResourceFilter.h" 27 #include "core/layout/svg/LayoutSVGResourceFilter.h"
28 #include "core/svg/SVGResourceClient.h" 28 #include "core/svg/SVGElementProxy.h"
29 29
30 namespace blink { 30 namespace blink {
31 31
32 inline SVGFilterElement::SVGFilterElement(Document& document) 32 inline SVGFilterElement::SVGFilterElement(Document& document)
33 : SVGElement(SVGNames::filterTag, document), 33 : SVGElement(SVGNames::filterTag, document),
34 SVGURIReference(this), 34 SVGURIReference(this),
35 m_x(SVGAnimatedLength::create(this, 35 m_x(SVGAnimatedLength::create(this,
36 SVGNames::xAttr, 36 SVGNames::xAttr,
37 SVGLength::create(SVGLengthMode::Width))), 37 SVGLength::create(SVGLengthMode::Width))),
38 m_y(SVGAnimatedLength::create(this, 38 m_y(SVGAnimatedLength::create(this,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 DEFINE_NODE_FACTORY(SVGFilterElement) 77 DEFINE_NODE_FACTORY(SVGFilterElement)
78 78
79 DEFINE_TRACE(SVGFilterElement) { 79 DEFINE_TRACE(SVGFilterElement) {
80 visitor->trace(m_x); 80 visitor->trace(m_x);
81 visitor->trace(m_y); 81 visitor->trace(m_y);
82 visitor->trace(m_width); 82 visitor->trace(m_width);
83 visitor->trace(m_height); 83 visitor->trace(m_height);
84 visitor->trace(m_filterUnits); 84 visitor->trace(m_filterUnits);
85 visitor->trace(m_primitiveUnits); 85 visitor->trace(m_primitiveUnits);
86 visitor->trace(m_clientsToAdd); 86 visitor->trace(m_elementProxySet);
87 SVGElement::trace(visitor); 87 SVGElement::trace(visitor);
88 SVGURIReference::trace(visitor); 88 SVGURIReference::trace(visitor);
89 } 89 }
90 90
91 void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) { 91 void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) {
92 bool isXYWH = attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || 92 bool isXYWH = attrName == SVGNames::xAttr || attrName == SVGNames::yAttr ||
93 attrName == SVGNames::widthAttr || 93 attrName == SVGNames::widthAttr ||
94 attrName == SVGNames::heightAttr; 94 attrName == SVGNames::heightAttr;
95 if (isXYWH) 95 if (isXYWH)
96 updateRelativeLengthsInformation(); 96 updateRelativeLengthsInformation();
(...skipping 17 matching lines...) Expand all
114 114
115 if (change.byParser) 115 if (change.byParser)
116 return; 116 return;
117 117
118 if (LayoutObject* object = layoutObject()) 118 if (LayoutObject* object = layoutObject())
119 object->setNeedsLayoutAndFullPaintInvalidation( 119 object->setNeedsLayoutAndFullPaintInvalidation(
120 LayoutInvalidationReason::ChildChanged); 120 LayoutInvalidationReason::ChildChanged);
121 } 121 }
122 122
123 LayoutObject* SVGFilterElement::createLayoutObject(const ComputedStyle&) { 123 LayoutObject* SVGFilterElement::createLayoutObject(const ComputedStyle&) {
124 LayoutSVGResourceFilter* layoutObject = new LayoutSVGResourceFilter(this); 124 return new LayoutSVGResourceFilter(this);
125
126 for (SVGResourceClient* client : m_clientsToAdd)
127 layoutObject->addResourceClient(client);
128 m_clientsToAdd.clear();
129
130 return layoutObject;
131 } 125 }
132 126
133 bool SVGFilterElement::selfHasRelativeLengths() const { 127 bool SVGFilterElement::selfHasRelativeLengths() const {
134 return m_x->currentValue()->isRelative() || 128 return m_x->currentValue()->isRelative() ||
135 m_y->currentValue()->isRelative() || 129 m_y->currentValue()->isRelative() ||
136 m_width->currentValue()->isRelative() || 130 m_width->currentValue()->isRelative() ||
137 m_height->currentValue()->isRelative(); 131 m_height->currentValue()->isRelative();
138 } 132 }
139 133
140 void SVGFilterElement::addClient(SVGResourceClient* client) { 134 SVGElementProxySet& SVGFilterElement::elementProxySet() {
141 ASSERT(client); 135 if (!m_elementProxySet)
142 m_clientsToAdd.add(client); 136 m_elementProxySet = new SVGElementProxySet;
143 } 137 return *m_elementProxySet;
144
145 void SVGFilterElement::removeClient(SVGResourceClient* client) {
146 ASSERT(client);
147 m_clientsToAdd.remove(client);
148 } 138 }
149 139
150 } // namespace blink 140 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGFilterElement.h ('k') | third_party/WebKit/Source/core/svg/SVGResourceClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698