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

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

Issue 18053005: Introduce SVGGraphicsElement IDL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 DEFINE_ANIMATED_RECT(SVGSVGElement, SVGNames::viewBoxAttr, ViewBox, viewBox) 68 DEFINE_ANIMATED_RECT(SVGSVGElement, SVGNames::viewBoxAttr, ViewBox, viewBox)
69 69
70 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSVGElement) 70 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSVGElement)
71 REGISTER_LOCAL_ANIMATED_PROPERTY(x) 71 REGISTER_LOCAL_ANIMATED_PROPERTY(x)
72 REGISTER_LOCAL_ANIMATED_PROPERTY(y) 72 REGISTER_LOCAL_ANIMATED_PROPERTY(y)
73 REGISTER_LOCAL_ANIMATED_PROPERTY(width) 73 REGISTER_LOCAL_ANIMATED_PROPERTY(width)
74 REGISTER_LOCAL_ANIMATED_PROPERTY(height) 74 REGISTER_LOCAL_ANIMATED_PROPERTY(height)
75 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) 75 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
76 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox) 76 REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
77 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) 77 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
78 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledTransformableElement) 78 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement)
79 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
80 END_REGISTER_ANIMATED_PROPERTIES 79 END_REGISTER_ANIMATED_PROPERTIES
81 80
82 inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document* doc) 81 inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document* doc)
83 : SVGStyledTransformableElement(tagName, doc) 82 : SVGGraphicsElement(tagName, doc)
84 , m_x(LengthModeWidth) 83 , m_x(LengthModeWidth)
85 , m_y(LengthModeHeight) 84 , m_y(LengthModeHeight)
86 , m_width(LengthModeWidth, "100%") 85 , m_width(LengthModeWidth, "100%")
87 , m_height(LengthModeHeight, "100%") 86 , m_height(LengthModeHeight, "100%")
88 , m_useCurrentView(false) 87 , m_useCurrentView(false)
89 , m_zoomAndPan(SVGZoomAndPanMagnify) 88 , m_zoomAndPan(SVGZoomAndPanMagnify)
90 , m_timeContainer(SMILTimeContainer::create(this)) 89 , m_timeContainer(SMILTimeContainer::create(this))
91 { 90 {
92 ASSERT(hasTagName(SVGNames::svgTag)); 91 ASSERT(hasTagName(SVGNames::svgTag));
93 ScriptWrappable::init(this); 92 ScriptWrappable::init(this);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 else if (name == SVGNames::widthAttr) 255 else if (name == SVGNames::widthAttr)
257 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths)); 256 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths));
258 else if (name == SVGNames::heightAttr) 257 else if (name == SVGNames::heightAttr)
259 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths)); 258 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths));
260 else if (SVGTests::parseAttribute(name, value) 259 else if (SVGTests::parseAttribute(name, value)
261 || SVGLangSpace::parseAttribute(name, value) 260 || SVGLangSpace::parseAttribute(name, value)
262 || SVGExternalResourcesRequired::parseAttribute(name, value) 261 || SVGExternalResourcesRequired::parseAttribute(name, value)
263 || SVGFitToViewBox::parseAttribute(this, name, value) 262 || SVGFitToViewBox::parseAttribute(this, name, value)
264 || SVGZoomAndPan::parseAttribute(this, name, value)) { 263 || SVGZoomAndPan::parseAttribute(this, name, value)) {
265 } else 264 } else
266 SVGStyledTransformableElement::parseAttribute(name, value); 265 SVGGraphicsElement::parseAttribute(name, value);
267 266
268 reportAttributeParsingError(parseError, name, value); 267 reportAttributeParsingError(parseError, name, value);
269 } 268 }
270 269
271 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) 270 void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
272 { 271 {
273 bool updateRelativeLengthsOrViewBox = false; 272 bool updateRelativeLengthsOrViewBox = false;
274 bool widthChanged = attrName == SVGNames::widthAttr; 273 bool widthChanged = attrName == SVGNames::widthAttr;
275 if (widthChanged 274 if (widthChanged
276 || attrName == SVGNames::heightAttr 275 || attrName == SVGNames::heightAttr
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 { 491 {
493 if (rootParent->inDocument()) { 492 if (rootParent->inDocument()) {
494 document()->accessSVGExtensions()->addTimeContainer(this); 493 document()->accessSVGExtensions()->addTimeContainer(this);
495 494
496 // Animations are started at the end of document parsing and after firin g the load event, 495 // Animations are started at the end of document parsing and after firin g the load event,
497 // but if we miss that train (deferred programmatic element insertion fo r example) we need 496 // but if we miss that train (deferred programmatic element insertion fo r example) we need
498 // to initialize the time container here. 497 // to initialize the time container here.
499 if (!document()->parsing() && !document()->processingLoadEvent() && docu ment()->loadEventFinished() && !timeContainer()->isStarted()) 498 if (!document()->parsing() && !document()->processingLoadEvent() && docu ment()->loadEventFinished() && !timeContainer()->isStarted())
500 timeContainer()->begin(); 499 timeContainer()->begin();
501 } 500 }
502 return SVGStyledTransformableElement::insertedInto(rootParent); 501 return SVGGraphicsElement::insertedInto(rootParent);
503 } 502 }
504 503
505 void SVGSVGElement::removedFrom(ContainerNode* rootParent) 504 void SVGSVGElement::removedFrom(ContainerNode* rootParent)
506 { 505 {
507 if (rootParent->inDocument()) 506 if (rootParent->inDocument())
508 document()->accessSVGExtensions()->removeTimeContainer(this); 507 document()->accessSVGExtensions()->removeTimeContainer(this);
509 SVGStyledTransformableElement::removedFrom(rootParent); 508 SVGGraphicsElement::removedFrom(rootParent);
510 } 509 }
511 510
512 void SVGSVGElement::pauseAnimations() 511 void SVGSVGElement::pauseAnimations()
513 { 512 {
514 if (!m_timeContainer->isPaused()) 513 if (!m_timeContainer->isPaused())
515 m_timeContainer->pause(); 514 m_timeContainer->pause();
516 } 515 }
517 516
518 void SVGSVGElement::unpauseAnimations() 517 void SVGSVGElement::unpauseAnimations()
519 { 518 {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 continue; 771 continue;
773 772
774 Element* element = toElement(node); 773 Element* element = toElement(node);
775 if (element->getIdAttribute() == id) 774 if (element->getIdAttribute() == id)
776 return element; 775 return element;
777 } 776 }
778 return 0; 777 return 0;
779 } 778 }
780 779
781 } 780 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698