OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2007 Apple Inc. All rights reserved. |
5 * Copyright (C) 2014 Google, Inc. | 5 * Copyright (C) 2014 Google, Inc. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } else if (SVGZoomAndPan::parseAttribute(name, value)) { | 236 } else if (SVGZoomAndPan::parseAttribute(name, value)) { |
237 } else { | 237 } else { |
238 parseAttributeNew(name, value); | 238 parseAttributeNew(name, value); |
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 bool SVGSVGElement::isPresentationAttribute(const QualifiedName& name) const | 242 bool SVGSVGElement::isPresentationAttribute(const QualifiedName& name) const |
243 { | 243 { |
244 if (isOutermostSVGSVGElement() && (name == SVGNames::widthAttr || name == SV
GNames::heightAttr)) | 244 if (isOutermostSVGSVGElement() && (name == SVGNames::widthAttr || name == SV
GNames::heightAttr)) |
245 return true; | 245 return true; |
| 246 else if (name == SVGNames::xAttr || name == SVGNames::yAttr) |
| 247 return true; |
| 248 |
246 return SVGGraphicsElement::isPresentationAttribute(name); | 249 return SVGGraphicsElement::isPresentationAttribute(name); |
247 } | 250 } |
248 | 251 |
| 252 bool SVGSVGElement::isPresentationAttributeWithSVGDOM(const QualifiedName& attrN
ame) const |
| 253 { |
| 254 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr) |
| 255 return true; |
| 256 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName); |
| 257 } |
| 258 |
249 void SVGSVGElement::collectStyleForPresentationAttribute(const QualifiedName& na
me, const AtomicString& value, MutableStylePropertySet* style) | 259 void SVGSVGElement::collectStyleForPresentationAttribute(const QualifiedName& na
me, const AtomicString& value, MutableStylePropertySet* style) |
250 { | 260 { |
251 if (isOutermostSVGSVGElement() && (name == SVGNames::widthAttr || name == SV
GNames::heightAttr)) { | 261 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute
(name); |
| 262 if (property == m_x) { |
| 263 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m
_x->currentValue()); |
| 264 } else if (property == m_y) { |
| 265 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m
_y->currentValue()); |
| 266 } else if (isOutermostSVGSVGElement() && (property == m_width || property ==
m_height)) { |
252 RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(LengthModeOther
); | 267 RefPtrWillBeRawPtr<SVGLength> length = SVGLength::create(LengthModeOther
); |
253 TrackExceptionState exceptionState; | 268 TrackExceptionState exceptionState; |
254 length->setValueAsString(value, exceptionState); | 269 length->setValueAsString(value, exceptionState); |
255 if (!exceptionState.hadException()) { | 270 if (!exceptionState.hadException()) { |
256 if (name == SVGNames::widthAttr) | 271 if (property == m_width) |
257 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth,
value); | 272 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth,
value); |
258 else if (name == SVGNames::heightAttr) | 273 else if (property == m_height) |
259 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight
, value); | 274 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight
, value); |
260 } | 275 } |
261 } else { | 276 } else { |
262 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st
yle); | 277 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st
yle); |
263 } | 278 } |
264 } | 279 } |
265 | 280 |
266 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) | 281 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) |
267 { | 282 { |
268 bool updateRelativeLengthsOrViewBox = false; | 283 bool updateRelativeLengthsOrViewBox = false; |
(...skipping 12 matching lines...) Expand all Loading... |
281 // | 296 // |
282 // FIXME: For width/height animated as XML attributes on SVG | 297 // FIXME: For width/height animated as XML attributes on SVG |
283 // roots, there is an attribute synchronization missing. See | 298 // roots, there is an attribute synchronization missing. See |
284 // http://crbug.com/364807 | 299 // http://crbug.com/364807 |
285 if (widthChanged || heightChanged) { | 300 if (widthChanged || heightChanged) { |
286 LayoutObject* layoutObject = renderer(); | 301 LayoutObject* layoutObject = renderer(); |
287 if (layoutObject && layoutObject->isSVGRoot()) { | 302 if (layoutObject && layoutObject->isSVGRoot()) { |
288 invalidateSVGPresentationAttributeStyle(); | 303 invalidateSVGPresentationAttributeStyle(); |
289 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin
g::create(StyleChangeReason::SVGContainerSizeChange)); | 304 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracin
g::create(StyleChangeReason::SVGContainerSizeChange)); |
290 } | 305 } |
| 306 } else { |
| 307 invalidateSVGPresentationAttributeStyle(); |
| 308 setNeedsStyleRecalc(LocalStyleChange, |
| 309 StyleChangeReasonForTracing::fromAttribute(attrName)); |
291 } | 310 } |
292 } | 311 } |
293 | 312 |
294 if (SVGFitToViewBox::isKnownAttribute(attrName)) { | 313 if (SVGFitToViewBox::isKnownAttribute(attrName)) { |
295 updateRelativeLengthsOrViewBox = true; | 314 updateRelativeLengthsOrViewBox = true; |
296 if (LayoutObject* object = renderer()) | 315 if (LayoutObject* object = renderer()) |
297 object->setNeedsTransformUpdate(); | 316 object->setNeedsTransformUpdate(); |
298 } | 317 } |
299 | 318 |
300 SVGElement::InvalidationGuard invalidationGuard(this); | 319 SVGElement::InvalidationGuard invalidationGuard(this); |
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
771 visitor->trace(m_width); | 790 visitor->trace(m_width); |
772 visitor->trace(m_height); | 791 visitor->trace(m_height); |
773 visitor->trace(m_translation); | 792 visitor->trace(m_translation); |
774 visitor->trace(m_timeContainer); | 793 visitor->trace(m_timeContainer); |
775 visitor->trace(m_viewSpec); | 794 visitor->trace(m_viewSpec); |
776 SVGGraphicsElement::trace(visitor); | 795 SVGGraphicsElement::trace(visitor); |
777 SVGFitToViewBox::trace(visitor); | 796 SVGFitToViewBox::trace(visitor); |
778 } | 797 } |
779 | 798 |
780 } // namespace blink | 799 } // namespace blink |
OLD | NEW |