diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/svg')
308 files changed, 2223 insertions, 2574 deletions
diff --git a/chromium/third_party/WebKit/Source/core/svg/ColorDistance.cpp b/chromium/third_party/WebKit/Source/core/svg/ColorDistance.cpp index df61eeedd29..00008684340 100644 --- a/chromium/third_party/WebKit/Source/core/svg/ColorDistance.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/ColorDistance.cpp @@ -20,7 +20,7 @@ #include "config.h" #include "core/svg/ColorDistance.h" -#include "core/platform/graphics/Color.h" +#include "platform/graphics/Color.h" #include "wtf/MathExtras.h" namespace WebCore { @@ -55,13 +55,6 @@ static inline int clampColorValue(int v) return v; } -ColorDistance ColorDistance::scaledDistance(float scaleFactor) const -{ - return ColorDistance(static_cast<int>(scaleFactor * m_redDiff), - static_cast<int>(scaleFactor * m_greenDiff), - static_cast<int>(scaleFactor * m_blueDiff)); -} - Color ColorDistance::clampColor(int red, int green, int blue, int alpha) { return Color(clampColorValue(red), clampColorValue(green), clampColorValue(blue), clampColorValue(alpha)); @@ -72,16 +65,6 @@ Color ColorDistance::addColors(const Color& first, const Color& second) return Color(first.red() + second.red(), first.green() + second.green(), first.blue() + second.blue()); } -Color ColorDistance::addToColor(const Color& color) const -{ - return Color(color.red() + m_redDiff, color.green() + m_greenDiff, color.blue() + m_blueDiff); -} - -bool ColorDistance::isZero() const -{ - return !m_redDiff && !m_blueDiff && !m_greenDiff; -} - float ColorDistance::distance() const { // This is just a simple distance calculation, not respecting color spaces diff --git a/chromium/third_party/WebKit/Source/core/svg/ColorDistance.h b/chromium/third_party/WebKit/Source/core/svg/ColorDistance.h index 4f8b3fd46bf..470effb7598 100644 --- a/chromium/third_party/WebKit/Source/core/svg/ColorDistance.h +++ b/chromium/third_party/WebKit/Source/core/svg/ColorDistance.h @@ -30,14 +30,9 @@ public: ColorDistance(const Color& fromColor, const Color& toColor); ColorDistance(int redDiff, int blueDiff, int greenDiff); - ColorDistance scaledDistance(float scaleFactor) const; - Color addToColor(const Color&) const; - static Color addColors(const Color&, const Color&); static Color clampColor(int red, int green, int blue, int alpha); - bool isZero() const; - float distance() const; private: diff --git a/chromium/third_party/WebKit/Source/core/svg/PatternAttributes.h b/chromium/third_party/WebKit/Source/core/svg/PatternAttributes.h index 1400e824395..7e4ae7520ca 100644 --- a/chromium/third_party/WebKit/Source/core/svg/PatternAttributes.h +++ b/chromium/third_party/WebKit/Source/core/svg/PatternAttributes.h @@ -20,9 +20,9 @@ #ifndef PatternAttributes_h #define PatternAttributes_h -#include "core/platform/graphics/transforms/AffineTransform.h" #include "core/svg/SVGLength.h" #include "core/svg/SVGPreserveAspectRatio.h" +#include "platform/transforms/AffineTransform.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAElement.cpp index 84fa34de617..4cac139fddc 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAElement.cpp @@ -29,9 +29,10 @@ #include "core/dom/Attr.h" #include "core/dom/Attribute.h" #include "core/dom/Document.h" -#include "core/dom/EventNames.h" -#include "core/dom/KeyboardEvent.h" -#include "core/dom/MouseEvent.h" +#include "core/events/KeyboardEvent.h" +#include "core/events/MouseEvent.h" +#include "core/events/ThreadLocalEventNames.h" +#include "core/frame/Frame.h" #include "core/html/HTMLAnchorElement.h" #include "core/html/HTMLFormElement.h" #include "core/html/parser/HTMLParserIdioms.h" @@ -40,15 +41,14 @@ #include "core/loader/FrameLoaderTypes.h" #include "core/page/Chrome.h" #include "core/page/ChromeClient.h" -#include "core/page/Frame.h" #include "core/page/Page.h" -#include "core/platform/PlatformMouseEvent.h" -#include "core/platform/network/ResourceRequest.h" #include "core/rendering/svg/RenderSVGInline.h" #include "core/rendering/svg/RenderSVGText.h" #include "core/rendering/svg/RenderSVGTransformableContainer.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/animation/SVGSMILElement.h" +#include "platform/PlatformMouseEvent.h" +#include "platform/network/ResourceRequest.h" namespace WebCore { @@ -66,17 +66,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGAElement::SVGAElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGAElement::SVGAElement(Document& document) + : SVGGraphicsElement(SVGNames::aTag, document) { - ASSERT(hasTagName(SVGNames::aTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGAElement(); } -PassRefPtr<SVGAElement> SVGAElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGAElement> SVGAElement::create(Document& document) { - return adoptRef(new SVGAElement(tagName, document)); + return adoptRef(new SVGAElement(document)); } String SVGAElement::title() const @@ -163,7 +162,7 @@ void SVGAElement::defaultEventHandler(Event* event) if (url[0] == '#') { Element* targetElement = treeScope().getElementById(url.substring(1)); - if (SVGSMILElement::isSMILElement(targetElement)) { + if (targetElement && isSVGSMILElement(*targetElement)) { toSVGSMILElement(targetElement)->beginByLinkActivation(); event->setDefaultHandled(); return; @@ -181,9 +180,9 @@ void SVGAElement::defaultEventHandler(Event* event) Frame* frame = document().frame(); if (!frame) return; - FrameLoadRequest frameRequest(document().securityOrigin(), ResourceRequest(document().completeURL(url)), target); + FrameLoadRequest frameRequest(&document(), ResourceRequest(document().completeURL(url)), target); frameRequest.setTriggeringEvent(event); - frame->loader()->load(frameRequest); + frame->loader().load(frameRequest); return; } } @@ -235,7 +234,7 @@ bool SVGAElement::childShouldCreateRenderer(const Node& child) const if (parentNode() && parentNode()->isSVGElement()) return parentNode()->childShouldCreateRenderer(child); - return SVGElement::childShouldCreateRenderer(child); + return SVGGraphicsElement::childShouldCreateRenderer(child); } } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGAElement.h index b3d0743aeee..10036dbee99 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAElement.h @@ -33,10 +33,10 @@ class SVGAElement FINAL : public SVGGraphicsElement, public SVGURIReference, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGAElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGAElement> create(Document&); private: - SVGAElement(const QualifiedName&, Document&); + explicit SVGAElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphDefElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphDefElement.cpp index d99b1656aac..4924ec5f3c5 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphDefElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphDefElement.cpp @@ -28,16 +28,15 @@ namespace WebCore { -inline SVGAltGlyphDefElement::SVGAltGlyphDefElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGAltGlyphDefElement::SVGAltGlyphDefElement(Document& document) + : SVGElement(SVGNames::altGlyphDefTag, document) { - ASSERT(hasTagName(SVGNames::altGlyphDefTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGAltGlyphDefElement> SVGAltGlyphDefElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGAltGlyphDefElement> SVGAltGlyphDefElement::create(Document& document) { - return adoptRef(new SVGAltGlyphDefElement(tagName, document)); + return adoptRef(new SVGAltGlyphDefElement(document)); } bool SVGAltGlyphDefElement::hasValidGlyphElements(Vector<String>& glyphNames) const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphDefElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphDefElement.h index f3b1fd809b1..e55794417b7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphDefElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphDefElement.h @@ -28,12 +28,12 @@ namespace WebCore { class SVGAltGlyphDefElement FINAL : public SVGElement { public: - static PassRefPtr<SVGAltGlyphDefElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGAltGlyphDefElement> create(Document&); bool hasValidGlyphElements(Vector<String>& glyphNames) const; private: - SVGAltGlyphDefElement(const QualifiedName&, Document&); + explicit SVGAltGlyphDefElement(Document&); virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.cpp index 691b8f49f3a..b170919f5b9 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.cpp @@ -42,22 +42,21 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGAltGlyphElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextPositioningElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGAltGlyphElement::SVGAltGlyphElement(const QualifiedName& tagName, Document& document) - : SVGTextPositioningElement(tagName, document) +inline SVGAltGlyphElement::SVGAltGlyphElement(Document& document) + : SVGTextPositioningElement(SVGNames::altGlyphTag, document) { - ASSERT(hasTagName(SVGNames::altGlyphTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGAltGlyphElement(); } -PassRefPtr<SVGAltGlyphElement> SVGAltGlyphElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGAltGlyphElement> SVGAltGlyphElement::create(Document& document) { - return adoptRef(new SVGAltGlyphElement(tagName, document)); + return adoptRef(new SVGAltGlyphElement(document)); } -void SVGAltGlyphElement::setGlyphRef(const AtomicString&, ExceptionState& es) +void SVGAltGlyphElement::setGlyphRef(const AtomicString&, ExceptionState& exceptionState) { - es.throwDOMException(NoModificationAllowedError); + exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError); } const AtomicString& SVGAltGlyphElement::glyphRef() const @@ -65,9 +64,9 @@ const AtomicString& SVGAltGlyphElement::glyphRef() const return fastGetAttribute(SVGNames::glyphRefAttr); } -void SVGAltGlyphElement::setFormat(const AtomicString&, ExceptionState& es) +void SVGAltGlyphElement::setFormat(const AtomicString&, ExceptionState& exceptionState) { - es.throwDOMException(NoModificationAllowedError); + exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError); } const AtomicString& SVGAltGlyphElement::format() const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.h index 2ab0ee76ced..841e1f0993e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.h @@ -35,7 +35,7 @@ class SVGGlyphElement; class SVGAltGlyphElement FINAL : public SVGTextPositioningElement, public SVGURIReference { public: - static PassRefPtr<SVGAltGlyphElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGAltGlyphElement> create(Document&); const AtomicString& glyphRef() const; void setGlyphRef(const AtomicString&, ExceptionState&); @@ -45,7 +45,7 @@ public: bool hasValidGlyphElements(Vector<String>& glyphNames) const; private: - SVGAltGlyphElement(const QualifiedName&, Document&); + explicit SVGAltGlyphElement(Document&); virtual RenderObject* createRenderer(RenderStyle*); virtual bool childShouldCreateRenderer(const Node& child) const; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.idl index 999598e8014..e3f99152598 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphElement.idl @@ -26,8 +26,8 @@ [ Conditional=SVG_FONTS ] interface SVGAltGlyphElement : SVGTextPositioningElement { - [SetterRaisesException] attribute DOMString glyphRef; - [SetterRaisesException] attribute DOMString format; + [RaisesException=Setter] attribute DOMString glyphRef; + [RaisesException=Setter] attribute DOMString format; }; SVGAltGlyphElement implements SVGURIReference; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphItemElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphItemElement.cpp index 22c4d959c6b..662dfeb54b7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphItemElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphItemElement.cpp @@ -27,16 +27,15 @@ namespace WebCore { -inline SVGAltGlyphItemElement::SVGAltGlyphItemElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGAltGlyphItemElement::SVGAltGlyphItemElement(Document& document) + : SVGElement(SVGNames::altGlyphItemTag, document) { - ASSERT(hasTagName(SVGNames::altGlyphItemTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGAltGlyphItemElement> SVGAltGlyphItemElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGAltGlyphItemElement> SVGAltGlyphItemElement::create(Document& document) { - return adoptRef(new SVGAltGlyphItemElement(tagName, document)); + return adoptRef(new SVGAltGlyphItemElement(document)); } bool SVGAltGlyphItemElement::hasValidGlyphElements(Vector<String>& glyphNames) const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphItemElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphItemElement.h index 18223d7b8ca..cf4c9b09180 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphItemElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAltGlyphItemElement.h @@ -28,12 +28,12 @@ namespace WebCore { class SVGAltGlyphItemElement FINAL : public SVGElement { public: - static PassRefPtr<SVGAltGlyphItemElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGAltGlyphItemElement> create(Document&); bool hasValidGlyphElements(Vector<String>& glyphNames) const; private: - SVGAltGlyphItemElement(const QualifiedName&, Document&); + explicit SVGAltGlyphItemElement(Document&); virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAngle.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAngle.cpp index e88d5da4956..30f4155db32 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAngle.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAngle.cpp @@ -150,7 +150,7 @@ static bool parseValue(const String& value, float& valueInSpecifiedUnits, SVGAng return true; } -void SVGAngle::setValueAsString(const String& value, ExceptionState& es) +void SVGAngle::setValueAsString(const String& value, ExceptionState& exceptionState) { if (value.isEmpty()) { m_unitType = SVG_ANGLETYPE_UNSPECIFIED; @@ -163,7 +163,7 @@ void SVGAngle::setValueAsString(const String& value, ExceptionState& es) bool success = value.is8Bit() ? parseValue<LChar>(value, valueInSpecifiedUnits, unitType) : parseValue<UChar>(value, valueInSpecifiedUnits, unitType); if (!success) { - es.throwDOMException(SyntaxError); + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError); return; } @@ -171,10 +171,10 @@ void SVGAngle::setValueAsString(const String& value, ExceptionState& es) m_valueInSpecifiedUnits = valueInSpecifiedUnits; } -void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionState& es) +void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits, ExceptionState& exceptionState) { if (unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return; } @@ -184,10 +184,10 @@ void SVGAngle::newValueSpecifiedUnits(unsigned short unitType, float valueInSpec m_valueInSpecifiedUnits = valueInSpecifiedUnits; } -void SVGAngle::convertToSpecifiedUnits(unsigned short unitType, ExceptionState& es) +void SVGAngle::convertToSpecifiedUnits(unsigned short unitType, ExceptionState& exceptionState) { if (unitType == SVG_ANGLETYPE_UNKNOWN || m_unitType == SVG_ANGLETYPE_UNKNOWN || unitType > SVG_ANGLETYPE_GRAD) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAngle.idl b/chromium/third_party/WebKit/Source/core/svg/SVGAngle.idl index 4501978c40d..665f6ead7fc 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAngle.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAngle.idl @@ -32,7 +32,7 @@ interface SVGAngle { [StrictTypeChecking] attribute float value; [StrictTypeChecking] attribute float valueInSpecifiedUnits; - [TreatNullAs=NullString, SetterRaisesException] attribute DOMString valueAsString; + [TreatNullAs=NullString, RaisesException=Setter] attribute DOMString valueAsString; [StrictTypeChecking, RaisesException] void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateColorElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateColorElement.cpp index ce8d772bba7..7bf3842c491 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateColorElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateColorElement.cpp @@ -22,23 +22,22 @@ #include "config.h" #include "SVGNames.h" -#include "core/page/UseCounter.h" +#include "core/frame/UseCounter.h" #include "core/svg/SVGAnimateColorElement.h" namespace WebCore { -inline SVGAnimateColorElement::SVGAnimateColorElement(const QualifiedName& tagName, Document& document) - : SVGAnimateElement(tagName, document) +inline SVGAnimateColorElement::SVGAnimateColorElement(Document& document) + : SVGAnimateElement(SVGNames::animateColorTag, document) { - ASSERT(hasTagName(SVGNames::animateColorTag)); ScriptWrappable::init(this); - UseCounter::count(&document, UseCounter::SVGAnimateColorElement); + UseCounter::count(document, UseCounter::SVGAnimateColorElement); } -PassRefPtr<SVGAnimateColorElement> SVGAnimateColorElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGAnimateColorElement> SVGAnimateColorElement::create(Document& document) { - return adoptRef(new SVGAnimateColorElement(tagName, document)); + return adoptRef(new SVGAnimateColorElement(document)); } static bool attributeValueIsCurrentColor(const String& value) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateColorElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateColorElement.h index 160b1c63ab2..f17ea2627ce 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateColorElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateColorElement.h @@ -28,10 +28,10 @@ namespace WebCore { class SVGAnimateColorElement FINAL : public SVGAnimateElement { public: - static PassRefPtr<SVGAnimateColorElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGAnimateColorElement> create(Document&); private: - SVGAnimateColorElement(const QualifiedName&, Document&); + explicit SVGAnimateColorElement(Document&); virtual void determinePropertyValueTypes(const String& from, const String& to); }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp index 4baee606355..83e30da7fc3 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp @@ -25,13 +25,13 @@ #include "core/svg/SVGAnimateElement.h" #include "CSSPropertyNames.h" -#include "SVGNames.h" #include "core/css/CSSParser.h" #include "core/css/StylePropertySet.h" #include "core/dom/QualifiedName.h" #include "core/svg/SVGAnimatedType.h" #include "core/svg/SVGAnimatedTypeAnimator.h" #include "core/svg/SVGAnimatorFactory.h" +#include "core/svg/SVGDocumentExtensions.h" namespace WebCore { @@ -43,13 +43,15 @@ SVGAnimateElement::SVGAnimateElement(const QualifiedName& tagName, Document& doc ScriptWrappable::init(this); } -PassRefPtr<SVGAnimateElement> SVGAnimateElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGAnimateElement> SVGAnimateElement::create(Document& document) { - return adoptRef(new SVGAnimateElement(tagName, document)); + return adoptRef(new SVGAnimateElement(SVGNames::animateTag, document)); } SVGAnimateElement::~SVGAnimateElement() { + if (targetElement()) + clearAnimatedType(targetElement()); } bool SVGAnimateElement::hasValidAttributeType() @@ -97,7 +99,7 @@ void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat { ASSERT(resultElement); SVGElement* targetElement = this->targetElement(); - if (!targetElement) + if (!targetElement || !isSVGAnimateElement(*resultElement)) return; ASSERT(m_animatedPropertyType == determineAnimatedPropertyType(targetElement)); @@ -211,6 +213,10 @@ void SVGAnimateElement::resetAnimatedType() if (shouldApply == ApplyXMLAnimation) { // SVG DOM animVal animation code-path. m_animatedProperties = animator->findAnimatedPropertiesForAttributeName(targetElement, attributeName); + SVGElementAnimatedPropertyList::const_iterator end = m_animatedProperties.end(); + for (SVGElementAnimatedPropertyList::const_iterator it = m_animatedProperties.begin(); it != end; ++it) + document().accessSVGExtensions()->addElementReferencingTarget(this, it->element); + ASSERT(!m_animatedProperties.isEmpty()); ASSERT(propertyTypesAreConsistent(m_animatedPropertyType, m_animatedProperties)); @@ -240,7 +246,7 @@ void SVGAnimateElement::resetAnimatedType() static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSPropertyID id, const String& value) { - ASSERT(!targetElement->m_deletionHasBegun); + ASSERT_WITH_SECURITY_IMPLICATION(!targetElement->m_deletionHasBegun); MutableStylePropertySet* propertySet = targetElement->ensureAnimatedSMILStyleProperties(); if (!propertySet->setProperty(id, value, false, 0)) @@ -251,7 +257,7 @@ static inline void applyCSSPropertyToTarget(SVGElement* targetElement, CSSProper static inline void removeCSSPropertyFromTarget(SVGElement* targetElement, CSSPropertyID id) { - ASSERT(!targetElement->m_deletionHasBegun); + ASSERT_WITH_SECURITY_IMPLICATION(!targetElement->m_deletionHasBegun); targetElement->ensureAnimatedSMILStyleProperties()->removeProperty(id); targetElement->setNeedsStyleRecalc(LocalStyleChange); } @@ -298,7 +304,7 @@ static inline void removeCSSPropertyFromTargetAndInstances(SVGElement* targetEle static inline void notifyTargetAboutAnimValChange(SVGElement* targetElement, const QualifiedName& attributeName) { - ASSERT(!targetElement->m_deletionHasBegun); + ASSERT_WITH_SECURITY_IMPLICATION(!targetElement->m_deletionHasBegun); targetElement->svgAttributeChanged(attributeName); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateElement.h index e7f2c673d83..e8b2dc438ab 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateElement.h @@ -35,7 +35,7 @@ class SVGAnimatedTypeAnimator; class SVGAnimateElement : public SVGAnimationElement { public: - static PassRefPtr<SVGAnimateElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGAnimateElement> create(Document&); virtual ~SVGAnimateElement(); AnimatedPropertyType determineAnimatedPropertyType(SVGElement*) const; @@ -75,16 +75,16 @@ private: OwnPtr<SVGAnimatedTypeAnimator> m_animator; }; -inline SVGAnimateElement* toSVGAnimateElement(Element* element) +inline bool isSVGAnimateElement(const Node& node) { - ASSERT_WITH_SECURITY_IMPLICATION(!element - || element->hasTagName(SVGNames::animateTag) - || element->hasTagName(SVGNames::animateColorTag) - || element->hasTagName(SVGNames::animateTransformTag) - || element->hasTagName(SVGNames::setTag)); - return static_cast<SVGAnimateElement*>(element); + return node.hasTagName(SVGNames::animateTag) + || node.hasTagName(SVGNames::animateColorTag) + || node.hasTagName(SVGNames::animateTransformTag) + || node.hasTagName(SVGNames::setTag); } +DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGAnimateElement); + } // namespace WebCore #endif // SVGAnimateElement_h diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp index faf70569fda..9c76b316404 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.cpp @@ -24,7 +24,6 @@ #include "core/svg/SVGAnimateMotionElement.h" #include "SVGNames.h" -#include "core/platform/graphics/transforms/AffineTransform.h" #include "core/rendering/RenderObject.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/rendering/svg/SVGPathData.h" @@ -33,6 +32,7 @@ #include "core/svg/SVGParserUtilities.h" #include "core/svg/SVGPathElement.h" #include "core/svg/SVGPathUtilities.h" +#include "platform/transforms/AffineTransform.h" #include "wtf/MathExtras.h" #include "wtf/StdLibExtras.h" @@ -40,18 +40,23 @@ namespace WebCore { using namespace SVGNames; -inline SVGAnimateMotionElement::SVGAnimateMotionElement(const QualifiedName& tagName, Document& document) - : SVGAnimationElement(tagName, document) +inline SVGAnimateMotionElement::SVGAnimateMotionElement(Document& document) + : SVGAnimationElement(animateMotionTag, document) , m_hasToPointAtEndOfDuration(false) { setCalcMode(CalcModePaced); - ASSERT(hasTagName(animateMotionTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGAnimateMotionElement> SVGAnimateMotionElement::create(const QualifiedName& tagName, Document& document) +SVGAnimateMotionElement::~SVGAnimateMotionElement() { - return adoptRef(new SVGAnimateMotionElement(tagName, document)); + if (targetElement()) + clearAnimatedType(targetElement()); +} + +PassRefPtr<SVGAnimateMotionElement> SVGAnimateMotionElement::create(Document& document) +{ + return adoptRef(new SVGAnimateMotionElement(document)); } bool SVGAnimateMotionElement::hasValidAttributeType() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.h index 79c84157ae4..46094a1302a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateMotionElement.h @@ -21,8 +21,8 @@ #ifndef SVGAnimateMotionElement_h #define SVGAnimateMotionElement_h -#include "core/platform/graphics/Path.h" #include "core/svg/SVGAnimationElement.h" +#include "platform/graphics/Path.h" namespace WebCore { @@ -30,11 +30,13 @@ class AffineTransform; class SVGAnimateMotionElement FINAL : public SVGAnimationElement { public: - static PassRefPtr<SVGAnimateMotionElement> create(const QualifiedName&, Document&); + virtual ~SVGAnimateMotionElement(); + + static PassRefPtr<SVGAnimateMotionElement> create(Document&); void updateAnimationPath(); private: - SVGAnimateMotionElement(const QualifiedName&, Document&); + explicit SVGAnimateMotionElement(Document&); virtual bool hasValidAttributeType(); virtual bool hasValidAttributeName(); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.cpp index 051cf9377d9..6774a387307 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.cpp @@ -25,21 +25,20 @@ #include "core/svg/SVGAnimateTransformElement.h" #include "SVGNames.h" -#include "core/svg/SVGTransformable.h" +#include "core/svg/SVGParserUtilities.h" namespace WebCore { -inline SVGAnimateTransformElement::SVGAnimateTransformElement(const QualifiedName& tagName, Document& document) - : SVGAnimateElement(tagName, document) +inline SVGAnimateTransformElement::SVGAnimateTransformElement(Document& document) + : SVGAnimateElement(SVGNames::animateTransformTag, document) , m_type(SVGTransform::SVG_TRANSFORM_UNKNOWN) { - ASSERT(hasTagName(SVGNames::animateTransformTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGAnimateTransformElement> SVGAnimateTransformElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGAnimateTransformElement> SVGAnimateTransformElement::create(Document& document) { - return adoptRef(new SVGAnimateTransformElement(tagName, document)); + return adoptRef(new SVGAnimateTransformElement(document)); } bool SVGAnimateTransformElement::hasValidAttributeType() @@ -70,7 +69,7 @@ void SVGAnimateTransformElement::parseAttribute(const QualifiedName& name, const } if (name == SVGNames::typeAttr) { - m_type = SVGTransformable::parseTransformType(value); + m_type = parseTransformType(value); if (m_type == SVGTransform::SVG_TRANSFORM_MATRIX) m_type = SVGTransform::SVG_TRANSFORM_UNKNOWN; return; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.h index 21c80f26991..86606d8890a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimateTransformElement.h @@ -32,12 +32,12 @@ class AffineTransform; class SVGAnimateTransformElement FINAL : public SVGAnimateElement { public: - static PassRefPtr<SVGAnimateTransformElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGAnimateTransformElement> create(Document&); SVGTransform::SVGTransformType transformType() const { return m_type; } private: - SVGAnimateTransformElement(const QualifiedName&, Document&); + explicit SVGAnimateTransformElement(Document&); virtual bool hasValidAttributeType(); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedAngle.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedAngle.cpp index e5e1a771cc2..a6265e5466b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedAngle.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedAngle.cpp @@ -31,13 +31,6 @@ SVGAnimatedAngleAnimator::SVGAnimatedAngleAnimator(SVGAnimationElement* animatio { } -static inline SVGAngle& sharedSVGAngle(const String& valueAsString) -{ - DEFINE_STATIC_LOCAL(SVGAngle, sharedAngle, ()); - sharedAngle.setValueAsString(valueAsString, ASSERT_NO_EXCEPTION); - return sharedAngle; -} - PassOwnPtr<SVGAnimatedType> SVGAnimatedAngleAnimator::constructFromString(const String& string) { OwnPtr<SVGAnimatedType> animatedType = SVGAnimatedType::createAngleAndEnumeration(new pair<SVGAngle, unsigned>); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedBoolean.idl b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedBoolean.idl index fa2ca08e01b..7fc919ccf26 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedBoolean.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedBoolean.idl @@ -24,7 +24,7 @@ */ interface SVGAnimatedBoolean { - [StrictTypeChecking, SetterRaisesException] attribute boolean baseVal; + [StrictTypeChecking, RaisesException=Setter] attribute boolean baseVal; readonly attribute boolean animVal; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedEnumeration.idl b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedEnumeration.idl index cb04e753a08..e51c9c1f87d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedEnumeration.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedEnumeration.idl @@ -24,7 +24,7 @@ */ interface SVGAnimatedEnumeration { - [StrictTypeChecking, SetterRaisesException] attribute unsigned short baseVal; + [StrictTypeChecking, RaisesException=Setter] attribute unsigned short baseVal; readonly attribute unsigned short animVal; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedInteger.idl b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedInteger.idl index ae72080cfbf..3c31681dc6c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedInteger.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedInteger.idl @@ -24,7 +24,7 @@ */ interface SVGAnimatedInteger { - [StrictTypeChecking, SetterRaisesException] attribute long baseVal; + [StrictTypeChecking, RaisesException=Setter] attribute long baseVal; readonly attribute long animVal; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedNumber.idl b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedNumber.idl index 6e3485cc238..e8cc9ba3161 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedNumber.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedNumber.idl @@ -25,7 +25,7 @@ */ interface SVGAnimatedNumber { - [StrictTypeChecking, SetterRaisesException] attribute float baseVal; + [StrictTypeChecking, RaisesException=Setter] attribute float baseVal; readonly attribute float animVal; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedPointList.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedPointList.cpp index 837cfdaf62c..fd68ad04e7e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedPointList.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedPointList.cpp @@ -23,7 +23,6 @@ #include "core/svg/SVGAnimateElement.h" #include "core/svg/SVGParserUtilities.h" -#include "core/svg/SVGPointList.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedString.idl b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedString.idl index 27e27dc29f1..d1fbf52a247 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedString.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedString.idl @@ -24,7 +24,7 @@ */ interface SVGAnimatedString { - [SetterRaisesException] attribute DOMString baseVal; + [RaisesException=Setter] attribute DOMString baseVal; readonly attribute DOMString animVal; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedType.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedType.cpp index 148e00bb42b..486773f4306 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedType.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedType.cpp @@ -280,9 +280,9 @@ bool SVGAnimatedType::setValueAsString(const QualifiedName& attrName, const Stri break; case AnimatedLength: { ASSERT(m_data.length); - TrackExceptionState es; - m_data.length->setValueAsString(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName), es); - return !es.hadException(); + TrackExceptionState exceptionState; + m_data.length->setValueAsString(value, SVGLength::lengthModeForAnimatedLengthAttribute(attrName), exceptionState); + return !exceptionState.hadException(); } case AnimatedLengthList: ASSERT(m_data.lengthList); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedType.h b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedType.h index d5d60334bf2..7c6aa01350a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedType.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimatedType.h @@ -35,10 +35,10 @@ namespace WebCore { class SVGPathByteStream; -class SVGAnimatedType { +class SVGAnimatedType FINAL { WTF_MAKE_FAST_ALLOCATED; public: - virtual ~SVGAnimatedType(); + ~SVGAnimatedType(); static PassOwnPtr<SVGAnimatedType> createAngleAndEnumeration(std::pair<SVGAngle, unsigned>*); static PassOwnPtr<SVGAnimatedType> createBoolean(bool*); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp index 21873d73010..f17bd5e7bd5 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp @@ -30,11 +30,11 @@ #include "SVGNames.h" #include "core/css/CSSComputedStyleDeclaration.h" #include "core/css/CSSParser.h" -#include "core/page/UseCounter.h" -#include "core/platform/FloatConversion.h" +#include "core/frame/UseCounter.h" #include "core/svg/SVGAnimateElement.h" #include "core/svg/SVGElement.h" #include "core/svg/SVGParserUtilities.h" +#include "platform/FloatConversion.h" #include "wtf/MathExtras.h" namespace WebCore { @@ -60,7 +60,7 @@ SVGAnimationElement::SVGAnimationElement(const QualifiedName& tagName, Document& ScriptWrappable::init(this); registerAnimatedPropertiesForSVGAnimationElement(); - UseCounter::count(&document, UseCounter::SVGAnimationElement); + UseCounter::count(document, UseCounter::SVGAnimationElement); } static void parseKeyTimes(const String& string, Vector<float>& result, bool verifyOrder) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.h index 11410e1885f..087529fc32d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAnimationElement.h @@ -25,11 +25,11 @@ #ifndef SVGAnimationElement_h #define SVGAnimationElement_h -#include "core/platform/graphics/UnitBezier.h" #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGExternalResourcesRequired.h" #include "core/svg/SVGTests.h" #include "core/svg/animation/SVGSMILElement.h" +#include "platform/animation/UnitBezier.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/svgattrs.in b/chromium/third_party/WebKit/Source/core/svg/SVGAttributeNames.in index bee8ecc5e2c..bee8ecc5e2c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/svgattrs.in +++ b/chromium/third_party/WebKit/Source/core/svg/SVGAttributeNames.in diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.cpp index 8852d8c33af..e1d6ba3bb6d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.cpp @@ -22,7 +22,6 @@ #include "core/svg/SVGCircleElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGEllipse.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/svg/SVGElementInstance.h" @@ -44,27 +43,25 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCircleElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGCircleElement::SVGCircleElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGCircleElement::SVGCircleElement(Document& document) + : SVGGeometryElement(SVGNames::circleTag, document) , m_cx(LengthModeWidth) , m_cy(LengthModeHeight) , m_r(LengthModeOther) { - ASSERT(hasTagName(SVGNames::circleTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGCircleElement(); } -PassRefPtr<SVGCircleElement> SVGCircleElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGCircleElement> SVGCircleElement::create(Document& document) { - return adoptRef(new SVGCircleElement(tagName, document)); + return adoptRef(new SVGCircleElement(document)); } bool SVGCircleElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); if (supportedAttributes.isEmpty()) { - SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); supportedAttributes.add(SVGNames::cxAttr); supportedAttributes.add(SVGNames::cyAttr); @@ -78,15 +75,14 @@ void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr SVGParsingError parseError = NoError; if (!isSupportedAttribute(name)) - SVGGraphicsElement::parseAttribute(name, value); + SVGGeometryElement::parseAttribute(name, value); else if (name == SVGNames::cxAttr) setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); else if (name == SVGNames::cyAttr) setCyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)); else if (name == SVGNames::rAttr) setRBaseValue(SVGLength::construct(LengthModeOther, value, parseError, ForbidNegativeLengths)); - else if (SVGLangSpace::parseAttribute(name, value) - || SVGExternalResourcesRequired::parseAttribute(name, value)) { + else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { } else ASSERT_NOT_REACHED(); @@ -96,7 +92,7 @@ void SVGCircleElement::parseAttribute(const QualifiedName& name, const AtomicStr void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { - SVGGraphicsElement::svgAttributeChanged(attrName); + SVGGeometryElement::svgAttributeChanged(attrName); return; } @@ -119,7 +115,7 @@ void SVGCircleElement::svgAttributeChanged(const QualifiedName& attrName) return; } - if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { + if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); return; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.h index ae702f6974f..eb689f8d31d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.h @@ -25,17 +25,17 @@ #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedLength.h" #include "core/svg/SVGExternalResourcesRequired.h" -#include "core/svg/SVGGraphicsElement.h" +#include "core/svg/SVGGeometryElement.h" namespace WebCore { -class SVGCircleElement FINAL : public SVGGraphicsElement, +class SVGCircleElement FINAL : public SVGGeometryElement, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGCircleElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGCircleElement> create(Document&); private: - SVGCircleElement(const QualifiedName&, Document&); + explicit SVGCircleElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } @@ -56,11 +56,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGCircleElement* toSVGCircleElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::circleTag)); - return static_cast<SVGCircleElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGCircleElement, hasTagName(SVGNames::circleTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.idl index 00ef676895a..67f3d445648 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGCircleElement.idl @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGCircleElement : SVGGraphicsElement { +interface SVGCircleElement : SVGGeometryElement { readonly attribute SVGAnimatedLength cx; readonly attribute SVGAnimatedLength cy; readonly attribute SVGAnimatedLength r; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.cpp index de8058f0c50..c4224f1cfa5 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.cpp @@ -23,7 +23,6 @@ #include "core/svg/SVGClipPathElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGResourceClipper.h" #include "core/svg/SVGElementInstance.h" @@ -39,18 +38,17 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGClipPathElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGClipPathElement::SVGClipPathElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGClipPathElement::SVGClipPathElement(Document& document) + : SVGGraphicsElement(SVGNames::clipPathTag, document) , m_clipPathUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { - ASSERT(hasTagName(SVGNames::clipPathTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGClipPathElement(); } -PassRefPtr<SVGClipPathElement> SVGClipPathElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGClipPathElement> SVGClipPathElement::create(Document& document) { - return adoptRef(new SVGClipPathElement(tagName, document)); + return adoptRef(new SVGClipPathElement(document)); } bool SVGClipPathElement::isSupportedAttribute(const QualifiedName& attrName) @@ -92,8 +90,9 @@ void SVGClipPathElement::svgAttributeChanged(const QualifiedName& attrName) SVGElementInstance::InvalidationGuard invalidationGuard(this); - if (RenderObject* object = renderer()) - object->setNeedsLayout(); + RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); + if (renderer) + renderer->invalidateCacheAndMarkForLayout(); } void SVGClipPathElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.h index 80f6be944ea..0b0baec5ec7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGClipPathElement.h @@ -35,10 +35,10 @@ class RenderObject; class SVGClipPathElement FINAL : public SVGGraphicsElement, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGClipPathElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGClipPathElement> create(Document&); private: - SVGClipPathElement(const QualifiedName&, Document&); + explicit SVGClipPathElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool needsPendingResourceHandling() const { return false; } @@ -56,11 +56,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGClipPathElement* toSVGClipPathElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::clipPathTag)); - return static_cast<SVGClipPathElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGClipPathElement, hasTagName(SVGNames::clipPathTag)); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGColor.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGColor.cpp index 5253f89a7f5..788ecf8d9f4 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGColor.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGColor.cpp @@ -54,24 +54,24 @@ Color SVGColor::colorFromRGBColorString(const String& colorString) return Color(); } -void SVGColor::setRGBColor(const String&, ExceptionState& es) +void SVGColor::setRGBColor(const String&, ExceptionState& exceptionState) { // The whole SVGColor interface is deprecated in SVG 1.1 (2nd edition). // The setters are the most problematic part so we remove the support for those first. - es.throwDOMException(NoModificationAllowedError); + exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError); } -void SVGColor::setRGBColorICCColor(const String&, const String&, ExceptionState& es) +void SVGColor::setRGBColorICCColor(const String&, const String&, ExceptionState& exceptionState) { - es.throwDOMException(NoModificationAllowedError); + exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError); } -void SVGColor::setColor(unsigned short, const String&, const String&, ExceptionState& es) +void SVGColor::setColor(unsigned short, const String&, const String&, ExceptionState& exceptionState) { - es.throwDOMException(NoModificationAllowedError); + exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError); } -String SVGColor::customCssText() const +String SVGColor::customCSSText() const { switch (m_colorType) { case SVG_COLORTYPE_UNKNOWN: diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGColor.h b/chromium/third_party/WebKit/Source/core/svg/SVGColor.h index 554fe77052b..03416661228 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGColor.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGColor.h @@ -23,7 +23,7 @@ #define SVGColor_h #include "core/css/CSSValue.h" -#include "core/platform/graphics/Color.h" +#include "platform/graphics/Color.h" #include "wtf/PassRefPtr.h" namespace WebCore { @@ -69,7 +69,7 @@ public: void setRGBColorICCColor(const String& rgbColor, const String& iccColor, ExceptionState&); void setColor(unsigned short colorType, const String& rgbColor, const String& iccColor, ExceptionState&); - String customCssText() const; + String customCSSText() const; ~SVGColor() { } @@ -93,6 +93,8 @@ private: SVGColorType m_colorType; }; +DEFINE_CSS_VALUE_TYPE_CASTS(SVGColor, isSVGColor()); + } // namespace WebCore #endif // SVGColor_h diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGComponentTransferFunctionElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGComponentTransferFunctionElement.h index 8a6bbd95984..b794e710d92 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGComponentTransferFunctionElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGComponentTransferFunctionElement.h @@ -21,10 +21,10 @@ #ifndef SVGComponentTransferFunctionElement_h #define SVGComponentTransferFunctionElement_h -#include "core/platform/graphics/filters/FEComponentTransfer.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGAnimatedNumberList.h" +#include "platform/graphics/filters/FEComponentTransfer.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGCursorElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGCursorElement.cpp index f83ffa93a73..5473a2f3084 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGCursorElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGCursorElement.cpp @@ -43,19 +43,18 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGCursorElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) END_REGISTER_ANIMATED_PROPERTIES -inline SVGCursorElement::SVGCursorElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGCursorElement::SVGCursorElement(Document& document) + : SVGElement(SVGNames::cursorTag, document) , m_x(LengthModeWidth) , m_y(LengthModeHeight) { - ASSERT(hasTagName(SVGNames::cursorTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGCursorElement(); } -PassRefPtr<SVGCursorElement> SVGCursorElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGCursorElement> SVGCursorElement::create(Document& document) { - return adoptRef(new SVGCursorElement(tagName, document)); + return adoptRef(new SVGCursorElement(document)); } SVGCursorElement::~SVGCursorElement() @@ -134,11 +133,4 @@ void SVGCursorElement::svgAttributeChanged(const QualifiedName& attrName) (*it)->setNeedsStyleRecalc(); } -void SVGCursorElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const -{ - SVGElement::addSubresourceAttributeURLs(urls); - - addSubresourceURL(urls, document().completeURL(hrefCurrentValue())); -} - } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGCursorElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGCursorElement.h index eb93d4a4fee..57011308521 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGCursorElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGCursorElement.h @@ -36,7 +36,7 @@ class SVGCursorElement FINAL : public SVGElement, public SVGExternalResourcesRequired, public SVGURIReference { public: - static PassRefPtr<SVGCursorElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGCursorElement> create(Document&); virtual ~SVGCursorElement(); @@ -45,7 +45,7 @@ public: void removeReferencedElement(SVGElement*); private: - SVGCursorElement(const QualifiedName&, Document&); + explicit SVGCursorElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } @@ -53,8 +53,6 @@ private: virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&); - virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const; - virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGCursorElement) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGDefsElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGDefsElement.cpp index 4b2d39b52f1..ae425f37ecf 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGDefsElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGDefsElement.cpp @@ -35,17 +35,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGDefsElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGDefsElement::SVGDefsElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGDefsElement::SVGDefsElement(Document& document) + : SVGGraphicsElement(SVGNames::defsTag, document) { - ASSERT(hasTagName(SVGNames::defsTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGDefsElement(); } -PassRefPtr<SVGDefsElement> SVGDefsElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGDefsElement> SVGDefsElement::create(Document& document) { - return adoptRef(new SVGDefsElement(tagName, document)); + return adoptRef(new SVGDefsElement(document)); } bool SVGDefsElement::isValid() const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGDefsElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGDefsElement.h index b29d526c924..60ff06beb4a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGDefsElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGDefsElement.h @@ -30,10 +30,10 @@ namespace WebCore { class SVGDefsElement FINAL : public SVGGraphicsElement, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGDefsElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGDefsElement> create(Document&); private: - SVGDefsElement(const QualifiedName&, Document&); + explicit SVGDefsElement(Document&); virtual bool isValid() const; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGDescElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGDescElement.cpp index 219bedaf093..9696aa1c04e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGDescElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGDescElement.cpp @@ -24,16 +24,15 @@ namespace WebCore { -inline SVGDescElement::SVGDescElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGDescElement::SVGDescElement(Document& document) + : SVGElement(SVGNames::descTag, document) { - ASSERT(hasTagName(SVGNames::descTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGDescElement> SVGDescElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGDescElement> SVGDescElement::create(Document& document) { - return adoptRef(new SVGDescElement(tagName, document)); + return adoptRef(new SVGDescElement(document)); } String SVGDescElement::description() const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGDescElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGDescElement.h index 2c8cfa65971..181053dc0a1 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGDescElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGDescElement.h @@ -27,12 +27,12 @@ namespace WebCore { class SVGDescElement FINAL : public SVGElement { public: - static PassRefPtr<SVGDescElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGDescElement> create(Document&); String description() const; private: - SVGDescElement(const QualifiedName&, Document&); + explicit SVGDescElement(Document&); virtual bool rendererIsNeeded(const RenderStyle&) { return false; } }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGDocument.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGDocument.cpp index c82b6e73b65..876b66f645a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGDocument.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGDocument.cpp @@ -23,8 +23,8 @@ #include "SVGNames.h" #include "bindings/v8/ExceptionStatePlaceholder.h" -#include "core/dom/EventNames.h" -#include "core/page/FrameView.h" +#include "core/events/ThreadLocalEventNames.h" +#include "core/frame/FrameView.h" #include "core/rendering/RenderView.h" #include "core/svg/SVGElement.h" #include "core/svg/SVGSVGElement.h" @@ -51,8 +51,8 @@ SVGSVGElement* SVGDocument::rootElement() const void SVGDocument::dispatchZoomEvent(float prevScale, float newScale) { - RefPtr<SVGZoomEvent> event = static_pointer_cast<SVGZoomEvent>(createEvent("SVGZoomEvents", IGNORE_EXCEPTION)); - event->initEvent(eventNames().zoomEvent, true, false); + RefPtr<SVGZoomEvent> event = SVGZoomEvent::create(); + event->initEvent(EventTypeNames::zoom, true, false); event->setPreviousScale(prevScale); event->setNewScale(newScale); rootElement()->dispatchEvent(event.release(), IGNORE_EXCEPTION); @@ -60,8 +60,8 @@ void SVGDocument::dispatchZoomEvent(float prevScale, float newScale) void SVGDocument::dispatchScrollEvent() { - RefPtr<Event> event = createEvent("SVGEvents", IGNORE_EXCEPTION); - event->initEvent(eventNames().scrollEvent, true, false); + RefPtr<Event> event = Event::create(); + event->initEvent(EventTypeNames::scroll, true, false); rootElement()->dispatchEvent(event.release(), IGNORE_EXCEPTION); } @@ -101,4 +101,9 @@ bool SVGDocument::childShouldCreateRenderer(const Node& child) const return true; } +PassRefPtr<Document> SVGDocument::cloneDocumentWithoutChildren() +{ + return create(DocumentInit(url())); +} + } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGDocument.h b/chromium/third_party/WebKit/Source/core/svg/SVGDocument.h index bddf66f45bd..a9b3392c398 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGDocument.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGDocument.h @@ -22,7 +22,7 @@ #define SVGDocument_h #include "core/dom/Document.h" -#include "core/platform/graphics/FloatPoint.h" +#include "platform/geometry/FloatPoint.h" namespace WebCore { @@ -45,6 +45,8 @@ public: void startPan(const FloatPoint& start); void updatePan(const FloatPoint& pos) const; + virtual PassRefPtr<Document> cloneDocumentWithoutChildren() OVERRIDE FINAL; + private: explicit SVGDocument(const DocumentInit&); @@ -53,20 +55,7 @@ private: FloatPoint m_translate; }; -inline SVGDocument* toSVGDocument(Document* document) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isSVGDocument()); - return static_cast<SVGDocument*>(document); -} - -inline const SVGDocument* toSVGDocument(const Document* document) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!document || document->isSVGDocument()); - return static_cast<const SVGDocument*>(document); -} - -// This will catch anyone doing an unnecessary cast. -void toSVGDocument(const SVGDocument*); +DEFINE_DOCUMENT_TYPE_CASTS(SVGDocument); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGDocument.idl b/chromium/third_party/WebKit/Source/core/svg/SVGDocument.idl index 64ec90c33c8..dced4119455 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGDocument.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGDocument.idl @@ -19,9 +19,7 @@ * Boston, MA 02110-1301, USA. */ -[ - CustomToV8 -] interface SVGDocument : Document { +interface SVGDocument : Document { readonly attribute SVGSVGElement rootElement; // Overwrite the one in events::DocumentEvent diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp index 4542e506be9..a135845e036 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.cpp @@ -28,6 +28,7 @@ #include "core/svg/SVGElement.h" #include "core/svg/SVGSVGElement.h" #include "core/svg/animation/SMILTimeContainer.h" +#include "wtf/TemporaryChange.h" #include "wtf/text/AtomicString.h" namespace WebCore { @@ -35,6 +36,9 @@ namespace WebCore { SVGDocumentExtensions::SVGDocumentExtensions(Document* document) : m_document(document) , m_resourcesCache(adoptPtr(new SVGResourcesCache)) +#if !ASSERT_DISABLED + , m_inRelativeLengthSVGRootsInvalidation(false) +#endif { } @@ -367,6 +371,35 @@ void SVGDocumentExtensions::removeAllElementReferencesForTarget(SVGElement* refe m_elementDependencies.remove(it); } +void SVGDocumentExtensions::addSVGRootWithRelativeLengthDescendents(SVGSVGElement* svgRoot) +{ + ASSERT(!m_inRelativeLengthSVGRootsInvalidation); + m_relativeLengthSVGRoots.add(svgRoot); +} + +void SVGDocumentExtensions::removeSVGRootWithRelativeLengthDescendents(SVGSVGElement* svgRoot) +{ + ASSERT(!m_inRelativeLengthSVGRootsInvalidation); + m_relativeLengthSVGRoots.remove(svgRoot); +} + +bool SVGDocumentExtensions::isSVGRootWithRelativeLengthDescendents(SVGSVGElement* svgRoot) const +{ + return m_relativeLengthSVGRoots.contains(svgRoot); +} + +void SVGDocumentExtensions::invalidateSVGRootsWithRelativeLengthDescendents(SubtreeLayoutScope* scope) +{ + ASSERT(!m_inRelativeLengthSVGRootsInvalidation); +#if !ASSERT_DISABLED + TemporaryChange<bool> inRelativeLengthSVGRootsChange(m_inRelativeLengthSVGRootsInvalidation, true); +#endif + + HashSet<SVGSVGElement*>::iterator end = m_relativeLengthSVGRoots.end(); + for (HashSet<SVGSVGElement*>::iterator it = m_relativeLengthSVGRoots.begin(); it != end; ++it) + (*it)->invalidateRelativeLengthClients(scope); +} + #if ENABLE(SVG_FONTS) void SVGDocumentExtensions::registerSVGFontFaceElement(SVGFontFaceElement* element) { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h b/chromium/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h index 1223dd3291c..abf4a68172e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h @@ -30,6 +30,7 @@ namespace WebCore { class Document; class RenderSVGResourceContainer; +class SubtreeLayoutScope; class SVGElement; #if ENABLE(SVG_FONTS) class SVGFontFaceElement; @@ -69,6 +70,11 @@ public: void rebuildAllElementReferencesForTarget(SVGElement*); void removeAllElementReferencesForTarget(SVGElement*); + void addSVGRootWithRelativeLengthDescendents(SVGSVGElement*); + void removeSVGRootWithRelativeLengthDescendents(SVGSVGElement*); + bool isSVGRootWithRelativeLengthDescendents(SVGSVGElement*) const; + void invalidateSVGRootsWithRelativeLengthDescendents(SubtreeLayoutScope*); + #if ENABLE(SVG_FONTS) const HashSet<SVGFontFaceElement*>& svgFontFaceElements() const { return m_svgFontFaceElements; } void registerSVGFontFaceElement(SVGFontFaceElement*); @@ -86,6 +92,10 @@ private: HashMap<AtomicString, OwnPtr<SVGPendingElements> > m_pendingResourcesForRemoval; // Resources that are pending and scheduled for removal. HashMap<SVGElement*, OwnPtr<HashSet<SVGElement*> > > m_elementDependencies; OwnPtr<SVGResourcesCache> m_resourcesCache; + HashSet<SVGSVGElement*> m_relativeLengthSVGRoots; // Root SVG elements with relative length descendants. +#if !ASSERT_DISABLED + bool m_inRelativeLengthSVGRootsInvalidation; +#endif public: // This HashMap contains a list of pending resources. Pending resources, are such diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGElement.cpp index 6fe95edfb35..0ab482d46c4 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGElement.cpp @@ -32,10 +32,9 @@ #include "bindings/v8/ScriptEventListener.h" #include "core/css/CSSCursorImageValue.h" #include "core/css/CSSParser.h" -#include "core/dom/DOMImplementation.h" #include "core/dom/Document.h" #include "core/dom/ElementTraversal.h" -#include "core/dom/Event.h" +#include "core/events/Event.h" #include "core/dom/shadow/ShadowRoot.h" #include "core/rendering/RenderObject.h" #include "core/rendering/svg/RenderSVGResourceContainer.h" @@ -76,6 +75,8 @@ SVGElement::SVGElement(const QualifiedName& tagName, Document& document, Constru #if !ASSERT_DISABLED , m_inRelativeLengthClientsInvalidation(false) #endif + , m_animatedPropertiesDestructed(false) + , m_isContextElement(false) { ScriptWrappable::init(this); registerAnimatedPropertiesForSVGElement(); @@ -84,12 +85,22 @@ SVGElement::SVGElement(const QualifiedName& tagName, Document& document, Constru SVGElement::~SVGElement() { + ASSERT(inDocument() || !hasRelativeLengths()); +} + +void +SVGElement::cleanupAnimatedProperties() +{ + if (m_animatedPropertiesDestructed) + return; + m_animatedPropertiesDestructed = true; + if (!hasSVGRareData()) ASSERT(!SVGElementRareData::rareDataMap().contains(this)); else { SVGElementRareData::SVGElementRareDataMap& rareDataMap = SVGElementRareData::rareDataMap(); SVGElementRareData::SVGElementRareDataMap::iterator it = rareDataMap.find(this); - ASSERT(it != rareDataMap.end()); + ASSERT_WITH_SECURITY_IMPLICATION(it != rareDataMap.end()); SVGElementRareData* rareData = it->value; rareData->destroyAnimatedSMILStyleProperties(); @@ -111,8 +122,7 @@ SVGElement::~SVGElement() } document().accessSVGExtensions()->rebuildAllElementReferencesForTarget(this); document().accessSVGExtensions()->removeAllElementReferencesForTarget(this); - - ASSERT(inDocument() || !hasRelativeLengths()); + SVGAnimatedProperty::detachAnimatedPropertiesForElement(this); } void SVGElement::willRecalcStyle(StyleRecalcChange change) @@ -228,12 +238,6 @@ void SVGElement::reportAttributeParsingError(SVGParsingError error, const Qualif ASSERT_NOT_REACHED(); } - -bool SVGElement::isSupported(StringImpl* feature, StringImpl* version) const -{ - return DOMImplementation::hasFeature(feature, version); -} - String SVGElement::title() const { // According to spec, we should not return titles when hovering over root <svg> elements (those @@ -260,8 +264,8 @@ String SVGElement::title() const // If we aren't an instance in a <use> or the <use> title was not found, then find the first // <title> child of this element. - Element* titleElement = ElementTraversal::firstWithin(this); - for (; titleElement; titleElement = ElementTraversal::nextSkippingChildren(titleElement, this)) { + Element* titleElement = ElementTraversal::firstWithin(*this); + for (; titleElement; titleElement = ElementTraversal::nextSkippingChildren(*titleElement, this)) { if (titleElement->hasTagName(SVGNames::titleTag) && titleElement->isSVGElement()) break; } @@ -291,10 +295,6 @@ PassRefPtr<CSSValue> SVGElement::getPresentationAttribute(const String& name) return cssValue ? cssValue->cloneForCSSOM() : 0; } -bool SVGElement::isKnownAttribute(const QualifiedName& attrName) -{ - return isIdAttributeName(attrName); -} bool SVGElement::instanceUpdatesBlocked() const { @@ -307,7 +307,7 @@ void SVGElement::setInstanceUpdatesBlocked(bool value) svgRareData()->setInstanceUpdatesBlocked(value); } -AffineTransform SVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const +AffineTransform SVGElement::localCoordinateSpaceTransform(CTMScope) const { // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement) return AffineTransform(); @@ -318,11 +318,31 @@ String SVGElement::xmlbase() const return fastGetAttribute(XMLNames::baseAttr); } -void SVGElement::setXmlbase(const String& value) +void SVGElement::setXMLbase(const String& value) { setAttribute(XMLNames::baseAttr, value); } +String SVGElement::xmllang() const +{ + return fastGetAttribute(XMLNames::langAttr); +} + +void SVGElement::setXMLlang(const String& value) +{ + setAttribute(XMLNames::langAttr, value); +} + +String SVGElement::xmlspace() const +{ + return fastGetAttribute(XMLNames::spaceAttr); +} + +void SVGElement::setXMLspace(const String& value) +{ + setAttribute(XMLNames::spaceAttr, value); +} + Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootParent) { Element::insertedInto(rootParent); @@ -447,6 +467,8 @@ CSSPropertyID SVGElement::cssPropertyIdForSVGAttributeName(const QualifiedName& void SVGElement::updateRelativeLengthsInformation(bool clientHasRelativeLengths, SVGElement* clientElement) { + ASSERT(clientElement); + // If we're not yet in a document, this function will be called again from insertedInto(). Do nothing now. if (!inDocument()) return; @@ -464,13 +486,22 @@ void SVGElement::updateRelativeLengthsInformation(bool clientHasRelativeLengths, else currentElement->m_elementsWithRelativeLengths.remove(clientElement); - // If the relative length state hasn't changed, we can stop propagating the notfication. + // If the relative length state hasn't changed, we can stop propagating the notification. if (hadRelativeLengths == currentElement->hasRelativeLengths()) - break; + return; clientElement = currentElement; clientHasRelativeLengths = clientElement->hasRelativeLengths(); } + + // Register root SVG elements for top level viewport change notifications. + if (clientElement->isSVGSVGElement()) { + SVGDocumentExtensions* svgExtensions = accessDocumentSVGExtensions(); + if (clientElement->hasRelativeLengths()) + svgExtensions->addSVGRootWithRelativeLengthDescendents(toSVGSVGElement(clientElement)); + else + svgExtensions->removeSVGRootWithRelativeLengthDescendents(toSVGSVGElement(clientElement)); + } } void SVGElement::invalidateRelativeLengthClients(SubtreeLayoutScope* layoutScope) @@ -483,15 +514,18 @@ void SVGElement::invalidateRelativeLengthClients(SubtreeLayoutScope* layoutScope TemporaryChange<bool> inRelativeLengthClientsInvalidationChange(m_inRelativeLengthClientsInvalidation, true); #endif + RenderObject* renderer = this->renderer(); + if (renderer && selfHasRelativeLengths()) { + if (renderer->isSVGResourceContainer()) + toRenderSVGResourceContainer(renderer)->invalidateCacheAndMarkForLayout(layoutScope); + else + renderer->setNeedsLayout(MarkContainingBlockChain, layoutScope); + } + HashSet<SVGElement*>::iterator end = m_elementsWithRelativeLengths.end(); for (HashSet<SVGElement*>::iterator it = m_elementsWithRelativeLengths.begin(); it != end; ++it) { - if (*it == this) - continue; - - if ((*it)->renderer() && (*it)->selfHasRelativeLengths()) - (*it)->renderer()->setNeedsLayout(MarkContainingBlockChain, layoutScope); - - (*it)->invalidateRelativeLengthClients(layoutScope); + if (*it != this) + (*it)->invalidateRelativeLengthClients(layoutScope); } } @@ -560,13 +594,13 @@ const HashSet<SVGElementInstance*>& SVGElement::instancesForElement() const return svgRareData()->elementInstances(); } -bool SVGElement::getBoundingBox(FloatRect& rect, SVGLocatable::StyleUpdateStrategy styleUpdateStrategy) +bool SVGElement::getBoundingBox(FloatRect& rect) { - if (isSVGGraphicsElement()) { - rect = toSVGGraphicsElement(this)->getBBox(styleUpdateStrategy); - return true; - } - return false; + if (!isSVGGraphicsElement()) + return false; + + rect = toSVGGraphicsElement(this)->getBBox(); + return true; } void SVGElement::setCursorElement(SVGCursorElement* cursorElement) @@ -618,36 +652,42 @@ void SVGElement::parseAttribute(const QualifiedName& name, const AtomicString& v { // standard events if (name == onloadAttr) - setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::load, createAttributeEventListener(this, name, value)); + else if (name == onbeginAttr) + setAttributeEventListener(EventTypeNames::beginEvent, createAttributeEventListener(this, name, value)); + else if (name == onendAttr) + setAttributeEventListener(EventTypeNames::endEvent, createAttributeEventListener(this, name, value)); + else if (name == onrepeatAttr) + setAttributeEventListener(EventTypeNames::repeatEvent, createAttributeEventListener(this, name, value)); else if (name == onclickAttr) - setAttributeEventListener(eventNames().clickEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::click, createAttributeEventListener(this, name, value)); else if (name == onmousedownAttr) - setAttributeEventListener(eventNames().mousedownEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::mousedown, createAttributeEventListener(this, name, value)); else if (name == onmouseenterAttr) - setAttributeEventListener(eventNames().mouseenterEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::mouseenter, createAttributeEventListener(this, name, value)); else if (name == onmouseleaveAttr) - setAttributeEventListener(eventNames().mouseleaveEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::mouseleave, createAttributeEventListener(this, name, value)); else if (name == onmousemoveAttr) - setAttributeEventListener(eventNames().mousemoveEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::mousemove, createAttributeEventListener(this, name, value)); else if (name == onmouseoutAttr) - setAttributeEventListener(eventNames().mouseoutEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::mouseout, createAttributeEventListener(this, name, value)); else if (name == onmouseoverAttr) - setAttributeEventListener(eventNames().mouseoverEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::mouseover, createAttributeEventListener(this, name, value)); else if (name == onmouseupAttr) - setAttributeEventListener(eventNames().mouseupEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::mouseup, createAttributeEventListener(this, name, value)); else if (name == SVGNames::onfocusinAttr) - setAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::focusin, createAttributeEventListener(this, name, value)); else if (name == SVGNames::onfocusoutAttr) - setAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::focusout, createAttributeEventListener(this, name, value)); else if (name == SVGNames::onactivateAttr) - setAttributeEventListener(eventNames().DOMActivateEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::DOMActivate, createAttributeEventListener(this, name, value)); else if (name == HTMLNames::classAttr) { // SVG animation has currently requires special storage of values so we set // the className here. svgAttributeChanged actually causes the resulting // style updates (instead of Element::parseAttribute). We don't // tell Element about the change to avoid parsing the class list twice setClassNameBaseValue(value); - } else if (SVGLangSpace::parseAttribute(name, value)) { + } else if (name.matches(XMLNames::langAttr) || name.matches(XMLNames::spaceAttr)) { } else Element::parseAttribute(name, value); } @@ -842,11 +882,11 @@ bool SVGElement::removeEventListener(const AtomicString& eventType, EventListene static bool hasLoadListener(Element* element) { - if (element->hasEventListeners(eventNames().loadEvent)) + if (element->hasEventListeners(EventTypeNames::load)) return true; for (element = element->parentOrShadowHostElement(); element; element = element->parentOrShadowHostElement()) { - const EventListenerVector& entry = element->getEventListeners(eventNames().loadEvent); + const EventListenerVector& entry = element->getEventListeners(EventTypeNames::load); for (size_t i = 0; i < entry.size(); ++i) { if (entry[i].useCapture) return true; @@ -870,9 +910,9 @@ void SVGElement::sendSVGLoadEventIfPossible(bool sendParentLoadEvents) if (sendParentLoadEvents) parent = currentTarget->parentOrShadowHostElement(); // save the next parent to dispatch too incase dispatching the event changes the tree if (hasLoadListener(currentTarget.get())) - currentTarget->dispatchEvent(Event::create(eventNames().loadEvent)); + currentTarget->dispatchEvent(Event::create(EventTypeNames::load)); currentTarget = (parent && parent->isSVGElement()) ? static_pointer_cast<SVGElement>(parent) : RefPtr<SVGElement>(); - SVGElement* element = toSVGElement(currentTarget.get()); + SVGElement* element = currentTarget.get(); if (!element || !element->isOutermostSVGSVGElement()) continue; @@ -970,7 +1010,7 @@ void SVGElement::svgAttributeChanged(const QualifiedName& attrName) RenderObject* object = renderer(); // Notify resources about id changes, this is important as we cache resources by id in SVGDocumentExtensions if (object && object->isSVGResourceContainer()) - object->toRenderSVGResourceContainer()->idChanged(); + toRenderSVGResourceContainer(object)->idChanged(); if (inDocument()) buildPendingResourcesIfNeeded(); SVGElementInstance::invalidateAllInstancesOfElement(this); @@ -1012,7 +1052,7 @@ void SVGElement::synchronizeSystemLanguage(SVGElement* contextElement) PassRefPtr<RenderStyle> SVGElement::customStyleForRenderer() { if (!correspondingElement()) - return document().styleResolver()->styleForElement(this); + return document().ensureStyleResolver().styleForElement(this); RenderStyle* style = 0; if (Element* parent = parentOrShadowHostElement()) { @@ -1020,7 +1060,7 @@ PassRefPtr<RenderStyle> SVGElement::customStyleForRenderer() style = renderer->style(); } - return document().styleResolver()->styleForElement(correspondingElement(), style, DisallowStyleSharing); + return document().ensureStyleResolver().styleForElement(correspondingElement(), style, DisallowStyleSharing); } MutableStylePropertySet* SVGElement::animatedSMILStyleProperties() const @@ -1057,9 +1097,7 @@ RenderStyle* SVGElement::computedStyle(PseudoId pseudoElementSpecifier) bool SVGElement::hasFocusEventListeners() const { - // FIXME: EventTarget::hasEventListeners should be const. - SVGElement* mutableThis = const_cast<SVGElement*>(this); - return mutableThis->hasEventListeners(eventNames().focusinEvent) || mutableThis->hasEventListeners(eventNames().focusoutEvent); + return hasEventListeners(EventTypeNames::focusin) || hasEventListeners(EventTypeNames::focusout); } bool SVGElement::isKeyboardFocusable() const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGElement.h index 9badaae41b5..9098753995f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGElement.h @@ -23,13 +23,11 @@ #define SVGElement_h #include "core/dom/Element.h" -#include "core/platform/Timer.h" #include "core/svg/SVGAnimatedString.h" -#include "core/svg/SVGLangSpace.h" -#include "core/svg/SVGLocatable.h" #include "core/svg/SVGParsingError.h" #include "core/svg/properties/SVGAnimatedPropertyMacros.h" #include "core/svg/properties/SVGPropertyInfo.h" +#include "platform/Timer.h" #include "wtf/HashMap.h" namespace WebCore { @@ -47,7 +45,7 @@ class SVGSVGElement; void mapAttributeToCSSProperty(HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName); -class SVGElement : public Element, public SVGLangSpace { +class SVGElement : public Element { public: virtual ~SVGElement(); @@ -57,16 +55,25 @@ public: bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); } virtual bool supportsMarkers() const { return false; } PassRefPtr<CSSValue> getPresentationAttribute(const String& name); - bool isKnownAttribute(const QualifiedName&); static bool isAnimatableCSSProperty(const QualifiedName&); - virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const; + enum CTMScope { + NearestViewportScope, // Used by SVGGraphicsElement::getCTM() + ScreenScope // Used by SVGGraphicsElement::getScreenCTM() + }; + virtual AffineTransform localCoordinateSpaceTransform(CTMScope) const; virtual bool needsPendingResourceHandling() const { return true; } bool instanceUpdatesBlocked() const; void setInstanceUpdatesBlocked(bool); String xmlbase() const; - void setXmlbase(const String&); + void setXMLbase(const String&); + + String xmllang() const; + void setXMLlang(const String& xmlLang); + + String xmlspace() const; + void setXMLspace(const String& xmlSpace); SVGSVGElement* ownerSVGElement() const; SVGElement* viewportElement() const; @@ -97,7 +104,7 @@ public: const HashSet<SVGElementInstance*>& instancesForElement() const; - bool getBoundingBox(FloatRect&, SVGLocatable::StyleUpdateStrategy = SVGLocatable::AllowStyleUpdate); + bool getBoundingBox(FloatRect&); void setCursorElement(SVGCursorElement*); void cursorElementRemoved(); @@ -136,6 +143,9 @@ public: void invalidateRelativeLengthClients(SubtreeLayoutScope* = 0); + bool isContextElement() const { return m_isContextElement; } + void setContextElement() { m_isContextElement = true; } + protected: SVGElement(const QualifiedName&, Document&, ConstructionType = CreateSVGElement); @@ -165,6 +175,25 @@ protected: void reportAttributeParsingError(SVGParsingError, const QualifiedName&, const AtomicString&); bool hasFocusEventListeners() const; + class CleanUpAnimatedPropertiesCaller { + public: + CleanUpAnimatedPropertiesCaller() + : m_owner(0) + { + } + + ~CleanUpAnimatedPropertiesCaller() + { + ASSERT(m_owner); + m_owner->cleanupAnimatedProperties(); + } + + void setOwner(SVGElement* owner) { m_owner = owner; } + + private: + SVGElement* m_owner; + }; + private: friend class SVGElementInstance; @@ -179,11 +208,12 @@ private: void buildPendingResourcesIfNeeded(); - virtual bool isSupported(StringImpl* feature, StringImpl* version) const; - void mapInstanceToElement(SVGElementInstance*); void removeInstanceMapping(SVGElementInstance*); + void cleanupAnimatedProperties(); + friend class CleanUpAnimatedPropertiesCaller; + HashSet<SVGElement*> m_elementsWithRelativeLengths; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGElement) @@ -193,6 +223,8 @@ private: #if !ASSERT_DISABLED bool m_inRelativeLengthClientsInvalidation; #endif + bool m_animatedPropertiesDestructed; + bool m_isContextElement; }; struct SVGAttributeHashTranslator { @@ -207,17 +239,7 @@ struct SVGAttributeHashTranslator { static bool equal(const QualifiedName& a, const QualifiedName& b) { return a.matches(b); } }; -inline SVGElement* toSVGElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isSVGElement()); - return static_cast<SVGElement*>(node); -} - -inline const SVGElement* toSVGElement(const Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isSVGElement()); - return static_cast<const SVGElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGElement, isSVGElement()); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGElement.idl index 26d6c95dda1..d27e2abb355 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGElement.idl @@ -21,7 +21,7 @@ */ [ - CustomToV8 + Custom=Wrap, ] interface SVGElement : Element { [TreatNullAs=NullString] attribute DOMString xmlbase; readonly attribute SVGSVGElement ownerSVGElement; @@ -36,3 +36,4 @@ CSSValue getPresentationAttribute([Default=Undefined] optional DOMString name); }; +SVGElement implements GlobalEventHandlers; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGElementInstance.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGElementInstance.cpp index e93740c100e..3e835c184e4 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGElementInstance.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGElementInstance.cpp @@ -24,9 +24,9 @@ #include "core/svg/SVGElementInstance.h" #include "core/dom/ContainerNodeAlgorithms.h" -#include "core/dom/Event.h" -#include "core/dom/EventListener.h" -#include "core/dom/EventNames.h" +#include "core/events/Event.h" +#include "core/events/EventListener.h" +#include "core/events/ThreadLocalEventNames.h" #include "core/svg/SVGElement.h" #include "core/svg/SVGElementInstanceList.h" #include "core/svg/SVGUseElement.h" @@ -125,7 +125,7 @@ SVGElementInstance::~SVGElementInstance() // delete an SVGElementInstance at each deref call site. void SVGElementInstance::removedLastRef() { -#ifndef NDEBUG +#if SECURITY_ASSERT_ENABLED m_deletionHasBegun = true; #endif delete this; @@ -149,7 +149,7 @@ void SVGElementInstance::detach() m_directUseElement = 0; m_correspondingUseElement = 0; - removeDetachedChildrenInContainer<SVGElementInstance, SVGElementInstance>(this); + removeDetachedChildrenInContainer<SVGElementInstance, SVGElementInstance>(*this); } PassRefPtr<SVGElementInstanceList> SVGElementInstance::childNodes() @@ -165,7 +165,7 @@ void SVGElementInstance::setShadowTreeElement(SVGElement* element) void SVGElementInstance::appendChild(PassRefPtr<SVGElementInstance> child) { - appendChildToContainer<SVGElementInstance, SVGElementInstance>(child.get(), this); + appendChildToContainer<SVGElementInstance, SVGElementInstance>(*child, *this); } void SVGElementInstance::invalidateAllInstancesOfElement(SVGElement* element) @@ -200,10 +200,10 @@ void SVGElementInstance::invalidateAllInstancesOfElement(SVGElement* element) const AtomicString& SVGElementInstance::interfaceName() const { - return eventNames().interfaceForSVGElementInstance; + return EventTargetNames::SVGElementInstance; } -ScriptExecutionContext* SVGElementInstance::scriptExecutionContext() const +ExecutionContext* SVGElementInstance::executionContext() const { return &m_element->document(); } @@ -248,12 +248,12 @@ EventTargetData* SVGElementInstance::eventTargetData() return 0; } -EventTargetData* SVGElementInstance::ensureEventTargetData() +EventTargetData& SVGElementInstance::ensureEventTargetData() { // EventTarget would use these methods if we were actually using its add/removeEventListener logic. // As we're forwarding those calls to the correspondingElement(), no one should ever call this function. ASSERT_NOT_REACHED(); - return 0; + return *eventTargetData(); } SVGElementInstance::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetElement) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGElementInstance.h b/chromium/third_party/WebKit/Source/core/svg/SVGElementInstance.h index ba364f37255..66de33c7d75 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGElementInstance.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGElementInstance.h @@ -22,14 +22,14 @@ #define SVGElementInstance_h #include "bindings/v8/ScriptWrappable.h" -#include "core/dom/EventTarget.h" -#include "core/platform/TreeShared.h" +#include "core/dom/TreeShared.h" +#include "core/events/EventTarget.h" namespace WebCore { namespace Private { template<class GenericNode, class GenericNodeContainer> -void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container); +void addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer&); }; class Document; @@ -39,6 +39,7 @@ class SVGUseElement; // SVGElementInstance mimics Node, but without providing all its functionality class SVGElementInstance : public EventTarget, public ScriptWrappable, public TreeShared<SVGElementInstance> { + DEFINE_EVENT_TARGET_REFCOUNTING(TreeShared<SVGElementInstance>); public: static PassRefPtr<SVGElementInstance> create(SVGUseElement* correspondingUseElement, SVGUseElement* directUseElement, PassRefPtr<SVGElement> originalElement); @@ -47,7 +48,7 @@ public: void setParentOrShadowHostNode(SVGElementInstance* instance) { m_parentInstance = instance; } virtual const AtomicString& interfaceName() const; - virtual ScriptExecutionContext* scriptExecutionContext() const; + virtual ExecutionContext* executionContext() const; virtual bool addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture); virtual bool removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture); @@ -95,9 +96,6 @@ public: static void invalidateAllInstancesOfElement(SVGElement*); - using TreeShared<SVGElementInstance>::ref; - using TreeShared<SVGElementInstance>::deref; - // EventTarget API DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), abort); DECLARE_FORWARDING_ATTRIBUTE_EVENT_LISTENER(correspondingElement(), blur); @@ -158,13 +156,13 @@ private: void setShadowTreeElement(SVGElement*); template<class GenericNode, class GenericNodeContainer> - friend void appendChildToContainer(GenericNode* child, GenericNodeContainer* container); + friend void appendChildToContainer(GenericNode& child, GenericNodeContainer&); template<class GenericNode, class GenericNodeContainer> - friend void removeDetachedChildrenInContainer(GenericNodeContainer*); + friend void removeDetachedChildrenInContainer(GenericNodeContainer&); template<class GenericNode, class GenericNodeContainer> - friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer* container); + friend void Private::addChildNodesToDeletionQueue(GenericNode*& head, GenericNode*& tail, GenericNodeContainer&); bool hasChildNodes() const { return m_firstChild; } @@ -174,10 +172,8 @@ private: void setNextSibling(SVGElementInstance* sibling) { m_nextSibling = sibling; } void setPreviousSibling(SVGElementInstance* sibling) { m_previousSibling = sibling; } - virtual void refEventTarget() { ref(); } - virtual void derefEventTarget() { deref(); } - virtual EventTargetData* eventTargetData(); - virtual EventTargetData* ensureEventTargetData(); + virtual EventTargetData* eventTargetData() OVERRIDE; + virtual EventTargetData& ensureEventTargetData() OVERRIDE; SVGElementInstance* m_parentInstance; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGElementInstanceList.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGElementInstanceList.cpp index c9f112d905b..0e3d89518b8 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGElementInstanceList.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGElementInstanceList.cpp @@ -30,10 +30,6 @@ SVGElementInstanceList::SVGElementInstanceList(PassRefPtr<SVGElementInstance> ro ScriptWrappable::init(this); } -SVGElementInstanceList::~SVGElementInstanceList() -{ -} - unsigned SVGElementInstanceList::length() const { // NOTE: We could use the same caching facilities, like the ones "ChildNodeList" uses. diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGElementInstanceList.h b/chromium/third_party/WebKit/Source/core/svg/SVGElementInstanceList.h index 5cc7bf3ca12..2ac15927df0 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGElementInstanceList.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGElementInstanceList.h @@ -28,10 +28,9 @@ namespace WebCore { class SVGElementInstance; -class SVGElementInstanceList : public RefCounted<SVGElementInstanceList>, public ScriptWrappable { +class SVGElementInstanceList FINAL : public RefCounted<SVGElementInstanceList>, public ScriptWrappable { public: static PassRefPtr<SVGElementInstanceList> create(PassRefPtr<SVGElementInstance> root) { return adoptRef(new SVGElementInstanceList(root)); } - virtual ~SVGElementInstanceList(); unsigned length() const; SVGElementInstance* item(unsigned index); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGElementRareData.h b/chromium/third_party/WebKit/Source/core/svg/SVGElementRareData.h index 6f3b38da8d1..91a69d938c5 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGElementRareData.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGElementRareData.h @@ -94,7 +94,7 @@ public: return 0; if (!m_overrideComputedStyle || m_needsOverrideComputedStyleUpdate) { // The style computed here contains no CSS Animations/Transitions or SMIL induced rules - this is needed to compute the "base value" for the SMIL animation sandwhich model. - m_overrideComputedStyle = element->document().styleResolver()->styleForElement(element, parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL); + m_overrideComputedStyle = element->document().ensureStyleResolver().styleForElement(element, parentStyle, DisallowStyleSharing, MatchAllRulesExcludingSMIL); m_needsOverrideComputedStyleUpdate = false; } ASSERT(m_overrideComputedStyle); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp index 8002b06dd94..b0e4aeda679 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.cpp @@ -22,7 +22,6 @@ #include "core/svg/SVGEllipseElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGEllipse.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/svg/SVGElementInstance.h" @@ -46,28 +45,26 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGEllipseElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGEllipseElement::SVGEllipseElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGEllipseElement::SVGEllipseElement(Document& document) + : SVGGeometryElement(SVGNames::ellipseTag, document) , m_cx(LengthModeWidth) , m_cy(LengthModeHeight) , m_rx(LengthModeWidth) , m_ry(LengthModeHeight) { - ASSERT(hasTagName(SVGNames::ellipseTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGEllipseElement(); } -PassRefPtr<SVGEllipseElement> SVGEllipseElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGEllipseElement> SVGEllipseElement::create(Document& document) { - return adoptRef(new SVGEllipseElement(tagName, document)); + return adoptRef(new SVGEllipseElement(document)); } bool SVGEllipseElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); if (supportedAttributes.isEmpty()) { - SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); supportedAttributes.add(SVGNames::cxAttr); supportedAttributes.add(SVGNames::cyAttr); @@ -82,7 +79,7 @@ void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt SVGParsingError parseError = NoError; if (!isSupportedAttribute(name)) - SVGGraphicsElement::parseAttribute(name, value); + SVGGeometryElement::parseAttribute(name, value); else if (name == SVGNames::cxAttr) setCxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); else if (name == SVGNames::cyAttr) @@ -91,8 +88,7 @@ void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt setRxBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); else if (name == SVGNames::ryAttr) setRyBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); - else if (SVGLangSpace::parseAttribute(name, value) - || SVGExternalResourcesRequired::parseAttribute(name, value)) { + else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { } else ASSERT_NOT_REACHED(); @@ -102,7 +98,7 @@ void SVGEllipseElement::parseAttribute(const QualifiedName& name, const AtomicSt void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { - SVGGraphicsElement::svgAttributeChanged(attrName); + SVGGeometryElement::svgAttributeChanged(attrName); return; } @@ -126,7 +122,7 @@ void SVGEllipseElement::svgAttributeChanged(const QualifiedName& attrName) return; } - if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { + if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); return; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.h index dcfc5ecb76d..e0cc981a96c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.h @@ -25,17 +25,17 @@ #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedLength.h" #include "core/svg/SVGExternalResourcesRequired.h" -#include "core/svg/SVGGraphicsElement.h" +#include "core/svg/SVGGeometryElement.h" namespace WebCore { -class SVGEllipseElement FINAL : public SVGGraphicsElement, +class SVGEllipseElement FINAL : public SVGGeometryElement, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGEllipseElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGEllipseElement> create(Document&); private: - SVGEllipseElement(const QualifiedName&, Document&); + explicit SVGEllipseElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } @@ -57,11 +57,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGEllipseElement* toSVGEllipseElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::ellipseTag)); - return static_cast<SVGEllipseElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGEllipseElement, hasTagName(SVGNames::ellipseTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.idl index a9ea183d55b..fcd09c7967f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGEllipseElement.idl @@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGEllipseElement : SVGGraphicsElement { +interface SVGEllipseElement : SVGGeometryElement { readonly attribute SVGAnimatedLength cx; readonly attribute SVGAnimatedLength cy; readonly attribute SVGAnimatedLength rx; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGExternalResourcesRequired.h b/chromium/third_party/WebKit/Source/core/svg/SVGExternalResourcesRequired.h index c8781c33726..04b94fdd05f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGExternalResourcesRequired.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGExternalResourcesRequired.h @@ -45,7 +45,7 @@ public: protected: // These types look a bit awkward, but have to match the generic types of the SVGAnimatedProperty macros. - virtual void setExternalResourcesRequiredBaseValue(const bool&, const bool validValue = true) = 0; + virtual void setExternalResourcesRequiredBaseValue(const bool&) = 0; virtual bool& externalResourcesRequiredBaseValue() const = 0; virtual void setHaveFiredLoadEvent(bool) { } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEBlendElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEBlendElement.cpp index 1719515e0f3..832b4e40e65 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEBlendElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEBlendElement.cpp @@ -23,7 +23,7 @@ #include "core/svg/SVGFEBlendElement.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" @@ -41,18 +41,17 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEBlendElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEBlendElement::SVGFEBlendElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEBlendElement::SVGFEBlendElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feBlendTag, document) , m_mode(FEBLEND_MODE_NORMAL) { - ASSERT(hasTagName(SVGNames::feBlendTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEBlendElement(); } -PassRefPtr<SVGFEBlendElement> SVGFEBlendElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEBlendElement> SVGFEBlendElement::create(Document& document) { - return adoptRef(new SVGFEBlendElement(tagName, document)); + return adoptRef(new SVGFEBlendElement(document)); } bool SVGFEBlendElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEBlendElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEBlendElement.h index af78dd96682..20e211dfd0f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEBlendElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEBlendElement.h @@ -21,9 +21,9 @@ #ifndef SVGFEBlendElement_h #define SVGFEBlendElement_h -#include "core/platform/graphics/filters/FEBlend.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEBlend.h" namespace WebCore { @@ -70,10 +70,10 @@ struct SVGPropertyTraits<BlendModeType> { class SVGFEBlendElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEBlendElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEBlendElement> create(Document&); private: - SVGFEBlendElement(const QualifiedName&, Document&); + explicit SVGFEBlendElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEColorMatrixElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEColorMatrixElement.cpp index 1ecb088e6c4..a6fc8e4079c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEColorMatrixElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEColorMatrixElement.cpp @@ -23,7 +23,7 @@ #include "core/svg/SVGFEColorMatrixElement.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" @@ -41,18 +41,17 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEColorMatrixElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEColorMatrixElement::SVGFEColorMatrixElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEColorMatrixElement::SVGFEColorMatrixElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feColorMatrixTag, document) , m_type(FECOLORMATRIX_TYPE_MATRIX) { - ASSERT(hasTagName(SVGNames::feColorMatrixTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEColorMatrixElement(); } -PassRefPtr<SVGFEColorMatrixElement> SVGFEColorMatrixElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEColorMatrixElement> SVGFEColorMatrixElement::create(Document& document) { - return adoptRef(new SVGFEColorMatrixElement(tagName, document)); + return adoptRef(new SVGFEColorMatrixElement(document)); } bool SVGFEColorMatrixElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEColorMatrixElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEColorMatrixElement.h index acd3616f415..1ed615f2f24 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEColorMatrixElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEColorMatrixElement.h @@ -21,10 +21,10 @@ #ifndef SVGFEColorMatrixElement_h #define SVGFEColorMatrixElement_h -#include "core/platform/graphics/filters/FEColorMatrix.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGAnimatedNumberList.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEColorMatrix.h" namespace WebCore { @@ -67,10 +67,10 @@ struct SVGPropertyTraits<ColorMatrixType> { class SVGFEColorMatrixElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEColorMatrixElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEColorMatrixElement> create(Document&); private: - SVGFEColorMatrixElement(const QualifiedName&, Document&); + explicit SVGFEColorMatrixElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEComponentTransferElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEComponentTransferElement.cpp index 7b774987736..127dac25411 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEComponentTransferElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEComponentTransferElement.cpp @@ -23,7 +23,7 @@ #include "core/svg/SVGFEComponentTransferElement.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGFEFuncAElement.h" #include "core/svg/SVGFEFuncBElement.h" #include "core/svg/SVGFEFuncGElement.h" @@ -40,17 +40,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEComponentTransferElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEComponentTransferElement::SVGFEComponentTransferElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEComponentTransferElement::SVGFEComponentTransferElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feComponentTransferTag, document) { - ASSERT(hasTagName(SVGNames::feComponentTransferTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEComponentTransferElement(); } -PassRefPtr<SVGFEComponentTransferElement> SVGFEComponentTransferElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEComponentTransferElement> SVGFEComponentTransferElement::create(Document& document) { - return adoptRef(new SVGFEComponentTransferElement(tagName, document)); + return adoptRef(new SVGFEComponentTransferElement(document)); } bool SVGFEComponentTransferElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEComponentTransferElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEComponentTransferElement.h index f9d212bcc5c..c83f1fedbdb 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEComponentTransferElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEComponentTransferElement.h @@ -21,17 +21,17 @@ #ifndef SVGFEComponentTransferElement_h #define SVGFEComponentTransferElement_h -#include "core/platform/graphics/filters/FEComponentTransfer.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEComponentTransfer.h" namespace WebCore { class SVGFEComponentTransferElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEComponentTransferElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEComponentTransferElement> create(Document&); private: - SVGFEComponentTransferElement(const QualifiedName&, Document&); + explicit SVGFEComponentTransferElement(Document&); // FIXME: svgAttributeChanged missing. bool isSupportedAttribute(const QualifiedName&); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFECompositeElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFECompositeElement.cpp index 343ca1025f4..d9afc49656f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFECompositeElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFECompositeElement.cpp @@ -23,7 +23,7 @@ #include "core/svg/SVGFECompositeElement.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" @@ -49,18 +49,17 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFECompositeElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFECompositeElement::SVGFECompositeElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFECompositeElement::SVGFECompositeElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feCompositeTag, document) , m_svgOperator(FECOMPOSITE_OPERATOR_OVER) { - ASSERT(hasTagName(SVGNames::feCompositeTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFECompositeElement(); } -PassRefPtr<SVGFECompositeElement> SVGFECompositeElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFECompositeElement> SVGFECompositeElement::create(Document& document) { - return adoptRef(new SVGFECompositeElement(tagName, document)); + return adoptRef(new SVGFECompositeElement(document)); } bool SVGFECompositeElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFECompositeElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFECompositeElement.h index 7b7b9439c16..dad0fb2e1a9 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFECompositeElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFECompositeElement.h @@ -21,10 +21,10 @@ #ifndef SVGFECompositeElement_h #define SVGFECompositeElement_h -#include "core/platform/graphics/filters/FEComposite.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEComposite.h" namespace WebCore { @@ -75,10 +75,10 @@ struct SVGPropertyTraits<CompositeOperationType> { class SVGFECompositeElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFECompositeElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFECompositeElement> create(Document&); private: - SVGFECompositeElement(const QualifiedName&, Document&); + explicit SVGFECompositeElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEConvolveMatrixElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEConvolveMatrixElement.cpp index 9453bf73c32..2fad4d9fbad 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEConvolveMatrixElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEConvolveMatrixElement.cpp @@ -22,13 +22,13 @@ #include "core/svg/SVGFEConvolveMatrixElement.h" #include "SVGNames.h" -#include "core/platform/graphics/FloatPoint.h" -#include "core/platform/graphics/IntPoint.h" -#include "core/platform/graphics/IntSize.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/SVGParserUtilities.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" +#include "platform/geometry/FloatPoint.h" +#include "platform/geometry/IntPoint.h" +#include "platform/geometry/IntSize.h" namespace WebCore { @@ -62,18 +62,17 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEConvolveMatrixElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEConvolveMatrixElement::SVGFEConvolveMatrixElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feConvolveMatrixTag, document) , m_edgeMode(EDGEMODE_DUPLICATE) { - ASSERT(hasTagName(SVGNames::feConvolveMatrixTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEConvolveMatrixElement(); } -PassRefPtr<SVGFEConvolveMatrixElement> SVGFEConvolveMatrixElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEConvolveMatrixElement> SVGFEConvolveMatrixElement::create(Document& document) { - return adoptRef(new SVGFEConvolveMatrixElement(tagName, document)); + return adoptRef(new SVGFEConvolveMatrixElement(document)); } const AtomicString& SVGFEConvolveMatrixElement::kernelUnitLengthXIdentifier() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEConvolveMatrixElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEConvolveMatrixElement.h index f1faec5c6a7..4bc21ab5fc4 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEConvolveMatrixElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEConvolveMatrixElement.h @@ -20,13 +20,13 @@ #ifndef SVGFEConvolveMatrixElement_h #define SVGFEConvolveMatrixElement_h -#include "core/platform/graphics/filters/FEConvolveMatrix.h" #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGAnimatedInteger.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGAnimatedNumberList.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEConvolveMatrix.h" namespace WebCore { @@ -65,13 +65,13 @@ struct SVGPropertyTraits<EdgeModeType> { class SVGFEConvolveMatrixElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEConvolveMatrixElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEConvolveMatrixElement> create(Document&); void setOrder(float orderX, float orderY); void setKernelUnitLength(float kernelUnitLengthX, float kernelUnitLengthY); private: - SVGFEConvolveMatrixElement(const QualifiedName&, Document&); + explicit SVGFEConvolveMatrixElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEDiffuseLightingElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEDiffuseLightingElement.cpp index 7f146450aa3..9d18e3ccc74 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEDiffuseLightingElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEDiffuseLightingElement.cpp @@ -21,14 +21,12 @@ #include "core/svg/SVGFEDiffuseLightingElement.h" -#include "SVGNames.h" -#include "core/platform/graphics/filters/FEDiffuseLighting.h" -#include "core/platform/graphics/filters/FilterEffect.h" #include "core/rendering/style/RenderStyle.h" #include "core/svg/SVGElementInstance.h" -#include "core/svg/SVGFELightElement.h" #include "core/svg/SVGParserUtilities.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" +#include "platform/graphics/filters/FEDiffuseLighting.h" +#include "platform/graphics/filters/FilterEffect.h" namespace WebCore { @@ -48,19 +46,18 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDiffuseLightingElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEDiffuseLightingElement::SVGFEDiffuseLightingElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feDiffuseLightingTag, document) , m_diffuseConstant(1) , m_surfaceScale(1) { - ASSERT(hasTagName(SVGNames::feDiffuseLightingTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEDiffuseLightingElement(); } -PassRefPtr<SVGFEDiffuseLightingElement> SVGFEDiffuseLightingElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEDiffuseLightingElement> SVGFEDiffuseLightingElement::create(Document& document) { - return adoptRef(new SVGFEDiffuseLightingElement(tagName, document)); + return adoptRef(new SVGFEDiffuseLightingElement(document)); } const AtomicString& SVGFEDiffuseLightingElement::kernelUnitLengthXIdentifier() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEDiffuseLightingElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEDiffuseLightingElement.h index efd8e3fedbe..c3cbbc4b035 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEDiffuseLightingElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEDiffuseLightingElement.h @@ -33,11 +33,11 @@ class SVGColor; class SVGFEDiffuseLightingElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEDiffuseLightingElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEDiffuseLightingElement> create(Document&); void lightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&); private: - SVGFEDiffuseLightingElement(const QualifiedName&, Document&); + explicit SVGFEDiffuseLightingElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -57,11 +57,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGFEDiffuseLightingElement* toSVGFEDiffuseLightingElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feDiffuseLightingTag)); - return static_cast<SVGFEDiffuseLightingElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFEDiffuseLightingElement, hasTagName(SVGNames::feDiffuseLightingTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEDisplacementMapElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEDisplacementMapElement.cpp index 61fc8a90b01..6aff75bdbfd 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEDisplacementMapElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEDisplacementMapElement.cpp @@ -22,7 +22,7 @@ #include "core/svg/SVGFEDisplacementMapElement.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" @@ -44,19 +44,18 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDisplacementMapElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEDisplacementMapElement::SVGFEDisplacementMapElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feDisplacementMapTag, document) , m_xChannelSelector(CHANNEL_A) , m_yChannelSelector(CHANNEL_A) { - ASSERT(hasTagName(SVGNames::feDisplacementMapTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEDisplacementMapElement(); } -PassRefPtr<SVGFEDisplacementMapElement> SVGFEDisplacementMapElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEDisplacementMapElement> SVGFEDisplacementMapElement::create(Document& document) { - return adoptRef(new SVGFEDisplacementMapElement(tagName, document)); + return adoptRef(new SVGFEDisplacementMapElement(document)); } bool SVGFEDisplacementMapElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEDisplacementMapElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEDisplacementMapElement.h index 0aa95c18b22..cb0c70733ce 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEDisplacementMapElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEDisplacementMapElement.h @@ -20,10 +20,10 @@ #ifndef SVGFEDisplacementMapElement_h #define SVGFEDisplacementMapElement_h -#include "core/platform/graphics/filters/FEDisplacementMap.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEDisplacementMap.h" namespace WebCore { @@ -66,12 +66,12 @@ struct SVGPropertyTraits<ChannelSelectorType> { class SVGFEDisplacementMapElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEDisplacementMapElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEDisplacementMapElement> create(Document&); static ChannelSelectorType stringToChannel(const String&); private: - SVGFEDisplacementMapElement(const QualifiedName& tagName, Document&); + SVGFEDisplacementMapElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEDistantLightElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEDistantLightElement.cpp index d4535636404..f641868e74d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEDistantLightElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEDistantLightElement.cpp @@ -18,24 +18,22 @@ */ #include "config.h" - -#include "SVGNames.h" #include "core/svg/SVGFEDistantLightElement.h" -#include "core/platform/graphics/filters/DistantLightSource.h" +#include "SVGNames.h" +#include "platform/graphics/filters/DistantLightSource.h" namespace WebCore { -inline SVGFEDistantLightElement::SVGFEDistantLightElement(const QualifiedName& tagName, Document& document) - : SVGFELightElement(tagName, document) +inline SVGFEDistantLightElement::SVGFEDistantLightElement(Document& document) + : SVGFELightElement(SVGNames::feDistantLightTag, document) { - ASSERT(hasTagName(SVGNames::feDistantLightTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFEDistantLightElement> SVGFEDistantLightElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEDistantLightElement> SVGFEDistantLightElement::create(Document& document) { - return adoptRef(new SVGFEDistantLightElement(tagName, document)); + return adoptRef(new SVGFEDistantLightElement(document)); } PassRefPtr<LightSource> SVGFEDistantLightElement::lightSource() const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEDistantLightElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEDistantLightElement.h index df1b9c2a2db..8a50cc8414d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEDistantLightElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEDistantLightElement.h @@ -26,10 +26,10 @@ namespace WebCore { class SVGFEDistantLightElement FINAL : public SVGFELightElement { public: - static PassRefPtr<SVGFEDistantLightElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEDistantLightElement> create(Document&); private: - SVGFEDistantLightElement(const QualifiedName&, Document&); + explicit SVGFEDistantLightElement(Document&); virtual PassRefPtr<LightSource> lightSource() const; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEDropShadowElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEDropShadowElement.cpp index d5a5d296f08..366eaf3512c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEDropShadowElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEDropShadowElement.cpp @@ -46,21 +46,20 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEDropShadowElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEDropShadowElement::SVGFEDropShadowElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEDropShadowElement::SVGFEDropShadowElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feDropShadowTag, document) , m_dx(2) , m_dy(2) , m_stdDeviationX(2) , m_stdDeviationY(2) { - ASSERT(hasTagName(SVGNames::feDropShadowTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEDropShadowElement(); } -PassRefPtr<SVGFEDropShadowElement> SVGFEDropShadowElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEDropShadowElement> SVGFEDropShadowElement::create(Document& document) { - return adoptRef(new SVGFEDropShadowElement(tagName, document)); + return adoptRef(new SVGFEDropShadowElement(document)); } const AtomicString& SVGFEDropShadowElement::stdDeviationXIdentifier() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEDropShadowElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEDropShadowElement.h index 352f60217bb..2b48d763b7d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEDropShadowElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEDropShadowElement.h @@ -20,20 +20,20 @@ #ifndef SVGFEDropShadowElement_h #define SVGFEDropShadowElement_h -#include "core/platform/graphics/filters/FEDropShadow.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEDropShadow.h" namespace WebCore { class SVGFEDropShadowElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEDropShadowElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEDropShadowElement> create(Document&); void setStdDeviation(float stdDeviationX, float stdDeviationY); private: - SVGFEDropShadowElement(const QualifiedName&, Document&); + explicit SVGFEDropShadowElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEFloodElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEFloodElement.cpp index 33d3aa37050..baee77b7311 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEFloodElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEFloodElement.cpp @@ -28,16 +28,15 @@ namespace WebCore { -inline SVGFEFloodElement::SVGFEFloodElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEFloodElement::SVGFEFloodElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feFloodTag, document) { - ASSERT(hasTagName(SVGNames::feFloodTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFEFloodElement> SVGFEFloodElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEFloodElement> SVGFEFloodElement::create(Document& document) { - return adoptRef(new SVGFEFloodElement(tagName, document)); + return adoptRef(new SVGFEFloodElement(document)); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEFloodElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEFloodElement.h index 378533eaf2d..4fa91b67834 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEFloodElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEFloodElement.h @@ -21,17 +21,17 @@ #ifndef SVGFEFloodElement_h #define SVGFEFloodElement_h -#include "core/platform/graphics/filters/FEFlood.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEFlood.h" namespace WebCore { class SVGFEFloodElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEFloodElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEFloodElement> create(Document&); private: - SVGFEFloodElement(const QualifiedName&, Document&); + explicit SVGFEFloodElement(Document&); virtual bool setFilterEffectAttribute(FilterEffect*, const QualifiedName& attrName); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncAElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncAElement.cpp index 4d35ab7c947..757a4edf389 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncAElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncAElement.cpp @@ -20,21 +20,19 @@ #include "config.h" -#include "SVGNames.h" #include "core/svg/SVGFEFuncAElement.h" namespace WebCore { -inline SVGFEFuncAElement::SVGFEFuncAElement(const QualifiedName& tagName, Document& document) - : SVGComponentTransferFunctionElement(tagName, document) +inline SVGFEFuncAElement::SVGFEFuncAElement(Document& document) + : SVGComponentTransferFunctionElement(SVGNames::feFuncATag, document) { - ASSERT(hasTagName(SVGNames::feFuncATag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFEFuncAElement> SVGFEFuncAElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEFuncAElement> SVGFEFuncAElement::create(Document& document) { - return adoptRef(new SVGFEFuncAElement(tagName, document)); + return adoptRef(new SVGFEFuncAElement(document)); } } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncAElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncAElement.h index 7f6cfdc6e61..01a473aad7a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncAElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncAElement.h @@ -28,17 +28,13 @@ namespace WebCore { class SVGFEFuncAElement FINAL : public SVGComponentTransferFunctionElement { public: - static PassRefPtr<SVGFEFuncAElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEFuncAElement> create(Document&); private: - SVGFEFuncAElement(const QualifiedName&, Document&); + explicit SVGFEFuncAElement(Document&); }; -inline SVGFEFuncAElement* toSVGFEFuncAElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feFuncATag)); - return static_cast<SVGFEFuncAElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFEFuncAElement, hasTagName(SVGNames::feFuncATag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncBElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncBElement.cpp index abca696dbf2..08bc49c289c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncBElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncBElement.cpp @@ -20,21 +20,19 @@ #include "config.h" -#include "SVGNames.h" #include "core/svg/SVGFEFuncBElement.h" namespace WebCore { -inline SVGFEFuncBElement::SVGFEFuncBElement(const QualifiedName& tagName, Document& document) - : SVGComponentTransferFunctionElement(tagName, document) +inline SVGFEFuncBElement::SVGFEFuncBElement(Document& document) + : SVGComponentTransferFunctionElement(SVGNames::feFuncBTag, document) { - ASSERT(hasTagName(SVGNames::feFuncBTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFEFuncBElement> SVGFEFuncBElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEFuncBElement> SVGFEFuncBElement::create(Document& document) { - return adoptRef(new SVGFEFuncBElement(tagName, document)); + return adoptRef(new SVGFEFuncBElement(document)); } } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncBElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncBElement.h index 6bf582e5912..24560e3c4f5 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncBElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncBElement.h @@ -28,17 +28,13 @@ namespace WebCore { class SVGFEFuncBElement FINAL : public SVGComponentTransferFunctionElement { public: - static PassRefPtr<SVGFEFuncBElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEFuncBElement> create(Document&); private: - SVGFEFuncBElement(const QualifiedName&, Document&); + explicit SVGFEFuncBElement(Document&); }; -inline SVGFEFuncBElement* toSVGFEFuncBElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feFuncBTag)); - return static_cast<SVGFEFuncBElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFEFuncBElement, hasTagName(SVGNames::feFuncBTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncGElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncGElement.cpp index f7de1f35cba..4e27390412b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncGElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncGElement.cpp @@ -20,21 +20,19 @@ #include "config.h" -#include "SVGNames.h" #include "core/svg/SVGFEFuncGElement.h" namespace WebCore { -inline SVGFEFuncGElement::SVGFEFuncGElement(const QualifiedName& tagName, Document& document) - : SVGComponentTransferFunctionElement(tagName, document) +inline SVGFEFuncGElement::SVGFEFuncGElement(Document& document) + : SVGComponentTransferFunctionElement(SVGNames::feFuncGTag, document) { - ASSERT(hasTagName(SVGNames::feFuncGTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFEFuncGElement> SVGFEFuncGElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEFuncGElement> SVGFEFuncGElement::create(Document& document) { - return adoptRef(new SVGFEFuncGElement(tagName, document)); + return adoptRef(new SVGFEFuncGElement(document)); } } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncGElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncGElement.h index 5b29bdc0ccf..3d6ccb827d0 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncGElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncGElement.h @@ -28,17 +28,13 @@ namespace WebCore { class SVGFEFuncGElement FINAL : public SVGComponentTransferFunctionElement { public: - static PassRefPtr<SVGFEFuncGElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEFuncGElement> create(Document&); private: - SVGFEFuncGElement(const QualifiedName&, Document&); + explicit SVGFEFuncGElement(Document&); }; -inline SVGFEFuncGElement* toSVGFEFuncGElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feFuncGTag)); - return static_cast<SVGFEFuncGElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFEFuncGElement, hasTagName(SVGNames::feFuncGTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncRElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncRElement.cpp index cf059b68fef..786d4f8327a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncRElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncRElement.cpp @@ -20,21 +20,19 @@ #include "config.h" -#include "SVGNames.h" #include "core/svg/SVGFEFuncRElement.h" namespace WebCore { -inline SVGFEFuncRElement::SVGFEFuncRElement(const QualifiedName& tagName, Document& document) - : SVGComponentTransferFunctionElement(tagName, document) +inline SVGFEFuncRElement::SVGFEFuncRElement(Document& document) + : SVGComponentTransferFunctionElement(SVGNames::feFuncRTag, document) { - ASSERT(hasTagName(SVGNames::feFuncRTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFEFuncRElement> SVGFEFuncRElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEFuncRElement> SVGFEFuncRElement::create(Document& document) { - return adoptRef(new SVGFEFuncRElement(tagName, document)); + return adoptRef(new SVGFEFuncRElement(document)); } } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncRElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncRElement.h index 4822a0b20bc..49bff723664 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncRElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEFuncRElement.h @@ -28,17 +28,13 @@ namespace WebCore { class SVGFEFuncRElement FINAL : public SVGComponentTransferFunctionElement { public: - static PassRefPtr<SVGFEFuncRElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEFuncRElement> create(Document&); private: - SVGFEFuncRElement(const QualifiedName&, Document&); + explicit SVGFEFuncRElement(Document&); }; -inline SVGFEFuncRElement* toSVGFEFuncRElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feFuncRTag)); - return static_cast<SVGFEFuncRElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFEFuncRElement, hasTagName(SVGNames::feFuncRTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEGaussianBlurElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEGaussianBlurElement.cpp index 3611e960183..75cadffb04f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEGaussianBlurElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEGaussianBlurElement.cpp @@ -23,7 +23,7 @@ #include "core/svg/SVGFEGaussianBlurElement.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/SVGParserUtilities.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" @@ -42,17 +42,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEGaussianBlurElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEGaussianBlurElement::SVGFEGaussianBlurElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feGaussianBlurTag, document) { - ASSERT(hasTagName(SVGNames::feGaussianBlurTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEGaussianBlurElement(); } -PassRefPtr<SVGFEGaussianBlurElement> SVGFEGaussianBlurElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEGaussianBlurElement> SVGFEGaussianBlurElement::create(Document& document) { - return adoptRef(new SVGFEGaussianBlurElement(tagName, document)); + return adoptRef(new SVGFEGaussianBlurElement(document)); } const AtomicString& SVGFEGaussianBlurElement::stdDeviationXIdentifier() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEGaussianBlurElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEGaussianBlurElement.h index 317addc7f65..16b456b1692 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEGaussianBlurElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEGaussianBlurElement.h @@ -21,20 +21,20 @@ #ifndef SVGFEGaussianBlurElement_h #define SVGFEGaussianBlurElement_h -#include "core/platform/graphics/filters/FEGaussianBlur.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEGaussianBlur.h" namespace WebCore { class SVGFEGaussianBlurElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEGaussianBlurElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEGaussianBlurElement> create(Document&); void setStdDeviation(float stdDeviationX, float stdDeviationY); private: - SVGFEGaussianBlurElement(const QualifiedName&, Document&); + explicit SVGFEGaussianBlurElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp index e164c6595f9..b886a5097f1 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.cpp @@ -23,16 +23,14 @@ #include "core/svg/SVGFEImageElement.h" -#include "SVGNames.h" #include "XLinkNames.h" #include "core/dom/Document.h" #include "core/fetch/FetchRequest.h" -#include "core/fetch/ImageResource.h" #include "core/fetch/ResourceFetcher.h" -#include "core/platform/graphics/Image.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/SVGPreserveAspectRatio.h" +#include "platform/graphics/Image.h" namespace WebCore { @@ -48,17 +46,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEImageElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEImageElement::SVGFEImageElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEImageElement::SVGFEImageElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feImageTag, document) { - ASSERT(hasTagName(SVGNames::feImageTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEImageElement(); } -PassRefPtr<SVGFEImageElement> SVGFEImageElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEImageElement> SVGFEImageElement::create(Document& document) { - return adoptRef(new SVGFEImageElement(tagName, document)); + return adoptRef(new SVGFEImageElement(document)); } SVGFEImageElement::~SVGFEImageElement() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.h index c769e557213..5e6bb048582 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEImageElement.h @@ -24,13 +24,13 @@ #include "SVGNames.h" #include "core/fetch/ImageResource.h" #include "core/fetch/ResourcePtr.h" -#include "core/platform/graphics/ImageBuffer.h" #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedPreserveAspectRatio.h" #include "core/svg/SVGExternalResourcesRequired.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" #include "core/svg/SVGURIReference.h" #include "core/svg/graphics/filters/SVGFEImage.h" +#include "platform/graphics/ImageBuffer.h" namespace WebCore { @@ -39,14 +39,14 @@ class SVGFEImageElement FINAL : public SVGFilterPrimitiveStandardAttributes, public SVGExternalResourcesRequired, public ImageResourceClient { public: - static PassRefPtr<SVGFEImageElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEImageElement> create(Document&); bool currentFrameHasSingleSecurityOrigin() const; virtual ~SVGFEImageElement(); private: - SVGFEImageElement(const QualifiedName&, Document&); + explicit SVGFEImageElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -72,11 +72,7 @@ private: ResourcePtr<ImageResource> m_cachedImage; }; -inline SVGFEImageElement* toSVGFEImageElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feImageTag)); - return static_cast<SVGFEImageElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFEImageElement, hasTagName(SVGNames::feImageTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFELightElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFELightElement.h index 4d14e30d77c..4473ed3e646 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFELightElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFELightElement.h @@ -22,9 +22,9 @@ #ifndef SVGFELightElement_h #define SVGFELightElement_h -#include "core/platform/graphics/filters/LightSource.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGElement.h" +#include "platform/graphics/filters/LightSource.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeElement.cpp index 401fc30a46c..e1cf2db9b89 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeElement.cpp @@ -23,22 +23,21 @@ #include "core/svg/SVGFEMergeElement.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGFEMergeNodeElement.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" namespace WebCore { -inline SVGFEMergeElement::SVGFEMergeElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEMergeElement::SVGFEMergeElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feMergeTag, document) { - ASSERT(hasTagName(SVGNames::feMergeTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFEMergeElement> SVGFEMergeElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEMergeElement> SVGFEMergeElement::create(Document& document) { - return adoptRef(new SVGFEMergeElement(tagName, document)); + return adoptRef(new SVGFEMergeElement(document)); } PassRefPtr<FilterEffect> SVGFEMergeElement::build(SVGFilterBuilder* filterBuilder, Filter* filter) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeElement.h index ab682bb5f5f..9fae4a98d8f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeElement.h @@ -21,17 +21,17 @@ #ifndef SVGFEMergeElement_h #define SVGFEMergeElement_h -#include "core/platform/graphics/filters/FEMerge.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEMerge.h" namespace WebCore { class SVGFEMergeElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEMergeElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEMergeElement> create(Document&); private: - SVGFEMergeElement(const QualifiedName&, Document&); + explicit SVGFEMergeElement(Document&); virtual PassRefPtr<FilterEffect> build(SVGFilterBuilder*, Filter*); }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeNodeElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeNodeElement.cpp index 648f22e81dd..30df5a14e5f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeNodeElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeNodeElement.cpp @@ -22,7 +22,6 @@ #include "core/svg/SVGFEMergeNodeElement.h" -#include "SVGNames.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" @@ -35,17 +34,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMergeNodeElement) REGISTER_LOCAL_ANIMATED_PROPERTY(in1) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEMergeNodeElement::SVGFEMergeNodeElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGFEMergeNodeElement::SVGFEMergeNodeElement(Document& document) + : SVGElement(SVGNames::feMergeNodeTag, document) { - ASSERT(hasTagName(SVGNames::feMergeNodeTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEMergeNodeElement(); } -PassRefPtr<SVGFEMergeNodeElement> SVGFEMergeNodeElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEMergeNodeElement> SVGFEMergeNodeElement::create(Document& document) { - return adoptRef(new SVGFEMergeNodeElement(tagName, document)); + return adoptRef(new SVGFEMergeNodeElement(document)); } bool SVGFEMergeNodeElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeNodeElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeNodeElement.h index 9bfe59aec6e..a0760887bc4 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeNodeElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEMergeNodeElement.h @@ -29,10 +29,10 @@ namespace WebCore { class SVGFEMergeNodeElement FINAL : public SVGElement { public: - static PassRefPtr<SVGFEMergeNodeElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEMergeNodeElement> create(Document&); private: - SVGFEMergeNodeElement(const QualifiedName&, Document&); + explicit SVGFEMergeNodeElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -45,11 +45,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGFEMergeNodeElement* toSVGFEMergeNodeElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feMergeNodeTag)); - return static_cast<SVGFEMergeNodeElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFEMergeNodeElement, hasTagName(SVGNames::feMergeNodeTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEMorphologyElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEMorphologyElement.cpp index 4502e22e521..4f5385824e7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEMorphologyElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEMorphologyElement.cpp @@ -22,7 +22,7 @@ #include "core/svg/SVGFEMorphologyElement.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/SVGParserUtilities.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" @@ -43,18 +43,17 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEMorphologyElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEMorphologyElement::SVGFEMorphologyElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEMorphologyElement::SVGFEMorphologyElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feMorphologyTag, document) , m_svgOperator(FEMORPHOLOGY_OPERATOR_ERODE) { - ASSERT(hasTagName(SVGNames::feMorphologyTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEMorphologyElement(); } -PassRefPtr<SVGFEMorphologyElement> SVGFEMorphologyElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEMorphologyElement> SVGFEMorphologyElement::create(Document& document) { - return adoptRef(new SVGFEMorphologyElement(tagName, document)); + return adoptRef(new SVGFEMorphologyElement(document)); } const AtomicString& SVGFEMorphologyElement::radiusXIdentifier() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEMorphologyElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEMorphologyElement.h index 38dede0489d..5462712fdd7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEMorphologyElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEMorphologyElement.h @@ -20,10 +20,10 @@ #ifndef SVGFEMorphologyElement_h #define SVGFEMorphologyElement_h -#include "core/platform/graphics/filters/FEMorphology.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEMorphology.h" namespace WebCore { @@ -58,12 +58,12 @@ struct SVGPropertyTraits<MorphologyOperatorType> { class SVGFEMorphologyElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEMorphologyElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEMorphologyElement> create(Document&); void setRadius(float radiusX, float radiusY); private: - SVGFEMorphologyElement(const QualifiedName&, Document&); + explicit SVGFEMorphologyElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEOffsetElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEOffsetElement.cpp index a110b837e55..7b29b59b8a4 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEOffsetElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEOffsetElement.cpp @@ -23,7 +23,7 @@ #include "core/svg/SVGFEOffsetElement.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" @@ -41,17 +41,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEOffsetElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFEOffsetElement::SVGFEOffsetElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFEOffsetElement::SVGFEOffsetElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feOffsetTag, document) { - ASSERT(hasTagName(SVGNames::feOffsetTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFEOffsetElement(); } -PassRefPtr<SVGFEOffsetElement> SVGFEOffsetElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEOffsetElement> SVGFEOffsetElement::create(Document& document) { - return adoptRef(new SVGFEOffsetElement(tagName, document)); + return adoptRef(new SVGFEOffsetElement(document)); } bool SVGFEOffsetElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEOffsetElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEOffsetElement.h index a0489a43811..74278647990 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEOffsetElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEOffsetElement.h @@ -21,18 +21,18 @@ #ifndef SVGFEOffsetElement_h #define SVGFEOffsetElement_h -#include "core/platform/graphics/filters/FEOffset.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FEOffset.h" namespace WebCore { class SVGFEOffsetElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFEOffsetElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEOffsetElement> create(Document&); private: - SVGFEOffsetElement(const QualifiedName&, Document&); + explicit SVGFEOffsetElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEPointLightElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFEPointLightElement.cpp index 0f971b1bf47..aba77a621b8 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEPointLightElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEPointLightElement.cpp @@ -18,24 +18,22 @@ */ #include "config.h" - -#include "SVGNames.h" #include "core/svg/SVGFEPointLightElement.h" -#include "core/platform/graphics/filters/PointLightSource.h" +#include "SVGNames.h" +#include "platform/graphics/filters/PointLightSource.h" namespace WebCore { -inline SVGFEPointLightElement::SVGFEPointLightElement(const QualifiedName& tagName, Document& document) - : SVGFELightElement(tagName, document) +inline SVGFEPointLightElement::SVGFEPointLightElement(Document& document) + : SVGFELightElement(SVGNames::fePointLightTag, document) { - ASSERT(hasTagName(SVGNames::fePointLightTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFEPointLightElement> SVGFEPointLightElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFEPointLightElement> SVGFEPointLightElement::create(Document& document) { - return adoptRef(new SVGFEPointLightElement(tagName, document)); + return adoptRef(new SVGFEPointLightElement(document)); } PassRefPtr<LightSource> SVGFEPointLightElement::lightSource() const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFEPointLightElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFEPointLightElement.h index 10bdec9e04a..b32b9516fb9 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFEPointLightElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFEPointLightElement.h @@ -26,10 +26,10 @@ namespace WebCore { class SVGFEPointLightElement FINAL : public SVGFELightElement { public: - static PassRefPtr<SVGFEPointLightElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFEPointLightElement> create(Document&); private: - SVGFEPointLightElement(const QualifiedName&, Document&); + explicit SVGFEPointLightElement(Document&); virtual PassRefPtr<LightSource> lightSource() const; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFESpecularLightingElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFESpecularLightingElement.cpp index 12cd0c7f4f0..eee19788f0e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFESpecularLightingElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFESpecularLightingElement.cpp @@ -23,11 +23,9 @@ #include "core/svg/SVGFESpecularLightingElement.h" -#include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/rendering/style/RenderStyle.h" #include "core/svg/SVGElementInstance.h" -#include "core/svg/SVGFELightElement.h" #include "core/svg/SVGParserUtilities.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" @@ -51,20 +49,19 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFESpecularLightingElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFESpecularLightingElement::SVGFESpecularLightingElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFESpecularLightingElement::SVGFESpecularLightingElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feSpecularLightingTag, document) , m_specularConstant(1) , m_specularExponent(1) , m_surfaceScale(1) { - ASSERT(hasTagName(SVGNames::feSpecularLightingTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFESpecularLightingElement(); } -PassRefPtr<SVGFESpecularLightingElement> SVGFESpecularLightingElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFESpecularLightingElement> SVGFESpecularLightingElement::create(Document& document) { - return adoptRef(new SVGFESpecularLightingElement(tagName, document)); + return adoptRef(new SVGFESpecularLightingElement(document)); } const AtomicString& SVGFESpecularLightingElement::kernelUnitLengthXIdentifier() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFESpecularLightingElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFESpecularLightingElement.h index 38d5d620e4a..f76b161286d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFESpecularLightingElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFESpecularLightingElement.h @@ -23,20 +23,20 @@ #define SVGFESpecularLightingElement_h #include "SVGNames.h" -#include "core/platform/graphics/filters/FESpecularLighting.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGFELightElement.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FESpecularLighting.h" namespace WebCore { class SVGFESpecularLightingElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFESpecularLightingElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFESpecularLightingElement> create(Document&); void lightElementAttributeChanged(const SVGFELightElement*, const QualifiedName&); private: - SVGFESpecularLightingElement(const QualifiedName&, Document&); + explicit SVGFESpecularLightingElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -57,11 +57,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGFESpecularLightingElement* toSVGFESpecularLightingElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::feSpecularLightingTag)); - return static_cast<SVGFESpecularLightingElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFESpecularLightingElement, hasTagName(SVGNames::feSpecularLightingTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFESpotLightElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFESpotLightElement.cpp index c41e52aca2d..2eafdb32874 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFESpotLightElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFESpotLightElement.cpp @@ -18,24 +18,22 @@ */ #include "config.h" - -#include "SVGNames.h" #include "core/svg/SVGFESpotLightElement.h" -#include "core/platform/graphics/filters/SpotLightSource.h" +#include "SVGNames.h" +#include "platform/graphics/filters/SpotLightSource.h" namespace WebCore { -inline SVGFESpotLightElement::SVGFESpotLightElement(const QualifiedName& tagName, Document& document) - : SVGFELightElement(tagName, document) +inline SVGFESpotLightElement::SVGFESpotLightElement(Document& document) + : SVGFELightElement(SVGNames::feSpotLightTag, document) { - ASSERT(hasTagName(SVGNames::feSpotLightTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFESpotLightElement> SVGFESpotLightElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFESpotLightElement> SVGFESpotLightElement::create(Document& document) { - return adoptRef(new SVGFESpotLightElement(tagName, document)); + return adoptRef(new SVGFESpotLightElement(document)); } PassRefPtr<LightSource> SVGFESpotLightElement::lightSource() const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFESpotLightElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFESpotLightElement.h index 3b0ca9c698c..a36d7628408 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFESpotLightElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFESpotLightElement.h @@ -26,10 +26,10 @@ namespace WebCore { class SVGFESpotLightElement FINAL : public SVGFELightElement { public: - static PassRefPtr<SVGFESpotLightElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFESpotLightElement> create(Document&); private: - SVGFESpotLightElement(const QualifiedName&, Document&); + explicit SVGFESpotLightElement(Document&); virtual PassRefPtr<LightSource> lightSource() const; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFETileElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFETileElement.cpp index 44b94a04320..f9833e817ed 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFETileElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFETileElement.cpp @@ -23,7 +23,7 @@ #include "core/svg/SVGFETileElement.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" @@ -37,17 +37,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETileElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFETileElement::SVGFETileElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFETileElement::SVGFETileElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feTileTag, document) { - ASSERT(hasTagName(SVGNames::feTileTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFETileElement(); } -PassRefPtr<SVGFETileElement> SVGFETileElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFETileElement> SVGFETileElement::create(Document& document) { - return adoptRef(new SVGFETileElement(tagName, document)); + return adoptRef(new SVGFETileElement(document)); } bool SVGFETileElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFETileElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFETileElement.h index 005c53b91b5..0e605cd726c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFETileElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFETileElement.h @@ -21,17 +21,17 @@ #ifndef SVGFETileElement_h #define SVGFETileElement_h -#include "core/platform/graphics/filters/FETile.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FETile.h" namespace WebCore { class SVGFETileElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFETileElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFETileElement> create(Document&); private: - SVGFETileElement(const QualifiedName&, Document&); + explicit SVGFETileElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFETurbulenceElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFETurbulenceElement.cpp index 14236b2c0e4..b020f0fe1e4 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFETurbulenceElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFETurbulenceElement.cpp @@ -46,20 +46,19 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFETurbulenceElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFETurbulenceElement::SVGFETurbulenceElement(const QualifiedName& tagName, Document& document) - : SVGFilterPrimitiveStandardAttributes(tagName, document) +inline SVGFETurbulenceElement::SVGFETurbulenceElement(Document& document) + : SVGFilterPrimitiveStandardAttributes(SVGNames::feTurbulenceTag, document) , m_numOctaves(1) , m_stitchTiles(SVG_STITCHTYPE_NOSTITCH) , m_type(FETURBULENCE_TYPE_TURBULENCE) { - ASSERT(hasTagName(SVGNames::feTurbulenceTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFETurbulenceElement(); } -PassRefPtr<SVGFETurbulenceElement> SVGFETurbulenceElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFETurbulenceElement> SVGFETurbulenceElement::create(Document& document) { - return adoptRef(new SVGFETurbulenceElement(tagName, document)); + return adoptRef(new SVGFETurbulenceElement(document)); } const AtomicString& SVGFETurbulenceElement::baseFrequencyXIdentifier() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFETurbulenceElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFETurbulenceElement.h index c77eceb7ed0..b9ead22cab9 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFETurbulenceElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFETurbulenceElement.h @@ -21,11 +21,11 @@ #ifndef SVGFETurbulenceElement_h #define SVGFETurbulenceElement_h -#include "core/platform/graphics/filters/FETurbulence.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGAnimatedInteger.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" +#include "platform/graphics/filters/FETurbulence.h" namespace WebCore { @@ -95,10 +95,10 @@ struct SVGPropertyTraits<TurbulenceType> { class SVGFETurbulenceElement FINAL : public SVGFilterPrimitiveStandardAttributes { public: - static PassRefPtr<SVGFETurbulenceElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFETurbulenceElement> create(Document&); private: - SVGFETurbulenceElement(const QualifiedName&, Document&); + explicit SVGFETurbulenceElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFilterElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFilterElement.cpp index 391a1d88b19..332233635d1 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFilterElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFilterElement.cpp @@ -25,7 +25,6 @@ #include "core/svg/SVGFilterElement.h" -#include "SVGNames.h" #include "XLinkNames.h" #include "core/rendering/svg/RenderSVGResourceFilter.h" #include "core/svg/SVGElementInstance.h" @@ -58,8 +57,8 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFilterElement) REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGFilterElement::SVGFilterElement(Document& document) + : SVGElement(SVGNames::filterTag, document) , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) , m_x(LengthModeWidth, "-10%") @@ -69,14 +68,13 @@ inline SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document { // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified. // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified. - ASSERT(hasTagName(SVGNames::filterTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFilterElement(); } -PassRefPtr<SVGFilterElement> SVGFilterElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFilterElement> SVGFilterElement::create(Document& document) { - return adoptRef(new SVGFilterElement(tagName, document)); + return adoptRef(new SVGFilterElement(document)); } const AtomicString& SVGFilterElement::filterResXIdentifier() @@ -96,8 +94,9 @@ void SVGFilterElement::setFilterRes(unsigned filterResX, unsigned filterResY) setFilterResXBaseValue(filterResX); setFilterResYBaseValue(filterResY); - if (RenderObject* object = renderer()) - object->setNeedsLayout(); + RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); + if (renderer) + renderer->invalidateCacheAndMarkForLayout(); } bool SVGFilterElement::isSupportedAttribute(const QualifiedName& attrName) @@ -168,8 +167,9 @@ void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName) || attrName == SVGNames::heightAttr) updateRelativeLengthsInformation(); - if (RenderObject* object = renderer()) - object->setNeedsLayout(); + RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); + if (renderer) + renderer->invalidateCacheAndMarkForLayout(); } void SVGFilterElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFilterElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFilterElement.h index d344fd280b2..791939a0f5b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFilterElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFilterElement.h @@ -39,14 +39,14 @@ class SVGFilterElement FINAL : public SVGElement, public SVGURIReference, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGFilterElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFilterElement> create(Document&); void setFilterRes(unsigned filterResX, unsigned filterResY); void addClient(Node*); void removeClient(Node*); private: - SVGFilterElement(const QualifiedName&, Document&); + explicit SVGFilterElement(Document&); virtual bool needsPendingResourceHandling() const { return false; } @@ -79,11 +79,7 @@ private: HashSet<RefPtr<Node> > m_clientsToAdd; }; -inline SVGFilterElement* toSVGFilterElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::filterTag)); - return static_cast<SVGFilterElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFilterElement, hasTagName(SVGNames::filterTag)); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFilterPrimitiveStandardAttributes.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFilterPrimitiveStandardAttributes.cpp index 5299939d0b6..cb25ed470d9 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFilterPrimitiveStandardAttributes.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFilterPrimitiveStandardAttributes.cpp @@ -24,7 +24,7 @@ #include "core/svg/SVGFilterPrimitiveStandardAttributes.h" #include "SVGNames.h" -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/rendering/svg/RenderSVGResourceFilterPrimitive.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/SVGLength.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFitToViewBox.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFitToViewBox.cpp index ed7de02c660..60425c87a88 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFitToViewBox.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFitToViewBox.cpp @@ -22,14 +22,12 @@ #include "core/svg/SVGFitToViewBox.h" -#include "SVGNames.h" #include "core/dom/Attribute.h" #include "core/dom/Document.h" -#include "core/platform/graphics/FloatRect.h" -#include "core/platform/graphics/transforms/AffineTransform.h" #include "core/svg/SVGDocumentExtensions.h" #include "core/svg/SVGParserUtilities.h" -#include "core/svg/SVGPreserveAspectRatio.h" +#include "platform/geometry/FloatRect.h" +#include "platform/transforms/AffineTransform.h" #include "wtf/text/StringImpl.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFitToViewBox.h b/chromium/third_party/WebKit/Source/core/svg/SVGFitToViewBox.h index 65284454aea..ba8ca3cf8fa 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFitToViewBox.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFitToViewBox.h @@ -23,8 +23,8 @@ #include "SVGNames.h" #include "core/dom/QualifiedName.h" -#include "core/platform/graphics/FloatRect.h" #include "core/svg/SVGPreserveAspectRatio.h" +#include "core/svg/SVGRect.h" #include "wtf/HashSet.h" namespace WebCore { @@ -46,7 +46,10 @@ public: if (name == SVGNames::viewBoxAttr) { FloatRect viewBox; bool valueIsValid = !value.isNull() && parseViewBox(&target->document(), value, viewBox); - target->setViewBoxBaseValue(viewBox, valueIsValid); + if (valueIsValid) + target->setViewBoxBaseValue(viewBox); + else + target->setViewBoxBaseValue(SVGRect(SVGRect::InvalidSVGRectTag())); return true; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontData.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFontData.cpp index 45a5d49292a..64b6b3de5ca 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontData.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontData.cpp @@ -24,15 +24,16 @@ #include "SVGNames.h" #include "XMLNames.h" -#include "core/platform/graphics/SVGGlyph.h" -#include "core/platform/graphics/TextRun.h" -#include "core/platform/graphics/WidthIterator.h" #include "core/rendering/RenderObject.h" #include "core/rendering/svg/SVGTextRunRenderingContext.h" #include "core/svg/SVGAltGlyphElement.h" #include "core/svg/SVGFontElement.h" #include "core/svg/SVGFontFaceElement.h" #include "core/svg/SVGGlyphElement.h" +#include "platform/fonts/SVGGlyph.h" +#include "platform/fonts/SimpleFontData.h" +#include "platform/fonts/WidthIterator.h" +#include "platform/text/TextRun.h" #include "wtf/text/StringBuilder.h" #include "wtf/unicode/CharacterNames.h" #include "wtf/unicode/Unicode.h" @@ -43,7 +44,8 @@ using namespace Unicode; namespace WebCore { SVGFontData::SVGFontData(SVGFontFaceElement* fontFaceElement) - : m_svgFontFaceElement(fontFaceElement) + : CustomFontData(false) + , m_svgFontFaceElement(fontFaceElement) , m_horizontalOriginX(fontFaceElement->horizontalOriginX()) , m_horizontalOriginY(fontFaceElement->horizontalOriginY()) , m_horizontalAdvanceX(fontFaceElement->horizontalAdvanceX()) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontData.h b/chromium/third_party/WebKit/Source/core/svg/SVGFontData.h index 1e20938742d..8d4483fbfd7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontData.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontData.h @@ -21,26 +21,30 @@ #define SVGFontData_h #if ENABLE(SVG_FONTS) -#include "core/platform/graphics/SimpleFontData.h" +#include "platform/fonts/CustomFontData.h" +#include "wtf/text/WTFString.h" namespace WebCore { +class SimpleFontData; class SVGFontElement; class SVGFontFaceElement; -class SVGFontData : public SimpleFontData::AdditionalFontData { +class SVGFontData FINAL : public CustomFontData { public: - static PassOwnPtr<SVGFontData> create(SVGFontFaceElement* element) + static PassRefPtr<SVGFontData> create(SVGFontFaceElement* element) { - return adoptPtr(new SVGFontData(element)); + return adoptRef(new SVGFontData(element)); } virtual ~SVGFontData() { } - virtual void initializeFontData(SimpleFontData*, float fontSize); - virtual float widthForSVGGlyph(Glyph, float fontSize) const; - virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData*) const; - virtual bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool mirror, int currentCharacter, unsigned& advanceLength) const; + virtual bool isSVGFont() const OVERRIDE { return true; }; + virtual void initializeFontData(SimpleFontData*, float fontSize) OVERRIDE; + virtual float widthForSVGGlyph(Glyph, float fontSize) const OVERRIDE; + virtual bool fillSVGGlyphPage(GlyphPage*, unsigned offset, unsigned length, UChar* buffer, unsigned bufferLength, const SimpleFontData*) const OVERRIDE; + virtual bool applySVGGlyphSelection(WidthIterator&, GlyphData&, bool mirror, int currentCharacter, unsigned& advanceLength) const OVERRIDE; + SVGFontFaceElement* svgFontFaceElement() const { return m_svgFontFaceElement; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFontElement.cpp index ab333c079cd..6f956f582af 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontElement.cpp @@ -24,8 +24,7 @@ #if ENABLE(SVG_FONTS) #include "core/svg/SVGFontElement.h" -#include "SVGNames.h" -#include "core/page/UseCounter.h" +#include "core/frame/UseCounter.h" #include "core/svg/SVGGlyphElement.h" #include "core/svg/SVGHKernElement.h" #include "core/svg/SVGMissingGlyphElement.h" @@ -42,21 +41,20 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFontElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGFontElement::SVGFontElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGFontElement::SVGFontElement(Document& document) + : SVGElement(SVGNames::fontTag, document) , m_missingGlyph(0) , m_isGlyphCacheValid(false) { - ASSERT(hasTagName(SVGNames::fontTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGFontElement(); - UseCounter::count(&document, UseCounter::SVGFontElement); + UseCounter::count(document, UseCounter::SVGFontElement); } -PassRefPtr<SVGFontElement> SVGFontElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFontElement> SVGFontElement::create(Document& document) { - return adoptRef(new SVGFontElement(tagName, document)); + return adoptRef(new SVGFontElement(document)); } void SVGFontElement::invalidateGlyphCache() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFontElement.h index fefa0a543fd..f7d945ef502 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontElement.h @@ -55,7 +55,7 @@ class SVGMissingGlyphElement; class SVGFontElement FINAL : public SVGElement , public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGFontElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFontElement> create(Document&); void invalidateGlyphCache(); void collectGlyphsForString(const String&, Vector<SVGGlyph>&); @@ -71,7 +71,7 @@ public: SVGMissingGlyphElement* firstMissingGlyphElement() const; private: - SVGFontElement(const QualifiedName&, Document&); + explicit SVGFontElement(Document&); virtual bool rendererIsNeeded(const RenderStyle&) { return false; } @@ -89,11 +89,7 @@ private: bool m_isGlyphCacheValid; }; -inline SVGFontElement* toSVGFontElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::fontTag)); - return static_cast<SVGFontElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFontElement, hasTagName(SVGNames::fontTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceElement.cpp index 55945a5f407..a4907f53142 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceElement.cpp @@ -27,7 +27,6 @@ #include <math.h> #include "CSSPropertyNames.h" #include "CSSValueKeywords.h" -#include "SVGNames.h" #include "core/css/CSSFontFaceSrcValue.h" #include "core/css/CSSParser.h" #include "core/css/CSSStyleSheet.h" @@ -36,33 +35,32 @@ #include "core/css/StyleRule.h" #include "core/dom/Attribute.h" #include "core/dom/Document.h" -#include "core/platform/graphics/Font.h" #include "core/svg/SVGDocumentExtensions.h" #include "core/svg/SVGFontElement.h" #include "core/svg/SVGFontFaceSrcElement.h" #include "core/svg/SVGGlyphElement.h" +#include "platform/fonts/Font.h" namespace WebCore { using namespace SVGNames; -inline SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGFontFaceElement::SVGFontFaceElement(Document& document) + : SVGElement(font_faceTag, document) , m_fontFaceRule(StyleRuleFontFace::create()) , m_fontElement(0) { - ASSERT(hasTagName(font_faceTag)); ScriptWrappable::init(this); - RefPtr<MutableStylePropertySet> styleDeclaration = MutableStylePropertySet::create(CSSStrictMode); + RefPtr<MutableStylePropertySet> styleDeclaration = MutableStylePropertySet::create(HTMLStandardMode); m_fontFaceRule->setProperties(styleDeclaration.release()); } -PassRefPtr<SVGFontFaceElement> SVGFontFaceElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFontFaceElement> SVGFontFaceElement::create(Document& document) { - return adoptRef(new SVGFontFaceElement(tagName, document)); + return adoptRef(new SVGFontFaceElement(document)); } -static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName& attrName) +static CSSPropertyID cssPropertyIdForFontFaceAttributeName(const QualifiedName& attrName) { if (!attrName.namespaceURI().isNull()) return CSSPropertyInvalid; @@ -112,7 +110,7 @@ static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName& attrN void SVGFontFaceElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { - CSSPropertyID propId = cssPropertyIdForSVGAttributeName(name); + CSSPropertyID propId = cssPropertyIdForFontFaceAttributeName(name); if (propId > 0) { m_fontFaceRule->mutableProperties()->setProperty(propId, value, false); rebuildFontFace(); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceElement.h index 5e77bd7a176..0950ef41323 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceElement.h @@ -33,7 +33,7 @@ class StyleRuleFontFace; class SVGFontFaceElement FINAL : public SVGElement { public: - static PassRefPtr<SVGFontFaceElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFontFaceElement> create(Document&); unsigned unitsPerEm() const; int xHeight() const; @@ -53,7 +53,7 @@ public: StyleRuleFontFace* fontFaceRule() const { return m_fontFaceRule.get(); } private: - SVGFontFaceElement(const QualifiedName&, Document&); + explicit SVGFontFaceElement(Document&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -67,11 +67,7 @@ private: SVGFontElement* m_fontElement; }; -inline SVGFontFaceElement* toSVGFontFaceElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::font_faceTag)); - return static_cast<SVGFontFaceElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFontFaceElement, hasTagName(SVGNames::font_faceTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceFormatElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceFormatElement.cpp index 94970ccf26b..5468bdb240e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceFormatElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceFormatElement.cpp @@ -29,16 +29,15 @@ namespace WebCore { using namespace SVGNames; -inline SVGFontFaceFormatElement::SVGFontFaceFormatElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGFontFaceFormatElement::SVGFontFaceFormatElement(Document& document) + : SVGElement(font_face_formatTag, document) { - ASSERT(hasTagName(font_face_formatTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFontFaceFormatElement> SVGFontFaceFormatElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFontFaceFormatElement> SVGFontFaceFormatElement::create(Document& document) { - return adoptRef(new SVGFontFaceFormatElement(tagName, document)); + return adoptRef(new SVGFontFaceFormatElement(document)); } void SVGFontFaceFormatElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceFormatElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceFormatElement.h index 33e75021bd1..986431a58bd 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceFormatElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceFormatElement.h @@ -27,10 +27,10 @@ namespace WebCore { class SVGFontFaceFormatElement FINAL : public SVGElement { public: - static PassRefPtr<SVGFontFaceFormatElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFontFaceFormatElement> create(Document&); private: - SVGFontFaceFormatElement(const QualifiedName&, Document&); + explicit SVGFontFaceFormatElement(Document&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceNameElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceNameElement.cpp index 8157a5e39d1..2675278c0ff 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceNameElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceNameElement.cpp @@ -22,21 +22,19 @@ #if ENABLE(SVG_FONTS) #include "core/svg/SVGFontFaceNameElement.h" -#include "SVGNames.h" #include "core/css/CSSFontFaceSrcValue.h" namespace WebCore { -inline SVGFontFaceNameElement::SVGFontFaceNameElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGFontFaceNameElement::SVGFontFaceNameElement(Document& document) + : SVGElement(SVGNames::font_face_nameTag, document) { - ASSERT(hasTagName(SVGNames::font_face_nameTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFontFaceNameElement> SVGFontFaceNameElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFontFaceNameElement> SVGFontFaceNameElement::create(Document& document) { - return adoptRef(new SVGFontFaceNameElement(tagName, document)); + return adoptRef(new SVGFontFaceNameElement(document)); } PassRefPtr<CSSFontFaceSrcValue> SVGFontFaceNameElement::srcValue() const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceNameElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceNameElement.h index 1339e4aa618..8b9394278c3 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceNameElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceNameElement.h @@ -30,21 +30,17 @@ class CSSFontFaceSrcValue; class SVGFontFaceNameElement FINAL : public SVGElement { public: - static PassRefPtr<SVGFontFaceNameElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFontFaceNameElement> create(Document&); PassRefPtr<CSSFontFaceSrcValue> srcValue() const; private: - SVGFontFaceNameElement(const QualifiedName&, Document&); + explicit SVGFontFaceNameElement(Document&); virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } }; -inline SVGFontFaceNameElement* toSVGFontFaceNameElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::font_face_nameTag)); - return static_cast<SVGFontFaceNameElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFontFaceNameElement, hasTagName(SVGNames::font_face_nameTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceSrcElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceSrcElement.cpp index e5ba1db9634..bc2254ddea8 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceSrcElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceSrcElement.cpp @@ -33,16 +33,15 @@ namespace WebCore { using namespace SVGNames; -inline SVGFontFaceSrcElement::SVGFontFaceSrcElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGFontFaceSrcElement::SVGFontFaceSrcElement(Document& document) + : SVGElement(font_face_srcTag, document) { - ASSERT(hasTagName(font_face_srcTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFontFaceSrcElement> SVGFontFaceSrcElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFontFaceSrcElement> SVGFontFaceSrcElement::create(Document& document) { - return adoptRef(new SVGFontFaceSrcElement(tagName, document)); + return adoptRef(new SVGFontFaceSrcElement(document)); } PassRefPtr<CSSValueList> SVGFontFaceSrcElement::srcValue() const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceSrcElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceSrcElement.h index eb11d7b1d00..f7ef1af6f6b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceSrcElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceSrcElement.h @@ -29,12 +29,12 @@ class CSSValueList; class SVGFontFaceSrcElement FINAL : public SVGElement { public: - static PassRefPtr<SVGFontFaceSrcElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFontFaceSrcElement> create(Document&); PassRefPtr<CSSValueList> srcValue() const; private: - SVGFontFaceSrcElement(const QualifiedName&, Document&); + explicit SVGFontFaceSrcElement(Document&); virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.cpp index f5168be5be3..fabcf7f5b0c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.cpp @@ -23,12 +23,10 @@ #if ENABLE(SVG_FONTS) #include "core/svg/SVGFontFaceUriElement.h" -#include "SVGNames.h" #include "XLinkNames.h" #include "core/css/CSSFontFaceSrcValue.h" #include "core/dom/Document.h" #include "core/fetch/FetchRequest.h" -#include "core/fetch/FontResource.h" #include "core/fetch/ResourceFetcher.h" #include "core/svg/SVGFontFaceElement.h" @@ -36,16 +34,15 @@ namespace WebCore { using namespace SVGNames; -inline SVGFontFaceUriElement::SVGFontFaceUriElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGFontFaceUriElement::SVGFontFaceUriElement(Document& document) + : SVGElement(font_face_uriTag, document) { - ASSERT(hasTagName(font_face_uriTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGFontFaceUriElement> SVGFontFaceUriElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGFontFaceUriElement> SVGFontFaceUriElement::create(Document& document) { - return adoptRef(new SVGFontFaceUriElement(tagName, document)); + return adoptRef(new SVGFontFaceUriElement(document)); } SVGFontFaceUriElement::~SVGFontFaceUriElement() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.h index 8a3f84eedd5..338ce85b115 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGFontFaceUriElement.h @@ -32,14 +32,14 @@ class CSSFontFaceSrcValue; class SVGFontFaceUriElement FINAL : public SVGElement, public FontResourceClient { public: - static PassRefPtr<SVGFontFaceUriElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGFontFaceUriElement> create(Document&); virtual ~SVGFontFaceUriElement(); PassRefPtr<CSSFontFaceSrcValue> srcValue() const; private: - SVGFontFaceUriElement(const QualifiedName&, Document&); + explicit SVGFontFaceUriElement(Document&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0); @@ -52,11 +52,7 @@ private: ResourcePtr<FontResource> m_resource; }; -inline SVGFontFaceUriElement* toSVGFontFaceUriElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::font_face_uriTag)); - return static_cast<SVGFontFaceUriElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGFontFaceUriElement, hasTagName(SVGNames::font_face_uriTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.cpp index e8a99a2b701..8db9e53ced7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.cpp @@ -21,7 +21,6 @@ #include "config.h" #include "core/svg/SVGForeignObjectElement.h" -#include "SVGNames.h" #include "XLinkNames.h" #include "core/rendering/svg/RenderSVGForeignObject.h" #include "core/rendering/svg/RenderSVGResource.h" @@ -49,21 +48,20 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGForeignObjectElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGForeignObjectElement::SVGForeignObjectElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGForeignObjectElement::SVGForeignObjectElement(Document& document) + : SVGGraphicsElement(SVGNames::foreignObjectTag, document) , m_x(LengthModeWidth) , m_y(LengthModeHeight) , m_width(LengthModeWidth) , m_height(LengthModeHeight) { - ASSERT(hasTagName(SVGNames::foreignObjectTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGForeignObjectElement(); } -PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGForeignObjectElement> SVGForeignObjectElement::create(Document& document) { - return adoptRef(new SVGForeignObjectElement(tagName, document)); + return adoptRef(new SVGForeignObjectElement(document)); } bool SVGForeignObjectElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.h index 83018a89a72..38d3734f37e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGForeignObjectElement.h @@ -32,10 +32,10 @@ namespace WebCore { class SVGForeignObjectElement FINAL : public SVGGraphicsElement, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGForeignObjectElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGForeignObjectElement> create(Document&); private: - SVGForeignObjectElement(const QualifiedName&, Document&); + explicit SVGForeignObjectElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } bool isSupportedAttribute(const QualifiedName&); @@ -58,11 +58,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGForeignObjectElement* toSVGForeignObjectElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::foreignObjectTag)); - return static_cast<SVGForeignObjectElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGForeignObjectElement, hasTagName(SVGNames::foreignObjectTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGGElement.cpp index 20e2dd875fa..6345cc7570f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGElement.cpp @@ -38,17 +38,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -SVGGElement::SVGGElement(const QualifiedName& tagName, Document& document, ConstructionType constructionType) - : SVGGraphicsElement(tagName, document, constructionType) +SVGGElement::SVGGElement(Document& document, ConstructionType constructionType) + : SVGGraphicsElement(SVGNames::gTag, document, constructionType) { - ASSERT(hasTagName(SVGNames::gTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGGElement(); } -PassRefPtr<SVGGElement> SVGGElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGGElement> SVGGElement::create(Document& document) { - return adoptRef(new SVGGElement(tagName, document)); + return adoptRef(new SVGGElement(document)); } bool SVGGElement::isSupportedAttribute(const QualifiedName& attrName) @@ -66,9 +65,6 @@ void SVGGElement::parseAttribute(const QualifiedName& name, const AtomicString& return; } - if (SVGLangSpace::parseAttribute(name, value)) - return; - ASSERT_NOT_REACHED(); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGGElement.h index ee1e91a9753..255e514de40 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGElement.h @@ -30,10 +30,10 @@ namespace WebCore { class SVGGElement FINAL : public SVGGraphicsElement, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGGElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGGElement> create(Document&); protected: - SVGGElement(const QualifiedName&, Document&, ConstructionType = CreateSVGElement); + explicit SVGGElement(Document&, ConstructionType = CreateSVGElement); virtual RenderObject* createRenderer(RenderStyle*); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp new file mode 100644 index 00000000000..56b3d03b560 --- /dev/null +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGeometryElement.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2013 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "core/svg/SVGGeometryElement.h" + +#include "SVGNames.h" +#include "core/rendering/HitTestRequest.h" +#include "core/rendering/PointerEventsHitRules.h" +#include "core/rendering/svg/RenderSVGShape.h" + +namespace WebCore { + +SVGGeometryElement::SVGGeometryElement(const QualifiedName& tagName, Document& document, ConstructionType constructionType) + : SVGGraphicsElement(tagName, document, constructionType) +{ +} + +bool SVGGeometryElement::isPointInFill(const SVGPoint& point) const +{ + document().updateLayoutIgnorePendingStylesheets(); + + // FIXME: Eventually we should support isPointInFill for display:none elements. + if (!renderer() || !renderer()->isSVGShape()) + return false; + + HitTestRequest request(HitTestRequest::ReadOnly); + PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTING, request, renderer()->style()->pointerEvents()); + hitRules.canHitStroke = false; + return toRenderSVGShape(renderer())->nodeAtFloatPointInternal(request, point, hitRules); +} + +bool SVGGeometryElement::isPointInStroke(const SVGPoint& point) const +{ + document().updateLayoutIgnorePendingStylesheets(); + + // FIXME: Eventually we should support isPointInStroke for display:none elements. + if (!renderer() || !renderer()->isSVGShape()) + return false; + + HitTestRequest request(HitTestRequest::ReadOnly); + PointerEventsHitRules hitRules(PointerEventsHitRules::SVG_GEOMETRY_HITTESTING, request, renderer()->style()->pointerEvents()); + hitRules.canHitFill = false; + return toRenderSVGShape(renderer())->nodeAtFloatPointInternal(request, point, hitRules); +} + +} diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGeometryElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGGeometryElement.h new file mode 100644 index 00000000000..09fffa51344 --- /dev/null +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGeometryElement.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2013 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef SVGGeometryElement_h +#define SVGGeometryElement_h + +#include "core/svg/SVGGraphicsElement.h" +#include "core/svg/SVGPoint.h" + +namespace WebCore { + +class SVGGeometryElement : public SVGGraphicsElement { +public: + bool isPointInFill(const SVGPoint&) const; + bool isPointInStroke(const SVGPoint&) const; + +protected: + SVGGeometryElement(const QualifiedName&, Document&, ConstructionType = CreateSVGElement); +}; + +} // namespace WebCore + +#endif // SVGGraphicsElement_h diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGeometryElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGGeometryElement.idl new file mode 100644 index 00000000000..d7837585b28 --- /dev/null +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGeometryElement.idl @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2013 Samsung Electronics. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +interface SVGGeometryElement : SVGGraphicsElement { + boolean isPointInFill(SVGPoint point); + boolean isPointInStroke(SVGPoint point); +}; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphElement.cpp index 93263a27c58..ace7f98f80e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphElement.cpp @@ -24,23 +24,21 @@ #if ENABLE(SVG_FONTS) #include "core/svg/SVGGlyphElement.h" -#include "SVGNames.h" #include "core/svg/SVGFontData.h" #include "core/svg/SVGFontElement.h" #include "core/svg/SVGPathUtilities.h" namespace WebCore { -inline SVGGlyphElement::SVGGlyphElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGGlyphElement::SVGGlyphElement(Document& document) + : SVGElement(SVGNames::glyphTag, document) { - ASSERT(hasTagName(SVGNames::glyphTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGGlyphElement> SVGGlyphElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGGlyphElement> SVGGlyphElement::create(Document& document) { - return adoptRef(new SVGGlyphElement(tagName, document)); + return adoptRef(new SVGGlyphElement(document)); } void SVGGlyphElement::invalidateGlyphCache() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphElement.h index 2598356a5e8..565eb1de154 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphElement.h @@ -24,8 +24,8 @@ #if ENABLE(SVG_FONTS) #include "SVGNames.h" -#include "core/platform/graphics/SVGGlyph.h" #include "core/svg/SVGElement.h" +#include "platform/fonts/SVGGlyph.h" namespace WebCore { @@ -33,7 +33,7 @@ class SVGFontData; class SVGGlyphElement FINAL : public SVGElement { public: - static PassRefPtr<SVGGlyphElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGGlyphElement> create(Document&); SVGGlyph buildGlyphIdentifier() const; @@ -45,7 +45,7 @@ public: static SVGGlyph buildGenericGlyphIdentifier(const SVGElement*); private: - SVGGlyphElement(const QualifiedName&, Document&); + explicit SVGGlyphElement(Document&); // FIXME: svgAttributeChanged missing. virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -58,11 +58,7 @@ private: void invalidateGlyphCache(); }; -inline SVGGlyphElement* toSVGGlyphElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::glyphTag)); - return static_cast<SVGGlyphElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGGlyphElement, hasTagName(SVGNames::glyphTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphMap.h b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphMap.h index ea45597ea2d..8e20f0644ca 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphMap.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphMap.h @@ -21,9 +21,9 @@ #define SVGGlyphMap_h #if ENABLE(SVG_FONTS) -#include "core/platform/graphics/Latin1TextIterator.h" -#include "core/platform/graphics/SVGGlyph.h" -#include "core/platform/graphics/SurrogatePairAwareTextIterator.h" +#include "platform/fonts/Latin1TextIterator.h" +#include "platform/fonts/SVGGlyph.h" +#include "platform/text/SurrogatePairAwareTextIterator.h" #include "wtf/HashMap.h" #include "wtf/Vector.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.cpp index 159a20bd67a..5fd1b1c3667 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.cpp @@ -22,7 +22,6 @@ #if ENABLE(SVG_FONTS) #include "core/svg/SVGGlyphRefElement.h" -#include "SVGNames.h" #include "XLinkNames.h" #include "core/svg/SVGParserUtilities.h" #include "wtf/text/AtomicString.h" @@ -37,21 +36,20 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGlyphRefElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGGlyphRefElement::SVGGlyphRefElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGGlyphRefElement::SVGGlyphRefElement(Document& document) + : SVGElement(SVGNames::glyphRefTag, document) , m_x(0) , m_y(0) , m_dx(0) , m_dy(0) { - ASSERT(hasTagName(SVGNames::glyphRefTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGGlyphRefElement(); } -PassRefPtr<SVGGlyphRefElement> SVGGlyphRefElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGGlyphRefElement> SVGGlyphRefElement::create(Document& document) { - return adoptRef(new SVGGlyphRefElement(tagName, document)); + return adoptRef(new SVGGlyphRefElement(document)); } bool SVGGlyphRefElement::hasValidGlyphElement(String& glyphName) const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.h index 21a2e4ff5d3..8de1d2b96ae 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.h @@ -30,7 +30,7 @@ namespace WebCore { class SVGGlyphRefElement FINAL : public SVGElement, public SVGURIReference { public: - static PassRefPtr<SVGGlyphRefElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGGlyphRefElement> create(Document&); bool hasValidGlyphElement(String& glyphName) const; virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -48,7 +48,7 @@ public: void setDy(float); private: - SVGGlyphRefElement(const QualifiedName&, Document&); + explicit SVGGlyphRefElement(Document&); template<typename CharType> void parseAttributeInternal(const QualifiedName&, const AtomicString&); @@ -65,11 +65,7 @@ private: float m_dy; }; -inline SVGGlyphRefElement* toSVGGlyphRefElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::glyphRefTag)); - return static_cast<SVGGlyphRefElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGGlyphRefElement, hasTagName(SVGNames::glyphRefTag)); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.idl index e10bf7bae89..76a4e4a724b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGlyphRefElement.idl @@ -22,7 +22,7 @@ ] interface SVGGlyphRefElement : SVGElement { // FIXME: Use [Reflect] after https://bugs.webkit.org/show_bug.cgi?id=64843 is fixed. attribute DOMString glyphRef; - [Reflect] attribute DOMString format; + [Reflect, TreatNullAs=NullString] attribute DOMString format; attribute float x; attribute float y; attribute float dx; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp index 2b8f6172bff..a9a85d2e449 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGradientElement.cpp @@ -23,7 +23,6 @@ #include "core/svg/SVGGradientElement.h" -#include "SVGNames.h" #include "XLinkNames.h" #include "core/dom/Attribute.h" #include "core/rendering/svg/RenderSVGHiddenContainer.h" @@ -33,7 +32,6 @@ #include "core/svg/SVGElementInstance.h" #include "core/svg/SVGStopElement.h" #include "core/svg/SVGTransformList.h" -#include "core/svg/SVGTransformable.h" namespace WebCore { @@ -121,8 +119,9 @@ void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName) SVGElementInstance::InvalidationGuard invalidationGuard(this); - if (RenderObject* object = renderer()) - object->setNeedsLayout(); + RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); + if (renderer) + renderer->invalidateCacheAndMarkForLayout(); } void SVGGradientElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGradientElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGGradientElement.h index 65f92d05aed..cb2c9162659 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGradientElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGradientElement.h @@ -22,7 +22,6 @@ #define SVGGradientElement_h #include "SVGNames.h" -#include "core/platform/graphics/Gradient.h" #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedEnumeration.h" #include "core/svg/SVGAnimatedTransformList.h" @@ -30,6 +29,7 @@ #include "core/svg/SVGExternalResourcesRequired.h" #include "core/svg/SVGURIReference.h" #include "core/svg/SVGUnitTypes.h" +#include "platform/graphics/Gradient.h" namespace WebCore { @@ -107,12 +107,13 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGGradientElement* toSVGGradientElement(Node* node) +inline bool isSVGGradientElement(const Node& node) { - ASSERT_WITH_SECURITY_IMPLICATION(!node || (node->hasTagName(SVGNames::radialGradientTag) || node->hasTagName(SVGNames::linearGradientTag))); - return static_cast<SVGGradientElement*>(node); + return node.hasTagName(SVGNames::radialGradientTag) || node.hasTagName(SVGNames::linearGradientTag); } +DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGGradientElement); + } // namespace WebCore #endif diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.cpp index 2fec7167265..95bb0c2cd87 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.cpp @@ -23,11 +23,11 @@ #include "core/svg/SVGGraphicsElement.h" #include "SVGNames.h" -#include "core/platform/graphics/transforms/AffineTransform.h" #include "core/rendering/svg/RenderSVGPath.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/rendering/svg/SVGPathData.h" #include "core/svg/SVGElementInstance.h" +#include "platform/transforms/AffineTransform.h" namespace WebCore { @@ -50,14 +50,53 @@ SVGGraphicsElement::~SVGGraphicsElement() { } +AffineTransform SVGGraphicsElement::getTransformToElement(SVGElement* target, ExceptionState& exceptionState) +{ + AffineTransform ctm = getCTM(AllowStyleUpdate); + + if (target && target->isSVGGraphicsElement()) { + AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(AllowStyleUpdate); + if (!targetCTM.isInvertible()) { + exceptionState.throwUninformativeAndGenericDOMException(InvalidStateError); + return ctm; + } + ctm = targetCTM.inverse() * ctm; + } + + return ctm; +} + +static AffineTransform computeCTM(SVGGraphicsElement* element, SVGElement::CTMScope mode, SVGGraphicsElement::StyleUpdateStrategy styleUpdateStrategy) +{ + ASSERT(element); + if (styleUpdateStrategy == SVGGraphicsElement::AllowStyleUpdate) + element->document().updateLayoutIgnorePendingStylesheets(); + + AffineTransform ctm; + + SVGElement* stopAtElement = mode == SVGGraphicsElement::NearestViewportScope ? element->nearestViewportElement() : 0; + for (Element* currentElement = element; currentElement; currentElement = currentElement->parentOrShadowHostElement()) { + if (!currentElement->isSVGElement()) + break; + + ctm = toSVGElement(currentElement)->localCoordinateSpaceTransform(mode).multiply(ctm); + + // For getCTM() computation, stop at the nearest viewport element + if (currentElement == stopAtElement) + break; + } + + return ctm; +} + AffineTransform SVGGraphicsElement::getCTM(StyleUpdateStrategy styleUpdateStrategy) { - return SVGLocatable::computeCTM(this, SVGLocatable::NearestViewportScope, styleUpdateStrategy); + return computeCTM(this, NearestViewportScope, styleUpdateStrategy); } AffineTransform SVGGraphicsElement::getScreenCTM(StyleUpdateStrategy styleUpdateStrategy) { - return SVGLocatable::computeCTM(this, SVGLocatable::ScreenScope, styleUpdateStrategy); + return computeCTM(this, ScreenScope, styleUpdateStrategy); } AffineTransform SVGGraphicsElement::animatedLocalTransform() const @@ -74,6 +113,14 @@ AffineTransform SVGGraphicsElement::animatedLocalTransform() const // Flatten any 3D transform. matrix = transform.toAffineTransform(); + + // CSS bakes the zoom factor into lengths, including translation components. + // In order to align CSS & SVG transforms, we need to invert this operation. + float zoom = style->effectiveZoom(); + if (zoom != 1) { + matrix.setE(matrix.e() / zoom); + matrix.setF(matrix.f() / zoom); + } } else { transformCurrentValue().concatenate(matrix); } @@ -129,8 +176,11 @@ void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName) SVGElementInstance::InvalidationGuard invalidationGuard(this); - if (SVGTests::handleAttributeChange(this, attrName)) + // Reattach so the isValid() check will be run again during renderer creation. + if (SVGTests::isKnownAttribute(attrName)) { + lazyReattachIfAttached(); return; + } RenderObject* object = renderer(); if (!object) @@ -145,19 +195,54 @@ void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName) ASSERT_NOT_REACHED(); } +static bool isViewportElement(Node* node) +{ + return (node->hasTagName(SVGNames::svgTag) + || node->hasTagName(SVGNames::symbolTag) + || node->hasTagName(SVGNames::foreignObjectTag) + || node->hasTagName(SVGNames::imageTag)); +} + SVGElement* SVGGraphicsElement::nearestViewportElement() const { - return SVGTransformable::nearestViewportElement(this); + for (Element* current = parentOrShadowHostElement(); current; current = current->parentOrShadowHostElement()) { + if (isViewportElement(current)) + return toSVGElement(current); + } + + return 0; } SVGElement* SVGGraphicsElement::farthestViewportElement() const { - return SVGTransformable::farthestViewportElement(this); + SVGElement* farthest = 0; + for (Element* current = parentOrShadowHostElement(); current; current = current->parentOrShadowHostElement()) { + if (isViewportElement(current)) + farthest = toSVGElement(current); + } + return farthest; } -SVGRect SVGGraphicsElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) +SVGRect SVGGraphicsElement::getBBox() { - return SVGTransformable::getBBox(this, styleUpdateStrategy); + document().updateLayoutIgnorePendingStylesheets(); + + // FIXME: Eventually we should support getBBox for detached elements. + if (!renderer()) + return SVGRect(); + + return renderer()->objectBoundingBox(); +} + +SVGRect SVGGraphicsElement::getStrokeBBox() +{ + document().updateLayoutIgnorePendingStylesheets(); + + // FIXME: Eventually we should support getStrokeBBox for detached elements. + if (!renderer()) + return SVGRect(); + + return renderer()->strokeBoundingBox(); } RenderObject* SVGGraphicsElement::createRenderer(RenderStyle*) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.h index d02a8db70d0..6bc8830c32f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.h @@ -24,27 +24,30 @@ #include "core/svg/SVGAnimatedTransformList.h" #include "core/svg/SVGElement.h" #include "core/svg/SVGTests.h" -#include "core/svg/SVGTransformable.h" namespace WebCore { class AffineTransform; class Path; -class SVGGraphicsElement : public SVGElement, public SVGTransformable, public SVGTests { +class SVGGraphicsElement : public SVGElement, public SVGTests { public: virtual ~SVGGraphicsElement(); - virtual AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate); - virtual AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate); - virtual SVGElement* nearestViewportElement() const; - virtual SVGElement* farthestViewportElement() const; + enum StyleUpdateStrategy { AllowStyleUpdate, DisallowStyleUpdate }; - virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGTransformable::localCoordinateSpaceTransform(mode); } + AffineTransform getCTM(StyleUpdateStrategy = AllowStyleUpdate); + AffineTransform getScreenCTM(StyleUpdateStrategy = AllowStyleUpdate); + AffineTransform getTransformToElement(SVGElement*, ExceptionState&); + SVGElement* nearestViewportElement() const; + SVGElement* farthestViewportElement() const; + + virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const OVERRIDE { return animatedLocalTransform(); } virtual AffineTransform animatedLocalTransform() const; virtual AffineTransform* supplementalTransform(); - virtual SVGRect getBBox(StyleUpdateStrategy = AllowStyleUpdate); + virtual SVGRect getBBox(); + SVGRect getStrokeBBox(); // "base class" methods for all the elements which render as paths virtual void toClipPath(Path&); @@ -73,13 +76,13 @@ private: OwnPtr<AffineTransform> m_supplementalTransform; }; -inline SVGGraphicsElement* toSVGGraphicsElement(Node* node) +inline bool isSVGGraphicsElement(const Node& node) { - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->isSVGElement()); - ASSERT_WITH_SECURITY_IMPLICATION(!node || toSVGElement(node)->isSVGGraphicsElement()); - return static_cast<SVGGraphicsElement*>(node); + return node.isSVGElement() && toSVGElement(node).isSVGGraphicsElement(); } +DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGGraphicsElement); + } // namespace WebCore #endif // SVGGraphicsElement_h diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.idl index 0af24404822..eed23aa1d2f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGGraphicsElement.idl @@ -31,10 +31,11 @@ interface SVGGraphicsElement : SVGElement { readonly attribute SVGAnimatedTransformList transform; - readonly attribute SVGElement nearestViewportElement; - readonly attribute SVGElement farthestViewportElement; + [MeasureAs=SVGLocatableNearestViewportElement] readonly attribute SVGElement nearestViewportElement; + [MeasureAs=SVGLocatableFarthestViewportElement] readonly attribute SVGElement farthestViewportElement; SVGRect getBBox(); + SVGRect getStrokeBBox(); SVGMatrix getCTM(); SVGMatrix getScreenCTM(); [RaisesException] SVGMatrix getTransformToElement([Default=Undefined] optional SVGElement element); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGHKernElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGHKernElement.cpp index d9277274f6e..cfd9229fdb8 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGHKernElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGHKernElement.cpp @@ -24,21 +24,18 @@ #if ENABLE(SVG_FONTS) #include "core/svg/SVGHKernElement.h" -#include "SVGNames.h" -#include "core/svg/SVGFontElement.h" namespace WebCore { -inline SVGHKernElement::SVGHKernElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGHKernElement::SVGHKernElement(Document& document) + : SVGElement(SVGNames::hkernTag, document) { - ASSERT(hasTagName(SVGNames::hkernTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGHKernElement> SVGHKernElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGHKernElement> SVGHKernElement::create(Document& document) { - return adoptRef(new SVGHKernElement(tagName, document)); + return adoptRef(new SVGHKernElement(document)); } Node::InsertionNotificationRequest SVGHKernElement::insertedInto(ContainerNode* rootParent) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGHKernElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGHKernElement.h index c60d6249b4f..d54d89d701a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGHKernElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGHKernElement.h @@ -30,12 +30,12 @@ namespace WebCore { class SVGHKernElement FINAL : public SVGElement { public: - static PassRefPtr<SVGHKernElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGHKernElement> create(Document&); void buildHorizontalKerningPair(KerningPairVector&); private: - SVGHKernElement(const QualifiedName&, Document&); + explicit SVGHKernElement(Document&); virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; virtual void removedFrom(ContainerNode*) OVERRIDE; @@ -43,11 +43,7 @@ private: virtual bool rendererIsNeeded(const RenderStyle&) { return false; } }; -inline SVGHKernElement* toSVGHKernElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::hkernTag)); - return static_cast<SVGHKernElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGHKernElement, hasTagName(SVGNames::hkernTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGImageElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGImageElement.cpp index d2ce3c0db59..72e3008be73 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGImageElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGImageElement.cpp @@ -24,7 +24,6 @@ #include "core/svg/SVGImageElement.h" #include "CSSPropertyNames.h" -#include "SVGNames.h" #include "XLinkNames.h" #include "core/rendering/RenderImageResource.h" #include "core/rendering/svg/RenderSVGImage.h" @@ -53,22 +52,21 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGImageElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGImageElement::SVGImageElement(Document& document) + : SVGGraphicsElement(SVGNames::imageTag, document) , m_x(LengthModeWidth) , m_y(LengthModeHeight) , m_width(LengthModeWidth) , m_height(LengthModeHeight) , m_imageLoader(this) { - ASSERT(hasTagName(SVGNames::imageTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGImageElement(); } -PassRefPtr<SVGImageElement> SVGImageElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGImageElement> SVGImageElement::create(Document& document) { - return adoptRef(new SVGImageElement(tagName, document)); + return adoptRef(new SVGImageElement(document)); } bool SVGImageElement::currentFrameHasSingleSecurityOrigin() const @@ -87,7 +85,6 @@ bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); if (supportedAttributes.isEmpty()) { - SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); SVGURIReference::addSupportedAttributes(supportedAttributes); supportedAttributes.add(SVGNames::xAttr); @@ -134,8 +131,7 @@ void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); else if (name == SVGNames::heightAttr) setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); - else if (SVGLangSpace::parseAttribute(name, value) - || SVGExternalResourcesRequired::parseAttribute(name, value) + else if (SVGExternalResourcesRequired::parseAttribute(name, value) || SVGURIReference::parseAttribute(name, value)) { } else ASSERT_NOT_REACHED(); @@ -176,7 +172,6 @@ void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) } if (attrName == SVGNames::preserveAspectRatioAttr - || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); return; @@ -238,7 +233,7 @@ void SVGImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const addSubresourceURL(urls, document().completeURL(hrefCurrentValue())); } -void SVGImageElement::didMoveToNewDocument(Document* oldDocument) +void SVGImageElement::didMoveToNewDocument(Document& oldDocument) { m_imageLoader.elementDidMoveToNewDocument(); SVGGraphicsElement::didMoveToNewDocument(oldDocument); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGImageElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGImageElement.h index fc4e1573635..1270dc14204 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGImageElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGImageElement.h @@ -36,12 +36,12 @@ class SVGImageElement FINAL : public SVGGraphicsElement, public SVGExternalResourcesRequired, public SVGURIReference { public: - static PassRefPtr<SVGImageElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGImageElement> create(Document&); bool currentFrameHasSingleSecurityOrigin() const; private: - SVGImageElement(const QualifiedName&, Document&); + explicit SVGImageElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } @@ -63,7 +63,7 @@ private: virtual bool haveLoadedRequiredResources(); virtual bool selfHasRelativeLengths() const; - virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE; + virtual void didMoveToNewDocument(Document& oldDocument) OVERRIDE; BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGImageElement) DECLARE_ANIMATED_LENGTH(X, x) @@ -78,11 +78,7 @@ private: SVGImageLoader m_imageLoader; }; -inline SVGImageElement* toSVGImageElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::imageTag)); - return static_cast<SVGImageElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGImageElement, hasTagName(SVGNames::imageTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGImageLoader.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGImageLoader.cpp index 6b503e2f05e..e889c61b149 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGImageLoader.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGImageLoader.cpp @@ -22,8 +22,8 @@ #include "core/svg/SVGImageLoader.h" -#include "core/dom/Event.h" -#include "core/dom/EventNames.h" +#include "core/events/Event.h" +#include "core/events/ThreadLocalEventNames.h" #include "core/fetch/ImageResource.h" #include "core/html/parser/HTMLParserIdioms.h" #include "core/svg/SVGImageElement.h" @@ -38,7 +38,7 @@ SVGImageLoader::SVGImageLoader(SVGImageElement* node) void SVGImageLoader::dispatchLoadEvent() { if (image()->errorOccurred()) - element()->dispatchEvent(Event::create(eventNames().errorEvent)); + element()->dispatchEvent(Event::create(EventTypeNames::error)); else { SVGImageElement* imageElement = toSVGImageElement(element()); if (imageElement->externalResourcesRequiredBaseValue()) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLangSpace.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGLangSpace.cpp deleted file mode 100644 index c6bfe936ee5..00000000000 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLangSpace.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "core/svg/SVGLangSpace.h" - -#include "XMLNames.h" -#include "wtf/StdLibExtras.h" - -namespace WebCore { - -void SVGLangSpace::setXmllang(const AtomicString& xmlLang) -{ - m_lang = xmlLang; -} - -const AtomicString& SVGLangSpace::xmlspace() const -{ - if (!m_space) { - DEFINE_STATIC_LOCAL(const AtomicString, defaultString, ("default", AtomicString::ConstructFromLiteral)); - return defaultString; - } - - return m_space; -} - -void SVGLangSpace::setXmlspace(const AtomicString& xmlSpace) -{ - m_space = xmlSpace; -} - -bool SVGLangSpace::parseAttribute(const QualifiedName& name, const AtomicString& value) -{ - if (name.matches(XMLNames::langAttr)) { - setXmllang(value); - return true; - } - if (name.matches(XMLNames::spaceAttr)) { - setXmlspace(value); - return true; - } - - return false; -} - -bool SVGLangSpace::isKnownAttribute(const QualifiedName& attrName) -{ - return attrName.matches(XMLNames::langAttr) || attrName.matches(XMLNames::spaceAttr); -} - -void SVGLangSpace::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes) -{ - DEFINE_STATIC_LOCAL(AtomicString, xmlPrefix, ("xml", AtomicString::ConstructFromLiteral)); - - QualifiedName langWithPrefix = XMLNames::langAttr; - langWithPrefix.setPrefix(xmlPrefix); - supportedAttributes.add(langWithPrefix); - supportedAttributes.add(XMLNames::langAttr); - - QualifiedName spaceWithPrefix = XMLNames::spaceAttr; - spaceWithPrefix.setPrefix(xmlPrefix); - supportedAttributes.add(spaceWithPrefix); - supportedAttributes.add(XMLNames::spaceAttr); -} - -} diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLangSpace.h b/chromium/third_party/WebKit/Source/core/svg/SVGLangSpace.h deleted file mode 100644 index b10c97d90a1..00000000000 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLangSpace.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef SVGLangSpace_h -#define SVGLangSpace_h - -#include "core/dom/QualifiedName.h" -#include "wtf/HashSet.h" - -namespace WebCore { - -class Attribute; - -class SVGLangSpace { -public: - const AtomicString& xmllang() const { return m_lang; } - void setXmllang(const AtomicString& xmlLang); - - const AtomicString& xmlspace() const; - void setXmlspace(const AtomicString& xmlSpace); - - bool parseAttribute(const QualifiedName&, const AtomicString&); - bool isKnownAttribute(const QualifiedName&); - void addSupportedAttributes(HashSet<QualifiedName>&); - -private: - AtomicString m_lang; - AtomicString m_space; -}; - -} // namespace WebCore - -#endif // SVGLangSpace_h diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLength.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGLength.cpp index 4f78c902643..b6a95967fea 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLength.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLength.cpp @@ -24,7 +24,6 @@ #include "core/svg/SVGLength.h" #include "SVGNames.h" -#include "bindings/v8/ExceptionState.h" #include "bindings/v8/ExceptionStatePlaceholder.h" #include "core/css/CSSPrimitiveValue.h" #include "core/dom/ExceptionCode.h" @@ -150,11 +149,11 @@ SVGLength::SVGLength(const SVGLength& other) { } -void SVGLength::setValueAsString(const String& valueAsString, SVGLengthMode mode, ExceptionState& es) +void SVGLength::setValueAsString(const String& valueAsString, SVGLengthMode mode, ExceptionState& exceptionState) { m_valueInSpecifiedUnits = 0; m_unit = storeUnit(mode, LengthTypeNumber); - setValueAsString(valueAsString, es); + setValueAsString(valueAsString, exceptionState); } bool SVGLength::operator==(const SVGLength& other) const @@ -170,12 +169,12 @@ bool SVGLength::operator!=(const SVGLength& other) const SVGLength SVGLength::construct(SVGLengthMode mode, const String& valueAsString, SVGParsingError& parseError, SVGLengthNegativeValuesMode negativeValuesMode) { - TrackExceptionState es; + TrackExceptionState exceptionState; SVGLength length(mode); - length.setValueAsString(valueAsString, es); + length.setValueAsString(valueAsString, exceptionState); - if (es.hadException()) + if (exceptionState.hadException()) parseError = ParsingAttributeFailedError; else if (negativeValuesMode == ForbidNegativeLengths && length.valueInSpecifiedUnits() < 0) parseError = NegativeValueForbiddenError; @@ -198,25 +197,25 @@ float SVGLength::value(const SVGLengthContext& context) const return value(context, IGNORE_EXCEPTION); } -float SVGLength::value(const SVGLengthContext& context, ExceptionState& es) const +float SVGLength::value(const SVGLengthContext& context, ExceptionState& exceptionState) const { - return context.convertValueToUserUnits(m_valueInSpecifiedUnits, extractMode(m_unit), extractType(m_unit), es); + return context.convertValueToUserUnits(m_valueInSpecifiedUnits, extractMode(m_unit), extractType(m_unit), exceptionState); } -void SVGLength::setValue(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType, ExceptionState& es) +void SVGLength::setValue(const SVGLengthContext& context, float value, SVGLengthMode mode, SVGLengthType unitType, ExceptionState& exceptionState) { m_unit = storeUnit(mode, unitType); - setValue(value, context, es); + setValue(value, context, exceptionState); } -void SVGLength::setValue(float value, const SVGLengthContext& context, ExceptionState& es) +void SVGLength::setValue(float value, const SVGLengthContext& context, ExceptionState& exceptionState) { // 100% = 100.0 instead of 1.0 for historical reasons, this could eventually be changed if (extractType(m_unit) == LengthTypePercentage) value = value / 100; - float convertedValue = context.convertValueFromUserUnits(value, extractMode(m_unit), extractType(m_unit), es); - if (!es.hadException()) + float convertedValue = context.convertValueFromUserUnits(value, extractMode(m_unit), extractType(m_unit), exceptionState); + if (!exceptionState.hadException()) m_valueInSpecifiedUnits = convertedValue; } float SVGLength::valueAsPercentage() const @@ -245,7 +244,7 @@ static bool parseValueInternal(const String& string, float& convertedNumber, SVG return true; } -void SVGLength::setValueAsString(const String& string, ExceptionState& es) +void SVGLength::setValueAsString(const String& string, ExceptionState& exceptionState) { if (string.isEmpty()) return; @@ -258,7 +257,7 @@ void SVGLength::setValueAsString(const String& string, ExceptionState& es) parseValueInternal<UChar>(string, convertedNumber, type); if (!success) { - es.throwDOMException(SyntaxError); + exceptionState.throwUninformativeAndGenericDOMException(SyntaxError); return; } @@ -271,10 +270,10 @@ String SVGLength::valueAsString() const return String::number(m_valueInSpecifiedUnits) + lengthTypeToString(extractType(m_unit)); } -void SVGLength::newValueSpecifiedUnits(unsigned short type, float value, ExceptionState& es) +void SVGLength::newValueSpecifiedUnits(unsigned short type, float value, ExceptionState& exceptionState) { if (type == LengthTypeUnknown || type > LengthTypePC) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return; } @@ -282,21 +281,21 @@ void SVGLength::newValueSpecifiedUnits(unsigned short type, float value, Excepti m_valueInSpecifiedUnits = value; } -void SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGLengthContext& context, ExceptionState& es) +void SVGLength::convertToSpecifiedUnits(unsigned short type, const SVGLengthContext& context, ExceptionState& exceptionState) { if (type == LengthTypeUnknown || type > LengthTypePC) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return; } - float valueInUserUnits = value(context, es); - if (es.hadException()) + float valueInUserUnits = value(context, exceptionState); + if (exceptionState.hadException()) return; unsigned int originalUnitAndType = m_unit; m_unit = storeUnit(extractMode(m_unit), toSVGLengthType(type)); - setValue(valueInUserUnits, context, es); - if (!es.hadException()) + setValue(valueInUserUnits, context, exceptionState); + if (!exceptionState.hadException()) return; // Eventually restore old unit and type @@ -348,10 +347,10 @@ SVGLength SVGLength::fromCSSPrimitiveValue(CSSPrimitiveValue* value) if (svgType == LengthTypeUnknown) return SVGLength(); - TrackExceptionState es; + TrackExceptionState exceptionState; SVGLength length; - length.newValueSpecifiedUnits(svgType, value->getFloatValue(), es); - if (es.hadException()) + length.newValueSpecifiedUnits(svgType, value->getFloatValue(), exceptionState); + if (exceptionState.hadException()) return SVGLength(); return length; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLength.h b/chromium/third_party/WebKit/Source/core/svg/SVGLength.h index 1bc530ed197..31310509b1b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLength.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLength.h @@ -22,10 +22,10 @@ #define SVGLength_h #include "bindings/v8/ExceptionState.h" -#include "core/platform/animation/AnimationUtilities.h" #include "core/svg/SVGLengthContext.h" #include "core/svg/SVGParsingError.h" #include "core/svg/properties/SVGPropertyTraits.h" +#include "platform/animation/AnimationUtilities.h" namespace WebCore { @@ -114,13 +114,13 @@ public: return *this; SVGLength length; - TrackExceptionState es; + TrackExceptionState exceptionState; if (fromType == LengthTypePercentage || toType == LengthTypePercentage) { float fromPercent = from.valueAsPercentage() * 100; float toPercent = valueAsPercentage() * 100; - length.newValueSpecifiedUnits(LengthTypePercentage, WebCore::blend(fromPercent, toPercent, progress), es); - if (es.hadException()) + length.newValueSpecifiedUnits(LengthTypePercentage, WebCore::blend(fromPercent, toPercent, progress), exceptionState); + if (exceptionState.hadException()) return SVGLength(); return length; } @@ -129,10 +129,10 @@ public: float fromValue = from.valueInSpecifiedUnits(); float toValue = valueInSpecifiedUnits(); if (isZero()) - length.newValueSpecifiedUnits(fromType, WebCore::blend(fromValue, toValue, progress), es); + length.newValueSpecifiedUnits(fromType, WebCore::blend(fromValue, toValue, progress), exceptionState); else - length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress), es); - if (es.hadException()) + length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress), exceptionState); + if (exceptionState.hadException()) return SVGLength(); return length; } @@ -141,18 +141,18 @@ public: ASSERT(!from.isRelative()); SVGLengthContext nonRelativeLengthContext(0); - float fromValueInUserUnits = nonRelativeLengthContext.convertValueToUserUnits(from.valueInSpecifiedUnits(), from.unitMode(), fromType, es); - if (es.hadException()) + float fromValueInUserUnits = nonRelativeLengthContext.convertValueToUserUnits(from.valueInSpecifiedUnits(), from.unitMode(), fromType, exceptionState); + if (exceptionState.hadException()) return SVGLength(); - float fromValue = nonRelativeLengthContext.convertValueFromUserUnits(fromValueInUserUnits, unitMode(), toType, es); - if (es.hadException()) + float fromValue = nonRelativeLengthContext.convertValueFromUserUnits(fromValueInUserUnits, unitMode(), toType, exceptionState); + if (exceptionState.hadException()) return SVGLength(); float toValue = valueInSpecifiedUnits(); - length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress), es); + length.newValueSpecifiedUnits(toType, WebCore::blend(fromValue, toValue, progress), exceptionState); - if (es.hadException()) + if (exceptionState.hadException()) return SVGLength(); return length; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLength.idl b/chromium/third_party/WebKit/Source/core/svg/SVGLength.idl index e073b1a36aa..4d29af7ffa4 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLength.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLength.idl @@ -35,10 +35,10 @@ interface SVGLength { const unsigned short SVG_LENGTHTYPE_PC = 10; readonly attribute unsigned short unitType; - [Custom, StrictTypeChecking, GetterRaisesException, SetterRaisesException] attribute float value; + [Custom, StrictTypeChecking, RaisesException] attribute float value; [StrictTypeChecking] attribute float valueInSpecifiedUnits; - [TreatNullAs=NullString, StrictTypeChecking, SetterRaisesException] attribute DOMString valueAsString; + [TreatNullAs=NullString, StrictTypeChecking, RaisesException=Setter] attribute DOMString valueAsString; [StrictTypeChecking, RaisesException] void newValueSpecifiedUnits(unsigned short unitType, float valueInSpecifiedUnits); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp index 1c8ed6a4bc1..7fed6c20b7a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLengthContext.cpp @@ -27,12 +27,12 @@ #include "bindings/v8/ExceptionState.h" #include "core/css/CSSHelper.h" #include "core/dom/ExceptionCode.h" -#include "core/platform/graphics/FontMetrics.h" #include "core/rendering/RenderPart.h" #include "core/rendering/RenderView.h" #include "core/rendering/svg/RenderSVGRoot.h" #include "core/rendering/svg/RenderSVGViewportContainer.h" #include "core/svg/SVGSVGElement.h" +#include "platform/fonts/FontMetrics.h" namespace WebCore { @@ -86,116 +86,114 @@ float SVGLengthContext::resolveLength(const SVGElement* context, SVGUnitTypes::S return x.valueAsPercentage(); } -float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode, SVGLengthType fromUnit, ExceptionState& es) const +float SVGLengthContext::convertValueToUserUnits(float value, SVGLengthMode mode, SVGLengthType fromUnit, ExceptionState& exceptionState) const { // If the SVGLengthContext carries a custom viewport, force resolving against it. if (!m_overridenViewport.isEmpty()) { // 100% = 100.0 instead of 1.0 for historical reasons, this could eventually be changed if (fromUnit == LengthTypePercentage) value /= 100; - return convertValueFromPercentageToUserUnits(value, mode, es); + return convertValueFromPercentageToUserUnits(value, mode, exceptionState); } switch (fromUnit) { case LengthTypeUnknown: - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; case LengthTypeNumber: return value; case LengthTypePX: return value; case LengthTypePercentage: - return convertValueFromPercentageToUserUnits(value / 100, mode, es); + return convertValueFromPercentageToUserUnits(value / 100, mode, exceptionState); case LengthTypeEMS: - return convertValueFromEMSToUserUnits(value, es); + return convertValueFromEMSToUserUnits(value, exceptionState); case LengthTypeEXS: - return convertValueFromEXSToUserUnits(value, es); + return convertValueFromEXSToUserUnits(value, exceptionState); case LengthTypeCM: - return value * cssPixelsPerInch / 2.54f; + return value * cssPixelsPerCentimeter; case LengthTypeMM: - return value * cssPixelsPerInch / 25.4f; + return value * cssPixelsPerMillimeter; case LengthTypeIN: return value * cssPixelsPerInch; case LengthTypePT: - return value * cssPixelsPerInch / 72; + return value * cssPixelsPerPoint; case LengthTypePC: - return value * cssPixelsPerInch / 6; + return value * cssPixelsPerPica; } ASSERT_NOT_REACHED(); return 0; } -float SVGLengthContext::convertValueFromUserUnits(float value, SVGLengthMode mode, SVGLengthType toUnit, ExceptionState& es) const +float SVGLengthContext::convertValueFromUserUnits(float value, SVGLengthMode mode, SVGLengthType toUnit, ExceptionState& exceptionState) const { switch (toUnit) { case LengthTypeUnknown: - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; case LengthTypeNumber: return value; case LengthTypePercentage: - return convertValueFromUserUnitsToPercentage(value * 100, mode, es); + return convertValueFromUserUnitsToPercentage(value * 100, mode, exceptionState); case LengthTypeEMS: - return convertValueFromUserUnitsToEMS(value, es); + return convertValueFromUserUnitsToEMS(value, exceptionState); case LengthTypeEXS: - return convertValueFromUserUnitsToEXS(value, es); + return convertValueFromUserUnitsToEXS(value, exceptionState); case LengthTypePX: return value; case LengthTypeCM: - return value * 2.54f / cssPixelsPerInch; + return value / cssPixelsPerCentimeter; case LengthTypeMM: - return value * 25.4f / cssPixelsPerInch; + return value / cssPixelsPerMillimeter; case LengthTypeIN: return value / cssPixelsPerInch; case LengthTypePT: - return value * 72 / cssPixelsPerInch; + return value / cssPixelsPerPoint; case LengthTypePC: - return value * 6 / cssPixelsPerInch; + return value / cssPixelsPerPica; } ASSERT_NOT_REACHED(); return 0; } -float SVGLengthContext::convertValueFromUserUnitsToPercentage(float value, SVGLengthMode mode, ExceptionState& es) const +float SVGLengthContext::convertValueFromUserUnitsToPercentage(float value, SVGLengthMode mode, ExceptionState& exceptionState) const { - float width = 0; - float height = 0; - if (!determineViewport(width, height)) { - es.throwDOMException(NotSupportedError); + FloatSize viewportSize; + if (!determineViewport(viewportSize)) { + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; } switch (mode) { case LengthModeWidth: - return value / width * 100; + return value / viewportSize.width() * 100; case LengthModeHeight: - return value / height * 100; + return value / viewportSize.height() * 100; case LengthModeOther: - return value / (sqrtf((width * width + height * height) / 2)) * 100; + return value / sqrtf(viewportSize.diagonalLengthSquared() / 2) * 100; }; ASSERT_NOT_REACHED(); return 0; } -float SVGLengthContext::convertValueFromPercentageToUserUnits(float value, SVGLengthMode mode, ExceptionState& es) const +float SVGLengthContext::convertValueFromPercentageToUserUnits(float value, SVGLengthMode mode, ExceptionState& exceptionState) const { - float width = 0; - float height = 0; - if (!determineViewport(width, height)) { - es.throwDOMException(NotSupportedError); + FloatSize viewportSize; + if (!determineViewport(viewportSize)) { + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; } switch (mode) { case LengthModeWidth: - return value * width; + return value * viewportSize.width(); case LengthModeHeight: - return value * height; + return value * viewportSize.height(); case LengthModeOther: - return value * sqrtf((width * width + height * height) / 2); + return value * sqrtf(viewportSize.diagonalLengthSquared() / 2); }; ASSERT_NOT_REACHED(); @@ -219,39 +217,39 @@ static inline RenderStyle* renderStyleForLengthResolving(const SVGElement* conte return 0; } -float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionState& es) const +float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionState& exceptionState) const { RenderStyle* style = renderStyleForLengthResolving(m_context); if (!style) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; } float fontSize = style->specifiedFontSize(); if (!fontSize) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; } return value / fontSize; } -float SVGLengthContext::convertValueFromEMSToUserUnits(float value, ExceptionState& es) const +float SVGLengthContext::convertValueFromEMSToUserUnits(float value, ExceptionState& exceptionState) const { RenderStyle* style = renderStyleForLengthResolving(m_context); if (!style) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; } return value * style->specifiedFontSize(); } -float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionState& es) const +float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionState& exceptionState) const { RenderStyle* style = renderStyleForLengthResolving(m_context); if (!style) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; } @@ -259,18 +257,18 @@ float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionSta // if this causes problems in real world cases maybe it would be best to remove this float xHeight = ceilf(style->fontMetrics().xHeight()); if (!xHeight) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; } return value / xHeight; } -float SVGLengthContext::convertValueFromEXSToUserUnits(float value, ExceptionState& es) const +float SVGLengthContext::convertValueFromEXSToUserUnits(float value, ExceptionState& exceptionState) const { RenderStyle* style = renderStyleForLengthResolving(m_context); if (!style) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return 0; } @@ -279,34 +277,33 @@ float SVGLengthContext::convertValueFromEXSToUserUnits(float value, ExceptionSta return value * ceilf(style->fontMetrics().xHeight()); } -bool SVGLengthContext::determineViewport(float& width, float& height) const +bool SVGLengthContext::determineViewport(FloatSize& viewportSize) const { if (!m_context) return false; // If an overriden viewport is given, it has precedence. if (!m_overridenViewport.isEmpty()) { - width = m_overridenViewport.width(); - height = m_overridenViewport.height(); + viewportSize = m_overridenViewport.size(); return true; } - // SVGLengthContext should NEVER be used to resolve width/height values for <svg> elements, - // as they require special treatment, due the relationship with the CSS width/height properties. - ASSERT(m_context->document().documentElement() != m_context); + // Root <svg> element lengths are resolved against the top level viewport. + if (m_context->isOutermostSVGSVGElement()) { + viewportSize = toSVGSVGElement(m_context)->currentViewportSize(); + return true; + } // Take size from nearest viewport element. SVGElement* viewportElement = m_context->viewportElement(); if (!viewportElement || !viewportElement->isSVGSVGElement()) return false; - const SVGSVGElement* svg = static_cast<const SVGSVGElement*>(viewportElement); - FloatSize viewportSize = svg->currentViewBoxRect().size(); + const SVGSVGElement* svg = toSVGSVGElement(viewportElement); + viewportSize = svg->currentViewBoxRect().size(); if (viewportSize.isEmpty()) viewportSize = svg->currentViewportSize(); - width = viewportSize.width(); - height = viewportSize.height(); return true; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLengthContext.h b/chromium/third_party/WebKit/Source/core/svg/SVGLengthContext.h index c2fea4ea1aa..64c237040c1 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLengthContext.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLengthContext.h @@ -20,8 +20,8 @@ #ifndef SVGLengthContext_h #define SVGLengthContext_h -#include "core/platform/graphics/FloatRect.h" #include "core/svg/SVGUnitTypes.h" +#include "platform/geometry/FloatRect.h" namespace WebCore { @@ -66,7 +66,7 @@ public: float convertValueToUserUnits(float, SVGLengthMode, SVGLengthType fromUnit, ExceptionState&) const; float convertValueFromUserUnits(float, SVGLengthMode, SVGLengthType toUnit, ExceptionState&) const; - bool determineViewport(float& width, float& height) const; + bool determineViewport(FloatSize&) const; private: SVGLengthContext(const SVGElement*, const FloatRect& viewport); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLengthList.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGLengthList.cpp index 02c1a0772e0..1518d2c924a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLengthList.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLengthList.cpp @@ -30,7 +30,7 @@ namespace WebCore { template<typename CharType> void SVGLengthList::parseInternal(const CharType*& ptr, const CharType* end, SVGLengthMode mode) { - TrackExceptionState es; + TrackExceptionState exceptionState; while (ptr < end) { const CharType* start = ptr; @@ -43,8 +43,8 @@ void SVGLengthList::parseInternal(const CharType*& ptr, const CharType* end, SVG String valueString(start, ptr - start); if (valueString.isEmpty()) return; - length.setValueAsString(valueString, es); - if (es.hadException()) + length.setValueAsString(valueString, exceptionState); + if (exceptionState.hadException()) return; append(length); skipOptionalSVGSpacesOrDelimiter(ptr, end); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.cpp index fe21256f3a9..05ffe1509e1 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.cpp @@ -22,7 +22,6 @@ #include "core/svg/SVGLineElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/SVGLength.h" @@ -45,28 +44,26 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLineElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGLineElement::SVGLineElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGLineElement::SVGLineElement(Document& document) + : SVGGeometryElement(SVGNames::lineTag, document) , m_x1(LengthModeWidth) , m_y1(LengthModeHeight) , m_x2(LengthModeWidth) , m_y2(LengthModeHeight) { - ASSERT(hasTagName(SVGNames::lineTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGLineElement(); } -PassRefPtr<SVGLineElement> SVGLineElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGLineElement> SVGLineElement::create(Document& document) { - return adoptRef(new SVGLineElement(tagName, document)); + return adoptRef(new SVGLineElement(document)); } bool SVGLineElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); if (supportedAttributes.isEmpty()) { - SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); supportedAttributes.add(SVGNames::x1Attr); supportedAttributes.add(SVGNames::x2Attr); @@ -81,7 +78,7 @@ void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin SVGParsingError parseError = NoError; if (!isSupportedAttribute(name)) - SVGGraphicsElement::parseAttribute(name, value); + SVGGeometryElement::parseAttribute(name, value); else if (name == SVGNames::x1Attr) setX1BaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); else if (name == SVGNames::y1Attr) @@ -90,8 +87,7 @@ void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin setX2BaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); else if (name == SVGNames::y2Attr) setY2BaseValue(SVGLength::construct(LengthModeHeight, value, parseError)); - else if (SVGLangSpace::parseAttribute(name, value) - || SVGExternalResourcesRequired::parseAttribute(name, value)) { + else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { } else ASSERT_NOT_REACHED(); @@ -101,7 +97,7 @@ void SVGLineElement::parseAttribute(const QualifiedName& name, const AtomicStrin void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { - SVGGraphicsElement::svgAttributeChanged(attrName); + SVGGeometryElement::svgAttributeChanged(attrName); return; } @@ -125,7 +121,7 @@ void SVGLineElement::svgAttributeChanged(const QualifiedName& attrName) return; } - if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { + if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); return; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.h index af514be6b49..68b961afa8d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.h @@ -25,17 +25,17 @@ #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedLength.h" #include "core/svg/SVGExternalResourcesRequired.h" -#include "core/svg/SVGGraphicsElement.h" +#include "core/svg/SVGGeometryElement.h" namespace WebCore { -class SVGLineElement FINAL : public SVGGraphicsElement, +class SVGLineElement FINAL : public SVGGeometryElement, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGLineElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGLineElement> create(Document&); private: - SVGLineElement(const QualifiedName&, Document&); + explicit SVGLineElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } @@ -57,11 +57,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGLineElement* toSVGLineElement(Element* element) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!element || element->hasTagName(SVGNames::lineTag)); - return static_cast<SVGLineElement*>(element); -} +DEFINE_NODE_TYPE_CASTS(SVGLineElement, hasTagName(SVGNames::lineTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.idl index 9df8fe6151a..a12e80b2cf7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLineElement.idl @@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGLineElement : SVGGraphicsElement { +interface SVGLineElement : SVGGeometryElement { readonly attribute SVGAnimatedLength x1; readonly attribute SVGAnimatedLength y1; readonly attribute SVGAnimatedLength x2; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLinearGradientElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGLinearGradientElement.cpp index cd1d6eacd84..84cdebeab31 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLinearGradientElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLinearGradientElement.cpp @@ -25,7 +25,6 @@ #include "core/svg/SVGLinearGradientElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGResourceLinearGradient.h" #include "core/svg/LinearGradientAttributes.h" #include "core/svg/SVGElementInstance.h" @@ -48,22 +47,21 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGLinearGradientElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGradientElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGLinearGradientElement::SVGLinearGradientElement(const QualifiedName& tagName, Document& document) - : SVGGradientElement(tagName, document) +inline SVGLinearGradientElement::SVGLinearGradientElement(Document& document) + : SVGGradientElement(SVGNames::linearGradientTag, document) , m_x1(LengthModeWidth) , m_y1(LengthModeHeight) , m_x2(LengthModeWidth, "100%") , m_y2(LengthModeHeight) { // Spec: If the x2 attribute is not specified, the effect is as if a value of "100%" were specified. - ASSERT(hasTagName(SVGNames::linearGradientTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGLinearGradientElement(); } -PassRefPtr<SVGLinearGradientElement> SVGLinearGradientElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGLinearGradientElement> SVGLinearGradientElement::create(Document& document) { - return adoptRef(new SVGLinearGradientElement(tagName, document)); + return adoptRef(new SVGLinearGradientElement(document)); } bool SVGLinearGradientElement::isSupportedAttribute(const QualifiedName& attrName) @@ -109,8 +107,9 @@ void SVGLinearGradientElement::svgAttributeChanged(const QualifiedName& attrName updateRelativeLengthsInformation(); - if (RenderObject* object = renderer()) - object->setNeedsLayout(); + RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); + if (renderer) + renderer->invalidateCacheAndMarkForLayout(); } RenderObject* SVGLinearGradientElement::createRenderer(RenderStyle*) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLinearGradientElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGLinearGradientElement.h index 7f5f5ebe6ab..179424e1ca7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLinearGradientElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGLinearGradientElement.h @@ -31,12 +31,12 @@ struct LinearGradientAttributes; class SVGLinearGradientElement FINAL : public SVGGradientElement { public: - static PassRefPtr<SVGLinearGradientElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGLinearGradientElement> create(Document&); bool collectGradientAttributes(LinearGradientAttributes&); private: - SVGLinearGradientElement(const QualifiedName&, Document&); + explicit SVGLinearGradientElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -54,11 +54,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGLinearGradientElement* toSVGLinearGradientElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::linearGradientTag)); - return static_cast<SVGLinearGradientElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGLinearGradientElement, hasTagName(SVGNames::linearGradientTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLocatable.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGLocatable.cpp deleted file mode 100644 index c3354c9e879..00000000000 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLocatable.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> - * Copyright (C) 2009 Google, Inc. All rights reserved. - * Copyright (C) Research In Motion Limited 2010. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" -#include "core/svg/SVGLocatable.h" - -#include "SVGNames.h" -#include "bindings/v8/ExceptionState.h" -#include "core/dom/ExceptionCode.h" -#include "core/rendering/RenderObject.h" -#include "core/svg/SVGGraphicsElement.h" - -namespace WebCore { - -static bool isViewportElement(Node* node) -{ - return (node->hasTagName(SVGNames::svgTag) - || node->hasTagName(SVGNames::symbolTag) - || node->hasTagName(SVGNames::foreignObjectTag) - || node->hasTagName(SVGNames::imageTag)); -} - -SVGElement* SVGLocatable::nearestViewportElement(const SVGElement* element) -{ - ASSERT(element); - for (Element* current = element->parentOrShadowHostElement(); current; current = current->parentOrShadowHostElement()) { - if (isViewportElement(current)) - return toSVGElement(current); - } - - return 0; -} - -SVGElement* SVGLocatable::farthestViewportElement(const SVGElement* element) -{ - ASSERT(element); - SVGElement* farthest = 0; - for (Element* current = element->parentOrShadowHostElement(); current; current = current->parentOrShadowHostElement()) { - if (isViewportElement(current)) - farthest = toSVGElement(current); - } - return farthest; -} - -SVGRect SVGLocatable::getBBox(SVGElement* element, StyleUpdateStrategy styleUpdateStrategy) -{ - ASSERT(element); - if (styleUpdateStrategy == AllowStyleUpdate) - element->document().updateLayoutIgnorePendingStylesheets(); - - // FIXME: Eventually we should support getBBox for detached elements. - if (!element->renderer()) - return SVGRect(); - - return element->renderer()->objectBoundingBox(); -} - -AffineTransform SVGLocatable::computeCTM(SVGElement* element, CTMScope mode, StyleUpdateStrategy styleUpdateStrategy) -{ - ASSERT(element); - if (styleUpdateStrategy == AllowStyleUpdate) - element->document().updateLayoutIgnorePendingStylesheets(); - - AffineTransform ctm; - - SVGElement* stopAtElement = mode == NearestViewportScope ? nearestViewportElement(element) : 0; - for (Element* currentElement = element; currentElement; currentElement = currentElement->parentOrShadowHostElement()) { - if (!currentElement->isSVGElement()) - break; - - ctm = toSVGElement(currentElement)->localCoordinateSpaceTransform(mode).multiply(ctm); - - // For getCTM() computation, stop at the nearest viewport element - if (currentElement == stopAtElement) - break; - } - - return ctm; -} - -AffineTransform SVGLocatable::getTransformToElement(SVGElement* target, ExceptionState& es, StyleUpdateStrategy styleUpdateStrategy) -{ - AffineTransform ctm = getCTM(styleUpdateStrategy); - - if (target && target->isSVGGraphicsElement()) { - AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(styleUpdateStrategy); - if (!targetCTM.isInvertible()) { - es.throwDOMException(InvalidStateError); - return ctm; - } - ctm = targetCTM.inverse() * ctm; - } - - return ctm; -} - -} diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGLocatable.h b/chromium/third_party/WebKit/Source/core/svg/SVGLocatable.h deleted file mode 100644 index 6ab6aad4541..00000000000 --- a/chromium/third_party/WebKit/Source/core/svg/SVGLocatable.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org> - * Copyright (C) Research In Motion Limited 2010. All rights reserved. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef SVGLocatable_h -#define SVGLocatable_h - -#include "core/platform/graphics/transforms/AffineTransform.h" -#include "core/svg/SVGRect.h" - -namespace WebCore { - -class ExceptionState; -class SVGElement; - -class SVGLocatable { -public: - virtual ~SVGLocatable() { } - - // 'SVGLocatable' functions - virtual SVGElement* nearestViewportElement() const = 0; - virtual SVGElement* farthestViewportElement() const = 0; - - enum StyleUpdateStrategy { AllowStyleUpdate, DisallowStyleUpdate }; - - virtual SVGRect getBBox(StyleUpdateStrategy) = 0; - virtual AffineTransform getCTM(StyleUpdateStrategy) = 0; - virtual AffineTransform getScreenCTM(StyleUpdateStrategy) = 0; - AffineTransform getTransformToElement(SVGElement*, ExceptionState&, StyleUpdateStrategy = AllowStyleUpdate); - - static SVGElement* nearestViewportElement(const SVGElement*); - static SVGElement* farthestViewportElement(const SVGElement*); - - enum CTMScope { - NearestViewportScope, // Used for getCTM() - ScreenScope // Used for getScreenCTM() - }; - -protected: - virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const { return AffineTransform(); } - - static SVGRect getBBox(SVGElement*, StyleUpdateStrategy); - static AffineTransform computeCTM(SVGElement*, CTMScope, StyleUpdateStrategy); -}; - -} // namespace WebCore - -#endif // SVGLocatable_h diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp index b766818f475..058738f61de 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMPathElement.cpp @@ -21,7 +21,6 @@ #include "core/svg/SVGMPathElement.h" -#include "SVGNames.h" #include "XLinkNames.h" #include "core/dom/Document.h" #include "core/svg/SVGAnimateMotionElement.h" @@ -39,17 +38,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMPathElement) REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) END_REGISTER_ANIMATED_PROPERTIES -inline SVGMPathElement::SVGMPathElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGMPathElement::SVGMPathElement(Document& document) + : SVGElement(SVGNames::mpathTag, document) { - ASSERT(hasTagName(SVGNames::mpathTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGMPathElement(); } -PassRefPtr<SVGMPathElement> SVGMPathElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGMPathElement> SVGMPathElement::create(Document& document) { - return adoptRef(new SVGMPathElement(tagName, document)); + return adoptRef(new SVGMPathElement(document)); } SVGMPathElement::~SVGMPathElement() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMPathElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGMPathElement.h index 62e50a5e655..0bccf802d6c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMPathElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMPathElement.h @@ -35,7 +35,7 @@ class SVGMPathElement FINAL : public SVGElement, public SVGURIReference, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGMPathElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGMPathElement> create(Document&); virtual ~SVGMPathElement(); @@ -44,7 +44,7 @@ public: void targetPathChanged(); private: - SVGMPathElement(const QualifiedName&, Document&); + explicit SVGMPathElement(Document&); void buildPendingResource(); void clearResourceReferences(); @@ -64,11 +64,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGMPathElement* toSVGMPathElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::mpathTag)); - return static_cast<SVGMPathElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGMPathElement, hasTagName(SVGNames::mpathTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMarkerElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGMarkerElement.cpp index 9c62bac0ac5..8bb26d62912 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMarkerElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMarkerElement.cpp @@ -26,7 +26,6 @@ #include "SVGNames.h" #include "core/rendering/svg/RenderSVGResourceMarker.h" #include "core/svg/SVGElementInstance.h" -#include "core/svg/SVGFitToViewBox.h" namespace WebCore { @@ -70,24 +69,23 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMarkerElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGMarkerElement::SVGMarkerElement(Document& document) + : SVGElement(SVGNames::markerTag, document) + , m_orientType(SVGMarkerOrientAngle) , m_refX(LengthModeWidth) , m_refY(LengthModeHeight) , m_markerWidth(LengthModeWidth, "3") , m_markerHeight(LengthModeHeight, "3") , m_markerUnits(SVGMarkerUnitsStrokeWidth) - , m_orientType(SVGMarkerOrientAngle) { // Spec: If the markerWidth/markerHeight attribute is not specified, the effect is as if a value of "3" were specified. - ASSERT(hasTagName(SVGNames::markerTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGMarkerElement(); } -PassRefPtr<SVGMarkerElement> SVGMarkerElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGMarkerElement> SVGMarkerElement::create(Document& document) { - return adoptRef(new SVGMarkerElement(tagName, document)); + return adoptRef(new SVGMarkerElement(document)); } const AtomicString& SVGMarkerElement::orientTypeIdentifier() @@ -171,8 +169,9 @@ void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName) || attrName == SVGNames::markerHeightAttr) updateRelativeLengthsInformation(); - if (RenderObject* object = renderer()) - object->setNeedsLayout(); + RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); + if (renderer) + renderer->invalidateCacheAndMarkForLayout(); } void SVGMarkerElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMarkerElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGMarkerElement.h index 05e50e2e6ac..da6b4654f8f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMarkerElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMarkerElement.h @@ -86,9 +86,9 @@ struct SVGPropertyTraits<SVGMarkerOrientType> { if (value == "auto") return SVGMarkerOrientAuto; - TrackExceptionState es; - angle.setValueAsString(value, es); - if (!es.hadException()) + TrackExceptionState exceptionState; + angle.setValueAsString(value, exceptionState); + if (!exceptionState.hadException()) return SVGMarkerOrientAngle; return SVGMarkerOrientUnknown; } @@ -111,7 +111,7 @@ public: SVG_MARKER_ORIENT_ANGLE = SVGMarkerOrientAngle }; - static PassRefPtr<SVGMarkerElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGMarkerElement> create(Document&); AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const; @@ -120,8 +120,16 @@ public: static const SVGPropertyInfo* orientTypePropertyInfo(); + // Custom 'orientType' property. + static void synchronizeOrientType(SVGElement* contextElement); + static PassRefPtr<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement); + SVGMarkerOrientType& orientTypeCurrentValue() const { return m_orientType.value; } + SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; } + void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; } + PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > orientType(); + private: - SVGMarkerElement(const QualifiedName&, Document&); + explicit SVGMarkerElement(Document&); virtual bool needsPendingResourceHandling() const { return false; } @@ -140,6 +148,8 @@ private: static const AtomicString& orientTypeIdentifier(); static const AtomicString& orientAngleIdentifier(); + mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType; + BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMarkerElement) DECLARE_ANIMATED_LENGTH(RefX, refX) DECLARE_ANIMATED_LENGTH(RefY, refY) @@ -151,25 +161,9 @@ private: DECLARE_ANIMATED_RECT(ViewBox, viewBox) DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) END_DECLARE_ANIMATED_PROPERTIES - -public: - // Custom 'orientType' property. - static void synchronizeOrientType(SVGElement* contextElement); - static PassRefPtr<SVGAnimatedProperty> lookupOrCreateOrientTypeWrapper(SVGElement* contextElement); - SVGMarkerOrientType& orientTypeCurrentValue() const { return m_orientType.value; } - SVGMarkerOrientType& orientTypeBaseValue() const { return m_orientType.value; } - void setOrientTypeBaseValue(const SVGMarkerOrientType& type) { m_orientType.value = type; } - PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<SVGMarkerOrientType> > orientType(); - -private: - mutable SVGSynchronizableAnimatedProperty<SVGMarkerOrientType> m_orientType; }; -inline SVGMarkerElement* toSVGMarkerElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::markerTag)); - return static_cast<SVGMarkerElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGMarkerElement, hasTagName(SVGNames::markerTag)); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMaskElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGMaskElement.cpp index ecae018ebaa..728dfcb8b4a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMaskElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMaskElement.cpp @@ -25,10 +25,8 @@ #include "core/svg/SVGMaskElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGResourceMasker.h" #include "core/svg/SVGElementInstance.h" -#include "core/svg/SVGUnitTypes.h" namespace WebCore { @@ -53,8 +51,8 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGMaskElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) END_REGISTER_ANIMATED_PROPERTIES -inline SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGMaskElement::SVGMaskElement(Document& document) + : SVGElement(SVGNames::maskTag, document) , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) , m_x(LengthModeWidth, "-10%") @@ -64,14 +62,13 @@ inline SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document& do { // Spec: If the x/y attribute is not specified, the effect is as if a value of "-10%" were specified. // Spec: If the width/height attribute is not specified, the effect is as if a value of "120%" were specified. - ASSERT(hasTagName(SVGNames::maskTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGMaskElement(); } -PassRefPtr<SVGMaskElement> SVGMaskElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGMaskElement> SVGMaskElement::create(Document& document) { - return adoptRef(new SVGMaskElement(tagName, document)); + return adoptRef(new SVGMaskElement(document)); } bool SVGMaskElement::isSupportedAttribute(const QualifiedName& attrName) @@ -137,8 +134,9 @@ void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName) || attrName == SVGNames::heightAttr) updateRelativeLengthsInformation(); - if (RenderObject* object = renderer()) - object->setNeedsLayout(); + RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); + if (renderer) + renderer->invalidateCacheAndMarkForLayout(); } void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMaskElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGMaskElement.h index dd4043afb52..a4b09ae2e3a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMaskElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMaskElement.h @@ -35,10 +35,10 @@ class SVGMaskElement FINAL : public SVGElement, public SVGTests, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGMaskElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGMaskElement> create(Document&); private: - SVGMaskElement(const QualifiedName&, Document&); + explicit SVGMaskElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool needsPendingResourceHandling() const { return false; } @@ -68,11 +68,7 @@ private: virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); } }; -inline SVGMaskElement* toSVGMaskElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::maskTag)); - return static_cast<SVGMaskElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGMaskElement, hasTagName(SVGNames::maskTag)); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMatrix.h b/chromium/third_party/WebKit/Source/core/svg/SVGMatrix.h index 7451d32a239..df536b56769 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMatrix.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMatrix.h @@ -22,7 +22,7 @@ #include "bindings/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" -#include "core/platform/graphics/transforms/AffineTransform.h" +#include "platform/transforms/AffineTransform.h" namespace WebCore { @@ -103,23 +103,19 @@ public: return static_cast<SVGMatrix>(copy); } - SVGMatrix inverse(ExceptionState& es) const + SVGMatrix inverse(ExceptionState& exceptionState) const { AffineTransform transform = AffineTransform::inverse(); - if (!isInvertible()) { - // FIXME: This used to have a more specific error message: - // "An attempt was made to invert a matrix that is not invertible." - // When switching to SVG2 style exceptions we lost this information. - es.throwDOMException(InvalidStateError); - } + if (!isInvertible()) + exceptionState.throwDOMException(InvalidStateError, "The matrix is not invertible."); return transform; } - SVGMatrix rotateFromVector(double x, double y, ExceptionState& es) + SVGMatrix rotateFromVector(double x, double y, ExceptionState& exceptionState) { if (!x || !y) - es.throwDOMException(InvalidAccessError); + exceptionState.throwDOMException(InvalidAccessError, "Arguments cannot be zero."); AffineTransform copy = *this; copy.rotateFromVector(x, y); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMatrix.idl b/chromium/third_party/WebKit/Source/core/svg/SVGMatrix.idl index dc871be5b9e..af560290c01 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMatrix.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMatrix.idl @@ -20,7 +20,9 @@ * Boston, MA 02110-1301, USA. */ -interface SVGMatrix { +[ + SetReference(SVGTransform parent) +] interface SVGMatrix { // FIXME: these attributes should all be floats but since we implement // AffineTransform with doubles setting these as doubles makes more sense. [StrictTypeChecking] attribute double a; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMetadataElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGMetadataElement.cpp index a02eb3114e0..d8ef56a6098 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMetadataElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMetadataElement.cpp @@ -24,16 +24,15 @@ namespace WebCore { -inline SVGMetadataElement::SVGMetadataElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGMetadataElement::SVGMetadataElement(Document& document) + : SVGElement(SVGNames::metadataTag, document) { - ASSERT(hasTagName(SVGNames::metadataTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGMetadataElement> SVGMetadataElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGMetadataElement> SVGMetadataElement::create(Document& document) { - return adoptRef(new SVGMetadataElement(tagName, document)); + return adoptRef(new SVGMetadataElement(document)); } } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMetadataElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGMetadataElement.h index 596f3179b30..1d889dfd0b2 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMetadataElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMetadataElement.h @@ -27,10 +27,10 @@ namespace WebCore { class SVGMetadataElement FINAL : public SVGElement { public: - static PassRefPtr<SVGMetadataElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGMetadataElement> create(Document&); private: - SVGMetadataElement(const QualifiedName&, Document&); + explicit SVGMetadataElement(Document&); virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMissingGlyphElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGMissingGlyphElement.cpp index f426e6b1530..dd0ed72f92b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMissingGlyphElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMissingGlyphElement.cpp @@ -20,21 +20,19 @@ #include "config.h" #if ENABLE(SVG_FONTS) -#include "SVGNames.h" #include "core/svg/SVGMissingGlyphElement.h" namespace WebCore { -inline SVGMissingGlyphElement::SVGMissingGlyphElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGMissingGlyphElement::SVGMissingGlyphElement(Document& document) + : SVGElement(SVGNames::missing_glyphTag, document) { - ASSERT(hasTagName(SVGNames::missing_glyphTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGMissingGlyphElement> SVGMissingGlyphElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGMissingGlyphElement> SVGMissingGlyphElement::create(Document& document) { - return adoptRef(new SVGMissingGlyphElement(tagName, document)); + return adoptRef(new SVGMissingGlyphElement(document)); } } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGMissingGlyphElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGMissingGlyphElement.h index 6ff776dec23..9057582fab5 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGMissingGlyphElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGMissingGlyphElement.h @@ -28,19 +28,15 @@ namespace WebCore { class SVGMissingGlyphElement FINAL : public SVGElement { public: - static PassRefPtr<SVGMissingGlyphElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGMissingGlyphElement> create(Document&); private: - SVGMissingGlyphElement(const QualifiedName&, Document&); + explicit SVGMissingGlyphElement(Document&); virtual bool rendererIsNeeded(const RenderStyle&) { return false; } }; -inline SVGMissingGlyphElement* toSVGMissingGlyphElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::missing_glyphTag)); - return static_cast<SVGMissingGlyphElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGMissingGlyphElement, hasTagName(SVGNames::missing_glyphTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPaint.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPaint.cpp index ae2b9555864..8aa13ae372b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPaint.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPaint.cpp @@ -23,7 +23,6 @@ #include "core/svg/SVGPaint.h" #include "bindings/v8/ExceptionState.h" -#include "wtf/text/WTFString.h" namespace WebCore { @@ -63,19 +62,19 @@ void SVGPaint::setUri(const String&) // The setters are the most problematic part so we remove the support for those first. } -void SVGPaint::setPaint(unsigned short, const String&, const String&, const String&, ExceptionState& es) +void SVGPaint::setPaint(unsigned short, const String&, const String&, const String&, ExceptionState& exceptionState) { - es.throwDOMException(NoModificationAllowedError); + exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError); } -String SVGPaint::customCssText() const +String SVGPaint::customCSSText() const { switch (m_paintType) { case SVG_PAINTTYPE_UNKNOWN: case SVG_PAINTTYPE_RGBCOLOR: case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: case SVG_PAINTTYPE_CURRENTCOLOR: - return SVGColor::customCssText(); + return SVGColor::customCSSText(); case SVG_PAINTTYPE_NONE: return "none"; case SVG_PAINTTYPE_URI_NONE: @@ -83,7 +82,7 @@ String SVGPaint::customCssText() const case SVG_PAINTTYPE_URI_CURRENTCOLOR: case SVG_PAINTTYPE_URI_RGBCOLOR: case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: { - String color = SVGColor::customCssText(); + String color = SVGColor::customCSSText(); if (color.isEmpty()) return m_uri; return "url(" + m_uri + ") " + color; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPaint.h b/chromium/third_party/WebKit/Source/core/svg/SVGPaint.h index f4f387dde15..f48b4b7ba07 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPaint.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPaint.h @@ -92,7 +92,7 @@ public: void setUri(const String&); void setPaint(unsigned short paintType, const String& uri, const String& rgbColor, const String& iccColor, ExceptionState&); - String customCssText() const; + String customCSSText() const; PassRefPtr<SVGPaint> cloneForCSSOM() const; @@ -116,6 +116,8 @@ private: String m_uri; }; +DEFINE_CSS_VALUE_TYPE_CASTS(SVGPaint, isSVGPaint()); + } // namespace WebCore #endif // SVGPaint_h diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp index bee9c1bb58c..262ef622f91 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGParserUtilities.cpp @@ -24,8 +24,10 @@ #include "core/svg/SVGParserUtilities.h" #include "core/dom/Document.h" -#include "core/platform/graphics/FloatRect.h" #include "core/svg/SVGPointList.h" +#include "core/svg/SVGTransformList.h" +#include "platform/geometry/FloatRect.h" +#include "platform/transforms/AffineTransform.h" #include "wtf/ASCIICType.h" #include <limits> @@ -559,4 +561,207 @@ bool parseFloatPoint3(const CharType*& current, const CharType* end, FloatPoint& template bool parseFloatPoint3(const LChar*& current, const LChar* end, FloatPoint& point1, FloatPoint& point2, FloatPoint& point3); template bool parseFloatPoint3(const UChar*& current, const UChar* end, FloatPoint& point1, FloatPoint& point2, FloatPoint& point3); +template<typename CharType> +static int parseTransformParamList(const CharType*& ptr, const CharType* end, float* values, int required, int optional) +{ + int optionalParams = 0, requiredParams = 0; + + if (!skipOptionalSVGSpaces(ptr, end) || *ptr != '(') + return -1; + + ptr++; + + skipOptionalSVGSpaces(ptr, end); + + while (requiredParams < required) { + if (ptr >= end || !parseNumber(ptr, end, values[requiredParams], false)) + return -1; + requiredParams++; + if (requiredParams < required) + skipOptionalSVGSpacesOrDelimiter(ptr, end); + } + if (!skipOptionalSVGSpaces(ptr, end)) + return -1; + + bool delimParsed = skipOptionalSVGSpacesOrDelimiter(ptr, end); + + if (ptr >= end) + return -1; + + if (*ptr == ')') { // skip optionals + ptr++; + if (delimParsed) + return -1; + } else { + while (optionalParams < optional) { + if (ptr >= end || !parseNumber(ptr, end, values[requiredParams + optionalParams], false)) + return -1; + optionalParams++; + if (optionalParams < optional) + skipOptionalSVGSpacesOrDelimiter(ptr, end); + } + + if (!skipOptionalSVGSpaces(ptr, end)) + return -1; + + delimParsed = skipOptionalSVGSpacesOrDelimiter(ptr, end); + + if (ptr >= end || *ptr != ')' || delimParsed) + return -1; + ptr++; + } + + return requiredParams + optionalParams; +} + +// These should be kept in sync with enum SVGTransformType +static const int requiredValuesForType[] = {0, 6, 1, 1, 1, 1, 1}; +static const int optionalValuesForType[] = {0, 0, 1, 1, 2, 0, 0}; + +template<typename CharType> +static bool parseTransformValueInternal(unsigned type, const CharType*& ptr, const CharType* end, SVGTransform& transform) +{ + if (type == SVGTransform::SVG_TRANSFORM_UNKNOWN) + return false; + + int valueCount = 0; + float values[] = {0, 0, 0, 0, 0, 0}; + if ((valueCount = parseTransformParamList(ptr, end, values, requiredValuesForType[type], optionalValuesForType[type])) < 0) + return false; + + switch (type) { + case SVGTransform::SVG_TRANSFORM_SKEWX: + transform.setSkewX(values[0]); + break; + case SVGTransform::SVG_TRANSFORM_SKEWY: + transform.setSkewY(values[0]); + break; + case SVGTransform::SVG_TRANSFORM_SCALE: + if (valueCount == 1) // Spec: if only one param given, assume uniform scaling + transform.setScale(values[0], values[0]); + else + transform.setScale(values[0], values[1]); + break; + case SVGTransform::SVG_TRANSFORM_TRANSLATE: + if (valueCount == 1) // Spec: if only one param given, assume 2nd param to be 0 + transform.setTranslate(values[0], 0); + else + transform.setTranslate(values[0], values[1]); + break; + case SVGTransform::SVG_TRANSFORM_ROTATE: + if (valueCount == 1) + transform.setRotate(values[0], 0, 0); + else + transform.setRotate(values[0], values[1], values[2]); + break; + case SVGTransform::SVG_TRANSFORM_MATRIX: + transform.setMatrix(AffineTransform(values[0], values[1], values[2], values[3], values[4], values[5])); + break; + } + + return true; +} + +bool parseTransformValue(unsigned type, const LChar*& ptr, const LChar* end, SVGTransform& transform) +{ + return parseTransformValueInternal(type, ptr, end, transform); +} + +bool parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform& transform) +{ + return parseTransformValueInternal(type, ptr, end, transform); +} + +static const LChar skewXDesc[] = {'s', 'k', 'e', 'w', 'X'}; +static const LChar skewYDesc[] = {'s', 'k', 'e', 'w', 'Y'}; +static const LChar scaleDesc[] = {'s', 'c', 'a', 'l', 'e'}; +static const LChar translateDesc[] = {'t', 'r', 'a', 'n', 's', 'l', 'a', 't', 'e'}; +static const LChar rotateDesc[] = {'r', 'o', 't', 'a', 't', 'e'}; +static const LChar matrixDesc[] = {'m', 'a', 't', 'r', 'i', 'x'}; + +template<typename CharType> +static inline bool parseAndSkipType(const CharType*& ptr, const CharType* end, unsigned short& type) +{ + if (ptr >= end) + return false; + + if (*ptr == 's') { + if (skipString(ptr, end, skewXDesc, WTF_ARRAY_LENGTH(skewXDesc))) + type = SVGTransform::SVG_TRANSFORM_SKEWX; + else if (skipString(ptr, end, skewYDesc, WTF_ARRAY_LENGTH(skewYDesc))) + type = SVGTransform::SVG_TRANSFORM_SKEWY; + else if (skipString(ptr, end, scaleDesc, WTF_ARRAY_LENGTH(scaleDesc))) + type = SVGTransform::SVG_TRANSFORM_SCALE; + else + return false; + } else if (skipString(ptr, end, translateDesc, WTF_ARRAY_LENGTH(translateDesc))) + type = SVGTransform::SVG_TRANSFORM_TRANSLATE; + else if (skipString(ptr, end, rotateDesc, WTF_ARRAY_LENGTH(rotateDesc))) + type = SVGTransform::SVG_TRANSFORM_ROTATE; + else if (skipString(ptr, end, matrixDesc, WTF_ARRAY_LENGTH(matrixDesc))) + type = SVGTransform::SVG_TRANSFORM_MATRIX; + else + return false; + + return true; +} + +SVGTransform::SVGTransformType parseTransformType(const String& string) +{ + if (string.isEmpty()) + return SVGTransform::SVG_TRANSFORM_UNKNOWN; + unsigned short type = SVGTransform::SVG_TRANSFORM_UNKNOWN; + if (string.is8Bit()) { + const LChar* ptr = string.characters8(); + const LChar* end = ptr + string.length(); + parseAndSkipType(ptr, end, type); + } else { + const UChar* ptr = string.characters16(); + const UChar* end = ptr + string.length(); + parseAndSkipType(ptr, end, type); + } + return static_cast<SVGTransform::SVGTransformType>(type); +} + +template<typename CharType> +bool parseTransformAttributeInternal(SVGTransformList& list, const CharType*& ptr, const CharType* end, TransformParsingMode mode) +{ + if (mode == ClearList) + list.clear(); + + bool delimParsed = false; + while (ptr < end) { + delimParsed = false; + unsigned short type = SVGTransform::SVG_TRANSFORM_UNKNOWN; + skipOptionalSVGSpaces(ptr, end); + + if (!parseAndSkipType(ptr, end, type)) + return false; + + SVGTransform transform; + if (!parseTransformValue(type, ptr, end, transform)) + return false; + + list.append(transform); + skipOptionalSVGSpaces(ptr, end); + if (ptr < end && *ptr == ',') { + delimParsed = true; + ++ptr; + } + skipOptionalSVGSpaces(ptr, end); + } + + return !delimParsed; +} + +bool parseTransformAttribute(SVGTransformList& list, const LChar*& ptr, const LChar* end, TransformParsingMode mode) +{ + return parseTransformAttributeInternal(list, ptr, end, mode); +} + +bool parseTransformAttribute(SVGTransformList& list, const UChar*& ptr, const UChar* end, TransformParsingMode mode) +{ + return parseTransformAttributeInternal(list, ptr, end, mode); +} + } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGParserUtilities.h b/chromium/third_party/WebKit/Source/core/svg/SVGParserUtilities.h index 656e8b71e41..2946cf15cb7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGParserUtilities.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGParserUtilities.h @@ -22,7 +22,8 @@ #ifndef SVGParserUtilities_h #define SVGParserUtilities_h -#include "core/platform/text/ParserUtilities.h" +#include "core/svg/SVGTransform.h" +#include "platform/text/ParserUtilities.h" #include "wtf/HashSet.h" typedef pair<unsigned, unsigned> UnicodeRange; @@ -33,6 +34,7 @@ namespace WebCore { class FloatPoint; class FloatRect; class SVGPointList; +class SVGTransformList; template <typename CharType> bool parseSVGNumber(CharType* ptr, size_t length, double& number); @@ -86,6 +88,19 @@ Vector<String> parseDelimitedString(const String& input, const char seperator); bool parseKerningUnicodeString(const String& input, UnicodeRanges&, HashSet<String>& stringList); bool parseGlyphName(const String& input, HashSet<String>& values); +enum TransformParsingMode { + ClearList, + DoNotClearList +}; + +bool parseTransformAttribute(SVGTransformList&, const LChar*& ptr, const LChar* end, TransformParsingMode = ClearList); +bool parseTransformAttribute(SVGTransformList&, const UChar*& ptr, const UChar* end, TransformParsingMode = ClearList); + +bool parseTransformValue(unsigned type, const LChar*& ptr, const LChar* end, SVGTransform&); +bool parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform&); + +SVGTransform::SVGTransformType parseTransformType(const String&); + } // namespace WebCore #endif // SVGParserUtilities_h diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathBlender.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPathBlender.cpp index eba041bac43..dfeb61b2673 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathBlender.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathBlender.cpp @@ -20,9 +20,9 @@ #include "config.h" #include "core/svg/SVGPathBlender.h" -#include "core/platform/animation/AnimationUtilities.h" #include "core/svg/SVGPathSeg.h" #include "core/svg/SVGPathSource.h" +#include "platform/animation/AnimationUtilities.h" #include "wtf/TemporaryChange.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathBuilder.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPathBuilder.cpp index a489a79b079..2a8cc001634 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathBuilder.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathBuilder.cpp @@ -24,7 +24,7 @@ #include "config.h" #include "core/svg/SVGPathBuilder.h" -#include "core/platform/graphics/Path.h" +#include "platform/graphics/Path.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathBuilder.h b/chromium/third_party/WebKit/Source/core/svg/SVGPathBuilder.h index e3a9c4d215a..0c6a15d4aee 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathBuilder.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathBuilder.h @@ -24,8 +24,8 @@ #ifndef SVGPathBuilder_h #define SVGPathBuilder_h -#include "core/platform/graphics/FloatPoint.h" #include "core/svg/SVGPathConsumer.h" +#include "platform/geometry/FloatPoint.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathByteStreamBuilder.h b/chromium/third_party/WebKit/Source/core/svg/SVGPathByteStreamBuilder.h index 06c26e6805e..b3fd7472ffe 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathByteStreamBuilder.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathByteStreamBuilder.h @@ -20,9 +20,9 @@ #ifndef SVGPathByteStreamBuilder_h #define SVGPathByteStreamBuilder_h -#include "core/platform/graphics/FloatPoint.h" #include "core/svg/SVGPathByteStream.h" #include "core/svg/SVGPathConsumer.h" +#include "platform/geometry/FloatPoint.h" #include "wtf/PassOwnPtr.h" #include "wtf/text/WTFString.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathByteStreamSource.h b/chromium/third_party/WebKit/Source/core/svg/SVGPathByteStreamSource.h index ebdb90a1342..9dedab5bfe5 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathByteStreamSource.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathByteStreamSource.h @@ -20,9 +20,9 @@ #ifndef SVGPathByteStreamSource_h #define SVGPathByteStreamSource_h -#include "core/platform/graphics/FloatPoint.h" #include "core/svg/SVGPathByteStream.h" #include "core/svg/SVGPathSource.h" +#include "platform/geometry/FloatPoint.h" #include "wtf/PassOwnPtr.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathConsumer.h b/chromium/third_party/WebKit/Source/core/svg/SVGPathConsumer.h index fbd9e5609c3..dfb841f7e71 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathConsumer.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathConsumer.h @@ -24,7 +24,7 @@ #ifndef SVGPathConsumer_h #define SVGPathConsumer_h -#include "core/platform/graphics/FloatPoint.h" +#include "platform/geometry/FloatPoint.h" #include "wtf/FastAllocBase.h" #include "wtf/Noncopyable.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.cpp index 33b20a236d9..82af73a0123 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.cpp @@ -22,7 +22,6 @@ #include "core/svg/SVGPathElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGPath.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/svg/SVGElementInstance.h" @@ -44,7 +43,6 @@ #include "core/svg/SVGPathSegLinetoRel.h" #include "core/svg/SVGPathSegLinetoVerticalAbs.h" #include "core/svg/SVGPathSegLinetoVerticalRel.h" -#include "core/svg/SVGPathSegList.h" #include "core/svg/SVGPathSegMovetoAbs.h" #include "core/svg/SVGPathSegMovetoRel.h" #include "core/svg/SVGPathUtilities.h" @@ -78,20 +76,19 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPathElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGPathElement::SVGPathElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGPathElement::SVGPathElement(Document& document) + : SVGGeometryElement(SVGNames::pathTag, document) , m_pathByteStream(SVGPathByteStream::create()) , m_pathSegList(PathSegUnalteredRole) , m_isAnimValObserved(false) { - ASSERT(hasTagName(SVGNames::pathTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGPathElement(); } -PassRefPtr<SVGPathElement> SVGPathElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGPathElement> SVGPathElement::create(Document& document) { - return adoptRef(new SVGPathElement(tagName, document)); + return adoptRef(new SVGPathElement(document)); } float SVGPathElement::getTotalLength() @@ -224,7 +221,7 @@ bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName) void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (!isSupportedAttribute(name)) { - SVGGraphicsElement::parseAttribute(name, value); + SVGGeometryElement::parseAttribute(name, value); return; } @@ -250,7 +247,7 @@ void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { - SVGGraphicsElement::svgAttributeChanged(attrName); + SVGGeometryElement::svgAttributeChanged(attrName); return; } @@ -290,14 +287,14 @@ void SVGPathElement::invalidateMPathDependencies() Node::InsertionNotificationRequest SVGPathElement::insertedInto(ContainerNode* rootParent) { - SVGGraphicsElement::insertedInto(rootParent); + SVGGeometryElement::insertedInto(rootParent); invalidateMPathDependencies(); return InsertionDone; } void SVGPathElement::removedFrom(ContainerNode* rootParent) { - SVGGraphicsElement::removedFrom(rootParent); + SVGGeometryElement::removedFrom(rootParent); invalidateMPathDependencies(); } @@ -385,17 +382,18 @@ void SVGPathElement::pathSegListChanged(SVGPathSegRole role, ListModification li RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); } -FloatRect SVGPathElement::getBBox(StyleUpdateStrategy styleUpdateStrategy) +SVGRect SVGPathElement::getBBox() { - if (styleUpdateStrategy == AllowStyleUpdate) - this->document().updateLayoutIgnorePendingStylesheets(); + // By default, getBBox() returns objectBoundingBox but that will include + // markers so we override it to return just the path's bounding rect. - RenderSVGPath* renderer = toRenderSVGPath(this->renderer()); + document().updateLayoutIgnorePendingStylesheets(); // FIXME: Eventually we should support getBBox for detached elements. - if (!renderer) - return FloatRect(); + if (!renderer()) + return SVGRect(); + RenderSVGPath* renderer = toRenderSVGPath(this->renderer()); return renderer->path().boundingRect(); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.h index 3065a0eda4d..adc861c4fea 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.h @@ -25,7 +25,7 @@ #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedNumber.h" #include "core/svg/SVGExternalResourcesRequired.h" -#include "core/svg/SVGGraphicsElement.h" +#include "core/svg/SVGGeometryElement.h" #include "core/svg/SVGPathByteStream.h" #include "core/svg/SVGPathSegList.h" @@ -52,10 +52,10 @@ class SVGPathSegCurvetoQuadraticSmoothAbs; class SVGPathSegCurvetoQuadraticSmoothRel; class SVGPathSegListPropertyTearOff; -class SVGPathElement FINAL : public SVGGraphicsElement, +class SVGPathElement FINAL : public SVGGeometryElement, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGPathElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGPathElement> create(Document&); float getTotalLength(); SVGPoint getPointAtLength(float distance); @@ -91,14 +91,14 @@ public: void pathSegListChanged(SVGPathSegRole, ListModification = ListModificationUnknown); - virtual FloatRect getBBox(StyleUpdateStrategy = AllowStyleUpdate); + virtual SVGRect getBBox() OVERRIDE FINAL; static const SVGPropertyInfo* dPropertyInfo(); bool isAnimValObserved() const { return m_isAnimValObserved; } private: - SVGPathElement(const QualifiedName&, Document&); + explicit SVGPathElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } @@ -112,11 +112,6 @@ private: static void synchronizeD(SVGElement* contextElement); static PassRefPtr<SVGAnimatedProperty> lookupOrCreateDWrapper(SVGElement* contextElement); - BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPathElement) - DECLARE_ANIMATED_NUMBER(PathLength, pathLength) - DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) - END_DECLARE_ANIMATED_PROPERTIES - virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE; virtual Node::InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; @@ -124,17 +119,17 @@ private: void invalidateMPathDependencies(); -private: OwnPtr<SVGPathByteStream> m_pathByteStream; mutable SVGSynchronizableAnimatedProperty<SVGPathSegList> m_pathSegList; bool m_isAnimValObserved; + + BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPathElement) + DECLARE_ANIMATED_NUMBER(PathLength, pathLength) + DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) + END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGPathElement* toSVGPathElement(Element* element) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!element || element->hasTagName(SVGNames::pathTag)); - return static_cast<SVGPathElement*>(element); -} +DEFINE_NODE_TYPE_CASTS(SVGPathElement, hasTagName(SVGNames::pathTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.idl index 083663bb15f..297b5b1d684 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathElement.idl @@ -24,81 +24,47 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGPathElement : SVGGraphicsElement { +interface SVGPathElement : SVGGeometryElement { readonly attribute SVGAnimatedNumber pathLength; float getTotalLength(); - SVGPoint getPointAtLength([Default=Undefined] optional float distance); - unsigned long getPathSegAtLength([Default=Undefined] optional float distance); + [StrictTypeChecking] SVGPoint getPointAtLength(float distance); + [StrictTypeChecking] unsigned long getPathSegAtLength(float distance); SVGPathSegClosePath createSVGPathSegClosePath(); - SVGPathSegMovetoAbs createSVGPathSegMovetoAbs([Default=Undefined] optional float x, - [Default=Undefined] optional float y); - SVGPathSegMovetoRel createSVGPathSegMovetoRel([Default=Undefined] optional float x, - [Default=Undefined] optional float y); + [StrictTypeChecking] SVGPathSegMovetoAbs createSVGPathSegMovetoAbs(float x, float y); + [StrictTypeChecking] SVGPathSegMovetoRel createSVGPathSegMovetoRel(float x, float y); - SVGPathSegLinetoAbs createSVGPathSegLinetoAbs([Default=Undefined] optional float x, - [Default=Undefined] optional float y); - SVGPathSegLinetoRel createSVGPathSegLinetoRel([Default=Undefined] optional float x, - [Default=Undefined] optional float y); + [StrictTypeChecking] SVGPathSegLinetoAbs createSVGPathSegLinetoAbs(float x, float y); + [StrictTypeChecking] SVGPathSegLinetoRel createSVGPathSegLinetoRel(float x, float y); - SVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float x1, - [Default=Undefined] optional float y1, - [Default=Undefined] optional float x2, - [Default=Undefined] optional float y2); - SVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float x1, - [Default=Undefined] optional float y1, - [Default=Undefined] optional float x2, - [Default=Undefined] optional float y2); + [StrictTypeChecking] SVGPathSegCurvetoCubicAbs + createSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2); + [StrictTypeChecking] SVGPathSegCurvetoCubicRel + createSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2); - SVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float x1, - [Default=Undefined] optional float y1); - SVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float x1, - [Default=Undefined] optional float y1); + [StrictTypeChecking] SVGPathSegCurvetoQuadraticAbs + createSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1); + [StrictTypeChecking] SVGPathSegCurvetoQuadraticRel + createSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1); - SVGPathSegArcAbs createSVGPathSegArcAbs([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float r1, - [Default=Undefined] optional float r2, - [Default=Undefined] optional float angle, - [Default=Undefined] optional boolean largeArcFlag, - [Default=Undefined] optional boolean sweepFlag); - SVGPathSegArcRel createSVGPathSegArcRel([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float r1, - [Default=Undefined] optional float r2, - [Default=Undefined] optional float angle, - [Default=Undefined] optional boolean largeArcFlag, - [Default=Undefined] optional boolean sweepFlag); + [StrictTypeChecking] SVGPathSegArcAbs + createSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, boolean largeArcFlag, boolean sweepFlag); + [StrictTypeChecking] SVGPathSegArcRel + createSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, boolean largeArcFlag, boolean sweepFlag); - SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs([Default=Undefined] optional float x); - SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel([Default=Undefined] optional float x); + [StrictTypeChecking] SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs(float x); + [StrictTypeChecking] SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel(float x); - SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs([Default=Undefined] optional float y); - SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel([Default=Undefined] optional float y); + [StrictTypeChecking] SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs(float y); + [StrictTypeChecking] SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel(float y); - SVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float x2, - [Default=Undefined] optional float y2); - SVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel([Default=Undefined] optional float x, - [Default=Undefined] optional float y, - [Default=Undefined] optional float x2, - [Default=Undefined] optional float y2); + [StrictTypeChecking] SVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2); + [StrictTypeChecking] SVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2); - SVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs([Default=Undefined] optional float x, - [Default=Undefined] optional float y); - SVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel([Default=Undefined] optional float x, - [Default=Undefined] optional float y); + [StrictTypeChecking] SVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y); + [StrictTypeChecking] SVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y); readonly attribute SVGPathSegList pathSegList; readonly attribute SVGPathSegList normalizedPathSegList; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathParser.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPathParser.cpp index 62c90c85bb5..6b7ac433993 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathParser.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathParser.cpp @@ -24,8 +24,8 @@ #include "config.h" #include "core/svg/SVGPathParser.h" -#include "core/platform/graphics/transforms/AffineTransform.h" #include "core/svg/SVGPathSource.h" +#include "platform/transforms/AffineTransform.h" #include "wtf/MathExtras.h" static const float gOneOverThree = 1 / 3.f; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathSeg.idl b/chromium/third_party/WebKit/Source/core/svg/SVGPathSeg.idl index 4ca8a2c53dd..60ed633dd31 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathSeg.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathSeg.idl @@ -25,7 +25,7 @@ */ [ - CustomToV8 + Custom=Wrap, ] interface SVGPathSeg { // Path Segment Types const unsigned short PATHSEG_UNKNOWN = 0; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListBuilder.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListBuilder.cpp index afc00b4a175..b394f526c14 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListBuilder.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListBuilder.cpp @@ -44,7 +44,6 @@ #include "core/svg/SVGPathSegLinetoRel.h" #include "core/svg/SVGPathSegLinetoVerticalAbs.h" #include "core/svg/SVGPathSegLinetoVerticalRel.h" -#include "core/svg/SVGPathSegList.h" #include "core/svg/SVGPathSegMovetoAbs.h" #include "core/svg/SVGPathSegMovetoRel.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListBuilder.h b/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListBuilder.h index 1c9e06d9d47..7b5c3aacbe2 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListBuilder.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListBuilder.h @@ -24,9 +24,9 @@ #ifndef SVGPathSegListBuilder_h #define SVGPathSegListBuilder_h -#include "core/platform/graphics/FloatPoint.h" #include "core/svg/SVGPathConsumer.h" #include "core/svg/SVGPathSegList.h" +#include "platform/geometry/FloatPoint.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListSource.h b/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListSource.h index b0e0cdd6160..9ff02c4d8ba 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListSource.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathSegListSource.h @@ -20,10 +20,10 @@ #ifndef SVGPathSegListSource_h #define SVGPathSegListSource_h -#include "core/platform/graphics/FloatPoint.h" #include "core/svg/SVGPathSeg.h" #include "core/svg/SVGPathSegList.h" #include "core/svg/SVGPathSource.h" +#include "platform/geometry/FloatPoint.h" #include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathSegWithContext.h b/chromium/third_party/WebKit/Source/core/svg/SVGPathSegWithContext.h index e2fbe84b4d3..c12689d24dc 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathSegWithContext.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathSegWithContext.h @@ -38,7 +38,7 @@ public: case PathSegUndefinedRole: return 0; case PathSegUnalteredRole: - return SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(m_element.get(), SVGPathElement::dPropertyInfo()); + return SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(m_element, SVGPathElement::dPropertyInfo()); case PathSegNormalizedRole: // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! return 0; @@ -47,7 +47,7 @@ public: return 0; } - SVGPathElement* contextElement() const { return m_element.get(); } + SVGPathElement* contextElement() const { return m_element; } SVGPathSegRole role() const { return m_role; } void setContextAndRole(SVGPathElement* element, SVGPathSegRole role) @@ -64,13 +64,12 @@ protected: return; } - ASSERT(m_role != PathSegUndefinedRole); m_element->pathSegListChanged(m_role); } private: SVGPathSegRole m_role; - RefPtr<SVGPathElement> m_element; + SVGPathElement* m_element; }; class SVGPathSegSingleCoordinate : public SVGPathSegWithContext { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathStringBuilder.h b/chromium/third_party/WebKit/Source/core/svg/SVGPathStringBuilder.h index 8e20442aba3..68938945e1a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathStringBuilder.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathStringBuilder.h @@ -20,8 +20,8 @@ #ifndef SVGPathStringBuilder_h #define SVGPathStringBuilder_h -#include "core/platform/graphics/FloatPoint.h" #include "core/svg/SVGPathConsumer.h" +#include "platform/geometry/FloatPoint.h" #include "wtf/text/StringBuilder.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathStringSource.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPathStringSource.cpp index 92c8ca64d15..75e983d6a2e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathStringSource.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathStringSource.cpp @@ -22,8 +22,8 @@ #include "core/svg/SVGPathStringSource.h" -#include "core/platform/graphics/FloatPoint.h" #include "core/svg/SVGParserUtilities.h" +#include "platform/geometry/FloatPoint.h" namespace WebCore { @@ -247,4 +247,4 @@ bool SVGPathStringSource::parseArcToSegment(float& rx, float& ry, float& angle, return parseArcToSegmentHelper(m_current.m_character16, m_end.m_character16, rx, ry, angle, largeArc, sweep, targetPoint); } -} // namespace WebKit +} // namespace blink diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathTraversalStateBuilder.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPathTraversalStateBuilder.cpp index 99d93630cf6..1fe2b5cb183 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathTraversalStateBuilder.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathTraversalStateBuilder.cpp @@ -21,7 +21,7 @@ */ #include "config.h" -#include "core/platform/graphics/PathTraversalState.h" +#include "platform/graphics/PathTraversalState.h" #include "core/svg/SVGPathTraversalStateBuilder.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPathUtilities.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPathUtilities.cpp index 2d938007a0e..dcbeb40b7b3 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPathUtilities.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPathUtilities.cpp @@ -21,7 +21,6 @@ #include "core/svg/SVGPathUtilities.h" -#include "core/platform/graphics/PathTraversalState.h" #include "core/svg/SVGPathBlender.h" #include "core/svg/SVGPathBuilder.h" #include "core/svg/SVGPathByteStreamBuilder.h" @@ -32,6 +31,7 @@ #include "core/svg/SVGPathStringBuilder.h" #include "core/svg/SVGPathStringSource.h" #include "core/svg/SVGPathTraversalStateBuilder.h" +#include "platform/graphics/PathTraversalState.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp index 0fdf163bbdd..110bd77a5ea 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPatternElement.cpp @@ -23,13 +23,11 @@ #include "core/svg/SVGPatternElement.h" -#include "SVGNames.h" #include "XLinkNames.h" -#include "core/platform/graphics/transforms/AffineTransform.h" #include "core/rendering/svg/RenderSVGResourcePattern.h" #include "core/svg/PatternAttributes.h" #include "core/svg/SVGElementInstance.h" -#include "core/svg/SVGFitToViewBox.h" +#include "platform/transforms/AffineTransform.h" namespace WebCore { @@ -62,8 +60,8 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPatternElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) END_REGISTER_ANIMATED_PROPERTIES -inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGPatternElement::SVGPatternElement(Document& document) + : SVGElement(SVGNames::patternTag, document) , m_x(LengthModeWidth) , m_y(LengthModeHeight) , m_width(LengthModeWidth) @@ -71,14 +69,13 @@ inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Docume , m_patternUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) , m_patternContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) { - ASSERT(hasTagName(SVGNames::patternTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGPatternElement(); } -PassRefPtr<SVGPatternElement> SVGPatternElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGPatternElement> SVGPatternElement::create(Document& document) { - return adoptRef(new SVGPatternElement(tagName, document)); + return adoptRef(new SVGPatternElement(document)); } bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName) @@ -155,8 +152,9 @@ void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName) || attrName == SVGNames::heightAttr) updateRelativeLengthsInformation(); - if (RenderObject* object = renderer()) - object->setNeedsLayout(); + RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); + if (renderer) + renderer->invalidateCacheAndMarkForLayout(); } void SVGPatternElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta) @@ -193,7 +191,7 @@ void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes) if (!attributes.hasHeight() && current->hasAttribute(SVGNames::heightAttr)) attributes.setHeight(current->heightCurrentValue()); - if (!attributes.hasViewBox() && current->hasAttribute(SVGNames::viewBoxAttr) && current->viewBoxIsValid()) + if (!attributes.hasViewBox() && current->hasAttribute(SVGNames::viewBoxAttr) && current->viewBoxCurrentValue().isValid()) attributes.setViewBox(current->viewBoxCurrentValue()); if (!attributes.hasPreserveAspectRatio() && current->hasAttribute(SVGNames::preserveAspectRatioAttr)) @@ -219,7 +217,7 @@ void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes) // Respect xlink:href, take attributes from referenced element Node* refNode = SVGURIReference::targetElementFromIRIString(current->hrefCurrentValue(), document()); if (refNode && refNode->hasTagName(SVGNames::patternTag)) { - current = static_cast<const SVGPatternElement*>(const_cast<const Node*>(refNode)); + current = toSVGPatternElement(const_cast<const Node*>(refNode)); // Cycle detection if (processedPatterns.contains(current)) { @@ -231,7 +229,7 @@ void SVGPatternElement::collectPatternAttributes(PatternAttributes& attributes) } } -AffineTransform SVGPatternElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const +AffineTransform SVGPatternElement::localCoordinateSpaceTransform(SVGElement::CTMScope) const { AffineTransform matrix; patternTransformCurrentValue().concatenate(matrix); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPatternElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGPatternElement.h index 2afb90df3a9..3536b4b89ea 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPatternElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPatternElement.h @@ -45,14 +45,14 @@ class SVGPatternElement FINAL : public SVGElement, public SVGExternalResourcesRequired, public SVGFitToViewBox { public: - static PassRefPtr<SVGPatternElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGPatternElement> create(Document&); void collectPatternAttributes(PatternAttributes&) const; - virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const; + virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const; private: - SVGPatternElement(const QualifiedName&, Document&); + explicit SVGPatternElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool needsPendingResourceHandling() const { return false; } @@ -86,11 +86,7 @@ private: virtual void synchronizeSystemLanguage() { SVGTests::synchronizeSystemLanguage(this); } }; -inline SVGPatternElement* toSVGPatternElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::patternTag)); - return static_cast<SVGPatternElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGPatternElement, hasTagName(SVGNames::patternTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPoint.h b/chromium/third_party/WebKit/Source/core/svg/SVGPoint.h index 78f91bb8bad..c258a0f3ad8 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPoint.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPoint.h @@ -26,7 +26,7 @@ #ifndef SVGPoint_h #define SVGPoint_h -#include "core/platform/graphics/FloatRect.h" +#include "platform/geometry/FloatRect.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPoint.idl b/chromium/third_party/WebKit/Source/core/svg/SVGPoint.idl index 19606d63a57..d8945c9ed72 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPoint.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPoint.idl @@ -24,6 +24,6 @@ interface SVGPoint { [StrictTypeChecking] attribute float x; [StrictTypeChecking] attribute float y; - [StrictTypeChecking] SVGPoint matrixTransform(SVGMatrix matrix); + [MeasureAs=SVGPointMatrixTransform, StrictTypeChecking] SVGPoint matrixTransform(SVGMatrix matrix); }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPointList.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPointList.cpp index 10013e63f2f..3b7d9b91f0e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPointList.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPointList.cpp @@ -21,7 +21,7 @@ #include "config.h" #include "core/svg/SVGPointList.h" -#include "core/platform/graphics/FloatPoint.h" +#include "platform/geometry/FloatPoint.h" #include "wtf/text/StringBuilder.h" #include "wtf/text/WTFString.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPolyElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPolyElement.cpp index a6eec9b2fd5..8f984b9be0f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPolyElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPolyElement.cpp @@ -22,7 +22,6 @@ #include "core/svg/SVGPolyElement.h" -#include "SVGNames.h" #include "core/dom/Document.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/svg/SVGAnimatedPointList.h" @@ -46,6 +45,17 @@ const SVGPropertyInfo* SVGPolyElement::pointsPropertyInfo() return s_propertyInfo; } +SVGPointList& SVGPolyElement::pointsCurrentValue() +{ + SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo()); + if (wrapper && wrapper->isAnimating()) { + if (SVGListPropertyTearOff<SVGPointList>* ap = animatedPoints()) + return ap->values(); + } + + return m_points.value; +} + // Animated property definitions DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr, ExternalResourcesRequired, externalResourcesRequired) @@ -56,7 +66,7 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) END_REGISTER_ANIMATED_PROPERTIES SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) + : SVGGeometryElement(tagName, document) { registerAnimatedPropertiesForSVGPolyElement(); } @@ -65,7 +75,6 @@ bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); if (supportedAttributes.isEmpty()) { - SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); supportedAttributes.add(SVGNames::pointsAttr); } @@ -75,7 +84,7 @@ bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (!isSupportedAttribute(name)) { - SVGGraphicsElement::parseAttribute(name, value); + SVGGeometryElement::parseAttribute(name, value); return; } @@ -91,8 +100,6 @@ void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin return; } - if (SVGLangSpace::parseAttribute(name, value)) - return; if (SVGExternalResourcesRequired::parseAttribute(name, value)) return; @@ -102,7 +109,7 @@ void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { - SVGGraphicsElement::svgAttributeChanged(attrName); + SVGGeometryElement::svgAttributeChanged(attrName); return; } @@ -118,7 +125,7 @@ void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) return; } - if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { + if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); return; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPolyElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGPolyElement.h index 617de152ec4..4cc460158df 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPolyElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPolyElement.h @@ -24,18 +24,18 @@ #include "SVGNames.h" #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGExternalResourcesRequired.h" -#include "core/svg/SVGGraphicsElement.h" +#include "core/svg/SVGGeometryElement.h" #include "core/svg/SVGPointList.h" namespace WebCore { -class SVGPolyElement : public SVGGraphicsElement +class SVGPolyElement : public SVGGeometryElement , public SVGExternalResourcesRequired { public: SVGListPropertyTearOff<SVGPointList>* points(); SVGListPropertyTearOff<SVGPointList>* animatedPoints(); - SVGPointList& pointList() const { return m_points.value; } + SVGPointList& pointsCurrentValue(); static const SVGPropertyInfo* pointsPropertyInfo(); @@ -56,20 +56,21 @@ private: static void synchronizePoints(SVGElement* contextElement); static PassRefPtr<SVGAnimatedProperty> lookupOrCreatePointsWrapper(SVGElement* contextElement); + mutable SVGSynchronizableAnimatedProperty<SVGPointList> m_points; + +private: BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGPolyElement) DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired) END_DECLARE_ANIMATED_PROPERTIES - -protected: - mutable SVGSynchronizableAnimatedProperty<SVGPointList> m_points; }; -inline SVGPolyElement* toSVGPolyElement(SVGElement* element) +inline bool isSVGPolyElement(const Node& node) { - ASSERT_WITH_SECURITY_IMPLICATION(!element || element->hasTagName(SVGNames::polygonTag) || element->hasTagName(SVGNames::polylineTag)); - return static_cast<SVGPolyElement*>(element); + return node.hasTagName(SVGNames::polygonTag) || node.hasTagName(SVGNames::polylineTag); } +DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGPolyElement); + } // namespace WebCore #endif diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.cpp index 28175e4bb41..14d7a94ebc7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.cpp @@ -20,21 +20,19 @@ #include "config.h" -#include "SVGNames.h" #include "core/svg/SVGPolygonElement.h" namespace WebCore { -inline SVGPolygonElement::SVGPolygonElement(const QualifiedName& tagName, Document& document) - : SVGPolyElement(tagName, document) +inline SVGPolygonElement::SVGPolygonElement(Document& document) + : SVGPolyElement(SVGNames::polygonTag, document) { - ASSERT(hasTagName(SVGNames::polygonTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGPolygonElement> SVGPolygonElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGPolygonElement> SVGPolygonElement::create(Document& document) { - return adoptRef(new SVGPolygonElement(tagName, document)); + return adoptRef(new SVGPolygonElement(document)); } } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.h index 0076f6495aa..89571f75749 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.h @@ -28,17 +28,13 @@ namespace WebCore { class SVGPolygonElement FINAL : public SVGPolyElement { public: - static PassRefPtr<SVGPolygonElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGPolygonElement> create(Document&); private: - SVGPolygonElement(const QualifiedName&, Document&); + explicit SVGPolygonElement(Document&); }; -inline SVGPolygonElement* toSVGPolygonElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::polygonTag)); - return static_cast<SVGPolygonElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGPolygonElement, hasTagName(SVGNames::polygonTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.idl index 735067bd44b..be639f1d8c7 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPolygonElement.idl @@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGPolygonElement : SVGGraphicsElement { +interface SVGPolygonElement : SVGGeometryElement { readonly attribute SVGPointList points; readonly attribute SVGPointList animatedPoints; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.cpp index 15b878d76a6..d3c3323f655 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.cpp @@ -20,21 +20,19 @@ #include "config.h" -#include "SVGNames.h" #include "core/svg/SVGPolylineElement.h" namespace WebCore { -inline SVGPolylineElement::SVGPolylineElement(const QualifiedName& tagName, Document& document) - : SVGPolyElement(tagName, document) +inline SVGPolylineElement::SVGPolylineElement(Document& document) + : SVGPolyElement(SVGNames::polylineTag, document) { - ASSERT(hasTagName(SVGNames::polylineTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGPolylineElement> SVGPolylineElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGPolylineElement> SVGPolylineElement::create(Document& document) { - return adoptRef(new SVGPolylineElement(tagName, document)); + return adoptRef(new SVGPolylineElement(document)); } } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.h index fe1a5c078ac..428314366de 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.h @@ -28,17 +28,13 @@ namespace WebCore { class SVGPolylineElement FINAL : public SVGPolyElement { public: - static PassRefPtr<SVGPolylineElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGPolylineElement> create(Document&); private: - SVGPolylineElement(const QualifiedName&, Document&); + explicit SVGPolylineElement(Document&); }; -inline SVGPolylineElement* toSVGPolylineElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::polylineTag)); - return static_cast<SVGPolylineElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGPolylineElement, hasTagName(SVGNames::polylineTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.idl index a7eefed045f..1fd499b8d96 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPolylineElement.idl @@ -23,7 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGPolylineElement : SVGGraphicsElement { +interface SVGPolylineElement : SVGGeometryElement { readonly attribute SVGPointList points; readonly attribute SVGPointList animatedPoints; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.cpp index 5e425e323d6..5e9de721a00 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.cpp @@ -24,9 +24,9 @@ #include "bindings/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" -#include "core/platform/graphics/FloatRect.h" -#include "core/platform/graphics/transforms/AffineTransform.h" #include "core/svg/SVGParserUtilities.h" +#include "platform/geometry/FloatRect.h" +#include "platform/transforms/AffineTransform.h" #include "wtf/text/WTFString.h" namespace WebCore { @@ -37,20 +37,20 @@ SVGPreserveAspectRatio::SVGPreserveAspectRatio() { } -void SVGPreserveAspectRatio::setAlign(unsigned short align, ExceptionState& es) +void SVGPreserveAspectRatio::setAlign(unsigned short align, ExceptionState& exceptionState) { if (align == SVG_PRESERVEASPECTRATIO_UNKNOWN || align > SVG_PRESERVEASPECTRATIO_XMAXYMAX) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return; } m_align = static_cast<SVGPreserveAspectRatioType>(align); } -void SVGPreserveAspectRatio::setMeetOrSlice(unsigned short meetOrSlice, ExceptionState& es) +void SVGPreserveAspectRatio::setMeetOrSlice(unsigned short meetOrSlice, ExceptionState& exceptionState) { if (meetOrSlice == SVG_MEETORSLICE_UNKNOWN || meetOrSlice > SVG_MEETORSLICE_SLICE) { - es.throwDOMException(NotSupportedError); + exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); return; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.idl b/chromium/third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.idl index 178f1a048d6..477369ee6d9 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGPreserveAspectRatio.idl @@ -42,8 +42,8 @@ interface SVGPreserveAspectRatio { const unsigned short SVG_MEETORSLICE_MEET = 1; const unsigned short SVG_MEETORSLICE_SLICE = 2; - [StrictTypeChecking, SetterRaisesException] attribute unsigned short align; + [StrictTypeChecking, RaisesException=Setter] attribute unsigned short align; - [StrictTypeChecking, SetterRaisesException] attribute unsigned short meetOrSlice; + [StrictTypeChecking, RaisesException=Setter] attribute unsigned short meetOrSlice; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGRadialGradientElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGRadialGradientElement.cpp index cb286b150fe..af45582ec58 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGRadialGradientElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGRadialGradientElement.cpp @@ -25,7 +25,6 @@ #include "core/svg/SVGRadialGradientElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGResourceRadialGradient.h" #include "core/svg/RadialGradientAttributes.h" #include "core/svg/SVGElementInstance.h" @@ -51,8 +50,8 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGRadialGradientElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGradientElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& tagName, Document& document) - : SVGGradientElement(tagName, document) +inline SVGRadialGradientElement::SVGRadialGradientElement(Document& document) + : SVGGradientElement(SVGNames::radialGradientTag, document) , m_cx(LengthModeWidth, "50%") , m_cy(LengthModeHeight, "50%") , m_r(LengthModeOther, "50%") @@ -61,14 +60,13 @@ inline SVGRadialGradientElement::SVGRadialGradientElement(const QualifiedName& t , m_fr(LengthModeOther, "0%") { // Spec: If the cx/cy/r/fr attribute is not specified, the effect is as if a value of "50%" were specified. - ASSERT(hasTagName(SVGNames::radialGradientTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGRadialGradientElement(); } -PassRefPtr<SVGRadialGradientElement> SVGRadialGradientElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGRadialGradientElement> SVGRadialGradientElement::create(Document& document) { - return adoptRef(new SVGRadialGradientElement(tagName, document)); + return adoptRef(new SVGRadialGradientElement(document)); } bool SVGRadialGradientElement::isSupportedAttribute(const QualifiedName& attrName) @@ -120,8 +118,9 @@ void SVGRadialGradientElement::svgAttributeChanged(const QualifiedName& attrName updateRelativeLengthsInformation(); - if (RenderObject* object = renderer()) - object->setNeedsLayout(); + RenderSVGResourceContainer* renderer = toRenderSVGResourceContainer(this->renderer()); + if (renderer) + renderer->invalidateCacheAndMarkForLayout(); } RenderObject* SVGRadialGradientElement::createRenderer(RenderStyle*) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGRadialGradientElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGRadialGradientElement.h index 4b7c376a3ac..e448d2077c8 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGRadialGradientElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGRadialGradientElement.h @@ -31,12 +31,12 @@ struct RadialGradientAttributes; class SVGRadialGradientElement FINAL : public SVGGradientElement { public: - static PassRefPtr<SVGRadialGradientElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGRadialGradientElement> create(Document&); bool collectGradientAttributes(RadialGradientAttributes&); private: - SVGRadialGradientElement(const QualifiedName&, Document&); + explicit SVGRadialGradientElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -56,11 +56,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGRadialGradientElement* toSVGRadialGradientElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::radialGradientTag)); - return static_cast<SVGRadialGradientElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGRadialGradientElement, hasTagName(SVGNames::radialGradientTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGRect.h b/chromium/third_party/WebKit/Source/core/svg/SVGRect.h index a5c22121b96..775c1966012 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGRect.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGRect.h @@ -20,17 +20,42 @@ #ifndef SVGRect_h #define SVGRect_h -#include "core/platform/graphics/FloatRect.h" #include "core/svg/properties/SVGPropertyTraits.h" +#include "platform/geometry/FloatRect.h" #include "wtf/text/StringBuilder.h" namespace WebCore { -typedef FloatRect SVGRect; +class SVGRect : public FloatRect { +public: + struct InvalidSVGRectTag { }; + + SVGRect() + : m_isValid(true) { } + SVGRect(InvalidSVGRectTag) + : m_isValid(false) { } + SVGRect(const FloatRect& rect) + : FloatRect(rect), m_isValid(true) { } + SVGRect(const FloatPoint& location, const FloatSize& size) + : FloatRect(location, size), m_isValid(true) { } + SVGRect(float x, float y, float width, float height) + : FloatRect(x, y, width, height), m_isValid(true) { } + SVGRect(const IntRect& intRect) + : FloatRect(intRect), m_isValid(true) { } + SVGRect(const LayoutRect& layoutRect) + : FloatRect(layoutRect), m_isValid(true) { } + SVGRect(const SkRect& skRect) + : FloatRect(skRect), m_isValid(true) { } + + bool isValid() const { return m_isValid; } + +private: + bool m_isValid; +}; template<> struct SVGPropertyTraits<SVGRect> { - static SVGRect initialValue() { return SVGRect(); } + static SVGRect initialValue() { return SVGRect(SVGRect::InvalidSVGRectTag()); } static String toString(const SVGRect& type) { StringBuilder builder; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.cpp index 2f0e12c0b97..61c539edf11 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.cpp @@ -22,7 +22,6 @@ #include "core/svg/SVGRectElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGRect.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/svg/SVGElementInstance.h" @@ -50,8 +49,8 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGRectElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGRectElement::SVGRectElement(Document& document) + : SVGGeometryElement(SVGNames::rectTag, document) , m_x(LengthModeWidth) , m_y(LengthModeHeight) , m_width(LengthModeWidth) @@ -59,21 +58,19 @@ inline SVGRectElement::SVGRectElement(const QualifiedName& tagName, Document& do , m_rx(LengthModeWidth) , m_ry(LengthModeHeight) { - ASSERT(hasTagName(SVGNames::rectTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGRectElement(); } -PassRefPtr<SVGRectElement> SVGRectElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGRectElement> SVGRectElement::create(Document& document) { - return adoptRef(new SVGRectElement(tagName, document)); + return adoptRef(new SVGRectElement(document)); } bool SVGRectElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); if (supportedAttributes.isEmpty()) { - SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); supportedAttributes.add(SVGNames::xAttr); supportedAttributes.add(SVGNames::yAttr); @@ -90,7 +87,7 @@ void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin SVGParsingError parseError = NoError; if (!isSupportedAttribute(name)) - SVGGraphicsElement::parseAttribute(name, value); + SVGGeometryElement::parseAttribute(name, value); else if (name == SVGNames::xAttr) setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); else if (name == SVGNames::yAttr) @@ -103,8 +100,7 @@ void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); else if (name == SVGNames::heightAttr) setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); - else if (SVGLangSpace::parseAttribute(name, value) - || SVGExternalResourcesRequired::parseAttribute(name, value)) { + else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { } else ASSERT_NOT_REACHED(); @@ -114,7 +110,7 @@ void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicStrin void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) { if (!isSupportedAttribute(attrName)) { - SVGGraphicsElement::svgAttributeChanged(attrName); + SVGGeometryElement::svgAttributeChanged(attrName); return; } @@ -140,7 +136,7 @@ void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName) return; } - if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { + if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); return; } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.h index 2c631b81ac7..1a500884f4e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.h @@ -25,17 +25,17 @@ #include "core/svg/SVGAnimatedBoolean.h" #include "core/svg/SVGAnimatedLength.h" #include "core/svg/SVGExternalResourcesRequired.h" -#include "core/svg/SVGGraphicsElement.h" +#include "core/svg/SVGGeometryElement.h" namespace WebCore { -class SVGRectElement FINAL : public SVGGraphicsElement, +class SVGRectElement FINAL : public SVGGeometryElement, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGRectElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGRectElement> create(Document&); private: - SVGRectElement(const QualifiedName&, Document&); + explicit SVGRectElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } @@ -59,11 +59,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGRectElement* toSVGRectElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::rectTag)); - return static_cast<SVGRectElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGRectElement, hasTagName(SVGNames::rectTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.idl index 42fe0633946..a3cf85e5d7a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGRectElement.idl @@ -24,7 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -interface SVGRectElement : SVGGraphicsElement { +interface SVGRectElement : SVGGeometryElement { readonly attribute SVGAnimatedLength x; readonly attribute SVGAnimatedLength y; readonly attribute SVGAnimatedLength width; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGRenderingIntent.idl b/chromium/third_party/WebKit/Source/core/svg/SVGRenderingIntent.idl index 5c081536e13..4092cda304f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGRenderingIntent.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGRenderingIntent.idl @@ -23,9 +23,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - DoNotGenerateToV8 -] interface SVGRenderingIntent { +interface SVGRenderingIntent { // Rendering Intent Types const unsigned short RENDERING_INTENT_UNKNOWN = 0; const unsigned short RENDERING_INTENT_AUTO = 1; @@ -34,4 +32,3 @@ const unsigned short RENDERING_INTENT_SATURATION = 4; const unsigned short RENDERING_INTENT_ABSOLUTE_COLORIMETRIC = 5; }; - diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp index f15b610e5c2..f53db048703 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.cpp @@ -29,18 +29,15 @@ #include "core/css/CSSHelper.h" #include "core/dom/Document.h" #include "core/dom/ElementTraversal.h" -#include "core/dom/EventListener.h" -#include "core/dom/EventNames.h" #include "core/dom/NodeTraversal.h" #include "core/dom/StaticNodeList.h" #include "core/editing/FrameSelection.h" -#include "core/page/Frame.h" +#include "core/events/EventListener.h" +#include "core/events/ThreadLocalEventNames.h" +#include "core/frame/Frame.h" #include "core/page/FrameTree.h" -#include "core/page/FrameView.h" -#include "core/page/UseCounter.h" -#include "core/platform/FloatConversion.h" -#include "core/platform/graphics/FloatRect.h" -#include "core/platform/graphics/transforms/AffineTransform.h" +#include "core/frame/FrameView.h" +#include "core/frame/UseCounter.h" #include "core/rendering/RenderObject.h" #include "core/rendering/RenderPart.h" #include "core/rendering/svg/RenderSVGModelObject.h" @@ -49,13 +46,16 @@ #include "core/rendering/svg/RenderSVGViewportContainer.h" #include "core/svg/SVGAngle.h" #include "core/svg/SVGElementInstance.h" -#include "core/svg/SVGFitToViewBox.h" #include "core/svg/SVGPreserveAspectRatio.h" #include "core/svg/SVGTransform.h" #include "core/svg/SVGTransformList.h" #include "core/svg/SVGViewElement.h" #include "core/svg/SVGViewSpec.h" #include "core/svg/animation/SMILTimeContainer.h" +#include "platform/FloatConversion.h" +#include "platform/LengthFunctions.h" +#include "platform/geometry/FloatRect.h" +#include "platform/transforms/AffineTransform.h" #include "wtf/StdLibExtras.h" namespace WebCore { @@ -80,8 +80,8 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSVGElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& doc) - : SVGGraphicsElement(tagName, doc) +inline SVGSVGElement::SVGSVGElement(Document& doc) + : SVGGraphicsElement(SVGNames::svgTag, doc) , m_x(LengthModeWidth) , m_y(LengthModeHeight) , m_width(LengthModeWidth, "100%") @@ -89,26 +89,26 @@ inline SVGSVGElement::SVGSVGElement(const QualifiedName& tagName, Document& doc) , m_useCurrentView(false) , m_zoomAndPan(SVGZoomAndPanMagnify) , m_timeContainer(SMILTimeContainer::create(this)) + , m_weakFactory(this) { - ASSERT(hasTagName(SVGNames::svgTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGSVGElement(); - UseCounter::count(&doc, UseCounter::SVGSVGElement); + UseCounter::count(doc, UseCounter::SVGSVGElement); } -PassRefPtr<SVGSVGElement> SVGSVGElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGSVGElement> SVGSVGElement::create(Document& document) { - return adoptRef(new SVGSVGElement(tagName, document)); + return adoptRef(new SVGSVGElement(document)); } SVGSVGElement::~SVGSVGElement() { - if (m_viewSpec) - m_viewSpec->resetContextElement(); // There are cases where removedFromDocument() is not called. // see ContainerNode::removeAllChildren, called by its destructor. document().accessSVGExtensions()->removeTimeContainer(this); + + ASSERT(inDocument() || !accessDocumentSVGExtensions()->isSVGRootWithRelativeLengthDescendents(this)); } const AtomicString& SVGSVGElement::contentScriptType() const @@ -144,14 +144,12 @@ SVGRect SVGSVGElement::viewport() const float SVGSVGElement::pixelUnitToMillimeterX() const { - // 2.54 / cssPixelsPerInch gives CM. - return (2.54f / cssPixelsPerInch) * 10.0f; + return 1 / cssPixelsPerMillimeter; } float SVGSVGElement::pixelUnitToMillimeterY() const { - // 2.54 / cssPixelsPerInch gives CM. - return (2.54f / cssPixelsPerInch) * 10.0f; + return 1 / cssPixelsPerMillimeter; } float SVGSVGElement::screenPixelToMillimeterX() const @@ -167,7 +165,7 @@ float SVGSVGElement::screenPixelToMillimeterY() const SVGViewSpec* SVGSVGElement::currentView() { if (!m_viewSpec) - m_viewSpec = SVGViewSpec::create(this); + m_viewSpec = SVGViewSpec::create(m_weakFactory.createWeakPtr()); return m_viewSpec.get(); } @@ -180,13 +178,12 @@ float SVGSVGElement::currentScale() const if (!frame) return 1; - FrameTree* frameTree = frame->tree(); - ASSERT(frameTree); + const FrameTree& frameTree = frame->tree(); // The behaviour of currentScale() is undefined, when we're dealing with non-standalone SVG documents. // If the svg is embedded, the scaling is handled by the host renderer, so when asking from inside // the SVG document, a scale value of 1 seems reasonable, as it doesn't know anything about the parent scale. - return frameTree->parent() ? 1 : frame->pageZoomFactor(); + return frameTree.parent() ? 1 : frame->pageZoomFactor(); } void SVGSVGElement::setCurrentScale(float scale) @@ -198,13 +195,12 @@ void SVGSVGElement::setCurrentScale(float scale) if (!frame) return; - FrameTree* frameTree = frame->tree(); - ASSERT(frameTree); + const FrameTree& frameTree = frame->tree(); // The behaviour of setCurrentScale() is undefined, when we're dealing with non-standalone SVG documents. // We choose the ignore this call, it's pretty useless to support calling setCurrentScale() from within // an embedded SVG document, for the same reasons as in currentScale() - needs resolution by SVG WG. - if (frameTree->parent()) + if (frameTree.parent()) return; frame->setPageZoomFactor(scale); @@ -221,7 +217,7 @@ void SVGSVGElement::updateCurrentTranslate() if (RenderObject* object = renderer()) object->setNeedsLayout(); - if (parentNode() == &document() && document().renderer()) + if (parentNode() == document() && document().renderer()) document().renderer()->repaint(); } @@ -234,13 +230,13 @@ void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString // Only handle events if we're the outermost <svg> element if (name == HTMLNames::onunloadAttr) - document().setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document().frame(), name, value)); + document().setWindowAttributeEventListener(EventTypeNames::unload, createAttributeEventListener(document().frame(), name, value)); else if (name == HTMLNames::onresizeAttr) - document().setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document().frame(), name, value)); + document().setWindowAttributeEventListener(EventTypeNames::resize, createAttributeEventListener(document().frame(), name, value)); else if (name == HTMLNames::onscrollAttr) - document().setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document().frame(), name, value)); + document().setWindowAttributeEventListener(EventTypeNames::scroll, createAttributeEventListener(document().frame(), name, value)); else if (name == SVGNames::onzoomAttr) - document().setWindowAttributeEventListener(eventNames().zoomEvent, createAttributeEventListener(document().frame(), name, value)); + document().setWindowAttributeEventListener(EventTypeNames::zoom, createAttributeEventListener(document().frame(), name, value)); else setListener = false; @@ -249,9 +245,9 @@ void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString } if (name == HTMLNames::onabortAttr) - document().setWindowAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(document().frame(), name, value)); + document().setWindowAttributeEventListener(EventTypeNames::abort, createAttributeEventListener(document().frame(), name, value)); else if (name == HTMLNames::onerrorAttr) - document().setWindowAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(document().frame(), name, value)); + document().setWindowAttributeEventListener(EventTypeNames::error, createAttributeEventListener(document().frame(), name, value)); else if (name == SVGNames::xAttr) setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError)); else if (name == SVGNames::yAttr) @@ -260,8 +256,7 @@ void SVGSVGElement::parseAttribute(const QualifiedName& name, const AtomicString setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); else if (name == SVGNames::heightAttr) setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); - else if (SVGLangSpace::parseAttribute(name, value) - || SVGExternalResourcesRequired::parseAttribute(name, value) + else if (SVGExternalResourcesRequired::parseAttribute(name, value) || SVGFitToViewBox::parseAttribute(this, name, value) || SVGZoomAndPan::parseAttribute(this, name, value)) { } else @@ -300,7 +295,6 @@ void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName) SVGElementInstance::InvalidationGuard invalidationGuard(this); if (updateRelativeLengthsOrViewBox - || SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired::isKnownAttribute(attrName) || SVGZoomAndPan::isKnownAttribute(attrName)) { if (renderer()) @@ -335,7 +329,7 @@ void SVGSVGElement::forceRedraw() PassRefPtr<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const SVGRect& rect, SVGElement* referenceElement, CollectIntersectionOrEnclosure collect) const { Vector<RefPtr<Node> > nodes; - Element* element = ElementTraversal::next(referenceElement ? referenceElement : this); + Element* element = ElementTraversal::next(*(referenceElement ? referenceElement : this)); while (element) { if (element->isSVGElement()) { SVGElement* svgElement = toSVGElement(element); @@ -348,7 +342,7 @@ PassRefPtr<NodeList> SVGSVGElement::collectIntersectionOrEnclosureList(const SVG } } - element = ElementTraversal::next(element, referenceElement ? referenceElement : this); + element = ElementTraversal::next(*element, referenceElement ? referenceElement : this); } return StaticNodeList::adopt(nodes); } @@ -423,7 +417,7 @@ SVGTransform SVGSVGElement::createSVGTransformFromMatrix(const SVGMatrix& matrix return SVGTransform(static_cast<const AffineTransform&>(matrix)); } -AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const +AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGElement::CTMScope mode) const { AffineTransform viewBoxTransform; if (!hasEmptyViewBox()) { @@ -435,7 +429,7 @@ AffineTransform SVGSVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMSc if (!isOutermostSVGSVGElement()) { SVGLengthContext lengthContext(this); transform.translate(xCurrentValue().value(lengthContext), yCurrentValue().value(lengthContext)); - } else if (mode == SVGLocatable::ScreenScope) { + } else if (mode == SVGElement::ScreenScope) { if (RenderObject* renderer = this->renderer()) { FloatPoint location; float zoomFactor = 1; @@ -505,8 +499,12 @@ Node::InsertionNotificationRequest SVGSVGElement::insertedInto(ContainerNode* ro void SVGSVGElement::removedFrom(ContainerNode* rootParent) { - if (rootParent->inDocument()) - document().accessSVGExtensions()->removeTimeContainer(this); + if (rootParent->inDocument()) { + SVGDocumentExtensions* svgExtensions = document().accessSVGExtensions(); + svgExtensions->removeTimeContainer(this); + svgExtensions->removeSVGRootWithRelativeLengthDescendents(this); + } + SVGGraphicsElement::removedFrom(rootParent); } @@ -569,7 +567,7 @@ SVGRect SVGSVGElement::currentViewBoxRect() const // If no viewBox is specified but non-relative width/height values, then we // should always synthesize a viewBox if we're embedded through a SVGImage. - return SVGRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0), floatValueForLength(intrinsicHeight, 0))); + return SVGRect(FloatPoint(), FloatSize(floatValueForLength(intrinsicWidth, 0, 0), floatValueForLength(intrinsicHeight, 0, 0))); } FloatSize SVGSVGElement::currentViewportSize() const @@ -724,9 +722,7 @@ void SVGSVGElement::setupInitialView(const String& fragmentIdentifier, Element* if (!viewElement) return; - SVGElement* element = SVGLocatable::nearestViewportElement(viewElement); - if (element->hasTagName(SVGNames::svgTag)) { - SVGSVGElement* svg = toSVGSVGElement(element); + if (SVGSVGElement* svg = viewElement->ownerSVGElement()) { svg->inheritViewAttributes(viewElement); if (RenderObject* renderer = svg->renderer()) @@ -769,7 +765,7 @@ Element* SVGSVGElement::getElementById(const AtomicString& id) const // Fall back to traversing our subtree. Duplicate ids are allowed, the first found will // be returned. - for (Node* node = firstChild(); node; node = NodeTraversal::next(node, this)) { + for (Node* node = firstChild(); node; node = NodeTraversal::next(*node, this)) { if (!node->isElementNode()) continue; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h index 54b39de7ead..65f8c69c30e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h @@ -29,6 +29,7 @@ #include "core/svg/SVGFitToViewBox.h" #include "core/svg/SVGGraphicsElement.h" #include "core/svg/SVGZoomAndPan.h" +#include "wtf/WeakPtr.h" namespace WebCore { @@ -44,7 +45,7 @@ class SVGSVGElement FINAL : public SVGGraphicsElement, public SVGFitToViewBox, public SVGZoomAndPan { public: - static PassRefPtr<SVGSVGElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGSVGElement> create(Document&); using SVGGraphicsElement::ref; using SVGGraphicsElement::deref; @@ -130,10 +131,10 @@ public: SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; } void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); } - bool hasEmptyViewBox() const { return viewBoxIsValid() && viewBoxCurrentValue().isEmpty(); } + bool hasEmptyViewBox() const { return viewBoxCurrentValue().isValid() && viewBoxCurrentValue().isEmpty(); } private: - SVGSVGElement(const QualifiedName&, Document&); + explicit SVGSVGElement(Document&); virtual ~SVGSVGElement(); virtual bool isSVGSVGElement() const OVERRIDE { return true; } @@ -169,26 +170,22 @@ private: DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio) END_DECLARE_ANIMATED_PROPERTIES - virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const; + virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const; bool m_useCurrentView; SVGZoomAndPanType m_zoomAndPan; RefPtr<SMILTimeContainer> m_timeContainer; SVGPoint m_translation; RefPtr<SVGViewSpec> m_viewSpec; + WeakPtrFactory<SVGSVGElement> m_weakFactory; }; -inline SVGSVGElement* toSVGSVGElement(Node* node) +inline bool isSVGSVGElement(const Node& node) { - ASSERT_WITH_SECURITY_IMPLICATION(!node || toSVGElement(node)->isSVGSVGElement()); - return static_cast<SVGSVGElement*>(node); + return node.isSVGElement() && toSVGElement(node).isSVGSVGElement(); } -inline const SVGSVGElement* toSVGSVGElement(const Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || toSVGElement(node)->isSVGSVGElement()); - return static_cast<const SVGSVGElement*>(node); -} +DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSVGElement); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp index c7d848288e0..9a7040f1093 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGScriptElement.cpp @@ -27,8 +27,8 @@ #include "bindings/v8/ScriptEventListener.h" #include "core/dom/Attribute.h" #include "core/dom/Document.h" -#include "core/dom/EventNames.h" #include "core/dom/ScriptLoader.h" +#include "core/events/ThreadLocalEventNames.h" #include "core/svg/SVGElementInstance.h" #include "core/svg/properties/SVGAnimatedStaticPropertyTearOff.h" @@ -43,19 +43,18 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGScriptElement) REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) END_REGISTER_ANIMATED_PROPERTIES -inline SVGScriptElement::SVGScriptElement(const QualifiedName& tagName, Document& document, bool wasInsertedByParser, bool alreadyStarted) - : SVGElement(tagName, document) +inline SVGScriptElement::SVGScriptElement(Document& document, bool wasInsertedByParser, bool alreadyStarted) + : SVGElement(SVGNames::scriptTag, document) , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) , m_loader(ScriptLoader::create(this, wasInsertedByParser, alreadyStarted)) { - ASSERT(hasTagName(SVGNames::scriptTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGScriptElement(); } -PassRefPtr<SVGScriptElement> SVGScriptElement::create(const QualifiedName& tagName, Document& document, bool insertedByParser) +PassRefPtr<SVGScriptElement> SVGScriptElement::create(Document& document, bool insertedByParser) { - return adoptRef(new SVGScriptElement(tagName, document, insertedByParser, false)); + return adoptRef(new SVGScriptElement(document, insertedByParser, false)); } bool SVGScriptElement::isSupportedAttribute(const QualifiedName& attrName) @@ -83,7 +82,7 @@ void SVGScriptElement::parseAttribute(const QualifiedName& name, const AtomicStr } if (name == HTMLNames::onerrorAttr) { - setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, name, value)); + setAttributeEventListener(EventTypeNames::error, createAttributeEventListener(this, name, value)); return; } @@ -211,7 +210,7 @@ bool SVGScriptElement::hasSourceAttribute() const PassRefPtr<Element> SVGScriptElement::cloneElementWithoutAttributesAndChildren() { - return adoptRef(new SVGScriptElement(tagQName(), document(), false, m_loader->alreadyStarted())); + return adoptRef(new SVGScriptElement(document(), false, m_loader->alreadyStarted())); } void SVGScriptElement::setHaveFiredLoadEvent(bool haveFiredLoadEvent) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGScriptElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGScriptElement.h index 10c5d4569a4..ec59d85ad68 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGScriptElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGScriptElement.h @@ -39,7 +39,7 @@ class SVGScriptElement FINAL , public SVGExternalResourcesRequired , public ScriptLoaderClient { public: - static PassRefPtr<SVGScriptElement> create(const QualifiedName&, Document&, bool wasInsertedByParser); + static PassRefPtr<SVGScriptElement> create(Document&, bool wasInsertedByParser); String type() const; void setType(const String&); @@ -47,7 +47,7 @@ public: ScriptLoader* loader() const { return m_loader.get(); } private: - SVGScriptElement(const QualifiedName&, Document&, bool wasInsertedByParser, bool alreadyStarted); + SVGScriptElement(Document&, bool wasInsertedByParser, bool alreadyStarted); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -94,11 +94,7 @@ private: OwnPtr<ScriptLoader> m_loader; }; -inline SVGScriptElement* toSVGScriptElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::scriptTag)); - return static_cast<SVGScriptElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGScriptElement, hasTagName(SVGNames::scriptTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGSetElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGSetElement.cpp index 934ed567571..da8334b751c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGSetElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGSetElement.cpp @@ -24,17 +24,16 @@ namespace WebCore { -inline SVGSetElement::SVGSetElement(const QualifiedName& tagName, Document& document) - : SVGAnimateElement(tagName, document) +inline SVGSetElement::SVGSetElement(Document& document) + : SVGAnimateElement(SVGNames::setTag, document) { setAnimationMode(ToAnimation); - ASSERT(hasTagName(SVGNames::setTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGSetElement> SVGSetElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGSetElement> SVGSetElement::create(Document& document) { - return adoptRef(new SVGSetElement(tagName, document)); + return adoptRef(new SVGSetElement(document)); } void SVGSetElement::updateAnimationMode() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGSetElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGSetElement.h index 7ff5a5741cb..a2cd048c003 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGSetElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGSetElement.h @@ -28,10 +28,10 @@ namespace WebCore { // SVGAnimateElement implements superset of the functionality. class SVGSetElement FINAL : public SVGAnimateElement { public: - static PassRefPtr<SVGSetElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGSetElement> create(Document&); private: - SVGSetElement(const QualifiedName&, Document&); + explicit SVGSetElement(Document&); virtual void updateAnimationMode() OVERRIDE; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGStopElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGStopElement.cpp index 0751619940d..b3d85099a44 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGStopElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGStopElement.cpp @@ -22,7 +22,6 @@ #include "core/svg/SVGStopElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGGradientStop.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/svg/SVGElementInstance.h" @@ -37,18 +36,17 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGStopElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGStopElement::SVGStopElement(Document& document) + : SVGElement(SVGNames::stopTag, document) , m_offset(0) { - ASSERT(hasTagName(SVGNames::stopTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGStopElement(); } -PassRefPtr<SVGStopElement> SVGStopElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGStopElement> SVGStopElement::create(Document& document) { - return adoptRef(new SVGStopElement(tagName, document)); + return adoptRef(new SVGStopElement(document)); } bool SVGStopElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGStopElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGStopElement.h index 98b0dfe26fd..6b941f2e503 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGStopElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGStopElement.h @@ -29,12 +29,12 @@ namespace WebCore { class SVGStopElement FINAL : public SVGElement { public: - static PassRefPtr<SVGStopElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGStopElement> create(Document&); Color stopColorIncludingOpacity() const; private: - SVGStopElement(const QualifiedName&, Document&); + explicit SVGStopElement(Document&); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -50,12 +50,13 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGStopElement* toSVGStopElement(Node* node) +inline bool isSVGStopElement(const Node& node) { - ASSERT_WITH_SECURITY_IMPLICATION(!node || toSVGElement(node)->isGradientStop()); - return static_cast<SVGStopElement*>(node); + return node.isSVGElement() && toSVGElement(node).isGradientStop(); } +DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGStopElement); + } // namespace WebCore #endif diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGStyleElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGStyleElement.cpp index adb399dbd99..f0815b4daeb 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGStyleElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGStyleElement.cpp @@ -23,18 +23,16 @@ #include "config.h" #include "core/svg/SVGStyleElement.h" -#include "SVGNames.h" #include "core/css/CSSStyleSheet.h" #include "wtf/StdLibExtras.h" namespace WebCore { -inline SVGStyleElement::SVGStyleElement(const QualifiedName& tagName, Document& document, bool createdByParser) - : SVGElement(tagName, document) +inline SVGStyleElement::SVGStyleElement(Document& document, bool createdByParser) + : SVGElement(SVGNames::styleTag, document) , StyleElement(&document, createdByParser) , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) { - ASSERT(hasTagName(SVGNames::styleTag)); ScriptWrappable::init(this); } @@ -43,9 +41,9 @@ SVGStyleElement::~SVGStyleElement() StyleElement::clearDocumentData(document(), this); } -PassRefPtr<SVGStyleElement> SVGStyleElement::create(const QualifiedName& tagName, Document& document, bool createdByParser) +PassRefPtr<SVGStyleElement> SVGStyleElement::create(Document& document, bool createdByParser) { - return adoptRef(new SVGStyleElement(tagName, document, createdByParser)); + return adoptRef(new SVGStyleElement(document, createdByParser)); } bool SVGStyleElement::disabled() const diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGStyleElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGStyleElement.h index 35cf7be6a1e..522f0af3dff 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGStyleElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGStyleElement.h @@ -30,7 +30,7 @@ namespace WebCore { class SVGStyleElement FINAL : public SVGElement , public StyleElement { public: - static PassRefPtr<SVGStyleElement> create(const QualifiedName&, Document&, bool createdByParser); + static PassRefPtr<SVGStyleElement> create(Document&, bool createdByParser); virtual ~SVGStyleElement(); using StyleElement::sheet; @@ -48,7 +48,7 @@ public: void setTitle(const AtomicString&); private: - SVGStyleElement(const QualifiedName&, Document&, bool createdByParser); + SVGStyleElement(Document&, bool createdByParser); bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; @@ -68,11 +68,7 @@ private: Timer<SVGElement> m_svgLoadEventTimer; }; -inline SVGStyleElement* toSVGStyleElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::styleTag)); - return static_cast<SVGStyleElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGStyleElement, hasTagName(SVGNames::styleTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGSwitchElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGSwitchElement.cpp index 07916668ca5..f4c8dd11e1a 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGSwitchElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGSwitchElement.cpp @@ -23,7 +23,7 @@ #include "core/svg/SVGSwitchElement.h" #include "SVGNames.h" -#include "core/page/UseCounter.h" +#include "core/frame/UseCounter.h" #include "core/rendering/svg/RenderSVGTransformableContainer.h" namespace WebCore { @@ -36,25 +36,25 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSwitchElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGSwitchElement::SVGSwitchElement(const QualifiedName& tagName, Document& document) - : SVGGraphicsElement(tagName, document) +inline SVGSwitchElement::SVGSwitchElement(Document& document) + : SVGGraphicsElement(SVGNames::switchTag, document) { - ASSERT(hasTagName(SVGNames::switchTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGSwitchElement(); - UseCounter::count(&document, UseCounter::SVGSwitchElement); + UseCounter::count(document, UseCounter::SVGSwitchElement); } -PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(Document& document) { - return adoptRef(new SVGSwitchElement(tagName, document)); + return adoptRef(new SVGSwitchElement(document)); } bool SVGSwitchElement::childShouldCreateRenderer(const Node& child) const { // FIXME: This function does not do what the comment below implies it does. // It will create a renderer for any valid SVG element children, not just the first one. + bool shouldCreateRenderer = false; for (Node* node = firstChild(); node; node = node->nextSibling()) { if (!node->isSVGElement()) continue; @@ -63,10 +63,11 @@ bool SVGSwitchElement::childShouldCreateRenderer(const Node& child) const if (!element || !element->isValid()) continue; - return node == &child; // Only allow this child if it's the first valid child + shouldCreateRenderer = node == &child; // Only allow this child if it's the first valid child. + break; } - return false; + return shouldCreateRenderer && SVGGraphicsElement::childShouldCreateRenderer(child); } RenderObject* SVGSwitchElement::createRenderer(RenderStyle*) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGSwitchElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGSwitchElement.h index d7af51c6caf..48312ea530b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGSwitchElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGSwitchElement.h @@ -30,10 +30,10 @@ namespace WebCore { class SVGSwitchElement FINAL : public SVGGraphicsElement, public SVGExternalResourcesRequired { public: - static PassRefPtr<SVGSwitchElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGSwitchElement> create(Document&); private: - SVGSwitchElement(const QualifiedName&, Document&); + explicit SVGSwitchElement(Document&); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGSymbolElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGSymbolElement.cpp index 2d65a2da6f3..b9a405ad027 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGSymbolElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGSymbolElement.cpp @@ -25,7 +25,6 @@ #include "SVGNames.h" #include "core/rendering/svg/RenderSVGHiddenContainer.h" #include "core/svg/SVGElementInstance.h" -#include "core/svg/SVGFitToViewBox.h" namespace WebCore { @@ -41,17 +40,16 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGSymbolElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGSymbolElement::SVGSymbolElement(Document& document) + : SVGElement(SVGNames::symbolTag, document) { - ASSERT(hasTagName(SVGNames::symbolTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGSymbolElement(); } -PassRefPtr<SVGSymbolElement> SVGSymbolElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGSymbolElement> SVGSymbolElement::create(Document& document) { - return adoptRef(new SVGSymbolElement(tagName, document)); + return adoptRef(new SVGSymbolElement(document)); } bool SVGSymbolElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGSymbolElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGSymbolElement.h index 9d010de67c5..d65a0da0f26 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGSymbolElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGSymbolElement.h @@ -34,10 +34,10 @@ class SVGSymbolElement FINAL : public SVGElement, public SVGExternalResourcesRequired, public SVGFitToViewBox { public: - static PassRefPtr<SVGSymbolElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGSymbolElement> create(Document&); private: - SVGSymbolElement(const QualifiedName&, Document&); + explicit SVGSymbolElement(Document&); virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTSpanElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTSpanElement.cpp index 7b47b96553e..77f13fcb23f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTSpanElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTSpanElement.cpp @@ -27,16 +27,15 @@ namespace WebCore { -inline SVGTSpanElement::SVGTSpanElement(const QualifiedName& tagName, Document& document) - : SVGTextPositioningElement(tagName, document) +inline SVGTSpanElement::SVGTSpanElement(Document& document) + : SVGTextPositioningElement(SVGNames::tspanTag, document) { - ASSERT(hasTagName(SVGNames::tspanTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGTSpanElement> SVGTSpanElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGTSpanElement> SVGTSpanElement::create(Document& document) { - return adoptRef(new SVGTSpanElement(tagName, document)); + return adoptRef(new SVGTSpanElement(document)); } RenderObject* SVGTSpanElement::createRenderer(RenderStyle*) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTSpanElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGTSpanElement.h index 2861f85f661..547e9ee5e03 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTSpanElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTSpanElement.h @@ -27,10 +27,10 @@ namespace WebCore { class SVGTSpanElement FINAL : public SVGTextPositioningElement { public: - static PassRefPtr<SVGTSpanElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGTSpanElement> create(Document&); private: - SVGTSpanElement(const QualifiedName&, Document&); + explicit SVGTSpanElement(Document&); virtual RenderObject* createRenderer(RenderStyle*); virtual bool childShouldCreateRenderer(const Node& child) const; diff --git a/chromium/third_party/WebKit/Source/core/svg/svgtags.in b/chromium/third_party/WebKit/Source/core/svg/SVGTagNames.in index 094ccafbf8b..caf925d610c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/svgtags.in +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTagNames.in @@ -16,9 +16,7 @@ animateTransform set circle clipPath -#if 0 -color_profile -#endif +# color-profile cursor defs desc @@ -51,11 +49,11 @@ feTurbulence filter #if ENABLE_SVG_FONTS font -font_face -font_face_format -font_face_name -font_face_src -font_face_uri +font-face +font-face-format +font-face-name +font-face-src +font-face-uri #endif foreignObject g @@ -71,7 +69,7 @@ marker mask metadata #if ENABLE_SVG_FONTS -missing_glyph +missing-glyph #endif mpath interfaceName=SVGMPathElement path diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTests.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTests.cpp index 2c309550176..1332610788d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTests.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTests.cpp @@ -24,9 +24,8 @@ #include "SVGNames.h" #include "core/dom/DOMImplementation.h" -#include "core/platform/Language.h" +#include "platform/Language.h" #include "core/svg/SVGElement.h" -#include "core/svg/SVGStringList.h" namespace WebCore { @@ -146,23 +145,6 @@ bool SVGTests::isKnownAttribute(const QualifiedName& attrName) || attrName == SVGNames::systemLanguageAttr; } -bool SVGTests::handleAttributeChange(SVGElement* targetElement, const QualifiedName& attrName) -{ - ASSERT(targetElement); - if (!isKnownAttribute(attrName)) - return false; - if (!targetElement->inDocument()) - return true; - - bool valid = targetElement->isValid(); - if (valid && !targetElement->attached() && targetElement->parentNode()->attached()) - targetElement->lazyAttach(); - else if (!valid && targetElement->attached()) - targetElement->detach(); - - return true; -} - void SVGTests::addSupportedAttributes(HashSet<QualifiedName>& supportedAttributes) { supportedAttributes.add(SVGNames::requiredFeaturesAttr); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTests.h b/chromium/third_party/WebKit/Source/core/svg/SVGTests.h index 9350a15493f..7df0e223f1b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTests.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTests.h @@ -44,7 +44,6 @@ public: bool isKnownAttribute(const QualifiedName&); void addSupportedAttributes(HashSet<QualifiedName>&); - bool handleAttributeChange(SVGElement*, const QualifiedName&); static SVGAttributeToPropertyMap& attributeToPropertyMap(); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp index 4f7a3a805d4..1c298456cae 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.cpp @@ -28,7 +28,7 @@ #include "bindings/v8/ExceptionState.h" #include "bindings/v8/ExceptionStatePlaceholder.h" #include "core/editing/FrameSelection.h" -#include "core/page/Frame.h" +#include "core/frame/Frame.h" #include "core/rendering/RenderObject.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/rendering/svg/SVGTextQuery.h" @@ -113,13 +113,13 @@ float SVGTextContentElement::getComputedTextLength() return SVGTextQuery(renderer()).textLength(); } -float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars, ExceptionState& es) +float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchars, ExceptionState& exceptionState) { document().updateLayoutIgnorePendingStylesheets(); unsigned numberOfChars = getNumberOfChars(); if (charnum >= numberOfChars) { - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return 0.0f; } @@ -129,48 +129,48 @@ float SVGTextContentElement::getSubStringLength(unsigned charnum, unsigned nchar return SVGTextQuery(renderer()).subStringLength(charnum, nchars); } -SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionState& es) +SVGPoint SVGTextContentElement::getStartPositionOfChar(unsigned charnum, ExceptionState& exceptionState) { document().updateLayoutIgnorePendingStylesheets(); if (charnum > getNumberOfChars()) { - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return FloatPoint(); } return SVGTextQuery(renderer()).startPositionOfCharacter(charnum); } -SVGPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionState& es) +SVGPoint SVGTextContentElement::getEndPositionOfChar(unsigned charnum, ExceptionState& exceptionState) { document().updateLayoutIgnorePendingStylesheets(); if (charnum > getNumberOfChars()) { - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return FloatPoint(); } return SVGTextQuery(renderer()).endPositionOfCharacter(charnum); } -SVGRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionState& es) +SVGRect SVGTextContentElement::getExtentOfChar(unsigned charnum, ExceptionState& exceptionState) { document().updateLayoutIgnorePendingStylesheets(); if (charnum > getNumberOfChars()) { - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return SVGRect(); } return SVGTextQuery(renderer()).extentOfCharacter(charnum); } -float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState& es) +float SVGTextContentElement::getRotationOfChar(unsigned charnum, ExceptionState& exceptionState) { document().updateLayoutIgnorePendingStylesheets(); if (charnum > getNumberOfChars()) { - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return 0.0f; } @@ -183,11 +183,11 @@ int SVGTextContentElement::getCharNumAtPosition(const SVGPoint& point) return SVGTextQuery(renderer()).characterNumberAtPosition(point); } -void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, ExceptionState& es) +void SVGTextContentElement::selectSubString(unsigned charnum, unsigned nchars, ExceptionState& exceptionState) { unsigned numberOfChars = getNumberOfChars(); if (charnum >= numberOfChars) { - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return; } @@ -213,10 +213,10 @@ bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); if (supportedAttributes.isEmpty()) { - SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); supportedAttributes.add(SVGNames::lengthAdjustAttr); supportedAttributes.add(SVGNames::textLengthAttr); + supportedAttributes.add(XMLNames::spaceAttr); } return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); } @@ -255,7 +255,7 @@ void SVGTextContentElement::parseAttribute(const QualifiedName& name, const Atom } else if (name == SVGNames::textLengthAttr) { m_textLength.value = SVGLength::construct(LengthModeOther, value, parseError, ForbidNegativeLengths); } else if (SVGExternalResourcesRequired::parseAttribute(name, value)) { - } else if (SVGLangSpace::parseAttribute(name, value)) { + } else if (name.matches(XMLNames::spaceAttr)) { } else ASSERT_NOT_REACHED(); diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.h index 255330e8692..db0b622d8b9 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTextContentElement.h @@ -122,12 +122,13 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGTextContentElement* toSVGTextContentElement(SVGElement* element) +inline bool isSVGTextContentElement(const Node& node) { - ASSERT_WITH_SECURITY_IMPLICATION(!element || element->isTextContent()); - return static_cast<SVGTextContentElement*>(element); + return node.isSVGElement() && toSVGElement(node).isTextContent(); } +DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGTextContentElement); + } // namespace WebCore #endif diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTextElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTextElement.cpp index d7ed0d686aa..7806ed129ed 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTextElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTextElement.cpp @@ -22,23 +22,21 @@ #include "core/svg/SVGTextElement.h" -#include "SVGNames.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/rendering/svg/RenderSVGText.h" #include "core/svg/SVGElementInstance.h" namespace WebCore { -inline SVGTextElement::SVGTextElement(const QualifiedName& tagName, Document& doc) - : SVGTextPositioningElement(tagName, doc) +inline SVGTextElement::SVGTextElement(Document& doc) + : SVGTextPositioningElement(SVGNames::textTag, doc) { - ASSERT(hasTagName(SVGNames::textTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGTextElement> SVGTextElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGTextElement> SVGTextElement::create(Document& document) { - return adoptRef(new SVGTextElement(tagName, document)); + return adoptRef(new SVGTextElement(document)); } // We override SVGGraphics::animatedLocalTransform() so that the transform-origin diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTextElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGTextElement.h index 55b63e6407e..b52204c15c3 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTextElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTextElement.h @@ -28,12 +28,12 @@ namespace WebCore { class SVGTextElement FINAL : public SVGTextPositioningElement { public: - static PassRefPtr<SVGTextElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGTextElement> create(Document&); virtual AffineTransform animatedLocalTransform() const; private: - SVGTextElement(const QualifiedName&, Document&); + explicit SVGTextElement(Document&); virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } @@ -41,11 +41,7 @@ private: virtual bool childShouldCreateRenderer(const Node& child) const; }; -inline SVGTextElement* toSVGTextElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::textTag)); - return static_cast<SVGTextElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGTextElement, hasTagName(SVGNames::textTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp index eb21c90e306..b3f2e1b1fb4 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.cpp @@ -22,7 +22,6 @@ #include "core/svg/SVGTextPathElement.h" -#include "SVGNames.h" #include "XLinkNames.h" #include "core/rendering/svg/RenderSVGResource.h" #include "core/rendering/svg/RenderSVGTextPath.h" @@ -44,20 +43,19 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGTextPathElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTextContentElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGTextPathElement::SVGTextPathElement(const QualifiedName& tagName, Document& document) - : SVGTextContentElement(tagName, document) +inline SVGTextPathElement::SVGTextPathElement(Document& document) + : SVGTextContentElement(SVGNames::textPathTag, document) , m_startOffset(LengthModeOther) , m_method(SVGTextPathMethodAlign) , m_spacing(SVGTextPathSpacingExact) { - ASSERT(hasTagName(SVGNames::textPathTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGTextPathElement(); } -PassRefPtr<SVGTextPathElement> SVGTextPathElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGTextPathElement> SVGTextPathElement::create(Document& document) { - return adoptRef(new SVGTextPathElement(tagName, document)); + return adoptRef(new SVGTextPathElement(document)); } SVGTextPathElement::~SVGTextPathElement() diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.h index 1ea5d11cde5..2b7a38c1ead 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTextPathElement.h @@ -109,10 +109,10 @@ public: TEXTPATH_SPACINGTYPE_EXACT = SVGTextPathSpacingExact }; - static PassRefPtr<SVGTextPathElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGTextPathElement> create(Document&); private: - SVGTextPathElement(const QualifiedName&, Document&); + explicit SVGTextPathElement(Document&); virtual ~SVGTextPathElement(); @@ -140,11 +140,7 @@ private: END_DECLARE_ANIMATED_PROPERTIES }; -inline SVGTextPathElement* toSVGTextPathElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::textPathTag)); - return static_cast<SVGTextPathElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGTextPathElement, hasTagName(SVGNames::textPathTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTitleElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTitleElement.cpp index 7e6a1ce6571..cd018b8a0f1 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTitleElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTitleElement.cpp @@ -26,16 +26,15 @@ namespace WebCore { -inline SVGTitleElement::SVGTitleElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGTitleElement::SVGTitleElement(Document& document) + : SVGElement(SVGNames::titleTag, document) { - ASSERT(hasTagName(SVGNames::titleTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGTitleElement> SVGTitleElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGTitleElement> SVGTitleElement::create(Document& document) { - return adoptRef(new SVGTitleElement(tagName, document)); + return adoptRef(new SVGTitleElement(document)); } Node::InsertionNotificationRequest SVGTitleElement::insertedInto(ContainerNode* rootParent) @@ -43,6 +42,7 @@ Node::InsertionNotificationRequest SVGTitleElement::insertedInto(ContainerNode* SVGElement::insertedInto(rootParent); if (!rootParent->inDocument()) return InsertionDone; + // FIXME: It's possible to register SVGTitleElement to an HTMLDocument. if (firstChild()) document().setTitleElement(textContent(), this); return InsertionDone; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTitleElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGTitleElement.h index e5ac03b216b..21c3127f6dd 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTitleElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTitleElement.h @@ -27,10 +27,10 @@ namespace WebCore { class SVGTitleElement FINAL : public SVGElement { public: - static PassRefPtr<SVGTitleElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGTitleElement> create(Document&); private: - SVGTitleElement(const QualifiedName&, Document&); + explicit SVGTitleElement(Document&); virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; virtual void removedFrom(ContainerNode*) OVERRIDE; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTransform.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTransform.cpp index 2c44d366e55..8cf0ef2ffcc 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTransform.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTransform.cpp @@ -21,12 +21,10 @@ #include "config.h" #include "core/svg/SVGTransform.h" -#include "core/platform/FloatConversion.h" -#include "core/platform/graphics/FloatPoint.h" -#include "core/platform/graphics/FloatSize.h" +#include "platform/FloatConversion.h" +#include "platform/geometry/FloatSize.h" #include "wtf/MathExtras.h" #include "wtf/text/StringBuilder.h" -#include "wtf/text/WTFString.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTransform.h b/chromium/third_party/WebKit/Source/core/svg/SVGTransform.h index 3053d4f2401..71f7668b38d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTransform.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTransform.h @@ -21,8 +21,8 @@ #ifndef SVGTransform_h #define SVGTransform_h -#include "core/platform/graphics/FloatPoint.h" #include "core/svg/SVGMatrix.h" +#include "platform/geometry/FloatPoint.h" #include "wtf/text/WTFString.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTransformDistance.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTransformDistance.cpp index 47a544346f9..1108f322039 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTransformDistance.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTransformDistance.cpp @@ -21,10 +21,8 @@ #include "core/svg/SVGTransformDistance.h" -#include "core/platform/graphics/FloatPoint.h" -#include "core/platform/graphics/FloatSize.h" -#include "core/svg/SVGTransform.h" - +#include "platform/geometry/FloatPoint.h" +#include "platform/geometry/FloatSize.h" #include <math.h> namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTransformList.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTransformList.cpp index 3d3e58fda5d..f09a01046a5 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTransformList.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGTransformList.cpp @@ -21,10 +21,9 @@ #include "config.h" #include "core/svg/SVGTransformList.h" -#include "core/platform/graphics/transforms/AffineTransform.h" +#include "core/svg/SVGParserUtilities.h" #include "core/svg/SVGSVGElement.h" -#include "core/svg/SVGTransform.h" -#include "core/svg/SVGTransformable.h" +#include "platform/transforms/AffineTransform.h" #include "wtf/text/StringBuilder.h" namespace WebCore { @@ -83,12 +82,12 @@ void SVGTransformList::parse(const String& transform) } else if (transform.is8Bit()) { const LChar* ptr = transform.characters8(); const LChar* end = ptr + transform.length(); - if (!SVGTransformable::parseTransformAttribute(*this, ptr, end)) + if (!parseTransformAttribute(*this, ptr, end)) clear(); } else { const UChar* ptr = transform.characters16(); const UChar* end = ptr + transform.length(); - if (!SVGTransformable::parseTransformAttribute(*this, ptr, end)) + if (!parseTransformAttribute(*this, ptr, end)) clear(); } } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTransformable.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGTransformable.cpp deleted file mode 100644 index 9c35dc3a337..00000000000 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTransformable.cpp +++ /dev/null @@ -1,240 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> - * Copyright (C) 2007 Eric Seidel <eric@webkit.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#include "config.h" - -#include "core/svg/SVGTransformable.h" - -#include "core/platform/graphics/transforms/AffineTransform.h" -#include "core/svg/SVGParserUtilities.h" -#include "core/svg/SVGTransformList.h" - -namespace WebCore { - -template<typename CharType> -static int parseTransformParamList(const CharType*& ptr, const CharType* end, float* values, int required, int optional) -{ - int optionalParams = 0, requiredParams = 0; - - if (!skipOptionalSVGSpaces(ptr, end) || *ptr != '(') - return -1; - - ptr++; - - skipOptionalSVGSpaces(ptr, end); - - while (requiredParams < required) { - if (ptr >= end || !parseNumber(ptr, end, values[requiredParams], false)) - return -1; - requiredParams++; - if (requiredParams < required) - skipOptionalSVGSpacesOrDelimiter(ptr, end); - } - if (!skipOptionalSVGSpaces(ptr, end)) - return -1; - - bool delimParsed = skipOptionalSVGSpacesOrDelimiter(ptr, end); - - if (ptr >= end) - return -1; - - if (*ptr == ')') { // skip optionals - ptr++; - if (delimParsed) - return -1; - } else { - while (optionalParams < optional) { - if (ptr >= end || !parseNumber(ptr, end, values[requiredParams + optionalParams], false)) - return -1; - optionalParams++; - if (optionalParams < optional) - skipOptionalSVGSpacesOrDelimiter(ptr, end); - } - - if (!skipOptionalSVGSpaces(ptr, end)) - return -1; - - delimParsed = skipOptionalSVGSpacesOrDelimiter(ptr, end); - - if (ptr >= end || *ptr != ')' || delimParsed) - return -1; - ptr++; - } - - return requiredParams + optionalParams; -} - -// These should be kept in sync with enum SVGTransformType -static const int requiredValuesForType[] = {0, 6, 1, 1, 1, 1, 1}; -static const int optionalValuesForType[] = {0, 0, 1, 1, 2, 0, 0}; - -// This destructor is needed in order to link correctly with Intel ICC. -SVGTransformable::~SVGTransformable() -{ -} - -template<typename CharType> -static bool parseTransformValueInternal(unsigned type, const CharType*& ptr, const CharType* end, SVGTransform& transform) -{ - if (type == SVGTransform::SVG_TRANSFORM_UNKNOWN) - return false; - - int valueCount = 0; - float values[] = {0, 0, 0, 0, 0, 0}; - if ((valueCount = parseTransformParamList(ptr, end, values, requiredValuesForType[type], optionalValuesForType[type])) < 0) - return false; - - switch (type) { - case SVGTransform::SVG_TRANSFORM_SKEWX: - transform.setSkewX(values[0]); - break; - case SVGTransform::SVG_TRANSFORM_SKEWY: - transform.setSkewY(values[0]); - break; - case SVGTransform::SVG_TRANSFORM_SCALE: - if (valueCount == 1) // Spec: if only one param given, assume uniform scaling - transform.setScale(values[0], values[0]); - else - transform.setScale(values[0], values[1]); - break; - case SVGTransform::SVG_TRANSFORM_TRANSLATE: - if (valueCount == 1) // Spec: if only one param given, assume 2nd param to be 0 - transform.setTranslate(values[0], 0); - else - transform.setTranslate(values[0], values[1]); - break; - case SVGTransform::SVG_TRANSFORM_ROTATE: - if (valueCount == 1) - transform.setRotate(values[0], 0, 0); - else - transform.setRotate(values[0], values[1], values[2]); - break; - case SVGTransform::SVG_TRANSFORM_MATRIX: - transform.setMatrix(AffineTransform(values[0], values[1], values[2], values[3], values[4], values[5])); - break; - } - - return true; -} - -bool SVGTransformable::parseTransformValue(unsigned type, const LChar*& ptr, const LChar* end, SVGTransform& transform) -{ - return parseTransformValueInternal(type, ptr, end, transform); -} - -bool SVGTransformable::parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform& transform) -{ - return parseTransformValueInternal(type, ptr, end, transform); -} - -static const LChar skewXDesc[] = {'s', 'k', 'e', 'w', 'X'}; -static const LChar skewYDesc[] = {'s', 'k', 'e', 'w', 'Y'}; -static const LChar scaleDesc[] = {'s', 'c', 'a', 'l', 'e'}; -static const LChar translateDesc[] = {'t', 'r', 'a', 'n', 's', 'l', 'a', 't', 'e'}; -static const LChar rotateDesc[] = {'r', 'o', 't', 'a', 't', 'e'}; -static const LChar matrixDesc[] = {'m', 'a', 't', 'r', 'i', 'x'}; - -template<typename CharType> -static inline bool parseAndSkipType(const CharType*& ptr, const CharType* end, unsigned short& type) -{ - if (ptr >= end) - return false; - - if (*ptr == 's') { - if (skipString(ptr, end, skewXDesc, WTF_ARRAY_LENGTH(skewXDesc))) - type = SVGTransform::SVG_TRANSFORM_SKEWX; - else if (skipString(ptr, end, skewYDesc, WTF_ARRAY_LENGTH(skewYDesc))) - type = SVGTransform::SVG_TRANSFORM_SKEWY; - else if (skipString(ptr, end, scaleDesc, WTF_ARRAY_LENGTH(scaleDesc))) - type = SVGTransform::SVG_TRANSFORM_SCALE; - else - return false; - } else if (skipString(ptr, end, translateDesc, WTF_ARRAY_LENGTH(translateDesc))) - type = SVGTransform::SVG_TRANSFORM_TRANSLATE; - else if (skipString(ptr, end, rotateDesc, WTF_ARRAY_LENGTH(rotateDesc))) - type = SVGTransform::SVG_TRANSFORM_ROTATE; - else if (skipString(ptr, end, matrixDesc, WTF_ARRAY_LENGTH(matrixDesc))) - type = SVGTransform::SVG_TRANSFORM_MATRIX; - else - return false; - - return true; -} - -SVGTransform::SVGTransformType SVGTransformable::parseTransformType(const String& string) -{ - if (string.isEmpty()) - return SVGTransform::SVG_TRANSFORM_UNKNOWN; - unsigned short type = SVGTransform::SVG_TRANSFORM_UNKNOWN; - if (string.is8Bit()) { - const LChar* ptr = string.characters8(); - const LChar* end = ptr + string.length(); - parseAndSkipType(ptr, end, type); - } else { - const UChar* ptr = string.characters16(); - const UChar* end = ptr + string.length(); - parseAndSkipType(ptr, end, type); - } - return static_cast<SVGTransform::SVGTransformType>(type); -} - -template<typename CharType> -bool SVGTransformable::parseTransformAttributeInternal(SVGTransformList& list, const CharType*& ptr, const CharType* end, TransformParsingMode mode) -{ - if (mode == ClearList) - list.clear(); - - bool delimParsed = false; - while (ptr < end) { - delimParsed = false; - unsigned short type = SVGTransform::SVG_TRANSFORM_UNKNOWN; - skipOptionalSVGSpaces(ptr, end); - - if (!parseAndSkipType(ptr, end, type)) - return false; - - SVGTransform transform; - if (!parseTransformValue(type, ptr, end, transform)) - return false; - - list.append(transform); - skipOptionalSVGSpaces(ptr, end); - if (ptr < end && *ptr == ',') { - delimParsed = true; - ++ptr; - } - skipOptionalSVGSpaces(ptr, end); - } - - return !delimParsed; -} - -bool SVGTransformable::parseTransformAttribute(SVGTransformList& list, const LChar*& ptr, const LChar* end, TransformParsingMode mode) -{ - return parseTransformAttributeInternal(list, ptr, end, mode); -} - -bool SVGTransformable::parseTransformAttribute(SVGTransformList& list, const UChar*& ptr, const UChar* end, TransformParsingMode mode) -{ - return parseTransformAttributeInternal(list, ptr, end, mode); -} - -} diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGTransformable.h b/chromium/third_party/WebKit/Source/core/svg/SVGTransformable.h deleted file mode 100644 index f060545ae4e..00000000000 --- a/chromium/third_party/WebKit/Source/core/svg/SVGTransformable.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> - * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - -#ifndef SVGTransformable_h -#define SVGTransformable_h - -#include "core/svg/SVGLocatable.h" -#include "core/svg/SVGTransform.h" -#include "wtf/text/WTFString.h" - -namespace WebCore { - -class AffineTransform; -class SVGTransformList; - -class SVGTransformable : virtual public SVGLocatable { -public: - enum TransformParsingMode { - ClearList, - DoNotClearList - }; - - virtual ~SVGTransformable(); - - static bool parseTransformAttribute(SVGTransformList&, const LChar*& ptr, const LChar* end, TransformParsingMode = ClearList); - static bool parseTransformAttribute(SVGTransformList&, const UChar*& ptr, const UChar* end, TransformParsingMode = ClearList); - - static bool parseTransformValue(unsigned type, const LChar*& ptr, const LChar* end, SVGTransform&); - static bool parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform&); - - static SVGTransform::SVGTransformType parseTransformType(const String&); - - virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const { return animatedLocalTransform(); } - virtual AffineTransform animatedLocalTransform() const = 0; - -private: - template<typename CharType> - static bool parseTransformAttributeInternal(SVGTransformList&, const CharType*& ptr, const CharType* end, TransformParsingMode); -}; - -} // namespace WebCore - -#endif // SVGTransformable_h diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGURIReference.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGURIReference.cpp index f51aa1c047a..02cd99fa022 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGURIReference.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGURIReference.cpp @@ -23,8 +23,7 @@ #include "core/svg/SVGURIReference.h" #include "XLinkNames.h" -#include "core/dom/Document.h" -#include "weborigin/KURL.h" +#include "platform/weborigin/KURL.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGURIReference.h b/chromium/third_party/WebKit/Source/core/svg/SVGURIReference.h index e6901e66bcd..f73a23bd2bf 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGURIReference.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGURIReference.h @@ -51,7 +51,7 @@ public: } protected: - virtual void setHrefBaseValue(const String&, const bool validValue = true) = 0; + virtual void setHrefBaseValue(const String&) = 0; }; } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGUnitTypes.idl b/chromium/third_party/WebKit/Source/core/svg/SVGUnitTypes.idl index 22817c2d826..5f5ec2ec800 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGUnitTypes.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGUnitTypes.idl @@ -23,12 +23,9 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -[ - DoNotGenerateToV8 -] interface SVGUnitTypes { +interface SVGUnitTypes { // Unit Types const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0; const unsigned short SVG_UNIT_TYPE_USERSPACEONUSE = 1; const unsigned short SVG_UNIT_TYPE_OBJECTBOUNDINGBOX = 2; }; - diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.cpp index 68fbe2fa39a..80d36bf97f3 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.cpp @@ -26,15 +26,13 @@ #include "core/svg/SVGUseElement.h" -#include "SVGNames.h" #include "XLinkNames.h" #include "bindings/v8/ExceptionStatePlaceholder.h" #include "core/dom/Document.h" #include "core/dom/ElementTraversal.h" -#include "core/dom/Event.h" +#include "core/events/Event.h" #include "core/dom/shadow/ElementShadow.h" #include "core/dom/shadow/ShadowRoot.h" -#include "core/fetch/DocumentResource.h" #include "core/fetch/FetchRequest.h" #include "core/fetch/ResourceFetcher.h" #include "core/rendering/svg/RenderSVGResource.h" @@ -71,8 +69,8 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGUseElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document& document, bool wasInsertedByParser) - : SVGGraphicsElement(tagName, document) +inline SVGUseElement::SVGUseElement(Document& document, bool wasInsertedByParser) + : SVGGraphicsElement(SVGNames::useTag, document) , m_x(LengthModeWidth) , m_y(LengthModeHeight) , m_width(LengthModeWidth) @@ -83,15 +81,14 @@ inline SVGUseElement::SVGUseElement(const QualifiedName& tagName, Document& docu , m_svgLoadEventTimer(this, &SVGElement::svgLoadEventTimerFired) { ASSERT(hasCustomStyleCallbacks()); - ASSERT(hasTagName(SVGNames::useTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGUseElement(); } -PassRefPtr<SVGUseElement> SVGUseElement::create(const QualifiedName& tagName, Document& document, bool wasInsertedByParser) +PassRefPtr<SVGUseElement> SVGUseElement::create(Document& document, bool wasInsertedByParser) { // Always build a #shadow-root for SVGUseElement. - RefPtr<SVGUseElement> use = adoptRef(new SVGUseElement(tagName, document, wasInsertedByParser)); + RefPtr<SVGUseElement> use = adoptRef(new SVGUseElement(document, wasInsertedByParser)); use->ensureUserAgentShadowRoot(); return use.release(); } @@ -125,7 +122,6 @@ bool SVGUseElement::isSupportedAttribute(const QualifiedName& attrName) { DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); if (supportedAttributes.isEmpty()) { - SVGLangSpace::addSupportedAttributes(supportedAttributes); SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes); SVGURIReference::addSupportedAttributes(supportedAttributes); supportedAttributes.add(SVGNames::xAttr); @@ -150,8 +146,7 @@ void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseError, ForbidNegativeLengths)); else if (name == SVGNames::heightAttr) setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseError, ForbidNegativeLengths)); - else if (SVGLangSpace::parseAttribute(name, value) - || SVGExternalResourcesRequired::parseAttribute(name, value) + else if (SVGExternalResourcesRequired::parseAttribute(name, value) || SVGURIReference::parseAttribute(name, value)) { } else ASSERT_NOT_REACHED(); @@ -159,12 +154,14 @@ void SVGUseElement::parseAttribute(const QualifiedName& name, const AtomicString reportAttributeParsingError(parseError, name, value); } +#if !ASSERT_DISABLED static inline bool isWellFormedDocument(Document* document) { if (document->isSVGDocument() || document->isXHTMLDocument()) return static_cast<XMLDocumentParser*>(document->parser())->wellFormed(); return true; } +#endif Node::InsertionNotificationRequest SVGUseElement::insertedInto(ContainerNode* rootParent) { @@ -250,8 +247,7 @@ void SVGUseElement::svgAttributeChanged(const QualifiedName& attrName) if (!renderer) return; - if (SVGLangSpace::isKnownAttribute(attrName) - || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { + if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { invalidateShadowTree(); return; } @@ -657,7 +653,7 @@ bool SVGUseElement::hasCycleUseReferencing(SVGUseElement* use, SVGElementInstanc while (instance) { SVGElement* element = instance->correspondingElement(); - if (element->hasID() && element->getIdAttribute() == targetId && &element->document() == &newTarget->document()) + if (element->hasID() && element->getIdAttribute() == targetId && element->document() == newTarget->document()) return true; instance = instance->parentNode(); @@ -665,18 +661,19 @@ bool SVGUseElement::hasCycleUseReferencing(SVGUseElement* use, SVGElementInstanc return false; } -static inline void removeDisallowedElementsFromSubtree(Element* subtree) +static inline void removeDisallowedElementsFromSubtree(Element& subtree) { - ASSERT(!subtree->inDocument()); + ASSERT(!subtree.inDocument()); Element* element = ElementTraversal::firstWithin(subtree); while (element) { if (isDisallowedElement(element)) { - Element* next = ElementTraversal::nextSkippingChildren(element, subtree); + Element* next = ElementTraversal::nextSkippingChildren(*element, &subtree); // The subtree is not in document so this won't generate events that could mutate the tree. element->parentNode()->removeChild(element); element = next; - } else - element = ElementTraversal::next(element, subtree); + } else { + element = ElementTraversal::next(*element, &subtree); + } } } @@ -694,7 +691,7 @@ void SVGUseElement::buildShadowTree(SVGElement* target, SVGElementInstance* targ // Though if there are disallowed elements in the subtree, we have to remove them. // For instance: <use> on <g> containing <foreignObject> (indirect case). if (subtreeContainsDisallowedElement(newChild.get())) - removeDisallowedElementsFromSubtree(newChild.get()); + removeDisallowedElementsFromSubtree(*newChild); userAgentShadowRoot()->appendChild(newChild.release()); } @@ -720,7 +717,7 @@ void SVGUseElement::expandUseElementsInShadowTree(Node* element) // Don't ASSERT(target) here, it may be "pending", too. // Setup sub-shadow tree root node - RefPtr<SVGGElement> cloneParent = SVGGElement::create(SVGNames::gTag, *referencedDocument()); + RefPtr<SVGGElement> cloneParent = SVGGElement::create(*referencedDocument()); use->cloneChildNodes(cloneParent.get()); // Spec: In the generated content, the 'use' will be replaced by 'g', where all attributes from the @@ -739,7 +736,7 @@ void SVGUseElement::expandUseElementsInShadowTree(Node* element) // Though if there are disallowed elements in the subtree, we have to remove them. // For instance: <use> on <g> containing <foreignObject> (indirect case). if (subtreeContainsDisallowedElement(cloneParent.get())) - removeDisallowedElementsFromSubtree(cloneParent.get()); + removeDisallowedElementsFromSubtree(*cloneParent); RefPtr<Node> replacingElement(cloneParent.get()); @@ -768,7 +765,7 @@ void SVGUseElement::expandSymbolElementsInShadowTree(Node* element) // the generated 'svg'. If attributes width and/or height are not specified, the generated // 'svg' element will use values of 100% for these attributes. ASSERT(referencedDocument()); - RefPtr<SVGSVGElement> svgElement = SVGSVGElement::create(SVGNames::svgTag, *referencedDocument()); + RefPtr<SVGSVGElement> svgElement = SVGSVGElement::create(*referencedDocument()); // Transfer all data (attributes, etc.) from <symbol> to the new <svg> element. svgElement->cloneDataFromElement(*toElement(element)); @@ -785,7 +782,7 @@ void SVGUseElement::expandSymbolElementsInShadowTree(Node* element) // Though if there are disallowed elements in the subtree, we have to remove them. // For instance: <use> on <g> containing <foreignObject> (indirect case). if (subtreeContainsDisallowedElement(svgElement.get())) - removeDisallowedElementsFromSubtree(svgElement.get()); + removeDisallowedElementsFromSubtree(*svgElement); RefPtr<Node> replacingElement(svgElement.get()); @@ -891,7 +888,7 @@ SVGElementInstance* SVGUseElement::instanceForShadowTreeElement(Node* element, S void SVGUseElement::invalidateShadowTree() { - if (!attached() || m_needsShadowTreeRecreation) + if (!inActiveDocument() || m_needsShadowTreeRecreation) return; m_needsShadowTreeRecreation = true; setNeedsStyleRecalc(); @@ -940,7 +937,7 @@ bool SVGUseElement::selfHasRelativeLengths() const if (!element) return false; - return toSVGElement(element)->hasRelativeLengths(); + return element->hasRelativeLengths(); } void SVGUseElement::notifyFinished(Resource* resource) @@ -950,7 +947,7 @@ void SVGUseElement::notifyFinished(Resource* resource) invalidateShadowTree(); if (resource->errorOccurred()) - dispatchEvent(Event::create(eventNames().errorEvent)); + dispatchEvent(Event::create(EventTypeNames::error)); else if (!resource->wasCanceled()) SVGExternalResourcesRequired::dispatchLoadEvent(this); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.h index 459cb2b46c2..800af8f7c80 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.h @@ -39,7 +39,7 @@ class SVGUseElement FINAL : public SVGGraphicsElement, public SVGURIReference, public DocumentResourceClient { public: - static PassRefPtr<SVGUseElement> create(const QualifiedName&, Document&, bool wasInsertedByParser); + static PassRefPtr<SVGUseElement> create(Document&, bool wasInsertedByParser); virtual ~SVGUseElement(); SVGElementInstance* instanceRoot(); @@ -51,7 +51,7 @@ public: RenderObject* rendererClipChild() const; private: - SVGUseElement(const QualifiedName&, Document&, bool wasInsertedByParser); + SVGUseElement(Document&, bool wasInsertedByParser); virtual bool isValid() const { return SVGTests::isValid(); } virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); } @@ -126,11 +126,7 @@ private: Timer<SVGElement> m_svgLoadEventTimer; }; -inline SVGUseElement* toSVGUseElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::useTag)); - return static_cast<SVGUseElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGUseElement, hasTagName(SVGNames::useTag)); } diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.idl b/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.idl index 752daa99d05..eb5d82c8c22 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGUseElement.idl @@ -29,7 +29,7 @@ interface SVGUseElement : SVGGraphicsElement { readonly attribute SVGAnimatedLength width; readonly attribute SVGAnimatedLength height; - readonly attribute SVGElementInstance instanceRoot; + [MeasureAs=SVGInstanceRoot] readonly attribute SVGElementInstance instanceRoot; readonly attribute SVGElementInstance animatedInstanceRoot; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGVKernElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGVKernElement.cpp index 0908be7bf8f..ff60552df30 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGVKernElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGVKernElement.cpp @@ -22,22 +22,19 @@ #if ENABLE(SVG_FONTS) #include "core/svg/SVGVKernElement.h" -#include "SVGNames.h" -#include "core/svg/SVGFontElement.h" #include "core/svg/SVGParserUtilities.h" namespace WebCore { -inline SVGVKernElement::SVGVKernElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGVKernElement::SVGVKernElement(Document& document) + : SVGElement(SVGNames::vkernTag, document) { - ASSERT(hasTagName(SVGNames::vkernTag)); ScriptWrappable::init(this); } -PassRefPtr<SVGVKernElement> SVGVKernElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGVKernElement> SVGVKernElement::create(Document& document) { - return adoptRef(new SVGVKernElement(tagName, document)); + return adoptRef(new SVGVKernElement(document)); } Node::InsertionNotificationRequest SVGVKernElement::insertedInto(ContainerNode* rootParent) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGVKernElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGVKernElement.h index 185b0deff97..f8837bf686e 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGVKernElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGVKernElement.h @@ -29,12 +29,12 @@ namespace WebCore { class SVGVKernElement FINAL : public SVGElement { public: - static PassRefPtr<SVGVKernElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGVKernElement> create(Document&); void buildVerticalKerningPair(KerningPairVector&); private: - SVGVKernElement(const QualifiedName&, Document&); + explicit SVGVKernElement(Document&); virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE; virtual void removedFrom(ContainerNode*) OVERRIDE; @@ -42,11 +42,7 @@ private: virtual bool rendererIsNeeded(const RenderStyle&) { return false; } }; -inline SVGVKernElement* toSVGVKernElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::vkernTag)); - return static_cast<SVGVKernElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGVKernElement, hasTagName(SVGNames::vkernTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGViewElement.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGViewElement.cpp index 89d7bc448df..c72604a6f38 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGViewElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGViewElement.cpp @@ -22,10 +22,6 @@ #include "core/svg/SVGViewElement.h" -#include "SVGNames.h" -#include "core/svg/SVGFitToViewBox.h" -#include "core/svg/SVGStringList.h" -#include "core/svg/SVGZoomAndPan.h" namespace WebCore { @@ -41,19 +37,18 @@ BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGViewElement) REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement) END_REGISTER_ANIMATED_PROPERTIES -inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document& document) - : SVGElement(tagName, document) +inline SVGViewElement::SVGViewElement(Document& document) + : SVGElement(SVGNames::viewTag, document) , m_zoomAndPan(SVGZoomAndPanMagnify) , m_viewTarget(SVGNames::viewTargetAttr) { - ASSERT(hasTagName(SVGNames::viewTag)); ScriptWrappable::init(this); registerAnimatedPropertiesForSVGViewElement(); } -PassRefPtr<SVGViewElement> SVGViewElement::create(const QualifiedName& tagName, Document& document) +PassRefPtr<SVGViewElement> SVGViewElement::create(Document& document) { - return adoptRef(new SVGViewElement(tagName, document)); + return adoptRef(new SVGViewElement(document)); } bool SVGViewElement::isSupportedAttribute(const QualifiedName& attrName) diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGViewElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGViewElement.h index 881bfaf66b3..3069cbfcf7d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGViewElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGViewElement.h @@ -38,7 +38,7 @@ class SVGViewElement FINAL : public SVGElement, public SVGFitToViewBox, public SVGZoomAndPan { public: - static PassRefPtr<SVGViewElement> create(const QualifiedName&, Document&); + static PassRefPtr<SVGViewElement> create(Document&); using SVGElement::ref; using SVGElement::deref; @@ -48,7 +48,7 @@ public: void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); } private: - SVGViewElement(const QualifiedName&, Document&); + explicit SVGViewElement(Document&); // FIXME: svgAttributeChanged missing. bool isSupportedAttribute(const QualifiedName&); @@ -66,11 +66,7 @@ private: SVGStringList m_viewTarget; }; -inline SVGViewElement* toSVGViewElement(Node* node) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::viewTag)); - return static_cast<SVGViewElement*>(node); -} +DEFINE_NODE_TYPE_CASTS(SVGViewElement, hasTagName(SVGNames::viewTag)); } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.cpp index 7a188ccf851..b3201072998 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.cpp @@ -24,10 +24,7 @@ #include "bindings/v8/ExceptionState.h" #include "core/dom/Document.h" #include "core/svg/SVGAnimatedTransformList.h" -#include "core/svg/SVGFitToViewBox.h" #include "core/svg/SVGParserUtilities.h" -#include "core/svg/SVGSVGElement.h" -#include "core/svg/SVGTransformable.h" namespace WebCore { @@ -77,7 +74,7 @@ const SVGPropertyInfo* SVGViewSpec::transformPropertyInfo() return s_propertyInfo; } -SVGViewSpec::SVGViewSpec(SVGElement* contextElement) +SVGViewSpec::SVGViewSpec(WeakPtr<SVGSVGElement> contextElement) : m_contextElement(contextElement) , m_zoomAndPan(SVGZoomAndPanMagnify) { @@ -103,10 +100,10 @@ const AtomicString& SVGViewSpec::transformIdentifier() return s_identifier; } -void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionState& es) +void SVGViewSpec::setZoomAndPan(unsigned short, ExceptionState& exceptionState) { // SVGViewSpec and all of its content is read-only. - es.throwDOMException(NoModificationAllowedError); + exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError); } void SVGViewSpec::setTransformString(const String& transform) @@ -117,7 +114,7 @@ void SVGViewSpec::setTransformString(const String& transform) SVGTransformList newList; newList.parse(transform); - if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGElement, SVGAnimatedTransformList>(m_contextElement, transformPropertyInfo())) + if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGElement, SVGAnimatedTransformList>(m_contextElement.get(), transformPropertyInfo())) static_cast<SVGAnimatedTransformList*>(wrapper)->detachListWrappers(newList.size()); m_transform = newList; @@ -130,7 +127,7 @@ String SVGViewSpec::transformString() const String SVGViewSpec::viewBoxString() const { - return SVGPropertyTraits<FloatRect>::toString(viewBoxBaseValue()); + return SVGPropertyTraits<SVGRect>::toString(viewBoxBaseValue()); } String SVGViewSpec::preserveAspectRatioString() const @@ -142,7 +139,7 @@ SVGElement* SVGViewSpec::viewTarget() const { if (!m_contextElement) return 0; - Element* element = m_contextElement->treeScope().getElementById(m_viewTargetString); + Element* element = m_contextElement.get()->treeScope().getElementById(m_viewTargetString); if (!element || !element->isSVGElement()) return 0; return toSVGElement(element); @@ -174,7 +171,7 @@ PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreateViewBoxWrapper(SVGVie { ASSERT(ownerType); ASSERT(ownerType->contextElement()); - return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedRect, FloatRect>(ownerType->contextElement(), viewBoxPropertyInfo(), ownerType->m_viewBox); + return SVGAnimatedProperty::lookupOrCreateWrapper<SVGElement, SVGAnimatedRect, SVGRect>(ownerType->contextElement(), viewBoxPropertyInfo(), ownerType->m_viewBox); } PassRefPtr<SVGAnimatedProperty> SVGViewSpec::lookupOrCreatePreserveAspectRatioWrapper(SVGViewSpec* ownerType) @@ -195,7 +192,7 @@ void SVGViewSpec::reset() { m_zoomAndPan = SVGZoomAndPanMagnify; m_transform.clear(); - m_viewBox = FloatRect(); + m_viewBox = SVGRect(); m_preserveAspectRatio = SVGPreserveAspectRatio(); m_viewTargetString = emptyString(); } @@ -223,8 +220,8 @@ bool SVGViewSpec::parseViewSpecInternal(const CharType* ptr, const CharType* end if (ptr >= end || *ptr != '(') return false; ptr++; - FloatRect viewBox; - if (!SVGFitToViewBox::parseViewBox(&m_contextElement->document(), ptr, end, viewBox, false)) + SVGRect viewBox; + if (!SVGFitToViewBox::parseViewBox(&m_contextElement.get()->document(), ptr, end, viewBox, false)) return false; setViewBoxBaseValue(viewBox); if (ptr >= end || *ptr != ')') @@ -272,7 +269,7 @@ bool SVGViewSpec::parseViewSpecInternal(const CharType* ptr, const CharType* end if (ptr >= end || *ptr != '(') return false; ptr++; - SVGTransformable::parseTransformAttribute(m_transform, ptr, end, SVGTransformable::DoNotClearList); + parseTransformAttribute(m_transform, ptr, end, DoNotClearList); if (ptr >= end || *ptr != ')') return false; ptr++; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.h b/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.h index fd90616ff21..c5d742f5daa 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.h @@ -24,23 +24,22 @@ #include "core/svg/SVGAnimatedPreserveAspectRatio.h" #include "core/svg/SVGAnimatedRect.h" #include "core/svg/SVGFitToViewBox.h" +#include "core/svg/SVGSVGElement.h" #include "core/svg/SVGTransformList.h" #include "core/svg/SVGZoomAndPan.h" +#include "wtf/WeakPtr.h" namespace WebCore { class ExceptionState; -class SVGElement; class SVGTransformListPropertyTearOff; -class SVGViewSpec : public RefCounted<SVGViewSpec>, public ScriptWrappable, public SVGZoomAndPan, public SVGFitToViewBox { +class SVGViewSpec FINAL : public RefCounted<SVGViewSpec>, public ScriptWrappable, public SVGZoomAndPan, public SVGFitToViewBox { public: - virtual ~SVGViewSpec() { } - using RefCounted<SVGViewSpec>::ref; using RefCounted<SVGViewSpec>::deref; - static PassRefPtr<SVGViewSpec> create(SVGElement* contextElement) + static PassRefPtr<SVGViewSpec> create(WeakPtr<SVGSVGElement> contextElement) { return adoptRef(new SVGViewSpec(contextElement)); } @@ -64,8 +63,7 @@ public: void setZoomAndPan(unsigned short, ExceptionState&); void setZoomAndPanBaseValue(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); } - SVGElement* contextElement() const { return m_contextElement; } - void resetContextElement() { m_contextElement = 0; } + SVGElement* contextElement() const { return m_contextElement.get(); } // Custom non-animated 'transform' property. SVGTransformListPropertyTearOff* transform(); @@ -73,9 +71,9 @@ public: // Custom animated 'viewBox' property. PassRefPtr<SVGAnimatedRect> viewBox(); - FloatRect& viewBoxCurrentValue() { return m_viewBox; } - FloatRect viewBoxBaseValue() const { return m_viewBox; } - void setViewBoxBaseValue(const FloatRect& viewBox) { m_viewBox = viewBox; } + SVGRect& viewBoxCurrentValue() { return m_viewBox; } + SVGRect viewBoxBaseValue() const { return m_viewBox; } + void setViewBoxBaseValue(const SVGRect& viewBox) { m_viewBox = viewBox; } // Custom animated 'preserveAspectRatio' property. PassRefPtr<SVGAnimatedPreserveAspectRatio> preserveAspectRatio(); @@ -84,7 +82,7 @@ public: void setPreserveAspectRatioBaseValue(const SVGPreserveAspectRatio& preserveAspectRatio) { m_preserveAspectRatio = preserveAspectRatio; } private: - explicit SVGViewSpec(SVGElement*); + explicit SVGViewSpec(WeakPtr<SVGSVGElement>); static const SVGPropertyInfo* transformPropertyInfo(); static const SVGPropertyInfo* viewBoxPropertyInfo(); @@ -101,11 +99,11 @@ private: template<typename CharType> bool parseViewSpecInternal(const CharType* ptr, const CharType* end); - SVGElement* m_contextElement; - SVGZoomAndPanType m_zoomAndPan; + WeakPtr<SVGSVGElement> m_contextElement; + SVGZoomAndPanType m_zoomAndPan; SVGTransformList m_transform; - FloatRect m_viewBox; + SVGRect m_viewBox; SVGPreserveAspectRatio m_preserveAspectRatio; String m_viewTargetString; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.idl b/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.idl index ab57e7e01c6..80b1d809c44 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.idl +++ b/chromium/third_party/WebKit/Source/core/svg/SVGViewSpec.idl @@ -32,7 +32,7 @@ interface SVGViewSpec { readonly attribute DOMString viewTargetString; // SVGZoomAndPan - [SetterRaisesException] attribute unsigned short zoomAndPan; + [RaisesException=Setter] attribute unsigned short zoomAndPan; }; SVGViewSpec implements SVGFitToViewBox; diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGZoomEvent.cpp b/chromium/third_party/WebKit/Source/core/svg/SVGZoomEvent.cpp index f5403d6167c..fe5d283270f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGZoomEvent.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/SVGZoomEvent.cpp @@ -20,11 +20,10 @@ */ #include "config.h" - - -#include "core/dom/EventNames.h" #include "core/svg/SVGZoomEvent.h" +#include "core/events/ThreadLocalEventNames.h" + namespace WebCore { SVGZoomEvent::SVGZoomEvent() @@ -71,7 +70,7 @@ SVGPoint SVGZoomEvent::newTranslate() const const AtomicString& SVGZoomEvent::interfaceName() const { - return eventNames().interfaceForSVGZoomEvent; + return EventNames::SVGZoomEvent; } } // namespace WebCore diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGZoomEvent.h b/chromium/third_party/WebKit/Source/core/svg/SVGZoomEvent.h index 9aecc4d6bf1..59d31ae0b14 100644 --- a/chromium/third_party/WebKit/Source/core/svg/SVGZoomEvent.h +++ b/chromium/third_party/WebKit/Source/core/svg/SVGZoomEvent.h @@ -22,7 +22,7 @@ #ifndef SVGZoomEvent_h #define SVGZoomEvent_h -#include "core/dom/UIEvent.h" +#include "core/events/UIEvent.h" #include "core/svg/SVGPoint.h" #include "core/svg/SVGRect.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp b/chromium/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp index 08493279595..1ab6eda4342 100644 --- a/chromium/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.cpp @@ -228,8 +228,8 @@ void SMILTimeContainer::timerFired(Timer<SMILTimeContainer>*) void SMILTimeContainer::updateDocumentOrderIndexes() { unsigned timingElementCount = 0; - for (Element* element = m_ownerSVGElement; element; element = ElementTraversal::next(element, m_ownerSVGElement)) { - if (SVGSMILElement::isSMILElement(element)) + for (Element* element = m_ownerSVGElement; element; element = ElementTraversal::next(*element, m_ownerSVGElement)) { + if (isSVGSMILElement(*element)) toSVGSMILElement(element)->setDocumentOrderIndex(timingElementCount++); } m_documentOrderIndexesDirty = false; @@ -273,15 +273,6 @@ void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime) GroupedAnimationsMap::iterator end = m_scheduledAnimations.end(); for (GroupedAnimationsMap::iterator it = m_scheduledAnimations.begin(); it != end; ++it) { AnimationsVector* scheduled = it->value.get(); - unsigned size = scheduled->size(); - for (unsigned n = 0; n < size; n++) { - SVGSMILElement* animation = scheduled->at(n); - animation->connectConditions(); - } - } - - for (GroupedAnimationsMap::iterator it = m_scheduledAnimations.begin(); it != end; ++it) { - AnimationsVector* scheduled = it->value.get(); // Sort according to priority. Elements with later begin time have higher priority. // In case of a tie, document order decides. @@ -298,6 +289,7 @@ void SMILTimeContainer::updateAnimations(SMILTime elapsed, bool seekToTime) ASSERT(animation->hasValidAttributeName()); // Results are accumulated to the first animation that animates and contributes to a particular element/attribute pair. + // FIXME: we should ensure that resultElement is of an appropriate type. if (!resultElement) { if (!animation->hasValidAttributeType()) continue; diff --git a/chromium/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h b/chromium/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h index af3fb01b188..86b24ab46d1 100644 --- a/chromium/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h +++ b/chromium/third_party/WebKit/Source/core/svg/animation/SMILTimeContainer.h @@ -27,8 +27,8 @@ #define SMILTimeContainer_h #include "core/dom/QualifiedName.h" -#include "core/platform/Timer.h" #include "core/svg/animation/SMILTime.h" +#include "platform/Timer.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" #include "wtf/PassRefPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp b/chromium/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp index e380e73d153..7dbc0aedd5b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.cpp @@ -30,13 +30,13 @@ #include "XLinkNames.h" #include "bindings/v8/ExceptionStatePlaceholder.h" #include "core/dom/Document.h" -#include "core/dom/EventListener.h" -#include "core/dom/EventSender.h" -#include "core/platform/FloatConversion.h" +#include "core/events/EventListener.h" +#include "core/events/EventSender.h" #include "core/svg/SVGDocumentExtensions.h" #include "core/svg/SVGSVGElement.h" #include "core/svg/SVGURIReference.h" #include "core/svg/animation/SMILTimeContainer.h" +#include "platform/FloatConversion.h" #include "wtf/MathExtras.h" #include "wtf/StdLibExtras.h" #include "wtf/Vector.h" @@ -127,7 +127,7 @@ private: { } - virtual void handleEvent(ScriptExecutionContext*, Event*); + virtual void handleEvent(ExecutionContext*, Event*); SVGSMILElement* m_animation; SVGSMILElement::Condition* m_condition; @@ -140,7 +140,7 @@ bool ConditionEventListener::operator==(const EventListener& listener) return false; } -void ConditionEventListener::handleEvent(ScriptExecutionContext*, Event* event) +void ConditionEventListener::handleEvent(ExecutionContext*, Event* event) { if (!m_animation) return; @@ -239,7 +239,7 @@ void SVGSMILElement::buildPendingResource() } } -static inline QualifiedName constructQualifiedName(const SVGElement* svgElement, const String& attributeName) +static inline QualifiedName constructQualifiedName(const SVGElement* svgElement, const AtomicString& attributeName) { ASSERT(svgElement); if (attributeName.isEmpty()) @@ -247,12 +247,12 @@ static inline QualifiedName constructQualifiedName(const SVGElement* svgElement, if (!attributeName.contains(':')) return QualifiedName(nullAtom, attributeName, nullAtom); - String prefix; - String localName; + AtomicString prefix; + AtomicString localName; if (!Document::parseQualifiedName(attributeName, prefix, localName, ASSERT_NO_EXCEPTION)) return anyQName(); - String namespaceURI = svgElement->lookupNamespaceURI(prefix); + const AtomicString& namespaceURI = svgElement->lookupNamespaceURI(prefix); if (namespaceURI.isEmpty()) return anyQName(); @@ -460,14 +460,6 @@ bool SVGSMILElement::parseCondition(const String& value, BeginOrEnd beginOrEnd) return true; } -bool SVGSMILElement::isSMILElement(Node* node) -{ - if (!node) - return false; - return node->hasTagName(SVGNames::setTag) || node->hasTagName(SVGNames::animateTag) || node->hasTagName(SVGNames::animateMotionTag) - || node->hasTagName(SVGNames::animateTransformTag) || node->hasTagName(SVGNames::animateColorTag); -} - void SVGSMILElement::parseBeginOrEnd(const String& parseString, BeginOrEnd beginOrEnd) { Vector<SMILTimeWithOrigin>& timeList = beginOrEnd == Begin ? m_beginTimes : m_endTimes; @@ -551,6 +543,8 @@ void SVGSMILElement::svgAttributeChanged(const QualifiedName& attrName) else if (attrName.matches(XLinkNames::hrefAttr)) { SVGElementInstance::InvalidationGuard invalidationGuard(this); buildPendingResource(); + if (m_targetElement) + clearAnimatedType(m_targetElement); } else if (inDocument()) { if (attrName == SVGNames::beginAttr) beginListChanged(elapsed()); @@ -584,7 +578,7 @@ void SVGSMILElement::connectConditions() } else if (condition.m_type == Condition::Syncbase) { ASSERT(!condition.m_baseID.isEmpty()); condition.m_syncbase = treeScope().getElementById(condition.m_baseID); - if (!isSMILElement(condition.m_syncbase.get())) { + if (!condition.m_syncbase || !isSVGSMILElement(*condition.m_syncbase)) { condition.m_syncbase = 0; continue; } @@ -896,10 +890,9 @@ void SVGSMILElement::resolveFirstInterval() ASSERT(!begin.isIndefinite()); if (!begin.isUnresolved() && (begin != m_intervalBegin || end != m_intervalEnd)) { - bool wasUnresolved = m_intervalBegin.isUnresolved(); m_intervalBegin = begin; m_intervalEnd = end; - notifyDependentsIntervalChanged(wasUnresolved ? NewInterval : ExistingInterval); + notifyDependentsIntervalChanged(); m_nextProgressTime = min(m_nextProgressTime, m_intervalBegin); if (m_timeContainer) @@ -907,7 +900,7 @@ void SVGSMILElement::resolveFirstInterval() } } -bool SVGSMILElement::resolveNextInterval(bool notifyDependents) +bool SVGSMILElement::resolveNextInterval() { SMILTime begin; SMILTime end; @@ -917,8 +910,7 @@ bool SVGSMILElement::resolveNextInterval(bool notifyDependents) if (!begin.isUnresolved() && begin != m_intervalBegin) { m_intervalBegin = begin; m_intervalEnd = end; - if (notifyDependents) - notifyDependentsIntervalChanged(NewInterval); + notifyDependentsIntervalChanged(); m_nextProgressTime = min(m_nextProgressTime, m_intervalBegin); return true; } @@ -949,7 +941,7 @@ void SVGSMILElement::beginListChanged(SMILTime eventTime) if (m_activeState != Active) endedActiveInterval(); } - notifyDependentsIntervalChanged(ExistingInterval); + notifyDependentsIntervalChanged(); } } } @@ -970,7 +962,7 @@ void SVGSMILElement::endListChanged(SMILTime) newEnd = resolveActiveEnd(m_intervalBegin, newEnd); if (newEnd != m_intervalEnd) { m_intervalEnd = newEnd; - notifyDependentsIntervalChanged(ExistingInterval); + notifyDependentsIntervalChanged(); } } } @@ -995,12 +987,12 @@ void SVGSMILElement::checkRestart(SMILTime elapsed) SMILTime nextBegin = findInstanceTime(Begin, m_intervalBegin, false); if (nextBegin < m_intervalEnd) { m_intervalEnd = nextBegin; - notifyDependentsIntervalChanged(ExistingInterval); + notifyDependentsIntervalChanged(); } } if (elapsed >= m_intervalEnd) - resolveNextInterval(true); + resolveNextInterval(); } void SVGSMILElement::seekToIntervalCorrespondingToTime(SMILTime elapsed) @@ -1022,14 +1014,14 @@ void SVGSMILElement::seekToIntervalCorrespondingToTime(SMILTime elapsed) if (nextBegin < m_intervalEnd && elapsed >= nextBegin) { // End current interval, and start a new interval from the 'nextBegin' time. m_intervalEnd = nextBegin; - if (!resolveNextInterval(false)) + if (!resolveNextInterval()) break; continue; } // If the desired 'elapsed' time is past the current interval, advance to the next. if (elapsed >= m_intervalEnd) { - if (!resolveNextInterval(false)) + if (!resolveNextInterval()) break; continue; } @@ -1108,6 +1100,9 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b ASSERT(m_timeContainer); ASSERT(m_isWaitingForFirstInterval || m_intervalBegin.isFinite()); + if (!m_conditionsConnected) + connectConditions(); + if (!m_intervalBegin.isFinite()) { ASSERT(m_activeState == Inactive); m_nextProgressTime = SMILTime::unresolved(); @@ -1195,7 +1190,7 @@ bool SVGSMILElement::progress(SMILTime elapsed, SVGSMILElement* resultElement, b return animationIsContributing; } -void SVGSMILElement::notifyDependentsIntervalChanged(NewOrExistingInterval newOrExisting) +void SVGSMILElement::notifyDependentsIntervalChanged() { ASSERT(m_intervalBegin.isFinite()); DEFINE_STATIC_LOCAL(HashSet<SVGSMILElement*>, loopBreaker, ()); @@ -1205,13 +1200,13 @@ void SVGSMILElement::notifyDependentsIntervalChanged(NewOrExistingInterval newOr TimeDependentSet::iterator end = m_timeDependents.end(); for (TimeDependentSet::iterator it = m_timeDependents.begin(); it != end; ++it) { SVGSMILElement* dependent = *it; - dependent->createInstanceTimesFromSyncbase(this, newOrExisting); + dependent->createInstanceTimesFromSyncbase(this); } loopBreaker.remove(this); } -void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncbase, NewOrExistingInterval) +void SVGSMILElement::createInstanceTimesFromSyncbase(SVGSMILElement* syncbase) { // FIXME: To be really correct, this should handle updating exising interval by changing // the associated times instead of creating new ones. @@ -1238,7 +1233,7 @@ void SVGSMILElement::addTimeDependent(SVGSMILElement* animation) { m_timeDependents.add(animation); if (m_intervalBegin.isFinite()) - animation->createInstanceTimesFromSyncbase(this, NewInterval); + animation->createInstanceTimesFromSyncbase(this); } void SVGSMILElement::removeTimeDependent(SVGSMILElement* animation) diff --git a/chromium/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h b/chromium/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h index e9d5e0560b5..44c4fa19a47 100644 --- a/chromium/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h +++ b/chromium/third_party/WebKit/Source/core/svg/animation/SVGSMILElement.h @@ -26,6 +26,7 @@ #ifndef SVGSMILElement_h #define SVGSMILElement_h +#include "SVGNames.h" #include "core/svg/SVGElement.h" #include "core/svg/animation/SMILTime.h" #include "wtf/HashMap.h" @@ -45,8 +46,6 @@ public: SVGSMILElement(const QualifiedName&, Document&); virtual ~SVGSMILElement(); - static bool isSMILElement(Node*); - bool isSupportedAttribute(const QualifiedName&); virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE; virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE; @@ -145,7 +144,7 @@ private: SMILTime findInstanceTime(BeginOrEnd, SMILTime minimumTime, bool equalsMinimumOK) const; void resolveFirstInterval(); - bool resolveNextInterval(bool notifyDependents); + bool resolveNextInterval(); void resolveInterval(bool first, SMILTime& beginResult, SMILTime& endResult) const; SMILTime resolveActiveEnd(SMILTime resolvedBegin, SMILTime resolvedEnd) const; SMILTime repeatingDuration() const; @@ -181,14 +180,8 @@ private: // Event base timing void handleConditionEvent(Event*, Condition*); - // Syncbase timing - enum NewOrExistingInterval { - NewInterval, - ExistingInterval - }; - - void notifyDependentsIntervalChanged(NewOrExistingInterval); - void createInstanceTimesFromSyncbase(SVGSMILElement* syncbase, NewOrExistingInterval); + void notifyDependentsIntervalChanged(); + void createInstanceTimesFromSyncbase(SVGSMILElement* syncbase); void addTimeDependent(SVGSMILElement*); void removeTimeDependent(SVGSMILElement*); @@ -245,12 +238,14 @@ private: friend class ConditionEventListener; }; -inline SVGSMILElement* toSVGSMILElement(Element* element) +inline bool isSVGSMILElement(const Node& node) { - ASSERT_WITH_SECURITY_IMPLICATION(!element || SVGSMILElement::isSMILElement(element)); - return static_cast<SVGSMILElement*>(element); + return node.hasTagName(SVGNames::setTag) || node.hasTagName(SVGNames::animateTag) || node.hasTagName(SVGNames::animateMotionTag) + || node.hasTagName(SVGNames::animateTransformTag) || node.hasTagName(SVGNames::animateColorTag); } +DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSMILElement); + } #endif // SVGSMILElement_h diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp index e44c11b76c7..5526ab7ebf2 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImage.cpp @@ -33,13 +33,9 @@ #include "core/dom/shadow/ComposedTreeWalker.h" #include "core/loader/DocumentLoader.h" #include "core/page/Chrome.h" -#include "core/page/Frame.h" -#include "core/page/FrameView.h" -#include "core/page/Settings.h" -#include "core/platform/graphics/GraphicsContextStateSaver.h" -#include "core/platform/graphics/ImageBuffer.h" -#include "core/platform/graphics/ImageObserver.h" -#include "core/platform/graphics/IntRect.h" +#include "core/frame/Frame.h" +#include "core/frame/FrameView.h" +#include "core/frame/Settings.h" #include "core/rendering/style/RenderStyle.h" #include "core/rendering/svg/RenderSVGRoot.h" #include "core/svg/SVGDocument.h" @@ -47,6 +43,11 @@ #include "core/svg/SVGImageElement.h" #include "core/svg/SVGSVGElement.h" #include "core/svg/graphics/SVGImageChromeClient.h" +#include "platform/LengthFunctions.h" +#include "platform/geometry/IntRect.h" +#include "platform/graphics/GraphicsContextStateSaver.h" +#include "platform/graphics/ImageBuffer.h" +#include "platform/graphics/ImageObserver.h" #include "wtf/PassRefPtr.h" namespace WebCore { @@ -61,7 +62,7 @@ SVGImage::~SVGImage() if (m_page) { // Store m_page in a local variable, clearing m_page, so that SVGImageChromeClient knows we're destructed. OwnPtr<Page> currentPage = m_page.release(); - currentPage->mainFrame()->loader()->frameDetached(); // Break both the loader and view references to the frame + currentPage->mainFrame()->loader().frameDetached(); // Break both the loader and view references to the frame } // Verify that page teardown destroyed the Chrome @@ -119,13 +120,13 @@ void SVGImage::setContainerSize(const IntSize& size) SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); if (!rootElement) return; - RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer()); - if (!renderer) - return; FrameView* view = frameView(); view->resize(this->containerSize()); + RenderSVGRoot* renderer = toRenderSVGRoot(rootElement->renderer()); + if (!renderer) + return; renderer->setContainerSize(size); } @@ -164,7 +165,7 @@ IntSize SVGImage::containerSize() const } void SVGImage::drawForContainer(GraphicsContext* context, const FloatSize containerSize, float zoom, const FloatRect& dstRect, - const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode) + const FloatRect& srcRect, CompositeOperator compositeOp, blink::WebBlendMode blendMode) { if (!m_page) return; @@ -191,18 +192,18 @@ PassRefPtr<NativeImageSkia> SVGImage::nativeImageForCurrentFrame() if (!m_page) return 0; - OwnPtr<ImageBuffer> buffer = ImageBuffer::create(size(), 1); - if (!buffer) // failed to allocate image + OwnPtr<ImageBuffer> buffer = ImageBuffer::create(size()); + if (!buffer) return 0; - drawForContainer(buffer->context(), size(), 1, rect(), rect(), CompositeSourceOver, BlendModeNormal); + drawForContainer(buffer->context(), size(), 1, rect(), rect(), CompositeSourceOver, blink::WebBlendModeNormal); // FIXME: WK(Bug 113657): We should use DontCopyBackingStore here. return buffer->copyImage(CopyBackingStore)->nativeImageForCurrentFrame(); } void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize containerSize, float zoom, const FloatRect& srcRect, - const FloatSize& scale, const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode) + const FloatSize& scale, const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, blink::WebBlendMode blendMode, const IntSize& repeatSpacing) { FloatRect zoomedContainerRect = FloatRect(FloatPoint(), containerSize); zoomedContainerRect.scale(zoom); @@ -219,20 +220,21 @@ void SVGImage::drawPatternForContainer(GraphicsContext* context, const FloatSize FloatRect imageBufferSize = zoomedContainerRect; imageBufferSize.scale(imageBufferScale.width(), imageBufferScale.height()); - OwnPtr<ImageBuffer> buffer = ImageBuffer::create(expandedIntSize(imageBufferSize.size()), 1); + OwnPtr<ImageBuffer> buffer = ImageBuffer::create(expandedIntSize(imageBufferSize.size())); if (!buffer) // Failed to allocate buffer. return; - drawForContainer(buffer->context(), containerSize, zoom, imageBufferSize, zoomedContainerRect, CompositeSourceOver, BlendModeNormal); + + drawForContainer(buffer->context(), containerSize, zoom, imageBufferSize, zoomedContainerRect, CompositeSourceOver, blink::WebBlendModeNormal); RefPtr<Image> image = buffer->copyImage(DontCopyBackingStore, Unscaled); // Adjust the source rect and transform due to the image buffer's scaling. FloatRect scaledSrcRect = srcRect; scaledSrcRect.scale(imageBufferScale.width(), imageBufferScale.height()); - image->drawPattern(context, scaledSrcRect, scaleWithoutCTM, phase, compositeOp, dstRect, blendMode); + image->drawPattern(context, scaledSrcRect, scaleWithoutCTM, phase, compositeOp, dstRect, blendMode, repeatSpacing); } -void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode) +void SVGImage::draw(GraphicsContext* context, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator compositeOp, blink::WebBlendMode blendMode) { if (!m_page) return; @@ -361,6 +363,8 @@ void SVGImage::resetAnimation() bool SVGImage::dataChanged(bool allDataReceived) { + TRACE_EVENT0("webkit", "SVGImage::dataChanged"); + // Don't do anything if is an empty image. if (!data()->size()) return true; @@ -385,20 +389,20 @@ bool SVGImage::dataChanged(bool allDataReceived) m_page->settings().setPluginsEnabled(false); m_page->settings().setAcceleratedCompositingEnabled(false); - RefPtr<Frame> frame = Frame::create(m_page.get(), 0, dummyFrameLoaderClient); + RefPtr<Frame> frame = Frame::create(FrameInit::create(0, m_page.get(), dummyFrameLoaderClient)); frame->setView(FrameView::create(frame.get())); frame->init(); - FrameLoader* loader = frame->loader(); - loader->forceSandboxFlags(SandboxAll); + FrameLoader& loader = frame->loader(); + loader.forceSandboxFlags(SandboxAll); frame->view()->setScrollbarsSuppressed(true); frame->view()->setCanHaveScrollbars(false); // SVG Images will always synthesize a viewBox, if it's not available, and thus never see scrollbars. frame->view()->setTransparent(true); // SVG Images are transparent. - ASSERT(loader->activeDocumentLoader()); // DocumentLoader should have been created by frame->init(). - DocumentWriter* writer = loader->activeDocumentLoader()->beginWriting("image/svg+xml", "UTF-8"); + ASSERT(loader.activeDocumentLoader()); // DocumentLoader should have been created by frame->init(). + DocumentWriter* writer = loader.activeDocumentLoader()->beginWriting("image/svg+xml", "UTF-8"); writer->addData(data()->data(), data()->size()); - loader->activeDocumentLoader()->endWriting(writer); + loader.activeDocumentLoader()->endWriting(writer); // Set the intrinsic size before a container size is available. m_intrinsicSize = containerSize(); } diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImage.h b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImage.h index b75dd70e29e..19838c9e31d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImage.h +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImage.h @@ -27,7 +27,7 @@ #ifndef SVGImage_h #define SVGImage_h -#include "core/platform/graphics/Image.h" +#include "platform/graphics/Image.h" namespace WebCore { @@ -65,7 +65,7 @@ public: virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE; private: - friend class AccessibilityRenderObject; + friend class AXRenderObject; friend class SVGImageChromeClient; friend class SVGImageForContainer; @@ -86,27 +86,22 @@ private: // FIXME: SVGImages are underreporting decoded sizes and will be unable // to prune because these functions are not implemented yet. virtual void destroyDecodedData(bool) OVERRIDE { } - virtual unsigned decodedSize() const OVERRIDE { return 0; } // FIXME: Implement this to be less conservative. virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; } SVGImage(ImageObserver*); - virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator, BlendMode) OVERRIDE; - void drawForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode); + virtual void draw(GraphicsContext*, const FloatRect& fromRect, const FloatRect& toRect, CompositeOperator, blink::WebBlendMode) OVERRIDE; + void drawForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatRect&, CompositeOperator, blink::WebBlendMode); void drawPatternForContainer(GraphicsContext*, const FloatSize, float, const FloatRect&, const FloatSize&, const FloatPoint&, - CompositeOperator, const FloatRect&, BlendMode); + CompositeOperator, const FloatRect&, blink::WebBlendMode, const IntSize& repeatSpacing); OwnPtr<SVGImageChromeClient> m_chromeClient; OwnPtr<Page> m_page; IntSize m_intrinsicSize; }; -inline SVGImage* toSVGImage(Image* image) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!image || image->isSVGImage()); - return static_cast<SVGImage*>(image); -} +DEFINE_IMAGE_TYPE_CASTS(SVGImage); class ImageObserverDisabler { WTF_MAKE_NONCOPYABLE(ImageObserverDisabler); diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.cpp b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.cpp index 81153b3739e..059bbb42b4f 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.cpp @@ -22,13 +22,13 @@ #include "core/svg/graphics/SVGImageCache.h" #include "core/fetch/ImageResource.h" -#include "core/page/FrameView.h" +#include "core/frame/FrameView.h" #include "core/page/Page.h" -#include "core/platform/graphics/GraphicsContext.h" -#include "core/platform/graphics/ImageBuffer.h" #include "core/rendering/svg/RenderSVGRoot.h" #include "core/svg/graphics/SVGImage.h" #include "core/svg/graphics/SVGImageForContainer.h" +#include "platform/graphics/GraphicsContext.h" +#include "platform/graphics/ImageBuffer.h" namespace WebCore { @@ -46,9 +46,7 @@ SVGImageCache::~SVGImageCache() void SVGImageCache::removeClientFromCache(const ImageResourceClient* client) { ASSERT(client); - - if (m_imageForContainerMap.contains(client)) - m_imageForContainerMap.remove(client); + m_imageForContainerMap.remove(client); } void SVGImageCache::setContainerSizeForRenderer(const ImageResourceClient* client, const IntSize& containerSize, float containerZoom) diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.h b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.h index b2aef4ce377..0559062ba78 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.h +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageCache.h @@ -20,9 +20,9 @@ #ifndef SVGImageCache_h #define SVGImageCache_h -#include "core/platform/graphics/FloatSize.h" -#include "core/platform/graphics/Image.h" -#include "core/platform/graphics/IntSize.h" +#include "platform/geometry/FloatSize.h" +#include "platform/geometry/IntSize.h" +#include "platform/graphics/Image.h" #include "wtf/HashMap.h" #include "wtf/PassOwnPtr.h" #include "wtf/RefPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h index b17ca84a17b..76a4a9c56be 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageChromeClient.h @@ -30,7 +30,7 @@ #define SVGImageChromeClient_h #include "core/loader/EmptyClients.h" -#include "core/platform/graphics/ImageObserver.h" +#include "platform/graphics/ImageObserver.h" namespace WebCore { @@ -61,11 +61,7 @@ private: SVGImage* m_image; }; -inline SVGImageChromeClient* toSVGImageChromeClient(ChromeClient* client) -{ - ASSERT_WITH_SECURITY_IMPLICATION(!client || client->isSVGImageChromeClient()); - return static_cast<SVGImageChromeClient*>(client); -} +DEFINE_TYPE_CASTS(SVGImageChromeClient, ChromeClient, client, client->isSVGImageChromeClient(), client.isSVGImageChromeClient()); } diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.cpp b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.cpp index 27f9a94447a..96a0080d48c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.cpp @@ -20,10 +20,9 @@ #include "config.h" #include "core/svg/graphics/SVGImageForContainer.h" -#include "core/platform/graphics/FloatRect.h" -#include "core/platform/graphics/FloatSize.h" -#include "core/platform/graphics/Image.h" #include "core/svg/graphics/SVGImage.h" +#include "platform/geometry/FloatRect.h" +#include "platform/geometry/FloatSize.h" #include "wtf/PassRefPtr.h" namespace WebCore { @@ -36,15 +35,15 @@ IntSize SVGImageForContainer::size() const } void SVGImageForContainer::draw(GraphicsContext* context, const FloatRect& dstRect, - const FloatRect& srcRect, CompositeOperator compositeOp, BlendMode blendMode) + const FloatRect& srcRect, CompositeOperator compositeOp, blink::WebBlendMode blendMode) { m_image->drawForContainer(context, m_containerSize, m_zoom, dstRect, srcRect, compositeOp, blendMode); } void SVGImageForContainer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const FloatSize& scale, - const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, BlendMode blendMode) + const FloatPoint& phase, CompositeOperator compositeOp, const FloatRect& dstRect, blink::WebBlendMode blendMode, const IntSize& repeatSpacing) { - m_image->drawPatternForContainer(context, m_containerSize, m_zoom, srcRect, scale, phase, compositeOp, dstRect, blendMode); + m_image->drawPatternForContainer(context, m_containerSize, m_zoom, srcRect, scale, phase, compositeOp, dstRect, blendMode, repeatSpacing); } PassRefPtr<NativeImageSkia> SVGImageForContainer::nativeImageForCurrentFrame() diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.h b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.h index a90f652d012..4ea589eec44 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.h +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/SVGImageForContainer.h @@ -26,10 +26,10 @@ #ifndef SVGImageForContainer_h #define SVGImageForContainer_h -#include "core/platform/graphics/FloatRect.h" -#include "core/platform/graphics/FloatSize.h" -#include "core/platform/graphics/Image.h" #include "core/svg/graphics/SVGImage.h" +#include "platform/geometry/FloatRect.h" +#include "platform/geometry/FloatSize.h" +#include "platform/graphics/Image.h" namespace WebCore { @@ -52,9 +52,9 @@ public: m_image->computeIntrinsicDimensions(intrinsicWidth, intrinsicHeight, intrinsicRatio); } - virtual void draw(GraphicsContext*, const FloatRect&, const FloatRect&, CompositeOperator, BlendMode) OVERRIDE; + virtual void draw(GraphicsContext*, const FloatRect&, const FloatRect&, CompositeOperator, blink::WebBlendMode) OVERRIDE; - virtual void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const FloatPoint&, CompositeOperator, const FloatRect&, BlendMode) OVERRIDE; + virtual void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize&, const FloatPoint&, CompositeOperator, const FloatRect&, blink::WebBlendMode, const IntSize& repeatSpacing) OVERRIDE; // FIXME: Implement this to be less conservative. virtual bool currentFrameKnownToBeOpaque() OVERRIDE { return false; } @@ -70,7 +70,6 @@ private: } virtual void destroyDecodedData(bool) OVERRIDE { } - virtual unsigned decodedSize() const OVERRIDE { return 0; } SVGImage* m_image; const FloatSize m_containerSize; diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp b/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp index f61a702fc56..ab2d6ca4e97 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.cpp @@ -26,16 +26,14 @@ #include "core/svg/graphics/filters/SVGFEImage.h" #include "SkBitmapSource.h" -#include "core/platform/graphics/GraphicsContext.h" -#include "core/platform/graphics/filters/Filter.h" -#include "core/platform/graphics/transforms/AffineTransform.h" -#include "core/platform/text/TextStream.h" #include "core/rendering/RenderObject.h" -#include "core/rendering/RenderTreeAsText.h" #include "core/rendering/svg/SVGRenderingContext.h" #include "core/svg/SVGElement.h" -#include "core/svg/SVGPreserveAspectRatio.h" #include "core/svg/SVGURIReference.h" +#include "platform/graphics/GraphicsContext.h" +#include "platform/graphics/filters/Filter.h" +#include "platform/text/TextStream.h" +#include "platform/transforms/AffineTransform.h" namespace WebCore { @@ -122,13 +120,12 @@ void FEImage::applySoftware() SVGElement* contextNode = toSVGElement(renderer->node()); if (contextNode->hasRelativeLengths()) { SVGLengthContext lengthContext(contextNode); - float width = 0; - float height = 0; + FloatSize viewportSize; // If we're referencing an element with percentage units, eg. <rect with="30%"> those values were resolved against the viewport. // Build up a transformation that maps from the viewport space to the filter primitive subregion. - if (lengthContext.determineViewport(width, height)) - resultImage->context()->concatCTM(makeMapBetweenRects(FloatRect(0, 0, width, height), destRect)); + if (lengthContext.determineViewport(viewportSize)) + resultImage->context()->concatCTM(makeMapBetweenRects(FloatRect(FloatPoint(), viewportSize), destRect)); } else { const AffineTransform& absoluteTransform = filter()->absoluteTransform(); resultImage->context()->concatCTM(absoluteTransform); diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.h b/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.h index 3f755418bad..b82f673b7a5 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.h +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFEImage.h @@ -24,7 +24,7 @@ #ifndef SVGFEImage_h #define SVGFEImage_h -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "core/svg/SVGPreserveAspectRatio.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilter.h b/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilter.h index d140541d7c5..ad30b39218c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilter.h +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilter.h @@ -21,11 +21,11 @@ #ifndef SVGFilter_h #define SVGFilter_h -#include "core/platform/graphics/FloatRect.h" -#include "core/platform/graphics/FloatSize.h" -#include "core/platform/graphics/filters/Filter.h" -#include "core/platform/graphics/filters/FilterEffect.h" -#include "core/platform/graphics/transforms/AffineTransform.h" +#include "platform/geometry/FloatRect.h" +#include "platform/geometry/FloatSize.h" +#include "platform/graphics/filters/Filter.h" +#include "platform/graphics/filters/FilterEffect.h" +#include "platform/transforms/AffineTransform.h" #include "wtf/PassRefPtr.h" #include "wtf/RefCounted.h" #include "wtf/RefPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp b/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp index 084203f52c1..fec801263c6 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.cpp @@ -20,11 +20,8 @@ #include "config.h" #include "core/svg/graphics/filters/SVGFilterBuilder.h" -#include "core/platform/graphics/filters/FilterEffect.h" -#include "core/platform/graphics/filters/SourceAlpha.h" -#include "core/platform/graphics/filters/SourceGraphic.h" -#include "wtf/PassRefPtr.h" -#include "wtf/text/WTFString.h" +#include "platform/graphics/filters/SourceAlpha.h" +#include "platform/graphics/filters/SourceGraphic.h" namespace WebCore { diff --git a/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.h b/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.h index f879aca9a74..00482d3bb1c 100644 --- a/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.h +++ b/chromium/third_party/WebKit/Source/core/svg/graphics/filters/SVGFilterBuilder.h @@ -21,7 +21,7 @@ #ifndef SVGFilterBuilder_h #define SVGFilterBuilder_h -#include "core/platform/graphics/filters/FilterEffect.h" +#include "platform/graphics/filters/FilterEffect.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" #include "wtf/PassRefPtr.h" diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h index cd6014b37e8..962e7f3e2e0 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedEnumerationPropertyTearOff.h @@ -29,14 +29,14 @@ namespace WebCore { template<typename EnumType> class SVGAnimatedEnumerationPropertyTearOff : public SVGAnimatedStaticPropertyTearOff<unsigned> { public: - virtual void setBaseVal(const unsigned& property, ExceptionState& es) + virtual void setBaseVal(const unsigned& property, ExceptionState& exceptionState) { // All SVG enumeration values, that are allowed to be set via SVG DOM start with 1, 0 corresponds to unknown and is not settable through SVG DOM. if (!property || property > SVGPropertyTraits<EnumType>::highestEnumValue()) { - es.throwTypeError(); + exceptionState.throwUninformativeAndGenericTypeError(); return; } - SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property, es); + SVGAnimatedStaticPropertyTearOff<unsigned>::setBaseVal(property, exceptionState); } static PassRefPtr<SVGAnimatedEnumerationPropertyTearOff<EnumType> > create(SVGElement* contextElement, const QualifiedName& attributeName, AnimatedPropertyType animatedPropertyType, EnumType& property) diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedListPropertyTearOff.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedListPropertyTearOff.h index fdbd217ffd5..bebcc5a7202 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedListPropertyTearOff.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedListPropertyTearOff.h @@ -39,6 +39,14 @@ public: typedef SVGListPropertyTearOff<PropertyType> ListPropertyTearOff; typedef PropertyType ContentType; + virtual ~SVGAnimatedListPropertyTearOff() + { + if (m_baseVal) + static_cast<ListPropertyTearOff*>(m_baseVal.get())->clearAnimatedProperty(); + if (m_animVal) + static_cast<ListPropertyTearOff*>(m_animVal.get())->clearAnimatedProperty(); + } + virtual ListProperty* baseVal() { if (!m_baseVal) @@ -109,6 +117,7 @@ public: { ASSERT(m_isAnimating); ASSERT(m_animVal); + ASSERT(contextElement()); ASSERT(m_values.size() == m_wrappers.size()); ListProperty* animVal = static_cast<ListProperty*>(m_animVal.get()); diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.cpp b/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.cpp index e15971cd355..b1e1e7835cd 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.cpp @@ -32,28 +32,43 @@ SVGAnimatedProperty::SVGAnimatedProperty(SVGElement* contextElement, const Quali , m_isAnimating(false) , m_isReadOnly(false) { + contextElement->setContextElement(); } SVGAnimatedProperty::~SVGAnimatedProperty() { - // Remove wrapper from cache. + // Assure that animationEnded() was called, if animationStarted() was called before. + ASSERT(!m_isAnimating); +} + +void SVGAnimatedProperty::detachAnimatedPropertiesForElement(SVGElement* element) +{ + // Remove wrappers from cache. Cache* cache = animatedPropertyCache(); + + Vector<SVGAnimatedPropertyDescription> keysToRemove; + const Cache::const_iterator end = cache->end(); for (Cache::const_iterator it = cache->begin(); it != end; ++it) { - if (it->value == this) { - cache->remove(it->key); - break; + if (it->key.m_element == element) { + it->value->resetContextElement(); + keysToRemove.append(it->key); } } - // Assure that animationEnded() was called, if animationStarted() was called before. - ASSERT(!m_isAnimating); + for (Vector<SVGAnimatedPropertyDescription>::const_iterator it = keysToRemove.begin(); it != keysToRemove.end(); ++it) { + // http://crbug.com/333156 : + // There are cases where detachAnimatedPropertiesForElement is called recursively from ~SVGAnimatedProperty. + // This below protect makes this function safe by deferring the recursive call until we finish touching the HashMap. + RefPtr<SVGAnimatedProperty> protect = cache->get(*it); + cache->remove(*it); + } } void SVGAnimatedProperty::commitChange() { ASSERT(m_contextElement); - ASSERT(!m_contextElement->m_deletionHasBegun); + ASSERT_WITH_SECURITY_IMPLICATION(!m_contextElement->m_deletionHasBegun); m_contextElement->invalidateSVGAttributes(); m_contextElement->svgAttributeChanged(m_attributeName); } diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.h index 37eba881a58..eb0ba54e4bf 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedProperty.h @@ -31,7 +31,8 @@ class SVGElement; class SVGAnimatedProperty : public RefCounted<SVGAnimatedProperty> { public: - SVGElement* contextElement() const { return m_contextElement.get(); } + SVGElement* contextElement() const { return m_contextElement; } + void resetContextElement() { m_contextElement = 0; } const QualifiedName& attributeName() const { return m_attributeName; } AnimatedPropertyType animatedPropertyType() const { return m_animatedPropertyType; } bool isAnimating() const { return m_isAnimating; } @@ -43,7 +44,7 @@ public: virtual bool isAnimatedListTearOff() const { return false; } // Caching facilities. - typedef HashMap<SVGAnimatedPropertyDescription, SVGAnimatedProperty*, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> Cache; + typedef HashMap<SVGAnimatedPropertyDescription, RefPtr<SVGAnimatedProperty>, SVGAnimatedPropertyDescriptionHash, SVGAnimatedPropertyDescriptionHashTraits> Cache; virtual ~SVGAnimatedProperty(); @@ -57,7 +58,7 @@ public: wrapper = TearOffType::create(element, info->attributeName, info->animatedPropertyType, property); if (info->animatedPropertyState == PropertyIsReadOnly) wrapper->setIsReadOnly(); - animatedPropertyCache()->set(key, wrapper.get()); + animatedPropertyCache()->set(key, wrapper); } return static_pointer_cast<TearOffType>(wrapper); } @@ -76,13 +77,15 @@ public: return lookupWrapper<OwnerType, TearOffType>(const_cast<OwnerType*>(element), info); } + static void detachAnimatedPropertiesForElement(SVGElement*); + protected: SVGAnimatedProperty(SVGElement*, const QualifiedName&, AnimatedPropertyType); private: static Cache* animatedPropertyCache(); - RefPtr<SVGElement> m_contextElement; + SVGElement* m_contextElement; const QualifiedName& m_attributeName; AnimatedPropertyType m_animatedPropertyType; diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedPropertyMacros.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedPropertyMacros.h index e864b5cca78..74e377f6e6b 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedPropertyMacros.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGAnimatedPropertyMacros.h @@ -36,7 +36,6 @@ struct SVGSynchronizableAnimatedProperty { SVGSynchronizableAnimatedProperty() : value(SVGPropertyTraits<PropertyType>::initialValue()) , shouldSynchronize(false) - , isValid(false) { } @@ -44,7 +43,6 @@ struct SVGSynchronizableAnimatedProperty { SVGSynchronizableAnimatedProperty(const ConstructorParameter1& value1) : value(value1) , shouldSynchronize(false) - , isValid(false) { } @@ -52,7 +50,6 @@ struct SVGSynchronizableAnimatedProperty { SVGSynchronizableAnimatedProperty(const ConstructorParameter1& value1, const ConstructorParameter2& value2) : value(value1, value2) , shouldSynchronize(false) - , isValid(false) { } @@ -63,7 +60,6 @@ struct SVGSynchronizableAnimatedProperty { PropertyType value; bool shouldSynchronize : 1; - bool isValid : 1; }; // Property registration helpers @@ -79,8 +75,9 @@ SVGAttributeToPropertyMap& OwnerType::localAttributeToPropertyMap() const \ return attributeToPropertyMap(); \ } \ \ -static void registerAnimatedPropertiesFor##OwnerType() \ +void OwnerType::registerAnimatedPropertiesFor##OwnerType() \ { \ + OwnerType::m_cleanupAnimatedPropertiesCaller.setOwner(this); \ SVGAttributeToPropertyMap& map = OwnerType::attributeToPropertyMap(); \ if (!map.isEmpty()) \ return; \ @@ -120,10 +117,9 @@ PropertyType& OwnerType::LowerProperty##BaseValue() const \ return m_##LowerProperty.value; \ } \ \ -void OwnerType::set##UpperProperty##BaseValue(const PropertyType& type, const bool validValue) \ +void OwnerType::set##UpperProperty##BaseValue(const PropertyType& type) \ { \ m_##LowerProperty.value = type; \ - m_##LowerProperty.isValid = validValue; \ } \ \ PassRefPtr<TearOffType> OwnerType::LowerProperty() \ @@ -132,11 +128,6 @@ PassRefPtr<TearOffType> OwnerType::LowerProperty() \ return static_pointer_cast<TearOffType>(lookupOrCreate##UpperProperty##Wrapper(this)); \ } \ \ -bool OwnerType::LowerProperty##IsValid() const \ -{ \ - return m_##LowerProperty.isValid; \ -} \ -\ void OwnerType::synchronize##UpperProperty() \ { \ if (!m_##LowerProperty.shouldSynchronize) \ @@ -164,6 +155,7 @@ void OwnerType::synchronize##UpperProperty(SVGElement* maskedOwnerType) \ public: \ static SVGAttributeToPropertyMap& attributeToPropertyMap(); \ virtual SVGAttributeToPropertyMap& localAttributeToPropertyMap() const; \ + void registerAnimatedPropertiesFor##OwnerType(); \ typedef OwnerType UseOwnerType; #define DECLARE_ANIMATED_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty) \ @@ -171,9 +163,8 @@ public: \ static const SVGPropertyInfo* LowerProperty##PropertyInfo(); \ PropertyType& LowerProperty##CurrentValue() const; \ PropertyType& LowerProperty##BaseValue() const; \ - void set##UpperProperty##BaseValue(const PropertyType& type, const bool = true); \ + void set##UpperProperty##BaseValue(const PropertyType& type); \ PassRefPtr<TearOffType> LowerProperty(); \ - bool LowerProperty##IsValid() const; \ \ private: \ void synchronize##UpperProperty(); \ @@ -182,7 +173,8 @@ private: \ \ mutable SVGSynchronizableAnimatedProperty<PropertyType> m_##LowerProperty; -#define END_DECLARE_ANIMATED_PROPERTIES +#define END_DECLARE_ANIMATED_PROPERTIES \ + CleanUpAnimatedPropertiesCaller m_cleanupAnimatedPropertiesCaller; // List specific definition/declaration helpers #define DECLARE_ANIMATED_LIST_PROPERTY(TearOffType, PropertyType, UpperProperty, LowerProperty) \ diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGListProperty.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGListProperty.h index 7760b8d1d71..27e8d66cf1d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGListProperty.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGListProperty.h @@ -49,10 +49,10 @@ public: typedef SVGAnimatedListPropertyTearOff<PropertyType> AnimatedListPropertyTearOff; typedef typename SVGAnimatedListPropertyTearOff<PropertyType>::ListWrapperCache ListWrapperCache; - bool canAlterList(ExceptionState& es) const + bool canAlterList(ExceptionState& exceptionState) const { if (m_role == AnimValRole) { - es.throwDOMException(NoModificationAllowedError); + exceptionState.throwUninformativeAndGenericDOMException(NoModificationAllowedError); return false; } @@ -97,18 +97,18 @@ public: } // SVGList::clear() - void clearValues(ExceptionState& es) + void clearValues(ExceptionState& exceptionState) { - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return; m_values->clear(); commitChange(); } - void clearValuesAndWrappers(ExceptionState& es) + void clearValuesAndWrappers(ExceptionState& exceptionState) { - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return; detachListWrappers(0); @@ -123,9 +123,9 @@ public: } // SVGList::initialize() - ListItemType initializeValues(const ListItemType& newItem, ExceptionState& es) + ListItemType initializeValues(const ListItemType& newItem, ExceptionState& exceptionState) { - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return ListItemType(); // Spec: If the inserted item is already in a list, it is removed from its previous list before it is inserted into this list. @@ -139,15 +139,15 @@ public: return newItem; } - PassListItemTearOff initializeValuesAndWrappers(PassListItemTearOff passNewItem, ExceptionState& es) + PassListItemTearOff initializeValuesAndWrappers(PassListItemTearOff passNewItem, ExceptionState& exceptionState) { ASSERT(m_wrappers); - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return 0; // Not specified, but FF/Opera do it this way, and it's just sane. if (!passNewItem) { - es.throwTypeError(); + exceptionState.throwUninformativeAndGenericTypeError(); return 0; } @@ -169,29 +169,29 @@ public: } // SVGList::getItem() - bool canGetItem(unsigned index, ExceptionState& es) + bool canGetItem(unsigned index, ExceptionState& exceptionState) { if (index >= m_values->size()) { - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return false; } return true; } - ListItemType getItemValues(unsigned index, ExceptionState& es) + ListItemType getItemValues(unsigned index, ExceptionState& exceptionState) { - if (!canGetItem(index, es)) + if (!canGetItem(index, exceptionState)) return ListItemType(); // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy. return m_values->at(index); } - PassListItemTearOff getItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionState& es) + PassListItemTearOff getItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionState& exceptionState) { ASSERT(m_wrappers); - if (!canGetItem(index, es)) + if (!canGetItem(index, exceptionState)) return 0; // Spec: Returns the specified item from the list. The returned item is the item itself and not a copy. @@ -210,9 +210,9 @@ public: } // SVGList::insertItemBefore() - ListItemType insertItemBeforeValues(const ListItemType& newItem, unsigned index, ExceptionState& es) + ListItemType insertItemBeforeValues(const ListItemType& newItem, unsigned index, ExceptionState& exceptionState) { - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return ListItemType(); // Spec: If the index is greater than or equal to numberOfItems, then the new item is appended to the end of the list. @@ -233,15 +233,15 @@ public: return newItem; } - PassListItemTearOff insertItemBeforeValuesAndWrappers(PassListItemTearOff passNewItem, unsigned index, ExceptionState& es) + PassListItemTearOff insertItemBeforeValuesAndWrappers(PassListItemTearOff passNewItem, unsigned index, ExceptionState& exceptionState) { ASSERT(m_wrappers); - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return 0; // Not specified, but FF/Opera do it this way, and it's just sane. if (!passNewItem) { - es.throwTypeError(); + exceptionState.throwUninformativeAndGenericTypeError(); return 0; } @@ -268,22 +268,22 @@ public: } // SVGList::replaceItem() - bool canReplaceItem(unsigned index, ExceptionState& es) + bool canReplaceItem(unsigned index, ExceptionState& exceptionState) { - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return false; if (index >= m_values->size()) { - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return false; } return true; } - ListItemType replaceItemValues(const ListItemType& newItem, unsigned index, ExceptionState& es) + ListItemType replaceItemValues(const ListItemType& newItem, unsigned index, ExceptionState& exceptionState) { - if (!canReplaceItem(index, es)) + if (!canReplaceItem(index, exceptionState)) return ListItemType(); // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list. @@ -295,7 +295,7 @@ public: if (m_values->isEmpty()) { // 'newItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace. - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return ListItemType(); } @@ -306,15 +306,15 @@ public: return newItem; } - PassListItemTearOff replaceItemValuesAndWrappers(PassListItemTearOff passNewItem, unsigned index, ExceptionState& es) + PassListItemTearOff replaceItemValuesAndWrappers(PassListItemTearOff passNewItem, unsigned index, ExceptionState& exceptionState) { ASSERT(m_wrappers); - if (!canReplaceItem(index, es)) + if (!canReplaceItem(index, exceptionState)) return 0; // Not specified, but FF/Opera do it this way, and it's just sane. if (!passNewItem) { - es.throwTypeError(); + exceptionState.throwUninformativeAndGenericTypeError(); return 0; } @@ -329,7 +329,7 @@ public: if (m_values->isEmpty()) { ASSERT(m_wrappers->isEmpty()); // 'passNewItem' already lived in our list, we removed it, and now we're empty, which means there's nothing to replace. - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return 0; } @@ -347,22 +347,22 @@ public: } // SVGList::removeItem() - bool canRemoveItem(unsigned index, ExceptionState& es) + bool canRemoveItem(unsigned index, ExceptionState& exceptionState) { - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return false; if (index >= m_values->size()) { - es.throwDOMException(IndexSizeError); + exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); return false; } return true; } - ListItemType removeItemValues(unsigned index, ExceptionState& es) + ListItemType removeItemValues(unsigned index, ExceptionState& exceptionState) { - if (!canRemoveItem(index, es)) + if (!canRemoveItem(index, exceptionState)) return ListItemType(); ListItemType oldItem = m_values->at(index); @@ -372,10 +372,10 @@ public: return oldItem; } - PassListItemTearOff removeItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionState& es) + PassListItemTearOff removeItemValuesAndWrappers(AnimatedListPropertyTearOff* animatedList, unsigned index, ExceptionState& exceptionState) { ASSERT(m_wrappers); - if (!canRemoveItem(index, es)) + if (!canRemoveItem(index, exceptionState)) return 0; ASSERT(m_values->size() == m_wrappers->size()); @@ -394,9 +394,9 @@ public: } // SVGList::appendItem() - ListItemType appendItemValues(const ListItemType& newItem, ExceptionState& es) + ListItemType appendItemValues(const ListItemType& newItem, ExceptionState& exceptionState) { - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return ListItemType(); // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list. @@ -409,15 +409,15 @@ public: return newItem; } - PassListItemTearOff appendItemValuesAndWrappers(PassListItemTearOff passNewItem, ExceptionState& es) + PassListItemTearOff appendItemValuesAndWrappers(PassListItemTearOff passNewItem, ExceptionState& exceptionState) { ASSERT(m_wrappers); - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return 0; // Not specified, but FF/Opera do it this way, and it's just sane. if (!passNewItem) { - es.throwTypeError(); + exceptionState.throwUninformativeAndGenericTypeError(); return 0; } diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGListPropertyTearOff.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGListPropertyTearOff.h index c6246d7c24a..7f1410974fb 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGListPropertyTearOff.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGListPropertyTearOff.h @@ -80,39 +80,53 @@ public: } // SVGList API - void clear(ExceptionState& es) + void clear(ExceptionState& exceptionState) { - Base::clearValuesAndWrappers(es); + Base::clearValuesAndWrappers(exceptionState); } - PassListItemTearOff initialize(PassListItemTearOff passNewItem, ExceptionState& es) + PassListItemTearOff initialize(PassListItemTearOff passNewItem, ExceptionState& exceptionState) { - return Base::initializeValuesAndWrappers(passNewItem, es); + return Base::initializeValuesAndWrappers(passNewItem, exceptionState); } - PassListItemTearOff getItem(unsigned index, ExceptionState& es) + PassListItemTearOff getItem(unsigned index, ExceptionState& exceptionState) { - return Base::getItemValuesAndWrappers(m_animatedProperty.get(), index, es); + ASSERT(m_animatedProperty); + return Base::getItemValuesAndWrappers(m_animatedProperty, index, exceptionState); } - PassListItemTearOff insertItemBefore(PassListItemTearOff passNewItem, unsigned index, ExceptionState& es) + PassListItemTearOff insertItemBefore(PassListItemTearOff passNewItem, unsigned index, ExceptionState& exceptionState) { - return Base::insertItemBeforeValuesAndWrappers(passNewItem, index, es); + return Base::insertItemBeforeValuesAndWrappers(passNewItem, index, exceptionState); } - PassListItemTearOff replaceItem(PassListItemTearOff passNewItem, unsigned index, ExceptionState& es) + PassListItemTearOff replaceItem(PassListItemTearOff passNewItem, unsigned index, ExceptionState& exceptionState) { - return Base::replaceItemValuesAndWrappers(passNewItem, index, es); + return Base::replaceItemValuesAndWrappers(passNewItem, index, exceptionState); } - PassListItemTearOff removeItem(unsigned index, ExceptionState& es) + PassListItemTearOff removeItem(unsigned index, ExceptionState& exceptionState) { - return Base::removeItemValuesAndWrappers(m_animatedProperty.get(), index, es); + ASSERT(m_animatedProperty); + return Base::removeItemValuesAndWrappers(m_animatedProperty, index, exceptionState); } - PassListItemTearOff appendItem(PassListItemTearOff passNewItem, ExceptionState& es) + PassListItemTearOff appendItem(PassListItemTearOff passNewItem, ExceptionState& exceptionState) { - return Base::appendItemValuesAndWrappers(passNewItem, es); + return Base::appendItemValuesAndWrappers(passNewItem, exceptionState); + } + + SVGElement* contextElement() const + { + ASSERT(m_animatedProperty); + return m_animatedProperty->contextElement(); + } + + void clearAnimatedProperty() + { + ASSERT(m_animatedProperty); + m_animatedProperty = 0; } protected: @@ -120,6 +134,7 @@ protected: : SVGListProperty<PropertyType>(role, values, &wrappers) , m_animatedProperty(animatedProperty) { + ASSERT(m_animatedProperty); } virtual bool isReadOnly() const @@ -135,6 +150,7 @@ protected: { ASSERT(m_values); ASSERT(m_wrappers); + ASSERT(m_animatedProperty); // Update existing wrappers, as the index in the values list has changed. unsigned size = m_wrappers->size(); @@ -143,7 +159,7 @@ protected: ListItemTearOff* item = m_wrappers->at(i).get(); if (!item) continue; - item->setAnimatedProperty(m_animatedProperty.get()); + item->setAnimatedProperty(m_animatedProperty); item->setValue(m_values->at(i)); } @@ -179,6 +195,7 @@ protected: // Spec: If newItem is already in a list, it is removed from its previous list before it is inserted into this list. // 'newItem' is already living in another list. If it's not our list, synchronize the other lists wrappers after the removal. + ASSERT(m_animatedProperty); bool livesInOtherList = animatedPropertyOfItem != m_animatedProperty; AnimatedListPropertyTearOff* propertyTearOff = static_cast<AnimatedListPropertyTearOff*>(animatedPropertyOfItem); int indexToRemove = propertyTearOff->findItem(newItem.get()); @@ -206,7 +223,7 @@ protected: // Back pointer to the animated property that created us // For example (text.x.baseVal): m_animatedProperty points to the 'x' SVGAnimatedLengthList object - RefPtr<AnimatedListPropertyTearOff> m_animatedProperty; + AnimatedListPropertyTearOff* m_animatedProperty; }; } diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGMatrixTearOff.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGMatrixTearOff.h index 338899d735b..76935750407 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGMatrixTearOff.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGMatrixTearOff.h @@ -27,6 +27,20 @@ namespace WebCore { class SVGMatrixTearOff : public SVGPropertyTearOff<SVGMatrix> { public: + // Used for child types (baseVal/animVal) of a SVGAnimated* property (for example: SVGAnimatedLength::baseVal()). + // Also used for list tear offs (for example: text.x.baseVal.getItem(0)). + static PassRefPtr<SVGMatrixTearOff> create(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, SVGMatrix& value) + { + ASSERT(animatedProperty); + return adoptRef(new SVGMatrixTearOff(animatedProperty, role, value)); + } + + // Used for non-animated POD types (for example: SVGSVGElement::createSVGLength()). + static PassRefPtr<SVGMatrixTearOff> create(const SVGMatrix& initialValue) + { + return adoptRef(new SVGMatrixTearOff(initialValue)); + } + // Used for non-animated POD types that are not associated with a SVGAnimatedProperty object, nor with a XML DOM attribute // and that contain a parent type that's exposed to the bindings via a SVGStaticPropertyTearOff object // (for example: SVGTransform::matrix). @@ -40,11 +54,42 @@ public: virtual void commitChange() { - m_parent->propertyReference().updateSVGMatrix(); - m_parent->commitChange(); + if (m_parent) { + // This is a tear-off from a SVGPropertyTearOff<SVGTransform>. + m_parent->propertyReference().updateSVGMatrix(); + m_parent->commitChange(); + } else { + // This is either a detached tear-off or a reference tear-off from a AnimatedProperty. + SVGPropertyTearOff<SVGMatrix>::commitChange(); + } } + // SVGMatrixTearOff can be a child tear-off of a SVGTransform tear-off, + // which means that |m_value| may be pointing inside |m_value| of the other tear-off. + // This method is called from the parent SVGTransform tear-off when |m_parent->m_value| is updated, + // so that |this->m_value| would point to valid location. + virtual void setValueForMatrixIfNeeded(SVGTransform* transform) + { + setValue(transform->svgMatrix()); + } + + SVGPropertyTearOff<SVGTransform>* parent() { return m_parent; } + private: + SVGMatrixTearOff(SVGAnimatedProperty* animatedProperty, SVGPropertyRole role, SVGMatrix& value) + : SVGPropertyTearOff<SVGMatrix>(animatedProperty, role, value) + , m_parent(0) + , m_weakFactory(this) + { + } + + SVGMatrixTearOff(const SVGMatrix& initialValue) + : SVGPropertyTearOff<SVGMatrix>(initialValue) + , m_parent(0) + , m_weakFactory(this) + { + } + SVGMatrixTearOff(SVGPropertyTearOff<SVGTransform>* parent, SVGMatrix& value) : SVGPropertyTearOff<SVGMatrix>(0, UndefinedRole, value) , m_parent(parent) @@ -52,7 +97,9 @@ private: { } - RefPtr<SVGPropertyTearOff<SVGTransform> > m_parent; + // m_parent is kept alive from V8 wrapper. + SVGPropertyTearOff<SVGTransform>* m_parent; + WeakPtrFactory<SVGPropertyTearOffBase > m_weakFactory; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp b/chromium/third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp index cfe7bb3d7e9..48cb03a468d 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.cpp @@ -21,7 +21,6 @@ #include "core/svg/properties/SVGPathSegListPropertyTearOff.h" #include "SVGNames.h" -#include "bindings/v8/ExceptionState.h" #include "core/dom/ExceptionCode.h" #include "core/svg/SVGPathElement.h" #include "core/svg/SVGPathSegWithContext.h" @@ -39,19 +38,19 @@ void SVGPathSegListPropertyTearOff::clearContextAndRoles() } } -void SVGPathSegListPropertyTearOff::clear(ExceptionState& es) +void SVGPathSegListPropertyTearOff::clear(ExceptionState& exceptionState) { ASSERT(m_values); if (m_values->isEmpty()) return; clearContextAndRoles(); - SVGPathSegListPropertyTearOff::Base::clearValues(es); + SVGPathSegListPropertyTearOff::Base::clearValues(exceptionState); } -SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::getItem(unsigned index, ExceptionState& es) +SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::getItem(unsigned index, ExceptionState& exceptionState) { - ListItemType returnedItem = Base::getItemValues(index, es); + ListItemType returnedItem = Base::getItemValues(index, exceptionState); if (returnedItem) { ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->contextElement() == contextElement()); ASSERT(static_cast<SVGPathSegWithContext*>(returnedItem.get())->role() == m_pathSegRole); @@ -59,11 +58,11 @@ SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::g return returnedItem.release(); } -SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::replaceItem(PassListItemType passNewItem, unsigned index, ExceptionState& es) +SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::replaceItem(PassListItemType passNewItem, unsigned index, ExceptionState& exceptionState) { // Not specified, but FF/Opera do it this way, and it's just sane. if (!passNewItem) { - es.throwTypeError(); + exceptionState.throwUninformativeAndGenericTypeError(); return 0; } @@ -74,12 +73,12 @@ SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::r } ListItemType newItem = passNewItem; - return Base::replaceItemValues(newItem, index, es); + return Base::replaceItemValues(newItem, index, exceptionState); } -SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::removeItem(unsigned index, ExceptionState& es) +SVGPathSegListPropertyTearOff::PassListItemType SVGPathSegListPropertyTearOff::removeItem(unsigned index, ExceptionState& exceptionState) { - SVGPathSegListPropertyTearOff::ListItemType removedItem = SVGPathSegListPropertyTearOff::Base::removeItemValues(index, es); + SVGPathSegListPropertyTearOff::ListItemType removedItem = SVGPathSegListPropertyTearOff::Base::removeItemValues(index, exceptionState); if (removedItem) static_cast<SVGPathSegWithContext*>(removedItem.get())->setContextAndRole(0, PathSegUndefinedRole); return removedItem.release(); diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h index 56055ed92b3..4a755f76b77 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGPathSegListPropertyTearOff.h @@ -41,6 +41,9 @@ public: return adoptRef(new SVGPathSegListPropertyTearOff(animatedProperty, role, pathSegRole, values, wrappers)); } + SVGPathElement* contextElement() const; + SVGAnimatedProperty* animatedProperty() const { return m_animatedProperty; } + int findItem(const ListItemType& item) const { ASSERT(m_values); @@ -68,47 +71,47 @@ public: // SVGList API void clear(ExceptionState&); - PassListItemType initialize(PassListItemType passNewItem, ExceptionState& es) + PassListItemType initialize(PassListItemType passNewItem, ExceptionState& exceptionState) { // Not specified, but FF/Opera do it this way, and it's just sane. if (!passNewItem) { - es.throwTypeError(); + exceptionState.throwUninformativeAndGenericTypeError(); return 0; } clearContextAndRoles(); ListItemType newItem = passNewItem; - return Base::initializeValues(newItem, es); + return Base::initializeValues(newItem, exceptionState); } PassListItemType getItem(unsigned index, ExceptionState&); - PassListItemType insertItemBefore(PassListItemType passNewItem, unsigned index, ExceptionState& es) + PassListItemType insertItemBefore(PassListItemType passNewItem, unsigned index, ExceptionState& exceptionState) { // Not specified, but FF/Opera do it this way, and it's just sane. if (!passNewItem) { - es.throwTypeError(); + exceptionState.throwUninformativeAndGenericTypeError(); return 0; } ListItemType newItem = passNewItem; - return Base::insertItemBeforeValues(newItem, index, es); + return Base::insertItemBeforeValues(newItem, index, exceptionState); } PassListItemType replaceItem(PassListItemType, unsigned index, ExceptionState&); PassListItemType removeItem(unsigned index, ExceptionState&); - PassListItemType appendItem(PassListItemType passNewItem, ExceptionState& es) + PassListItemType appendItem(PassListItemType passNewItem, ExceptionState& exceptionState) { // Not specified, but FF/Opera do it this way, and it's just sane. if (!passNewItem) { - es.throwTypeError(); + exceptionState.throwUninformativeAndGenericTypeError(); return 0; } ListItemType newItem = passNewItem; - return Base::appendItemValues(newItem, es); + return Base::appendItemValues(newItem, exceptionState); } private: @@ -119,8 +122,6 @@ private: { } - SVGPathElement* contextElement() const; - void clearContextAndRoles(); using Base::m_role; @@ -154,7 +155,7 @@ private: } private: - RefPtr<AnimatedListPropertyTearOff> m_animatedProperty; + AnimatedListPropertyTearOff* m_animatedProperty; SVGPathSegRole m_pathSegRole; }; diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGPropertyTearOff.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGPropertyTearOff.h index a78bdea5677..b42f29bc452 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGPropertyTearOff.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGPropertyTearOff.h @@ -29,6 +29,8 @@ namespace WebCore { class SVGPropertyTearOffBase : public SVGProperty { public: + virtual void setValueForMatrixIfNeeded(SVGTransform*) { } + virtual void detachWrapper() = 0; }; @@ -60,6 +62,9 @@ public: detachChildren(); delete m_value; } + + updateChildrenTearOffs(&value); + m_valueIsCopy = false; m_value = &value; } @@ -76,7 +81,8 @@ public: { if (!m_animatedProperty || m_valueIsCopy) return 0; - return m_contextElement.get(); + ASSERT(m_contextElement); + return m_contextElement; } void addChild(WeakPtr<SVGPropertyTearOffBase> child) @@ -156,7 +162,22 @@ protected: m_childTearOffs.clear(); } - RefPtr<SVGElement> m_contextElement; + // Update m_value of children tear-offs. + // Currently only SVGTransform has child tear-offs. + void updateChildrenTearOffs(SVGTransform* transform) + { + for (Vector<WeakPtr<SVGPropertyTearOffBase> >::iterator iter = m_childTearOffs.begin(); iter != m_childTearOffs.end(); iter++) { + if (iter->get()) + iter->get()->setValueForMatrixIfNeeded(transform); + } + } + + void updateChildrenTearOffs(void*) + { + // Tear-offs for other types do not have child tear-offs. + } + + SVGElement* m_contextElement; SVGAnimatedProperty* m_animatedProperty; SVGPropertyRole m_role; PropertyType* m_value; diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGStaticListPropertyTearOff.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGStaticListPropertyTearOff.h index 367560fdc89..596a55185d9 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGStaticListPropertyTearOff.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGStaticListPropertyTearOff.h @@ -43,40 +43,42 @@ public: return adoptRef(new SVGStaticListPropertyTearOff<PropertyType>(contextElement, values)); } + SVGElement* contextElement() const { return m_contextElement; } + // SVGList API - void clear(ExceptionState& es) + void clear(ExceptionState& exceptionState) { - Base::clearValues(es); + Base::clearValues(exceptionState); } - ListItemType initialize(const ListItemType& newItem, ExceptionState& es) + ListItemType initialize(const ListItemType& newItem, ExceptionState& exceptionState) { - return Base::initializeValues(newItem, es); + return Base::initializeValues(newItem, exceptionState); } - ListItemType getItem(unsigned index, ExceptionState& es) + ListItemType getItem(unsigned index, ExceptionState& exceptionState) { - return Base::getItemValues(index, es); + return Base::getItemValues(index, exceptionState); } - ListItemType insertItemBefore(const ListItemType& newItem, unsigned index, ExceptionState& es) + ListItemType insertItemBefore(const ListItemType& newItem, unsigned index, ExceptionState& exceptionState) { - return Base::insertItemBeforeValues(newItem, index, es); + return Base::insertItemBeforeValues(newItem, index, exceptionState); } - ListItemType replaceItem(const ListItemType& newItem, unsigned index, ExceptionState& es) + ListItemType replaceItem(const ListItemType& newItem, unsigned index, ExceptionState& exceptionState) { - return Base::replaceItemValues(newItem, index, es); + return Base::replaceItemValues(newItem, index, exceptionState); } - ListItemType removeItem(unsigned index, ExceptionState& es) + ListItemType removeItem(unsigned index, ExceptionState& exceptionState) { - return Base::removeItemValues(index, es); + return Base::removeItemValues(index, exceptionState); } - ListItemType appendItem(const ListItemType& newItem, ExceptionState& es) + ListItemType appendItem(const ListItemType& newItem, ExceptionState& exceptionState) { - return Base::appendItemValues(newItem, es); + return Base::appendItemValues(newItem, exceptionState); } private: @@ -84,6 +86,7 @@ private: : SVGListProperty<PropertyType>(UndefinedRole, values, 0) , m_contextElement(contextElement) { + m_contextElement->setContextElement(); } virtual bool isReadOnly() const @@ -94,7 +97,8 @@ private: virtual void commitChange() { ASSERT(m_values); - m_values->commitChange(m_contextElement.get()); + ASSERT(m_contextElement); + m_values->commitChange(m_contextElement); } virtual bool processIncomingListItemValue(const ListItemType&, unsigned*) @@ -110,7 +114,7 @@ private: } private: - RefPtr<SVGElement> m_contextElement; + SVGElement* m_contextElement; }; } diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGStaticPropertyTearOff.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGStaticPropertyTearOff.h index 76683360fc7..93d1cc58be8 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGStaticPropertyTearOff.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGStaticPropertyTearOff.h @@ -51,6 +51,7 @@ private: , m_update(update) , m_contextElement(contextElement) { + m_contextElement->setContextElement(); } UpdateMethod m_update; diff --git a/chromium/third_party/WebKit/Source/core/svg/properties/SVGTransformListPropertyTearOff.h b/chromium/third_party/WebKit/Source/core/svg/properties/SVGTransformListPropertyTearOff.h index b3064569d6d..2ec007fcfd8 100644 --- a/chromium/third_party/WebKit/Source/core/svg/properties/SVGTransformListPropertyTearOff.h +++ b/chromium/third_party/WebKit/Source/core/svg/properties/SVGTransformListPropertyTearOff.h @@ -39,21 +39,21 @@ public: return adoptRef(new SVGTransformListPropertyTearOff(animatedProperty, role, values, wrappers)); } - PassRefPtr<SVGPropertyTearOff<SVGTransform> > createSVGTransformFromMatrix(SVGPropertyTearOff<SVGMatrix>* matrix, ExceptionState& es) + PassRefPtr<SVGPropertyTearOff<SVGTransform> > createSVGTransformFromMatrix(SVGPropertyTearOff<SVGMatrix>* matrix, ExceptionState& exceptionState) { ASSERT(m_values); if (!matrix) { - es.throwDOMException(TypeMismatchError); + exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchError); return 0; } return SVGPropertyTearOff<SVGTransform>::create(m_values->createSVGTransformFromMatrix(matrix->propertyReference())); } - PassRefPtr<SVGPropertyTearOff<SVGTransform> > consolidate(ExceptionState& es) + PassRefPtr<SVGPropertyTearOff<SVGTransform> > consolidate(ExceptionState& exceptionState) { ASSERT(m_values); ASSERT(m_wrappers); - if (!canAlterList(es)) + if (!canAlterList(exceptionState)) return 0; ASSERT(m_values->size() == m_wrappers->size()); |