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

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

Issue 423093014: [SVG2] Make transform, gradientTransform and patternTransform presentation attributes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: transform attr syntax should match property, with minor quirks Created 6 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 unified diff | Download patch
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 * Copyright (C) 2014 Google, Inc. 4 * Copyright (C) 2014 Google, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 25 matching lines...) Expand all
36 , SVGTests(this) 36 , SVGTests(this)
37 , m_transform(SVGAnimatedTransformList::create(this, SVGNames::transformAttr , SVGTransformList::create())) 37 , m_transform(SVGAnimatedTransformList::create(this, SVGNames::transformAttr , SVGTransformList::create()))
38 { 38 {
39 addToPropertyMap(m_transform); 39 addToPropertyMap(m_transform);
40 } 40 }
41 41
42 SVGGraphicsElement::~SVGGraphicsElement() 42 SVGGraphicsElement::~SVGGraphicsElement()
43 { 43 {
44 } 44 }
45 45
46 bool SVGGraphicsElement::isPresentationAttribute(const QualifiedName& name) cons t
47 {
48 if (name == SVGNames::transformAttr)
49 return true;
50 return SVGElement::isPresentationAttribute(name);
51 }
52
53 void SVGGraphicsElement::collectStyleForPresentationAttribute(const QualifiedNam e& name, const AtomicString& value, MutableStylePropertySet* style)
54 {
55 if (name == SVGNames::transformAttr)
56 addPropertyToPresentationAttributeStyle(style, CSSPropertyTransform, val ue);
57 else
58 SVGElement::collectStyleForPresentationAttribute(name, value, style);
59 }
60
46 PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getTransformToElement(SVGElemen t* target, ExceptionState& exceptionState) 61 PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getTransformToElement(SVGElemen t* target, ExceptionState& exceptionState)
47 { 62 {
48 AffineTransform ctm = getCTM(AllowStyleUpdate); 63 AffineTransform ctm = getCTM(AllowStyleUpdate);
49 64
50 if (target && target->isSVGGraphicsElement()) { 65 if (target && target->isSVGGraphicsElement()) {
51 AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(AllowSt yleUpdate); 66 AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(AllowSt yleUpdate);
52 if (!targetCTM.isInvertible()) { 67 if (!targetCTM.isInvertible()) {
53 exceptionState.throwDOMException(InvalidStateError, "The target tran sformation is not invertable."); 68 exceptionState.throwDOMException(InvalidStateError, "The target tran sformation is not invertable.");
54 return nullptr; 69 return nullptr;
55 } 70 }
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 if (SVGTests::isKnownAttribute(attrName)) { 210 if (SVGTests::isKnownAttribute(attrName)) {
196 lazyReattachIfAttached(); 211 lazyReattachIfAttached();
197 return; 212 return;
198 } 213 }
199 214
200 RenderObject* object = renderer(); 215 RenderObject* object = renderer();
201 if (!object) 216 if (!object)
202 return; 217 return;
203 218
204 if (attrName == SVGNames::transformAttr) { 219 if (attrName == SVGNames::transformAttr) {
220 invalidateSVGPresentationAttributeStyle();
pdr. 2014/08/01 22:43:10 We don't make these calls for many other other pre
Erik Dahlström (inactive) 2014/08/04 13:57:57 We do call invalidateSVGPresentationAttributeStyle
221 setNeedsStyleRecalc(SubtreeStyleChange);
205 object->setNeedsTransformUpdate(); 222 object->setNeedsTransformUpdate();
206 RenderSVGResource::markForLayoutAndParentResourceInvalidation(object); 223 RenderSVGResource::markForLayoutAndParentResourceInvalidation(object);
207 return; 224 return;
208 } 225 }
209 226
210 ASSERT_NOT_REACHED(); 227 ASSERT_NOT_REACHED();
211 } 228 }
212 229
213 SVGElement* SVGGraphicsElement::nearestViewportElement() const 230 SVGElement* SVGGraphicsElement::nearestViewportElement() const
214 { 231 {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 } 270 }
254 271
255 void SVGGraphicsElement::toClipPath(Path& path) 272 void SVGGraphicsElement::toClipPath(Path& path)
256 { 273 {
257 updatePathFromGraphicsElement(this, path); 274 updatePathFromGraphicsElement(this, path);
258 // FIXME: How do we know the element has done a layout? 275 // FIXME: How do we know the element has done a layout?
259 path.transform(animatedLocalTransform()); 276 path.transform(animatedLocalTransform());
260 } 277 }
261 278
262 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698