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

Side by Side Diff: Source/core/svg/SVGGraphicsElement.cpp

Issue 43223002: SVGTests should not leave detached elements in the tree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add TestExpectations Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2008 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 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #include "config.h" 21 #include "config.h"
22 22
23 #include "core/svg/SVGGraphicsElement.h" 23 #include "core/svg/SVGGraphicsElement.h"
24 24
25 #include "SVGNames.h" 25 #include "SVGNames.h"
26 #include "core/rendering/svg/RenderSVGPath.h" 26 #include "core/rendering/svg/RenderSVGPath.h"
27 #include "core/rendering/svg/RenderSVGResource.h" 27 #include "core/rendering/svg/RenderSVGResource.h"
28 #include "core/rendering/svg/SVGPathData.h" 28 #include "core/rendering/svg/SVGPathData.h"
29 #include "core/svg/SVGElementInstance.h" 29 #include "core/svg/SVGElementInstance.h"
30 #include "core/svg/SVGElementRareData.h"
30 #include "platform/transforms/AffineTransform.h" 31 #include "platform/transforms/AffineTransform.h"
31 32
32 namespace WebCore { 33 namespace WebCore {
33 34
34 // Animated property definitions 35 // Animated property definitions
35 DEFINE_ANIMATED_TRANSFORM_LIST(SVGGraphicsElement, SVGNames::transformAttr, Tran sform, transform) 36 DEFINE_ANIMATED_TRANSFORM_LIST(SVGGraphicsElement, SVGNames::transformAttr, Tran sform, transform)
36 37
37 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGraphicsElement) 38 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGraphicsElement)
38 REGISTER_LOCAL_ANIMATED_PROPERTY(transform) 39 REGISTER_LOCAL_ANIMATED_PROPERTY(transform)
39 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) 40 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 detachAnimatedTransformListWrappers(newList.size()); 114 detachAnimatedTransformListWrappers(newList.size());
114 setTransformBaseValue(newList); 115 setTransformBaseValue(newList);
115 return; 116 return;
116 } else if (SVGTests::parseAttribute(name, value)) { 117 } else if (SVGTests::parseAttribute(name, value)) {
117 return; 118 return;
118 } 119 }
119 120
120 ASSERT_NOT_REACHED(); 121 ASSERT_NOT_REACHED();
121 } 122 }
122 123
124 bool SVGGraphicsElement::cachedValidity() const
pdr. 2013/10/25 06:13:12 Ditto for this name.
125 {
126 if (!hasSVGRareData())
127 return true;
128 return svgRareData()->isValid();
129 }
130
123 void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName) 131 void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName)
124 { 132 {
125 if (!isSupportedAttribute(attrName)) { 133 if (!isSupportedAttribute(attrName)) {
126 SVGElement::svgAttributeChanged(attrName); 134 SVGElement::svgAttributeChanged(attrName);
127 return; 135 return;
128 } 136 }
129 137
130 SVGElementInstance::InvalidationGuard invalidationGuard(this); 138 SVGElementInstance::InvalidationGuard invalidationGuard(this);
131 139
132 if (SVGTests::handleAttributeChange(this, attrName)) 140 if (SVGTests::isKnownAttribute(attrName)) {
141 // FIXME: Need to cast because both SVGTests and SVGElement have isValid ()
142 // and SVG code uses multiple inheritance way too much.
143 bool validity = static_cast<SVGElement*>(this)->isValid();
pdr. 2013/10/25 06:13:12 Please use toSVGElement here instead of the static
144 if (cachedValidity() != validity) {
145 lazyReattachIfAttached();
146 ensureSVGRareData()->setIsValid(validity);
147 }
133 return; 148 return;
149 }
134 150
135 RenderObject* object = renderer(); 151 RenderObject* object = renderer();
136 if (!object) 152 if (!object)
137 return; 153 return;
138 154
139 if (attrName == SVGNames::transformAttr) { 155 if (attrName == SVGNames::transformAttr) {
140 object->setNeedsTransformUpdate(); 156 object->setNeedsTransformUpdate();
141 RenderSVGResource::markForLayoutAndParentResourceInvalidation(object); 157 RenderSVGResource::markForLayoutAndParentResourceInvalidation(object);
142 return; 158 return;
143 } 159 }
(...skipping 23 matching lines...) Expand all
167 } 183 }
168 184
169 void SVGGraphicsElement::toClipPath(Path& path) 185 void SVGGraphicsElement::toClipPath(Path& path)
170 { 186 {
171 updatePathFromGraphicsElement(this, path); 187 updatePathFromGraphicsElement(this, path);
172 // FIXME: How do we know the element has done a layout? 188 // FIXME: How do we know the element has done a layout?
173 path.transform(animatedLocalTransform()); 189 path.transform(animatedLocalTransform());
174 } 190 }
175 191
176 } 192 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698