| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 #if !ENABLE(OILPAN) | 89 #if !ENABLE(OILPAN) |
| 90 if (m_viewSpec) | 90 if (m_viewSpec) |
| 91 m_viewSpec->detachContextElement(); | 91 m_viewSpec->detachContextElement(); |
| 92 | 92 |
| 93 // There are cases where removedFromDocument() is not called. | 93 // There are cases where removedFromDocument() is not called. |
| 94 // see ContainerNode::removeAllChildren, called by its destructor. | 94 // see ContainerNode::removeAllChildren, called by its destructor. |
| 95 // With Oilpan, either removedFrom is called or the document | 95 // With Oilpan, either removedFrom is called or the document |
| 96 // is dead as well and there is no reason to clear the extensions. | 96 // is dead as well and there is no reason to clear the extensions. |
| 97 document().accessSVGExtensions().removeTimeContainer(this); | 97 document().accessSVGExtensions().removeTimeContainer(this); |
| 98 | 98 |
| 99 ASSERT(inDocument() || !accessDocumentSVGExtensions().isSVGRootWithRelativeL
engthDescendents(this)); | 99 ASSERT(inShadowIncludingDocument() || !accessDocumentSVGExtensions().isSVGRo
otWithRelativeLengthDescendents(this)); |
| 100 #endif | 100 #endif |
| 101 } | 101 } |
| 102 | 102 |
| 103 SVGRectTearOff* SVGSVGElement::viewport() const | 103 SVGRectTearOff* SVGSVGElement::viewport() const |
| 104 { | 104 { |
| 105 // FIXME: This method doesn't follow the spec and is basically untested. Par
ent documents are not considered here. | 105 // FIXME: This method doesn't follow the spec and is basically untested. Par
ent documents are not considered here. |
| 106 // As we have no test coverage for this, we're going to disable it completly
for now. | 106 // As we have no test coverage for this, we're going to disable it completly
for now. |
| 107 return SVGRectTearOff::create(SVGRect::create(), 0, PropertyIsNotAnimVal); | 107 return SVGRectTearOff::create(SVGRect::create(), 0, PropertyIsNotAnimVal); |
| 108 } | 108 } |
| 109 | 109 |
| 110 SVGViewSpec* SVGSVGElement::currentView() | 110 SVGViewSpec* SVGSVGElement::currentView() |
| 111 { | 111 { |
| 112 if (!m_viewSpec) | 112 if (!m_viewSpec) |
| 113 m_viewSpec = SVGViewSpec::create(this); | 113 m_viewSpec = SVGViewSpec::create(this); |
| 114 return m_viewSpec.get(); | 114 return m_viewSpec.get(); |
| 115 } | 115 } |
| 116 | 116 |
| 117 float SVGSVGElement::currentScale() const | 117 float SVGSVGElement::currentScale() const |
| 118 { | 118 { |
| 119 if (!inDocument() || !isOutermostSVGSVGElement()) | 119 if (!inShadowIncludingDocument() || !isOutermostSVGSVGElement()) |
| 120 return 1; | 120 return 1; |
| 121 | 121 |
| 122 return m_currentScale; | 122 return m_currentScale; |
| 123 } | 123 } |
| 124 | 124 |
| 125 void SVGSVGElement::setCurrentScale(float scale) | 125 void SVGSVGElement::setCurrentScale(float scale) |
| 126 { | 126 { |
| 127 ASSERT(std::isfinite(scale)); | 127 ASSERT(std::isfinite(scale)); |
| 128 if (!inDocument() || !isOutermostSVGSVGElement()) | 128 if (!inShadowIncludingDocument() || !isOutermostSVGSVGElement()) |
| 129 return; | 129 return; |
| 130 | 130 |
| 131 m_currentScale = scale; | 131 m_currentScale = scale; |
| 132 updateUserTransform(); | 132 updateUserTransform(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 class SVGCurrentTranslateTearOff : public SVGPointTearOff { | 135 class SVGCurrentTranslateTearOff : public SVGPointTearOff { |
| 136 public: | 136 public: |
| 137 static SVGCurrentTranslateTearOff* create(SVGSVGElement* contextElement) | 137 static SVGCurrentTranslateTearOff* create(SVGSVGElement* contextElement) |
| 138 { | 138 { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 LayoutObject* SVGSVGElement::createLayoutObject(const ComputedStyle&) | 500 LayoutObject* SVGSVGElement::createLayoutObject(const ComputedStyle&) |
| 501 { | 501 { |
| 502 if (isOutermostSVGSVGElement()) | 502 if (isOutermostSVGSVGElement()) |
| 503 return new LayoutSVGRoot(this); | 503 return new LayoutSVGRoot(this); |
| 504 | 504 |
| 505 return new LayoutSVGViewportContainer(this); | 505 return new LayoutSVGViewportContainer(this); |
| 506 } | 506 } |
| 507 | 507 |
| 508 Node::InsertionNotificationRequest SVGSVGElement::insertedInto(ContainerNode* ro
otParent) | 508 Node::InsertionNotificationRequest SVGSVGElement::insertedInto(ContainerNode* ro
otParent) |
| 509 { | 509 { |
| 510 if (rootParent->inDocument()) { | 510 if (rootParent->inShadowIncludingDocument()) { |
| 511 UseCounter::count(document(), UseCounter::SVGSVGElementInDocument); | 511 UseCounter::count(document(), UseCounter::SVGSVGElementInDocument); |
| 512 if (rootParent->document().isXMLDocument()) | 512 if (rootParent->document().isXMLDocument()) |
| 513 UseCounter::count(document(), UseCounter::SVGSVGElementInXMLDocument
); | 513 UseCounter::count(document(), UseCounter::SVGSVGElementInXMLDocument
); |
| 514 | 514 |
| 515 if (RuntimeEnabledFeatures::smilEnabled()) { | 515 if (RuntimeEnabledFeatures::smilEnabled()) { |
| 516 document().accessSVGExtensions().addTimeContainer(this); | 516 document().accessSVGExtensions().addTimeContainer(this); |
| 517 | 517 |
| 518 // Animations are started at the end of document parsing and after f
iring the load event, | 518 // Animations are started at the end of document parsing and after f
iring the load event, |
| 519 // but if we miss that train (deferred programmatic element insertio
n for example) we need | 519 // but if we miss that train (deferred programmatic element insertio
n for example) we need |
| 520 // to initialize the time container here. | 520 // to initialize the time container here. |
| 521 if (!document().parsing() && !document().processingLoadEvent() && do
cument().loadEventFinished() && !timeContainer()->isStarted()) | 521 if (!document().parsing() && !document().processingLoadEvent() && do
cument().loadEventFinished() && !timeContainer()->isStarted()) |
| 522 timeContainer()->begin(); | 522 timeContainer()->begin(); |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 return SVGGraphicsElement::insertedInto(rootParent); | 525 return SVGGraphicsElement::insertedInto(rootParent); |
| 526 } | 526 } |
| 527 | 527 |
| 528 void SVGSVGElement::removedFrom(ContainerNode* rootParent) | 528 void SVGSVGElement::removedFrom(ContainerNode* rootParent) |
| 529 { | 529 { |
| 530 if (rootParent->inDocument()) { | 530 if (rootParent->inShadowIncludingDocument()) { |
| 531 SVGDocumentExtensions& svgExtensions = document().accessSVGExtensions(); | 531 SVGDocumentExtensions& svgExtensions = document().accessSVGExtensions(); |
| 532 svgExtensions.removeTimeContainer(this); | 532 svgExtensions.removeTimeContainer(this); |
| 533 svgExtensions.removeSVGRootWithRelativeLengthDescendents(this); | 533 svgExtensions.removeSVGRootWithRelativeLengthDescendents(this); |
| 534 } | 534 } |
| 535 | 535 |
| 536 SVGGraphicsElement::removedFrom(rootParent); | 536 SVGGraphicsElement::removedFrom(rootParent); |
| 537 } | 537 } |
| 538 | 538 |
| 539 void SVGSVGElement::pauseAnimations() | 539 void SVGSVGElement::pauseAnimations() |
| 540 { | 540 { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 visitor->trace(m_width); | 743 visitor->trace(m_width); |
| 744 visitor->trace(m_height); | 744 visitor->trace(m_height); |
| 745 visitor->trace(m_translation); | 745 visitor->trace(m_translation); |
| 746 visitor->trace(m_timeContainer); | 746 visitor->trace(m_timeContainer); |
| 747 visitor->trace(m_viewSpec); | 747 visitor->trace(m_viewSpec); |
| 748 SVGGraphicsElement::trace(visitor); | 748 SVGGraphicsElement::trace(visitor); |
| 749 SVGFitToViewBox::trace(visitor); | 749 SVGFitToViewBox::trace(visitor); |
| 750 } | 750 } |
| 751 | 751 |
| 752 } // namespace blink | 752 } // namespace blink |
| OLD | NEW |