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

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

Issue 18328007: Move SVGTests attributes parsing to SVGGraphicsElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix issue in SVGSVGElement::svgAttributeChanged() Created 7 years, 5 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
« no previous file with comments | « Source/core/svg/SVGRectElement.cpp ('k') | Source/core/svg/SVGTextContentElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 else if (name == HTMLNames::onerrorAttr) 249 else if (name == HTMLNames::onerrorAttr)
250 document()->setWindowAttributeEventListener(eventNames().errorEvent, cre ateAttributeEventListener(document()->frame(), name, value)); 250 document()->setWindowAttributeEventListener(eventNames().errorEvent, cre ateAttributeEventListener(document()->frame(), name, value));
251 else if (name == SVGNames::xAttr) 251 else if (name == SVGNames::xAttr)
252 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); 252 setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
253 else if (name == SVGNames::yAttr) 253 else if (name == SVGNames::yAttr)
254 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ; 254 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ;
255 else if (name == SVGNames::widthAttr) 255 else if (name == SVGNames::widthAttr)
256 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths)); 256 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths));
257 else if (name == SVGNames::heightAttr) 257 else if (name == SVGNames::heightAttr)
258 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths)); 258 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths));
259 else if (SVGTests::parseAttribute(name, value) 259 else if (SVGLangSpace::parseAttribute(name, value)
260 || SVGLangSpace::parseAttribute(name, value)
261 || SVGExternalResourcesRequired::parseAttribute(name, value) 260 || SVGExternalResourcesRequired::parseAttribute(name, value)
262 || SVGFitToViewBox::parseAttribute(this, name, value) 261 || SVGFitToViewBox::parseAttribute(this, name, value)
263 || SVGZoomAndPan::parseAttribute(this, name, value)) { 262 || SVGZoomAndPan::parseAttribute(this, name, value)) {
264 } else 263 } else
265 SVGGraphicsElement::parseAttribute(name, value); 264 SVGGraphicsElement::parseAttribute(name, value);
266 265
267 reportAttributeParsingError(parseError, name, value); 266 reportAttributeParsingError(parseError, name, value);
268 } 267 }
269 268
270 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) 269 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
271 { 270 {
272 bool updateRelativeLengthsOrViewBox = false; 271 bool updateRelativeLengthsOrViewBox = false;
273 bool widthChanged = attrName == SVGNames::widthAttr; 272 bool widthChanged = attrName == SVGNames::widthAttr;
274 if (widthChanged 273 if (widthChanged
275 || attrName == SVGNames::heightAttr 274 || attrName == SVGNames::heightAttr
276 || attrName == SVGNames::xAttr 275 || attrName == SVGNames::xAttr
277 || attrName == SVGNames::yAttr) { 276 || attrName == SVGNames::yAttr) {
278 updateRelativeLengthsOrViewBox = true; 277 updateRelativeLengthsOrViewBox = true;
279 updateRelativeLengthsInformation(); 278 updateRelativeLengthsInformation();
280 279
281 // At the SVG/HTML boundary (aka RenderSVGRoot), the width attribute can 280 // At the SVG/HTML boundary (aka RenderSVGRoot), the width attribute can
282 // affect the replaced size so we need to mark it for updating. 281 // affect the replaced size so we need to mark it for updating.
283 if (widthChanged) { 282 if (widthChanged) {
284 RenderObject* renderObject = renderer(); 283 RenderObject* renderObject = renderer();
285 if (renderObject && renderObject->isSVGRoot()) 284 if (renderObject && renderObject->isSVGRoot())
286 toRenderSVGRoot(renderObject)->setNeedsLayoutAndPrefWidthsRecalc (); 285 toRenderSVGRoot(renderObject)->setNeedsLayoutAndPrefWidthsRecalc ();
287 } 286 }
288 } 287 }
289 288
290 if (SVGFitToViewBox::isKnownAttribute(attrName)) { 289 if (SVGFitToViewBox::isKnownAttribute(attrName)) {
291 updateRelativeLengthsOrViewBox = true; 290 updateRelativeLengthsOrViewBox = true;
292 if (RenderObject* object = renderer()) 291 if (RenderObject* object = renderer())
293 object->setNeedsTransformUpdate(); 292 object->setNeedsTransformUpdate();
294 } 293 }
295 294
296 SVGElementInstance::InvalidationGuard invalidationGuard(this); 295 SVGElementInstance::InvalidationGuard invalidationGuard(this);
297 if (SVGTests::handleAttributeChange(this, attrName))
298 return;
299 296
300 if (updateRelativeLengthsOrViewBox 297 if (updateRelativeLengthsOrViewBox
301 || SVGLangSpace::isKnownAttribute(attrName) 298 || SVGLangSpace::isKnownAttribute(attrName)
302 || SVGExternalResourcesRequired::isKnownAttribute(attrName) 299 || SVGExternalResourcesRequired::isKnownAttribute(attrName)
303 || SVGZoomAndPan::isKnownAttribute(attrName)) { 300 || SVGZoomAndPan::isKnownAttribute(attrName)) {
304 if (renderer()) 301 if (renderer())
305 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render er()); 302 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render er());
306 return; 303 return;
307 } 304 }
308 305
309 SVGStyledElement::svgAttributeChanged(attrName); 306 SVGGraphicsElement::svgAttributeChanged(attrName);
310 } 307 }
311 308
312 unsigned SVGSVGElement::suspendRedraw(unsigned /* maxWaitMilliseconds */) 309 unsigned SVGSVGElement::suspendRedraw(unsigned /* maxWaitMilliseconds */)
313 { 310 {
314 // FIXME: Implement me (see bug 11275) 311 // FIXME: Implement me (see bug 11275)
315 return 0; 312 return 0;
316 } 313 }
317 314
318 void SVGSVGElement::unsuspendRedraw(unsigned /* suspendHandleId */) 315 void SVGSVGElement::unsuspendRedraw(unsigned /* suspendHandleId */)
319 { 316 {
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 continue; 768 continue;
772 769
773 Element* element = toElement(node); 770 Element* element = toElement(node);
774 if (element->getIdAttribute() == id) 771 if (element->getIdAttribute() == id)
775 return element; 772 return element;
776 } 773 }
777 return 0; 774 return 0;
778 } 775 }
779 776
780 } 777 }
OLDNEW
« no previous file with comments | « Source/core/svg/SVGRectElement.cpp ('k') | Source/core/svg/SVGTextContentElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698