summaryrefslogtreecommitdiff
path: root/Source/WebCore/svg
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-02-24 16:36:50 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-02-24 16:36:50 +0100
commitad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (patch)
treeb34b0daceb7c8e7fdde4b4ec43650ab7caadb0a9 /Source/WebCore/svg
parent03e12282df9aa1e1fb05a8b90f1cfc2e08764cec (diff)
downloadqtwebkit-ad0d549d4cc13433f77c1ac8f0ab379c83d93f28.tar.gz
Imported WebKit commit bb52bf3c0119e8a128cd93afe5572413a8617de9 (http://svn.webkit.org/repository/webkit/trunk@108790)
Diffstat (limited to 'Source/WebCore/svg')
-rw-r--r--Source/WebCore/svg/DOMWindowSVG.idl187
-rw-r--r--Source/WebCore/svg/ElementTimeControl.idl4
-rw-r--r--Source/WebCore/svg/SVGAElement.cpp9
-rw-r--r--Source/WebCore/svg/SVGAElement.h2
-rw-r--r--Source/WebCore/svg/SVGAltGlyphElement.cpp5
-rw-r--r--Source/WebCore/svg/SVGAltGlyphElement.h2
-rw-r--r--Source/WebCore/svg/SVGAnimateElement.cpp39
-rw-r--r--Source/WebCore/svg/SVGAnimateElement.h4
-rw-r--r--Source/WebCore/svg/SVGAnimatedTypeAnimator.h4
-rw-r--r--Source/WebCore/svg/SVGAnimationElement.cpp8
-rw-r--r--Source/WebCore/svg/SVGAnimationElement.h1
-rw-r--r--Source/WebCore/svg/SVGDocument.cpp7
-rw-r--r--Source/WebCore/svg/SVGDocument.h2
-rw-r--r--Source/WebCore/svg/SVGDocument.idl5
-rw-r--r--Source/WebCore/svg/SVGDocumentExtensions.cpp11
-rw-r--r--Source/WebCore/svg/SVGDocumentExtensions.h1
-rw-r--r--Source/WebCore/svg/SVGElement.cpp7
-rw-r--r--Source/WebCore/svg/SVGElement.h2
-rw-r--r--Source/WebCore/svg/SVGElement.idl3
-rw-r--r--Source/WebCore/svg/SVGElementInstanceList.idl2
-rw-r--r--Source/WebCore/svg/SVGFEDropShadowElement.idl4
-rw-r--r--Source/WebCore/svg/SVGFEGaussianBlurElement.idl4
-rw-r--r--Source/WebCore/svg/SVGFEMorphologyElement.idl4
-rw-r--r--Source/WebCore/svg/SVGFilterElement.idl4
-rw-r--r--Source/WebCore/svg/SVGFontFaceElement.cpp3
-rw-r--r--Source/WebCore/svg/SVGForeignObjectElement.cpp9
-rw-r--r--Source/WebCore/svg/SVGForeignObjectElement.h2
-rw-r--r--Source/WebCore/svg/SVGImageElement.cpp25
-rw-r--r--Source/WebCore/svg/SVGImageElement.h2
-rw-r--r--[-rwxr-xr-x]Source/WebCore/svg/SVGLengthContext.cpp34
-rw-r--r--Source/WebCore/svg/SVGLocatable.idl2
-rw-r--r--Source/WebCore/svg/SVGMarkerElement.idl2
-rw-r--r--Source/WebCore/svg/SVGPathElement.idl120
-rw-r--r--Source/WebCore/svg/SVGPathSeg.idl2
-rw-r--r--Source/WebCore/svg/SVGSVGElement.cpp29
-rw-r--r--Source/WebCore/svg/SVGSVGElement.idl26
-rw-r--r--Source/WebCore/svg/SVGStylable.idl2
-rw-r--r--Source/WebCore/svg/SVGStyledElement.cpp21
-rw-r--r--Source/WebCore/svg/SVGStyledElement.h2
-rw-r--r--Source/WebCore/svg/SVGSwitchElement.cpp5
-rw-r--r--Source/WebCore/svg/SVGSwitchElement.h2
-rw-r--r--Source/WebCore/svg/SVGTRefElement.cpp82
-rw-r--r--Source/WebCore/svg/SVGTRefElement.h12
-rw-r--r--Source/WebCore/svg/SVGTSpanElement.cpp13
-rw-r--r--Source/WebCore/svg/SVGTSpanElement.h2
-rw-r--r--Source/WebCore/svg/SVGTests.idl2
-rw-r--r--Source/WebCore/svg/SVGTextContentElement.cpp29
-rw-r--r--Source/WebCore/svg/SVGTextContentElement.h2
-rw-r--r--Source/WebCore/svg/SVGTextContentElement.idl18
-rw-r--r--Source/WebCore/svg/SVGTextElement.cpp15
-rw-r--r--Source/WebCore/svg/SVGTextElement.h2
-rw-r--r--Source/WebCore/svg/SVGTextPathElement.cpp11
-rw-r--r--Source/WebCore/svg/SVGTextPathElement.h2
-rw-r--r--Source/WebCore/svg/SVGUseElement.cpp11
-rw-r--r--Source/WebCore/svg/animation/SMILTime.h27
-rw-r--r--Source/WebCore/svg/animation/SMILTimeContainer.cpp43
-rw-r--r--Source/WebCore/svg/animation/SMILTimeContainer.h5
-rw-r--r--Source/WebCore/svg/animation/SVGSMILElement.cpp96
-rw-r--r--Source/WebCore/svg/animation/SVGSMILElement.h16
-rw-r--r--Source/WebCore/svg/graphics/SVGImage.cpp6
-rw-r--r--Source/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h9
-rw-r--r--Source/WebCore/svg/svgtags.in6
62 files changed, 668 insertions, 350 deletions
diff --git a/Source/WebCore/svg/DOMWindowSVG.idl b/Source/WebCore/svg/DOMWindowSVG.idl
new file mode 100644
index 000000000..cc907136b
--- /dev/null
+++ b/Source/WebCore/svg/DOMWindowSVG.idl
@@ -0,0 +1,187 @@
+/*
+ * Copyright (C) 2012 Google Inc. 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.
+ */
+
+module window {
+
+ // FIXME: Most of this could/should be generated from make_names.pl/SVGNames.in
+ // to reduce the chance that we forget a constructor when adding a new element.
+ interface [
+ Conditional=SVG,
+ Supplemental=DOMWindow
+ ] DOMWindowSVG {
+
+ attribute SVGZoomEventConstructor SVGZoomEvent;
+
+ // Expose all implemented SVG 1.1 interfaces, excluding the SVG MI interfaces:
+ // SVGAnimatedPathData, SVGAnimatedPoints, SVGExternalResourcesRequired,
+ // SVGFilterPrimitiveStandardAttributes, SVGFitToViewBox, SVGLangSpace, SVGLocatable
+ // SVGStylable, SVGTests, SVGTransformable, SVGURIReference, SVGZoomAndPan
+ attribute SVGAElementConstructor SVGAElement;
+ attribute SVGAngleConstructor SVGAngle;
+ attribute SVGAnimatedAngleConstructor SVGAnimatedAngle;
+ attribute SVGAnimatedBooleanConstructor SVGAnimatedBoolean;
+ attribute SVGAnimatedEnumerationConstructor SVGAnimatedEnumeration;
+ attribute SVGAnimatedIntegerConstructor SVGAnimatedInteger;
+ attribute SVGAnimatedLengthConstructor SVGAnimatedLength;
+ attribute SVGAnimatedLengthListConstructor SVGAnimatedLengthList;
+ attribute SVGAnimatedNumberConstructor SVGAnimatedNumber;
+ attribute SVGAnimatedNumberListConstructor SVGAnimatedNumberList;
+ attribute SVGAnimatedPreserveAspectRatioConstructor SVGAnimatedPreserveAspectRatio;
+ attribute SVGAnimatedRectConstructor SVGAnimatedRect;
+ attribute SVGAnimatedStringConstructor SVGAnimatedString;
+ attribute SVGAnimatedTransformListConstructor SVGAnimatedTransformList;
+ attribute SVGCircleElementConstructor SVGCircleElement;
+ attribute SVGClipPathElementConstructor SVGClipPathElement;
+ attribute SVGColorConstructor SVGColor;
+ attribute SVGCursorElementConstructor SVGCursorElement;
+// attribute SVGCSSRuleConstructor SVGCSSRule;
+ attribute SVGDefsElementConstructor SVGDefsElement;
+ attribute SVGDescElementConstructor SVGDescElement;
+ attribute SVGDocumentConstructor SVGDocument;
+ attribute SVGElementConstructor SVGElement;
+ attribute SVGElementInstanceConstructor SVGElementInstance;
+ attribute SVGElementInstanceListConstructor SVGElementInstanceList;
+ attribute SVGEllipseElementConstructor SVGEllipseElement;
+ attribute SVGForeignObjectElementConstructor SVGForeignObjectElement;
+ attribute SVGExceptionConstructor SVGException;
+ attribute SVGGElementConstructor SVGGElement;
+ attribute SVGGradientElementConstructor SVGGradientElement;
+ attribute SVGImageElementConstructor SVGImageElement;
+ attribute SVGLengthConstructor SVGLength;
+ attribute SVGLengthListConstructor SVGLengthList;
+ attribute SVGLinearGradientElementConstructor SVGLinearGradientElement;
+ attribute SVGLineElementConstructor SVGLineElement;
+ attribute SVGMarkerElementConstructor SVGMarkerElement;
+ attribute SVGMaskElementConstructor SVGMaskElement;
+ attribute SVGMatrixConstructor SVGMatrix;
+ attribute SVGMetadataElementConstructor SVGMetadataElement;
+ attribute SVGNumberConstructor SVGNumber;
+ attribute SVGNumberListConstructor SVGNumberList;
+ attribute SVGPaintConstructor SVGPaint;
+ attribute SVGPathElementConstructor SVGPathElement;
+ attribute SVGPathSegConstructor SVGPathSeg;
+ attribute SVGPathSegArcAbsConstructor SVGPathSegArcAbs;
+ attribute SVGPathSegArcRelConstructor SVGPathSegArcRel;
+ attribute SVGPathSegClosePathConstructor SVGPathSegClosePath;
+ attribute SVGPathSegCurvetoCubicAbsConstructor SVGPathSegCurvetoCubicAbs;
+ attribute SVGPathSegCurvetoCubicRelConstructor SVGPathSegCurvetoCubicRel;
+ attribute SVGPathSegCurvetoCubicSmoothAbsConstructor SVGPathSegCurvetoCubicSmoothAbs;
+ attribute SVGPathSegCurvetoCubicSmoothRelConstructor SVGPathSegCurvetoCubicSmoothRel;
+ attribute SVGPathSegCurvetoQuadraticAbsConstructor SVGPathSegCurvetoQuadraticAbs;
+ attribute SVGPathSegCurvetoQuadraticRelConstructor SVGPathSegCurvetoQuadraticRel;
+ attribute SVGPathSegCurvetoQuadraticSmoothAbsConstructor SVGPathSegCurvetoQuadraticSmoothAbs;
+ attribute SVGPathSegCurvetoQuadraticSmoothRelConstructor SVGPathSegCurvetoQuadraticSmoothRel;
+ attribute SVGPathSegLinetoAbsConstructor SVGPathSegLinetoAbs;
+ attribute SVGPathSegLinetoHorizontalAbsConstructor SVGPathSegLinetoHorizontalAbs;
+ attribute SVGPathSegLinetoHorizontalRelConstructor SVGPathSegLinetoHorizontalRel;
+ attribute SVGPathSegLinetoRelConstructor SVGPathSegLinetoRel;
+ attribute SVGPathSegLinetoVerticalAbsConstructor SVGPathSegLinetoVerticalAbs;
+ attribute SVGPathSegLinetoVerticalRelConstructor SVGPathSegLinetoVerticalRel;
+ attribute SVGPathSegListConstructor SVGPathSegList;
+ attribute SVGPathSegMovetoAbsConstructor SVGPathSegMovetoAbs;
+ attribute SVGPathSegMovetoRelConstructor SVGPathSegMovetoRel;
+ attribute SVGPatternElementConstructor SVGPatternElement;
+ attribute SVGPointConstructor SVGPoint;
+ attribute SVGPointListConstructor SVGPointList;
+ attribute SVGPolygonElementConstructor SVGPolygonElement;
+ attribute SVGPolylineElementConstructor SVGPolylineElement;
+ attribute SVGPreserveAspectRatioConstructor SVGPreserveAspectRatio;
+ attribute SVGRadialGradientElementConstructor SVGRadialGradientElement;
+ attribute SVGRectConstructor SVGRect;
+ attribute SVGRectElementConstructor SVGRectElement;
+ attribute SVGRenderingIntentConstructor SVGRenderingIntent;
+ attribute SVGScriptElementConstructor SVGScriptElement;
+ attribute SVGStopElementConstructor SVGStopElement;
+ attribute SVGStringListConstructor SVGStringList;
+ attribute SVGStyleElementConstructor SVGStyleElement;
+ attribute SVGSVGElementConstructor SVGSVGElement;
+ attribute SVGSwitchElementConstructor SVGSwitchElement;
+ attribute SVGSymbolElementConstructor SVGSymbolElement;
+ attribute SVGTextContentElementConstructor SVGTextContentElement;
+ attribute SVGTextElementConstructor SVGTextElement;
+ attribute SVGTextPathElementConstructor SVGTextPathElement;
+ attribute SVGTextPositioningElementConstructor SVGTextPositioningElement;
+ attribute SVGTitleElementConstructor SVGTitleElement;
+ attribute SVGTransformConstructor SVGTransform;
+ attribute SVGTransformListConstructor SVGTransformList;
+ attribute SVGTRefElementConstructor SVGTRefElement;
+ attribute SVGTSpanElementConstructor SVGTSpanElement;
+ attribute SVGUnitTypesConstructor SVGUnitTypes;
+ attribute SVGUseElementConstructor SVGUseElement;
+ attribute SVGViewElementConstructor SVGViewElement;
+// attribute SVGViewSpecConstructor SVGViewSpec;
+
+ attribute SVGAnimateColorElementConstructor SVGAnimateColorElement;
+ attribute SVGAnimateElementConstructor SVGAnimateElement;
+ attribute SVGAnimateMotionElementConstructor SVGAnimateMotionElement;
+ attribute SVGAnimateTransformElementConstructor SVGAnimateTransformElement;
+ attribute SVGMPathElementConstructor SVGMPathElement;
+ attribute SVGSetElementConstructor SVGSetElement;
+
+#if defined(ENABLE_SVG_FONTS) && ENABLE_SVG_FONTS
+ attribute SVGAltGlyphDefElementConstructor SVGAltGlyphDefElement;
+ attribute SVGAltGlyphElementConstructor SVGAltGlyphElement;
+ attribute SVGAltGlyphItemElementConstructor SVGAltGlyphItemElement;
+// attribute SVGDefinitionSrcElementConstructor SVGDefinitionSrcElement;
+ attribute SVGFontElementConstructor SVGFontElement;
+ attribute SVGFontFaceElementConstructor SVGFontFaceElement;
+ attribute SVGFontFaceFormatElementConstructor SVGFontFaceFormatElement;
+ attribute SVGFontFaceNameElementConstructor SVGFontFaceNameElement;
+ attribute SVGFontFaceSrcElementConstructor SVGFontFaceSrcElement;
+ attribute SVGFontFaceUriElementConstructor SVGFontFaceUriElement;
+ attribute SVGGlyphElementConstructor SVGGlyphElement;
+ attribute SVGGlyphRefElementConstructor SVGGlyphRefElement;
+ attribute SVGHKernElementConstructor SVGHKernElement;
+ attribute SVGMissingGlyphElementConstructor SVGMissingGlyphElement;
+ attribute SVGVKernElementConstructor SVGVKernElement;
+#endif
+
+#if defined(ENABLE_FILTERS) && ENABLE_FILTERS
+ attribute SVGComponentTransferFunctionElementConstructor SVGComponentTransferFunctionElement;
+ attribute SVGFEBlendElementConstructor SVGFEBlendElement;
+ attribute SVGFEColorMatrixElementConstructor SVGFEColorMatrixElement;
+ attribute SVGFEComponentTransferElementConstructor SVGFEComponentTransferElement;
+ attribute SVGFECompositeElementConstructor SVGFECompositeElement;
+ attribute SVGFEConvolveMatrixElementConstructor SVGFEConvolveMatrixElement;
+ attribute SVGFEDiffuseLightingElementConstructor SVGFEDiffuseLightingElement;
+ attribute SVGFEDisplacementMapElementConstructor SVGFEDisplacementMapElement;
+ attribute SVGFEDistantLightElementConstructor SVGFEDistantLightElement;
+ attribute SVGFEDropShadowElementConstructor SVGFEDropShadowElement;
+ attribute SVGFEFloodElementConstructor SVGFEFloodElement;
+ attribute SVGFEFuncAElementConstructor SVGFEFuncAElement;
+ attribute SVGFEFuncBElementConstructor SVGFEFuncBElement;
+ attribute SVGFEFuncGElementConstructor SVGFEFuncGElement;
+ attribute SVGFEFuncRElementConstructor SVGFEFuncRElement;
+ attribute SVGFEGaussianBlurElementConstructor SVGFEGaussianBlurElement;
+ attribute SVGFEImageElementConstructor SVGFEImageElement;
+ attribute SVGFEMergeElementConstructor SVGFEMergeElement;
+ attribute SVGFEMergeNodeElementConstructor SVGFEMergeNodeElement;
+ attribute SVGFEMorphologyElementConstructor SVGFEMorphologyElement;
+ attribute SVGFEOffsetElementConstructor SVGFEOffsetElement;
+ attribute SVGFEPointLightElementConstructor SVGFEPointLightElement;
+ attribute SVGFESpecularLightingElementConstructor SVGFESpecularLightingElement;
+ attribute SVGFESpotLightElementConstructor SVGFESpotLightElement;
+ attribute SVGFETileElementConstructor SVGFETileElement;
+ attribute SVGFETurbulenceElementConstructor SVGFETurbulenceElement;
+ attribute SVGFilterElementConstructor SVGFilterElement;
+#endif
+
+ };
+
+}
diff --git a/Source/WebCore/svg/ElementTimeControl.idl b/Source/WebCore/svg/ElementTimeControl.idl
index 70164abaf..9c748c92e 100644
--- a/Source/WebCore/svg/ElementTimeControl.idl
+++ b/Source/WebCore/svg/ElementTimeControl.idl
@@ -32,9 +32,9 @@ module svg {
OmitConstructor
] ElementTimeControl {
void beginElement();
- void beginElementAt(in [Optional=CallWithDefaultValue] float offset);
+ void beginElementAt(in [Optional=DefaultIsUndefined] float offset);
void endElement();
- void endElementAt(in [Optional=CallWithDefaultValue] float offset);
+ void endElementAt(in [Optional=DefaultIsUndefined] float offset);
};
}
diff --git a/Source/WebCore/svg/SVGAElement.cpp b/Source/WebCore/svg/SVGAElement.cpp
index b3e0f8511..7ec617ae0 100644
--- a/Source/WebCore/svg/SVGAElement.cpp
+++ b/Source/WebCore/svg/SVGAElement.cpp
@@ -37,6 +37,7 @@
#include "HTMLParserIdioms.h"
#include "KeyboardEvent.h"
#include "MouseEvent.h"
+#include "NodeRenderingContext.h"
#include "PlatformMouseEvent.h"
#include "RenderSVGInline.h"
#include "RenderSVGTransformableContainer.h"
@@ -224,16 +225,16 @@ bool SVGAElement::isKeyboardFocusable(KeyboardEvent* event) const
return document()->frame()->eventHandler()->tabsToLinks(event);
}
-bool SVGAElement::childShouldCreateRenderer(Node* child) const
+bool SVGAElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
// http://www.w3.org/2003/01/REC-SVG11-20030114-errata#linking-text-environment
// The 'a' element may contain any element that its parent may contain, except itself.
- if (child->hasTagName(SVGNames::aTag))
+ if (childContext.node()->hasTagName(SVGNames::aTag))
return false;
if (parentNode() && parentNode()->isSVGElement())
- return parentNode()->childShouldCreateRenderer(child);
+ return parentNode()->childShouldCreateRenderer(childContext);
- return SVGElement::childShouldCreateRenderer(child);
+ return SVGElement::childShouldCreateRenderer(childContext);
}
} // namespace WebCore
diff --git a/Source/WebCore/svg/SVGAElement.h b/Source/WebCore/svg/SVGAElement.h
index f2af9a828..e3b8f2802 100644
--- a/Source/WebCore/svg/SVGAElement.h
+++ b/Source/WebCore/svg/SVGAElement.h
@@ -61,7 +61,7 @@ private:
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
virtual bool isFocusable() const;
- virtual bool childShouldCreateRenderer(Node*) const;
+ virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAElement)
// This declaration used to define a non-virtual "String& target() const" method, that clashes with "virtual String Element::target() const".
diff --git a/Source/WebCore/svg/SVGAltGlyphElement.cpp b/Source/WebCore/svg/SVGAltGlyphElement.cpp
index 1baba8494..f03d1ff27 100644
--- a/Source/WebCore/svg/SVGAltGlyphElement.cpp
+++ b/Source/WebCore/svg/SVGAltGlyphElement.cpp
@@ -26,6 +26,7 @@
#include "SVGAltGlyphElement.h"
#include "ExceptionCode.h"
+#include "NodeRenderingContext.h"
#include "RenderInline.h"
#include "RenderSVGTSpan.h"
#include "SVGAltGlyphDefElement.h"
@@ -75,9 +76,9 @@ const AtomicString& SVGAltGlyphElement::format() const
return fastGetAttribute(SVGNames::formatAttr);
}
-bool SVGAltGlyphElement::childShouldCreateRenderer(Node* child) const
+bool SVGAltGlyphElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
- if (child->isTextNode())
+ if (childContext.node()->isTextNode())
return true;
return false;
}
diff --git a/Source/WebCore/svg/SVGAltGlyphElement.h b/Source/WebCore/svg/SVGAltGlyphElement.h
index 0ba229c46..179ed7734 100644
--- a/Source/WebCore/svg/SVGAltGlyphElement.h
+++ b/Source/WebCore/svg/SVGAltGlyphElement.h
@@ -47,7 +47,7 @@ private:
SVGAltGlyphElement(const QualifiedName&, Document*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual bool childShouldCreateRenderer(Node*) const;
+ virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGAltGlyphElement)
DECLARE_ANIMATED_STRING(Href, href)
diff --git a/Source/WebCore/svg/SVGAnimateElement.cpp b/Source/WebCore/svg/SVGAnimateElement.cpp
index c819e1e16..13f7cf96b 100644
--- a/Source/WebCore/svg/SVGAnimateElement.cpp
+++ b/Source/WebCore/svg/SVGAnimateElement.cpp
@@ -59,7 +59,7 @@ SVGAnimateElement::~SVGAnimateElement()
static inline void getPropertyValue(SVGElement* svgParent, const QualifiedName& attributeName, String& value)
{
ASSERT(svgParent->isStyled());
- value = computedStyle(svgParent)->getPropertyValue(cssPropertyID(attributeName.localName()));
+ value = CSSComputedStyleDeclaration::create(svgParent)->getPropertyValue(cssPropertyID(attributeName.localName()));
}
static bool inheritsFromProperty(SVGElement* targetElement, const QualifiedName& attributeName, const String& value)
@@ -109,7 +109,7 @@ bool SVGAnimateElement::hasValidAttributeType()
if (!targetElement)
return false;
- return determineAnimatedPropertyType(targetElement) != AnimatedUnknown;
+ return m_animatedPropertyType != AnimatedUnknown;
}
AnimatedPropertyType SVGAnimateElement::determineAnimatedPropertyType(SVGElement* targetElement) const
@@ -159,12 +159,20 @@ void SVGAnimateElement::determinePropertyValueTypes(const String& from, const St
void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement)
{
ASSERT(resultElement);
+ SVGElement* targetElement = this->targetElement();
+ if (!targetElement)
+ return;
+
+ ASSERT(m_animatedPropertyType == determineAnimatedPropertyType(targetElement));
+
ASSERT(percentage >= 0 && percentage <= 1);
ASSERT(m_animatedPropertyType != AnimatedEnumeration);
ASSERT(m_animatedPropertyType != AnimatedTransformList);
ASSERT(m_animatedPropertyType != AnimatedUnknown);
ASSERT(m_animator);
+ ASSERT(m_animator->type() == m_animatedPropertyType);
ASSERT(m_fromType);
+ ASSERT(m_fromType->type() == m_animatedPropertyType);
ASSERT(m_toType);
SVGAnimateElement* resultAnimationElement = static_cast<SVGAnimateElement*>(resultElement);
@@ -177,10 +185,6 @@ void SVGAnimateElement::calculateAnimatedValue(float percentage, unsigned repeat
if (hasTagName(SVGNames::setTag))
percentage = 1;
- SVGElement* targetElement = this->targetElement();
- if (!targetElement)
- return;
-
// Target element might have changed.
m_animator->setContextElement(targetElement);
m_animator->calculateAnimatedValue(percentage, repeat, m_fromType, m_toType, resultAnimationElement->m_animatedType);
@@ -192,9 +196,8 @@ bool SVGAnimateElement::calculateFromAndToValues(const String& fromString, const
if (!targetElement)
return false;
- m_animatedPropertyType = determineAnimatedPropertyType(targetElement);
-
ensureAnimator()->calculateFromAndToValues(m_fromType, m_toType, fromString, toString);
+ ASSERT(m_animatedPropertyType == m_animator->type());
return true;
}
@@ -205,22 +208,19 @@ bool SVGAnimateElement::calculateFromAndByValues(const String& fromString, const
return false;
ASSERT(!hasTagName(SVGNames::setTag));
- m_animatedPropertyType = determineAnimatedPropertyType(targetElement);
ensureAnimator()->calculateFromAndByValues(m_fromType, m_toType, fromString, byString);
+ ASSERT(m_animatedPropertyType == m_animator->type());
return true;
}
void SVGAnimateElement::resetToBaseValue(const String& baseString)
{
- SVGElement* targetElement = this->targetElement();
- ASSERT(targetElement);
- m_animatedPropertyType = determineAnimatedPropertyType(targetElement);
-
if (!m_animatedType)
m_animatedType = ensureAnimator()->constructFromString(baseString);
else
m_animatedType->setValueAsString(attributeName(), baseString);
+ ASSERT(m_animatedPropertyType == m_animator->type());
}
void SVGAnimateElement::applyResultsToTarget()
@@ -239,15 +239,24 @@ float SVGAnimateElement::calculateDistance(const String& fromString, const Strin
SVGElement* targetElement = this->targetElement();
if (!targetElement)
return -1;
- m_animatedPropertyType = determineAnimatedPropertyType(targetElement);
-
+
return ensureAnimator()->calculateDistance(fromString, toString);
}
+void SVGAnimateElement::targetElementDidChange(SVGElement* targetElement)
+{
+ m_animatedType.clear();
+ m_fromType.clear();
+ m_toType.clear();
+ m_animator.clear();
+ m_animatedPropertyType = targetElement ? determineAnimatedPropertyType(targetElement) : AnimatedString;
+}
+
SVGAnimatedTypeAnimator* SVGAnimateElement::ensureAnimator()
{
if (!m_animator)
m_animator = SVGAnimatorFactory::create(this, targetElement(), m_animatedPropertyType);
+ ASSERT(m_animatedPropertyType == m_animator->type());
return m_animator.get();
}
diff --git a/Source/WebCore/svg/SVGAnimateElement.h b/Source/WebCore/svg/SVGAnimateElement.h
index d9ae3a28c..69cb9a6ed 100644
--- a/Source/WebCore/svg/SVGAnimateElement.h
+++ b/Source/WebCore/svg/SVGAnimateElement.h
@@ -45,7 +45,7 @@ public:
static PassRefPtr<SVGAnimateElement> create(const QualifiedName&, Document*);
virtual ~SVGAnimateElement();
-
+
static void adjustForCurrentColor(SVGElement* targetElement, Color&);
void adjustForInheritance(SVGElement* targetElement, const QualifiedName&, String& value);
@@ -65,6 +65,8 @@ protected:
virtual void applyResultsToTarget();
virtual float calculateDistance(const String& fromString, const String& toString);
+ virtual void targetElementDidChange(SVGElement* targetElement) OVERRIDE;
+
private:
SVGAnimatedTypeAnimator* ensureAnimator();
diff --git a/Source/WebCore/svg/SVGAnimatedTypeAnimator.h b/Source/WebCore/svg/SVGAnimatedTypeAnimator.h
index 1524ed8e4..f3218647d 100644
--- a/Source/WebCore/svg/SVGAnimatedTypeAnimator.h
+++ b/Source/WebCore/svg/SVGAnimatedTypeAnimator.h
@@ -41,7 +41,9 @@ public:
virtual float calculateDistance(const String& fromString, const String& toString) = 0;
void setContextElement(SVGElement* contextElement) { m_contextElement = contextElement; }
-
+
+ AnimatedPropertyType type() const { return m_type; }
+
protected:
SVGAnimatedTypeAnimator(AnimatedPropertyType type, SVGAnimationElement* animationElement, SVGElement* contextElement)
: m_type(type)
diff --git a/Source/WebCore/svg/SVGAnimationElement.cpp b/Source/WebCore/svg/SVGAnimationElement.cpp
index bced2016d..2659dd9df 100644
--- a/Source/WebCore/svg/SVGAnimationElement.cpp
+++ b/Source/WebCore/svg/SVGAnimationElement.cpp
@@ -232,7 +232,7 @@ void SVGAnimationElement::beginElement()
void SVGAnimationElement::beginElementAt(float offset)
{
SMILTime elapsed = this->elapsed();
- addBeginTime(elapsed, elapsed + offset);
+ addBeginTime(elapsed, elapsed + offset, SMILTimeWithOrigin::ScriptOrigin);
}
void SVGAnimationElement::endElement()
@@ -243,7 +243,7 @@ void SVGAnimationElement::endElement()
void SVGAnimationElement::endElementAt(float offset)
{
SMILTime elapsed = this->elapsed();
- addEndTime(elapsed, elapsed + offset);
+ addEndTime(elapsed, elapsed + offset, SMILTimeWithOrigin::ScriptOrigin);
}
AnimationMode SVGAnimationElement::animationMode() const
@@ -624,9 +624,5 @@ void SVGAnimationElement::updateAnimation(float percent, unsigned repeat, SVGSMI
calculateAnimatedValue(effectivePercent, repeat, resultElement);
}
-void SVGAnimationElement::endedActiveInterval()
-{
-}
-
}
#endif // ENABLE(SVG)
diff --git a/Source/WebCore/svg/SVGAnimationElement.h b/Source/WebCore/svg/SVGAnimationElement.h
index 66c10d99e..495c1b244 100644
--- a/Source/WebCore/svg/SVGAnimationElement.h
+++ b/Source/WebCore/svg/SVGAnimationElement.h
@@ -104,7 +104,6 @@ protected:
// from SVGSMILElement
virtual void startedActiveInterval();
virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement);
- virtual void endedActiveInterval();
private:
virtual void attributeChanged(Attribute*) OVERRIDE;
diff --git a/Source/WebCore/svg/SVGDocument.cpp b/Source/WebCore/svg/SVGDocument.cpp
index f5439489a..c29ede369 100644
--- a/Source/WebCore/svg/SVGDocument.cpp
+++ b/Source/WebCore/svg/SVGDocument.cpp
@@ -25,6 +25,7 @@
#include "EventNames.h"
#include "ExceptionCode.h"
#include "FrameView.h"
+#include "NodeRenderingContext.h"
#include "RenderView.h"
#include "SVGElement.h"
#include "SVGNames.h"
@@ -95,10 +96,10 @@ void SVGDocument::updatePan(const FloatPoint& pos) const
}
}
-bool SVGDocument::childShouldCreateRenderer(Node* node) const
+bool SVGDocument::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
- if (node->hasTagName(SVGNames::svgTag))
- return static_cast<SVGSVGElement*>(node)->isValid();
+ if (childContext.node()->hasTagName(SVGNames::svgTag))
+ return static_cast<SVGSVGElement*>(childContext.node())->isValid();
return true;
}
diff --git a/Source/WebCore/svg/SVGDocument.h b/Source/WebCore/svg/SVGDocument.h
index b93414526..a63787218 100644
--- a/Source/WebCore/svg/SVGDocument.h
+++ b/Source/WebCore/svg/SVGDocument.h
@@ -53,7 +53,7 @@ private:
virtual bool isSVGDocument() const { return true; }
- virtual bool childShouldCreateRenderer(Node*) const;
+ virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
FloatPoint m_translate;
};
diff --git a/Source/WebCore/svg/SVGDocument.idl b/Source/WebCore/svg/SVGDocument.idl
index c5059f82e..2f9abfc2e 100644
--- a/Source/WebCore/svg/SVGDocument.idl
+++ b/Source/WebCore/svg/SVGDocument.idl
@@ -22,12 +22,13 @@
module svg {
interface [
- Conditional=SVG
+ Conditional=SVG,
+ V8CustomToJSObject
] SVGDocument : Document {
readonly attribute SVGSVGElement rootElement;
// Overwrite the one in events::DocumentEvent
- Event createEvent(in [Optional=CallWithDefaultValue] DOMString eventType)
+ Event createEvent(in [Optional=DefaultIsUndefined] DOMString eventType)
raises(DOMException);
};
diff --git a/Source/WebCore/svg/SVGDocumentExtensions.cpp b/Source/WebCore/svg/SVGDocumentExtensions.cpp
index 6f19d800b..888bd5800 100644
--- a/Source/WebCore/svg/SVGDocumentExtensions.cpp
+++ b/Source/WebCore/svg/SVGDocumentExtensions.cpp
@@ -132,17 +132,6 @@ void SVGDocumentExtensions::dispatchSVGLoadEventToOutermostSVGElements()
}
}
-bool SVGDocumentExtensions::sampleAnimationAtTime(const String& elementId, SVGSMILElement* element, double time)
-{
- ASSERT(element);
- SMILTimeContainer* container = element->timeContainer();
- if (!container || container->isPaused())
- return false;
-
- container->sampleAnimationAtTime(elementId, time);
- return true;
-}
-
void SVGDocumentExtensions::addAnimationElementToTarget(SVGSMILElement* animationElement, SVGElement* targetElement)
{
ASSERT(targetElement);
diff --git a/Source/WebCore/svg/SVGDocumentExtensions.h b/Source/WebCore/svg/SVGDocumentExtensions.h
index 36664c32c..48dae9737 100644
--- a/Source/WebCore/svg/SVGDocumentExtensions.h
+++ b/Source/WebCore/svg/SVGDocumentExtensions.h
@@ -56,7 +56,6 @@ public:
void startAnimations();
void pauseAnimations();
void unpauseAnimations();
- bool sampleAnimationAtTime(const String& elementId, SVGSMILElement*, double time);
void dispatchSVGLoadEventToOutermostSVGElements();
void addAnimationElementToTarget(SVGSMILElement*, SVGElement*);
diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp
index f3d5874f3..24adcf794 100644
--- a/Source/WebCore/svg/SVGElement.cpp
+++ b/Source/WebCore/svg/SVGElement.cpp
@@ -36,6 +36,7 @@
#include "EventNames.h"
#include "FrameView.h"
#include "HTMLNames.h"
+#include "NodeRenderingContext.h"
#include "RegisteredEventListener.h"
#include "RenderObject.h"
#include "SVGCursorElement.h"
@@ -386,10 +387,10 @@ void SVGElement::finishParsingChildren()
sendSVGLoadEventIfPossible();
}
-bool SVGElement::childShouldCreateRenderer(Node* child) const
+bool SVGElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
- if (child->isSVGElement())
- return static_cast<SVGElement*>(child)->isValid();
+ if (childContext.node()->isSVGElement())
+ return static_cast<SVGElement*>(childContext.node())->isValid();
return false;
}
diff --git a/Source/WebCore/svg/SVGElement.h b/Source/WebCore/svg/SVGElement.h
index c5c5ac55f..4735690b3 100644
--- a/Source/WebCore/svg/SVGElement.h
+++ b/Source/WebCore/svg/SVGElement.h
@@ -114,7 +114,7 @@ protected:
virtual void finishParsingChildren();
virtual void attributeChanged(Attribute*) OVERRIDE;
- virtual bool childShouldCreateRenderer(Node*) const;
+ virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
virtual void removedFromDocument();
diff --git a/Source/WebCore/svg/SVGElement.idl b/Source/WebCore/svg/SVGElement.idl
index 5e9b8312c..41ae9c24d 100644
--- a/Source/WebCore/svg/SVGElement.idl
+++ b/Source/WebCore/svg/SVGElement.idl
@@ -24,7 +24,8 @@ module svg {
interface [
JSGenerateToNativeObject,
- Conditional=SVG
+ Conditional=SVG,
+ V8CustomToJSObject
] SVGElement : Element {
attribute [Reflect] DOMString id;
attribute [TreatNullAs=NullString] DOMString xmlbase setter raises(DOMException);
diff --git a/Source/WebCore/svg/SVGElementInstanceList.idl b/Source/WebCore/svg/SVGElementInstanceList.idl
index e710839ce..9429da719 100644
--- a/Source/WebCore/svg/SVGElementInstanceList.idl
+++ b/Source/WebCore/svg/SVGElementInstanceList.idl
@@ -29,6 +29,6 @@ module svg {
] SVGElementInstanceList {
readonly attribute unsigned long length;
- SVGElementInstance item(in [Optional=CallWithDefaultValue] unsigned long index);
+ SVGElementInstance item(in [Optional=DefaultIsUndefined] unsigned long index);
};
}
diff --git a/Source/WebCore/svg/SVGFEDropShadowElement.idl b/Source/WebCore/svg/SVGFEDropShadowElement.idl
index 91f654d99..3c7d7ce6b 100644
--- a/Source/WebCore/svg/SVGFEDropShadowElement.idl
+++ b/Source/WebCore/svg/SVGFEDropShadowElement.idl
@@ -29,8 +29,8 @@ module svg {
readonly attribute SVGAnimatedNumber stdDeviationX;
readonly attribute SVGAnimatedNumber stdDeviationY;
- void setStdDeviation(in [Optional=CallWithDefaultValue] float stdDeviationX,
- in [Optional=CallWithDefaultValue] float stdDeviationY);
+ void setStdDeviation(in [Optional=DefaultIsUndefined] float stdDeviationX,
+ in [Optional=DefaultIsUndefined] float stdDeviationY);
};
}
diff --git a/Source/WebCore/svg/SVGFEGaussianBlurElement.idl b/Source/WebCore/svg/SVGFEGaussianBlurElement.idl
index 5a01addd8..25858f80c 100644
--- a/Source/WebCore/svg/SVGFEGaussianBlurElement.idl
+++ b/Source/WebCore/svg/SVGFEGaussianBlurElement.idl
@@ -33,8 +33,8 @@ module svg {
readonly attribute SVGAnimatedNumber stdDeviationX;
readonly attribute SVGAnimatedNumber stdDeviationY;
- void setStdDeviation(in [Optional=CallWithDefaultValue] float stdDeviationX,
- in [Optional=CallWithDefaultValue] float stdDeviationY);
+ void setStdDeviation(in [Optional=DefaultIsUndefined] float stdDeviationX,
+ in [Optional=DefaultIsUndefined] float stdDeviationY);
};
}
diff --git a/Source/WebCore/svg/SVGFEMorphologyElement.idl b/Source/WebCore/svg/SVGFEMorphologyElement.idl
index b31d74fb6..24c0a47a9 100644
--- a/Source/WebCore/svg/SVGFEMorphologyElement.idl
+++ b/Source/WebCore/svg/SVGFEMorphologyElement.idl
@@ -40,8 +40,8 @@ module svg {
readonly attribute SVGAnimatedNumber radiusX;
readonly attribute SVGAnimatedNumber radiusY;
- void setRadius(in [Optional=CallWithDefaultValue] float radiusX,
- in [Optional=CallWithDefaultValue] float radiusY);
+ void setRadius(in [Optional=DefaultIsUndefined] float radiusX,
+ in [Optional=DefaultIsUndefined] float radiusY);
};
}
diff --git a/Source/WebCore/svg/SVGFilterElement.idl b/Source/WebCore/svg/SVGFilterElement.idl
index 4f984f469..ff2f49679 100644
--- a/Source/WebCore/svg/SVGFilterElement.idl
+++ b/Source/WebCore/svg/SVGFilterElement.idl
@@ -43,8 +43,8 @@ module svg {
readonly attribute SVGAnimatedInteger filterResX;
readonly attribute SVGAnimatedInteger filterResY;
- void setFilterRes(in [Optional=CallWithDefaultValue] unsigned long filterResX,
- in [Optional=CallWithDefaultValue] unsigned long filterResY);
+ void setFilterRes(in [Optional=DefaultIsUndefined] unsigned long filterResX,
+ in [Optional=DefaultIsUndefined] unsigned long filterResY);
};
}
diff --git a/Source/WebCore/svg/SVGFontFaceElement.cpp b/Source/WebCore/svg/SVGFontFaceElement.cpp
index 51fbc4447..98518de4d 100644
--- a/Source/WebCore/svg/SVGFontFaceElement.cpp
+++ b/Source/WebCore/svg/SVGFontFaceElement.cpp
@@ -51,7 +51,7 @@ inline SVGFontFaceElement::SVGFontFaceElement(const QualifiedName& tagName, Docu
, m_fontFaceRule(CSSFontFaceRule::create())
{
ASSERT(hasTagName(font_faceTag));
- RefPtr<StylePropertySet> styleDeclaration = StylePropertySet::create(m_fontFaceRule.get());
+ RefPtr<StylePropertySet> styleDeclaration = StylePropertySet::create();
styleDeclaration->setStrictParsing(true);
m_fontFaceRule->setDeclaration(styleDeclaration.release());
}
@@ -328,6 +328,7 @@ void SVGFontFaceElement::removedFromDocument()
{
removeFromMappedElementSheet();
SVGElement::removedFromDocument();
+ m_fontFaceRule->declaration()->parseDeclaration(emptyString(), 0);
}
void SVGFontFaceElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
diff --git a/Source/WebCore/svg/SVGForeignObjectElement.cpp b/Source/WebCore/svg/SVGForeignObjectElement.cpp
index d792c47a1..1d7407931 100644
--- a/Source/WebCore/svg/SVGForeignObjectElement.cpp
+++ b/Source/WebCore/svg/SVGForeignObjectElement.cpp
@@ -25,6 +25,7 @@
#include "Attribute.h"
#include "CSSPropertyNames.h"
+#include "NodeRenderingContext.h"
#include "RenderSVGForeignObject.h"
#include "RenderSVGResource.h"
#include "SVGElementInstance.h"
@@ -137,14 +138,14 @@ RenderObject* SVGForeignObjectElement::createRenderer(RenderArena* arena, Render
return new (arena) RenderSVGForeignObject(this);
}
-bool SVGForeignObjectElement::childShouldCreateRenderer(Node* child) const
+bool SVGForeignObjectElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
// Disallow arbitary SVG content. Only allow proper <svg xmlns="svgNS"> subdocuments.
- if (child->isSVGElement())
- return child->hasTagName(SVGNames::svgTag);
+ if (childContext.node()->isSVGElement())
+ return childContext.node()->hasTagName(SVGNames::svgTag);
// Skip over SVG rules which disallow non-SVG kids
- return StyledElement::childShouldCreateRenderer(child);
+ return StyledElement::childShouldCreateRenderer(childContext);
}
bool SVGForeignObjectElement::selfHasRelativeLengths() const
diff --git a/Source/WebCore/svg/SVGForeignObjectElement.h b/Source/WebCore/svg/SVGForeignObjectElement.h
index 67266d5da..057ba0507 100644
--- a/Source/WebCore/svg/SVGForeignObjectElement.h
+++ b/Source/WebCore/svg/SVGForeignObjectElement.h
@@ -46,7 +46,7 @@ private:
virtual void parseAttribute(Attribute*) OVERRIDE;
virtual void svgAttributeChanged(const QualifiedName&);
- virtual bool childShouldCreateRenderer(Node*) const;
+ virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
virtual RenderObject* createRenderer(RenderArena* arena, RenderStyle* style);
virtual bool selfHasRelativeLengths() const;
diff --git a/Source/WebCore/svg/SVGImageElement.cpp b/Source/WebCore/svg/SVGImageElement.cpp
index bf10a1ea9..6f7fe9d1e 100644
--- a/Source/WebCore/svg/SVGImageElement.cpp
+++ b/Source/WebCore/svg/SVGImageElement.cpp
@@ -91,6 +91,23 @@ bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName)
return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName);
}
+bool SVGImageElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == SVGNames::widthAttr || attr->name() == SVGNames::heightAttr)
+ return true;
+ return SVGStyledTransformableElement::isPresentationAttribute(attr);
+}
+
+void SVGImageElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+{
+ if (!isSupportedAttribute(attr->name()))
+ SVGStyledTransformableElement::collectStyleForAttribute(attr, style);
+ else if (attr->name() == SVGNames::widthAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyWidth, attr->value());
+ else if (attr->name() == SVGNames::heightAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyHeight, attr->value());
+}
+
void SVGImageElement::parseAttribute(Attribute* attr)
{
SVGParsingError parseError = NoError;
@@ -103,13 +120,11 @@ void SVGImageElement::parseAttribute(Attribute* attr)
setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
else if (attr->name() == SVGNames::preserveAspectRatioAttr)
SVGPreserveAspectRatio::parsePreserveAspectRatio(this, attr->value());
- else if (attr->name() == SVGNames::widthAttr) {
+ else if (attr->name() == SVGNames::widthAttr)
setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths));
- addCSSProperty(CSSPropertyWidth, attr->value());
- } else if (attr->name() == SVGNames::heightAttr) {
+ else if (attr->name() == SVGNames::heightAttr)
setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths));
- addCSSProperty(CSSPropertyHeight, attr->value());
- } else if (SVGTests::parseAttribute(attr)
+ else if (SVGTests::parseAttribute(attr)
|| SVGLangSpace::parseAttribute(attr)
|| SVGExternalResourcesRequired::parseAttribute(attr)
|| SVGURIReference::parseAttribute(attr)) {
diff --git a/Source/WebCore/svg/SVGImageElement.h b/Source/WebCore/svg/SVGImageElement.h
index 1fbbb0fd7..fb1229e23 100644
--- a/Source/WebCore/svg/SVGImageElement.h
+++ b/Source/WebCore/svg/SVGImageElement.h
@@ -50,6 +50,8 @@ private:
bool isSupportedAttribute(const QualifiedName&);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
+ virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void svgAttributeChanged(const QualifiedName&);
virtual void attach();
diff --git a/Source/WebCore/svg/SVGLengthContext.cpp b/Source/WebCore/svg/SVGLengthContext.cpp
index 36deeff46..d33de3456 100755..100644
--- a/Source/WebCore/svg/SVGLengthContext.cpp
+++ b/Source/WebCore/svg/SVGLengthContext.cpp
@@ -203,14 +203,31 @@ float SVGLengthContext::convertValueFromPercentageToUserUnits(float value, SVGLe
return 0;
}
+static inline RenderStyle* renderStyleForLengthResolving(const SVGElement* context)
+{
+ if (!context)
+ return 0;
+
+ const ContainerNode* currentContext = context;
+ while (currentContext) {
+ if (currentContext->renderer())
+ return currentContext->renderer()->style();
+ currentContext = currentContext->parentNode();
+ }
+
+ // There must be at least a RenderSVGRoot renderer, carrying a style.
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionCode& ec) const
{
- if (!m_context || !m_context->renderer() || !m_context->renderer()->style()) {
+ RenderStyle* style = renderStyleForLengthResolving(m_context);
+ if (!style) {
ec = NOT_SUPPORTED_ERR;
return 0;
}
- RenderStyle* style = m_context->renderer()->style();
float fontSize = style->fontSize();
if (!fontSize) {
ec = NOT_SUPPORTED_ERR;
@@ -222,24 +239,23 @@ float SVGLengthContext::convertValueFromUserUnitsToEMS(float value, ExceptionCod
float SVGLengthContext::convertValueFromEMSToUserUnits(float value, ExceptionCode& ec) const
{
- if (!m_context || !m_context->renderer() || !m_context->renderer()->style()) {
+ RenderStyle* style = renderStyleForLengthResolving(m_context);
+ if (!style) {
ec = NOT_SUPPORTED_ERR;
return 0;
}
- RenderStyle* style = m_context->renderer()->style();
return value * style->fontSize();
}
float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionCode& ec) const
{
- if (!m_context || !m_context->renderer() || !m_context->renderer()->style()) {
+ RenderStyle* style = renderStyleForLengthResolving(m_context);
+ if (!style) {
ec = NOT_SUPPORTED_ERR;
return 0;
}
- RenderStyle* style = m_context->renderer()->style();
-
// Use of ceil allows a pixel match to the W3Cs expected output of coords-units-03-b.svg
// if this causes problems in real world cases maybe it would be best to remove this
float xHeight = ceilf(style->fontMetrics().xHeight());
@@ -253,12 +269,12 @@ float SVGLengthContext::convertValueFromUserUnitsToEXS(float value, ExceptionCod
float SVGLengthContext::convertValueFromEXSToUserUnits(float value, ExceptionCode& ec) const
{
- if (!m_context || !m_context->renderer() || !m_context->renderer()->style()) {
+ RenderStyle* style = renderStyleForLengthResolving(m_context);
+ if (!style) {
ec = NOT_SUPPORTED_ERR;
return 0;
}
- RenderStyle* style = m_context->renderer()->style();
// Use of ceil allows a pixel match to the W3Cs expected output of coords-units-03-b.svg
// if this causes problems in real world cases maybe it would be best to remove this
return value * ceilf(style->fontMetrics().xHeight());
diff --git a/Source/WebCore/svg/SVGLocatable.idl b/Source/WebCore/svg/SVGLocatable.idl
index a83bca099..f626976dd 100644
--- a/Source/WebCore/svg/SVGLocatable.idl
+++ b/Source/WebCore/svg/SVGLocatable.idl
@@ -37,7 +37,7 @@ module svg {
SVGRect getBBox();
SVGMatrix getCTM();
SVGMatrix getScreenCTM();
- SVGMatrix getTransformToElement(in [Optional=CallWithDefaultValue] SVGElement element)
+ SVGMatrix getTransformToElement(in [Optional=DefaultIsUndefined] SVGElement element)
raises(SVGException);
};
diff --git a/Source/WebCore/svg/SVGMarkerElement.idl b/Source/WebCore/svg/SVGMarkerElement.idl
index 1b136852e..dd351e320 100644
--- a/Source/WebCore/svg/SVGMarkerElement.idl
+++ b/Source/WebCore/svg/SVGMarkerElement.idl
@@ -51,7 +51,7 @@ module svg {
readonly attribute SVGAnimatedAngle orientAngle;
void setOrientToAuto();
- void setOrientToAngle(in [Optional=CallWithDefaultValue] SVGAngle angle);
+ void setOrientToAngle(in [Optional=DefaultIsUndefined] SVGAngle angle);
};
}
diff --git a/Source/WebCore/svg/SVGPathElement.idl b/Source/WebCore/svg/SVGPathElement.idl
index 89f637ed4..5f4f6cab6 100644
--- a/Source/WebCore/svg/SVGPathElement.idl
+++ b/Source/WebCore/svg/SVGPathElement.idl
@@ -37,77 +37,77 @@ module svg {
readonly attribute SVGAnimatedNumber pathLength;
float getTotalLength();
- SVGPoint getPointAtLength(in [Optional=CallWithDefaultValue] float distance);
- unsigned long getPathSegAtLength(in [Optional=CallWithDefaultValue] float distance);
+ SVGPoint getPointAtLength(in [Optional=DefaultIsUndefined] float distance);
+ unsigned long getPathSegAtLength(in [Optional=DefaultIsUndefined] float distance);
SVGPathSegClosePath createSVGPathSegClosePath();
- SVGPathSegMovetoAbs createSVGPathSegMovetoAbs(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y);
- SVGPathSegMovetoRel createSVGPathSegMovetoRel(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y);
+ SVGPathSegMovetoAbs createSVGPathSegMovetoAbs(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y);
+ SVGPathSegMovetoRel createSVGPathSegMovetoRel(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y);
- SVGPathSegLinetoAbs createSVGPathSegLinetoAbs(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y);
- SVGPathSegLinetoRel createSVGPathSegLinetoRel(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y);
+ SVGPathSegLinetoAbs createSVGPathSegLinetoAbs(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y);
+ SVGPathSegLinetoRel createSVGPathSegLinetoRel(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y);
- SVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y,
- in [Optional=CallWithDefaultValue] float x1,
- in [Optional=CallWithDefaultValue] float y1,
- in [Optional=CallWithDefaultValue] float x2,
- in [Optional=CallWithDefaultValue] float y2);
- SVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y,
- in [Optional=CallWithDefaultValue] float x1,
- in [Optional=CallWithDefaultValue] float y1,
- in [Optional=CallWithDefaultValue] float x2,
- in [Optional=CallWithDefaultValue] float y2);
+ SVGPathSegCurvetoCubicAbs createSVGPathSegCurvetoCubicAbs(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y,
+ in [Optional=DefaultIsUndefined] float x1,
+ in [Optional=DefaultIsUndefined] float y1,
+ in [Optional=DefaultIsUndefined] float x2,
+ in [Optional=DefaultIsUndefined] float y2);
+ SVGPathSegCurvetoCubicRel createSVGPathSegCurvetoCubicRel(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y,
+ in [Optional=DefaultIsUndefined] float x1,
+ in [Optional=DefaultIsUndefined] float y1,
+ in [Optional=DefaultIsUndefined] float x2,
+ in [Optional=DefaultIsUndefined] float y2);
- SVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y,
- in [Optional=CallWithDefaultValue] float x1,
- in [Optional=CallWithDefaultValue] float y1);
- SVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y,
- in [Optional=CallWithDefaultValue] float x1,
- in [Optional=CallWithDefaultValue] float y1);
+ SVGPathSegCurvetoQuadraticAbs createSVGPathSegCurvetoQuadraticAbs(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y,
+ in [Optional=DefaultIsUndefined] float x1,
+ in [Optional=DefaultIsUndefined] float y1);
+ SVGPathSegCurvetoQuadraticRel createSVGPathSegCurvetoQuadraticRel(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y,
+ in [Optional=DefaultIsUndefined] float x1,
+ in [Optional=DefaultIsUndefined] float y1);
- SVGPathSegArcAbs createSVGPathSegArcAbs(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y,
- in [Optional=CallWithDefaultValue] float r1,
- in [Optional=CallWithDefaultValue] float r2,
- in [Optional=CallWithDefaultValue] float angle,
- in [Optional=CallWithDefaultValue] boolean largeArcFlag,
- in [Optional=CallWithDefaultValue] boolean sweepFlag);
- SVGPathSegArcRel createSVGPathSegArcRel(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y,
- in [Optional=CallWithDefaultValue] float r1,
- in [Optional=CallWithDefaultValue] float r2,
- in [Optional=CallWithDefaultValue] float angle,
- in [Optional=CallWithDefaultValue] boolean largeArcFlag,
- in [Optional=CallWithDefaultValue] boolean sweepFlag);
+ SVGPathSegArcAbs createSVGPathSegArcAbs(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y,
+ in [Optional=DefaultIsUndefined] float r1,
+ in [Optional=DefaultIsUndefined] float r2,
+ in [Optional=DefaultIsUndefined] float angle,
+ in [Optional=DefaultIsUndefined] boolean largeArcFlag,
+ in [Optional=DefaultIsUndefined] boolean sweepFlag);
+ SVGPathSegArcRel createSVGPathSegArcRel(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y,
+ in [Optional=DefaultIsUndefined] float r1,
+ in [Optional=DefaultIsUndefined] float r2,
+ in [Optional=DefaultIsUndefined] float angle,
+ in [Optional=DefaultIsUndefined] boolean largeArcFlag,
+ in [Optional=DefaultIsUndefined] boolean sweepFlag);
- SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs(in [Optional=CallWithDefaultValue] float x);
- SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel(in [Optional=CallWithDefaultValue] float x);
+ SVGPathSegLinetoHorizontalAbs createSVGPathSegLinetoHorizontalAbs(in [Optional=DefaultIsUndefined] float x);
+ SVGPathSegLinetoHorizontalRel createSVGPathSegLinetoHorizontalRel(in [Optional=DefaultIsUndefined] float x);
- SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs(in [Optional=CallWithDefaultValue] float y);
- SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel(in [Optional=CallWithDefaultValue] float y);
+ SVGPathSegLinetoVerticalAbs createSVGPathSegLinetoVerticalAbs(in [Optional=DefaultIsUndefined] float y);
+ SVGPathSegLinetoVerticalRel createSVGPathSegLinetoVerticalRel(in [Optional=DefaultIsUndefined] float y);
- SVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y,
- in [Optional=CallWithDefaultValue] float x2,
- in [Optional=CallWithDefaultValue] float y2);
- SVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y,
- in [Optional=CallWithDefaultValue] float x2,
- in [Optional=CallWithDefaultValue] float y2);
+ SVGPathSegCurvetoCubicSmoothAbs createSVGPathSegCurvetoCubicSmoothAbs(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y,
+ in [Optional=DefaultIsUndefined] float x2,
+ in [Optional=DefaultIsUndefined] float y2);
+ SVGPathSegCurvetoCubicSmoothRel createSVGPathSegCurvetoCubicSmoothRel(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y,
+ in [Optional=DefaultIsUndefined] float x2,
+ in [Optional=DefaultIsUndefined] float y2);
- SVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y);
- SVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel(in [Optional=CallWithDefaultValue] float x,
- in [Optional=CallWithDefaultValue] float y);
+ SVGPathSegCurvetoQuadraticSmoothAbs createSVGPathSegCurvetoQuadraticSmoothAbs(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y);
+ SVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel(in [Optional=DefaultIsUndefined] float x,
+ in [Optional=DefaultIsUndefined] float y);
readonly attribute SVGPathSegList pathSegList;
readonly attribute SVGPathSegList normalizedPathSegList;
diff --git a/Source/WebCore/svg/SVGPathSeg.idl b/Source/WebCore/svg/SVGPathSeg.idl
index 5b967c2c9..e7ad75a8b 100644
--- a/Source/WebCore/svg/SVGPathSeg.idl
+++ b/Source/WebCore/svg/SVGPathSeg.idl
@@ -28,7 +28,7 @@ module svg {
interface [
Conditional=SVG,
- JSCustomToJS,
+ CustomToJSObject,
ObjCPolymorphic
] SVGPathSeg {
// Path Segment Types
diff --git a/Source/WebCore/svg/SVGSVGElement.cpp b/Source/WebCore/svg/SVGSVGElement.cpp
index 8d6f1b03a..d381603ae 100644
--- a/Source/WebCore/svg/SVGSVGElement.cpp
+++ b/Source/WebCore/svg/SVGSVGElement.cpp
@@ -37,6 +37,7 @@
#include "FrameTree.h"
#include "FrameView.h"
#include "HTMLNames.h"
+#include "RenderObject.h"
#include "RenderPart.h"
#include "RenderSVGResource.h"
#include "RenderSVGModelObject.h"
@@ -286,25 +287,29 @@ void SVGSVGElement::parseAttribute(Attribute* attr)
void SVGSVGElement::svgAttributeChanged(const QualifiedName& attrName)
{
- bool updateRelativeLengths = false;
+ bool updateRelativeLengthsOrViewBox = false;
if (attrName == SVGNames::widthAttr
|| attrName == SVGNames::heightAttr
|| attrName == SVGNames::xAttr
- || attrName == SVGNames::yAttr
- || SVGFitToViewBox::isKnownAttribute(attrName)) {
- updateRelativeLengths = true;
+ || attrName == SVGNames::yAttr) {
+ updateRelativeLengthsOrViewBox = true;
updateRelativeLengthsInformation();
}
+ if (SVGFitToViewBox::isKnownAttribute(attrName)) {
+ updateRelativeLengthsOrViewBox = true;
+ if (RenderObject* object = renderer())
+ object->setNeedsTransformUpdate();
+ }
+
SVGElementInstance::InvalidationGuard invalidationGuard(this);
if (SVGTests::handleAttributeChange(this, attrName))
return;
- if (updateRelativeLengths
+ if (updateRelativeLengthsOrViewBox
|| SVGLangSpace::isKnownAttribute(attrName)
|| SVGExternalResourcesRequired::isKnownAttribute(attrName)
- || SVGZoomAndPan::isKnownAttribute(attrName)
- || attrName == SVGNames::viewBoxAttr) {
+ || SVGZoomAndPan::isKnownAttribute(attrName)) {
if (renderer())
RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer());
return;
@@ -550,12 +555,12 @@ FloatSize SVGSVGElement::currentViewportSize() const
return FloatSize();
if (renderer()->isSVGRoot()) {
- LayoutRect frameRect = toRenderSVGRoot(renderer())->frameRect();
- return FloatSize(frameRect.width() / renderer()->style()->effectiveZoom(), frameRect.height() / renderer()->style()->effectiveZoom());
+ LayoutRect contentBoxRect = toRenderSVGRoot(renderer())->contentBoxRect();
+ return FloatSize(contentBoxRect.width() / renderer()->style()->effectiveZoom(), contentBoxRect.height() / renderer()->style()->effectiveZoom());
}
- FloatRect frameRect = toRenderSVGViewportContainer(renderer())->viewport();
- return FloatSize(frameRect.width() / renderer()->style()->effectiveZoom(), frameRect.height() / renderer()->style()->effectiveZoom());
+ FloatRect viewportRect = toRenderSVGViewportContainer(renderer())->viewport();
+ return FloatSize(viewportRect.width() / renderer()->style()->effectiveZoom(), viewportRect.height() / renderer()->style()->effectiveZoom());
}
bool SVGSVGElement::widthAttributeEstablishesViewport() const
@@ -726,7 +731,7 @@ Element* SVGSVGElement::getElementById(const AtomicString& id) const
continue;
Element* element = static_cast<Element*>(node);
- if (element->hasID() && element->getIdAttribute() == id)
+ if (element->getIdAttribute() == id)
return element;
}
return 0;
diff --git a/Source/WebCore/svg/SVGSVGElement.idl b/Source/WebCore/svg/SVGSVGElement.idl
index ff0309a0d..8fcd3d81e 100644
--- a/Source/WebCore/svg/SVGSVGElement.idl
+++ b/Source/WebCore/svg/SVGSVGElement.idl
@@ -55,23 +55,23 @@ module svg {
/*setter raises(DOMException)*/;
readonly attribute SVGPoint currentTranslate;
- unsigned long suspendRedraw(in [Optional=CallWithDefaultValue] unsigned long maxWaitMilliseconds);
- void unsuspendRedraw(in [Optional=CallWithDefaultValue] unsigned long suspendHandleId);
+ unsigned long suspendRedraw(in [Optional=DefaultIsUndefined] unsigned long maxWaitMilliseconds);
+ void unsuspendRedraw(in [Optional=DefaultIsUndefined] unsigned long suspendHandleId);
void unsuspendRedrawAll();
void forceRedraw();
void pauseAnimations();
void unpauseAnimations();
boolean animationsPaused();
float getCurrentTime();
- void setCurrentTime(in [Optional=CallWithDefaultValue] float seconds);
- NodeList getIntersectionList(in [Optional=CallWithDefaultValue] SVGRect rect,
- in [Optional=CallWithDefaultValue] SVGElement referenceElement);
- NodeList getEnclosureList(in [Optional=CallWithDefaultValue] SVGRect rect,
- in [Optional=CallWithDefaultValue] SVGElement referenceElement);
- boolean checkIntersection(in [Optional=CallWithDefaultValue] SVGElement element,
- in [Optional=CallWithDefaultValue] SVGRect rect);
- boolean checkEnclosure(in [Optional=CallWithDefaultValue] SVGElement element,
- in [Optional=CallWithDefaultValue] SVGRect rect);
+ void setCurrentTime(in [Optional=DefaultIsUndefined] float seconds);
+ NodeList getIntersectionList(in [Optional=DefaultIsUndefined] SVGRect rect,
+ in [Optional=DefaultIsUndefined] SVGElement referenceElement);
+ NodeList getEnclosureList(in [Optional=DefaultIsUndefined] SVGRect rect,
+ in [Optional=DefaultIsUndefined] SVGElement referenceElement);
+ boolean checkIntersection(in [Optional=DefaultIsUndefined] SVGElement element,
+ in [Optional=DefaultIsUndefined] SVGRect rect);
+ boolean checkEnclosure(in [Optional=DefaultIsUndefined] SVGElement element,
+ in [Optional=DefaultIsUndefined] SVGRect rect);
void deselectAll();
SVGNumber createSVGNumber();
@@ -81,8 +81,8 @@ module svg {
SVGMatrix createSVGMatrix();
SVGRect createSVGRect();
SVGTransform createSVGTransform();
- SVGTransform createSVGTransformFromMatrix(in [Optional=CallWithDefaultValue] SVGMatrix matrix);
- Element getElementById(in [Optional=CallWithDefaultValue] DOMString elementId);
+ SVGTransform createSVGTransformFromMatrix(in [Optional=DefaultIsUndefined] SVGMatrix matrix);
+ Element getElementById(in [Optional=DefaultIsUndefined] DOMString elementId);
};
}
diff --git a/Source/WebCore/svg/SVGStylable.idl b/Source/WebCore/svg/SVGStylable.idl
index 481eec34f..3e06563f0 100644
--- a/Source/WebCore/svg/SVGStylable.idl
+++ b/Source/WebCore/svg/SVGStylable.idl
@@ -35,7 +35,7 @@ module svg {
readonly attribute SVGAnimatedString className;
readonly attribute CSSStyleDeclaration style;
- CSSValue getPresentationAttribute(in [Optional=CallWithDefaultValue] DOMString name);
+ CSSValue getPresentationAttribute(in [Optional=DefaultIsUndefined] DOMString name);
};
}
diff --git a/Source/WebCore/svg/SVGStyledElement.cpp b/Source/WebCore/svg/SVGStyledElement.cpp
index 518b5b3ee..dd159a099 100644
--- a/Source/WebCore/svg/SVGStyledElement.cpp
+++ b/Source/WebCore/svg/SVGStyledElement.cpp
@@ -292,15 +292,22 @@ bool SVGStyledElement::isAnimatableCSSProperty(const QualifiedName& attrName)
return cssPropertyToTypeMap().contains(attrName);
}
+bool SVGStyledElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name()) > 0)
+ return true;
+ return SVGElement::isPresentationAttribute(attr);
+}
+
+void SVGStyledElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+{
+ int propertyID = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name());
+ if (propertyID > 0)
+ addPropertyToAttributeStyle(style, propertyID, attr->value());
+}
+
void SVGStyledElement::parseAttribute(Attribute* attr)
{
- int propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name());
- if (propId > 0) {
- addCSSProperty(propId, attr->value());
- setNeedsStyleRecalc();
- return;
- }
-
// SVG animation has currently requires special storage of values so we set
// the className here. svgAttributeChanged actually causes the resulting
// style updates (instead of StyledElement::parseAttribute). We don't
diff --git a/Source/WebCore/svg/SVGStyledElement.h b/Source/WebCore/svg/SVGStyledElement.h
index 3df4c93fc..7a400641c 100644
--- a/Source/WebCore/svg/SVGStyledElement.h
+++ b/Source/WebCore/svg/SVGStyledElement.h
@@ -66,6 +66,8 @@ protected:
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
+ virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void svgAttributeChanged(const QualifiedName&);
virtual void attach();
diff --git a/Source/WebCore/svg/SVGSwitchElement.cpp b/Source/WebCore/svg/SVGSwitchElement.cpp
index 79a00ac92..7b976b2c0 100644
--- a/Source/WebCore/svg/SVGSwitchElement.cpp
+++ b/Source/WebCore/svg/SVGSwitchElement.cpp
@@ -23,6 +23,7 @@
#if ENABLE(SVG)
#include "SVGSwitchElement.h"
+#include "NodeRenderingContext.h"
#include "RenderSVGTransformableContainer.h"
#include "SVGNames.h"
@@ -49,7 +50,7 @@ PassRefPtr<SVGSwitchElement> SVGSwitchElement::create(const QualifiedName& tagNa
return adoptRef(new SVGSwitchElement(tagName, document));
}
-bool SVGSwitchElement::childShouldCreateRenderer(Node* child) const
+bool SVGSwitchElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) 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.
@@ -61,7 +62,7 @@ bool SVGSwitchElement::childShouldCreateRenderer(Node* child) const
if (!element || !element->isValid())
continue;
- return node == child; // Only allow this child if it's the first valid child
+ return node == childContext.node(); // Only allow this child if it's the first valid child
}
return false;
diff --git a/Source/WebCore/svg/SVGSwitchElement.h b/Source/WebCore/svg/SVGSwitchElement.h
index 073a03851..1bf7e6cd4 100644
--- a/Source/WebCore/svg/SVGSwitchElement.h
+++ b/Source/WebCore/svg/SVGSwitchElement.h
@@ -43,7 +43,7 @@ private:
virtual bool isValid() const { return SVGTests::isValid(); }
virtual bool supportsFocus() const { return true; }
- virtual bool childShouldCreateRenderer(Node*) const;
+ virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
diff --git a/Source/WebCore/svg/SVGTRefElement.cpp b/Source/WebCore/svg/SVGTRefElement.cpp
index 300b8c9fb..90b2d9985 100644
--- a/Source/WebCore/svg/SVGTRefElement.cpp
+++ b/Source/WebCore/svg/SVGTRefElement.cpp
@@ -27,10 +27,12 @@
#include "EventListener.h"
#include "EventNames.h"
#include "MutationEvent.h"
+#include "NodeRenderingContext.h"
#include "RenderSVGInline.h"
#include "RenderSVGInlineText.h"
#include "RenderSVGResource.h"
#include "ShadowRoot.h"
+#include "ShadowRootList.h"
#include "SVGDocument.h"
#include "SVGElementInstance.h"
#include "SVGNames.h"
@@ -56,19 +58,21 @@ inline SVGTRefElement::SVGTRefElement(const QualifiedName& tagName, Document* do
PassRefPtr<SVGTRefElement> SVGTRefElement::create(const QualifiedName& tagName, Document* document)
{
- return adoptRef(new SVGTRefElement(tagName, document));
+ RefPtr<SVGTRefElement> element = adoptRef(new SVGTRefElement(tagName, document));
+ element->createShadowSubtree();
+ return element.release();
}
-class SubtreeModificationEventListener : public EventListener {
+class TargetListener : public EventListener {
public:
- static PassRefPtr<SubtreeModificationEventListener> create(SVGTRefElement* trefElement, String targetId)
+ static PassRefPtr<TargetListener> create(SVGTRefElement* trefElement, String targetId)
{
- return adoptRef(new SubtreeModificationEventListener(trefElement, targetId));
+ return adoptRef(new TargetListener(trefElement, targetId));
}
- static const SubtreeModificationEventListener* cast(const EventListener* listener)
+ static const TargetListener* cast(const EventListener* listener)
{
- return listener->type() == CPPEventListenerType ? static_cast<const SubtreeModificationEventListener*>(listener) : 0;
+ return listener->type() == CPPEventListenerType ? static_cast<const TargetListener*>(listener) : 0;
}
virtual bool operator==(const EventListener&);
@@ -76,15 +80,17 @@ public:
void clear()
{
Element* target = m_trefElement->treeScope()->getElementById(m_targetId);
- if (target && target->parentNode())
- target->parentNode()->removeEventListener(eventNames().DOMSubtreeModifiedEvent, this, false);
+ if (target) {
+ target->removeEventListener(eventNames().DOMSubtreeModifiedEvent, this, false);
+ target->removeEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, this, false);
+ }
m_trefElement = 0;
m_targetId = String();
}
private:
- SubtreeModificationEventListener(SVGTRefElement* trefElement, String targetId)
+ TargetListener(SVGTRefElement* trefElement, String targetId)
: EventListener(CPPEventListenerType)
, m_trefElement(trefElement)
, m_targetId(targetId)
@@ -97,17 +103,20 @@ private:
String m_targetId;
};
-bool SubtreeModificationEventListener::operator==(const EventListener& listener)
+bool TargetListener::operator==(const EventListener& listener)
{
- if (const SubtreeModificationEventListener* subtreeModificationEventListener = SubtreeModificationEventListener::cast(&listener))
+ if (const TargetListener* subtreeModificationEventListener = TargetListener::cast(&listener))
return m_trefElement == subtreeModificationEventListener->m_trefElement;
return false;
}
-void SubtreeModificationEventListener::handleEvent(ScriptExecutionContext*, Event* event)
+void TargetListener::handleEvent(ScriptExecutionContext*, Event* event)
{
if (m_trefElement && event->type() == eventNames().DOMSubtreeModifiedEvent && m_trefElement != event->target())
m_trefElement->updateReferencedText();
+
+ if (m_trefElement && event->type() == eventNames().DOMNodeRemovedFromDocumentEvent)
+ m_trefElement->detachTarget();
}
class SVGShadowText : public Text {
@@ -144,18 +153,43 @@ SVGTRefElement::~SVGTRefElement()
clearEventListener();
}
+void SVGTRefElement::createShadowSubtree()
+{
+ ShadowRoot::create(this, ShadowRoot::CreatingUserAgentShadowRoot, ASSERT_NO_EXCEPTION);
+}
+
void SVGTRefElement::updateReferencedText()
{
- Element* target = SVGURIReference::targetElementFromIRIString(href(), document());
- ASSERT(target);
String textContent;
- if (target->parentNode())
+ if (Element* target = SVGURIReference::targetElementFromIRIString(href(), document()))
textContent = target->textContent();
- ExceptionCode ignore = 0;
- if (!ensureShadowRoot()->firstChild())
- shadowRoot()->appendChild(SVGShadowText::create(document(), textContent), ignore);
+
+ ASSERT(hasShadowRoot());
+ ShadowRoot* root = shadowRootList()->oldestShadowRoot();
+ if (!root->firstChild())
+ root->appendChild(SVGShadowText::create(document(), textContent), ASSERT_NO_EXCEPTION);
else
- shadowRoot()->firstChild()->setTextContent(textContent, ignore);
+ root->firstChild()->setTextContent(textContent, ASSERT_NO_EXCEPTION);
+}
+
+void SVGTRefElement::detachTarget()
+{
+ // Remove active listeners and clear the text content.
+ clearEventListener();
+
+ String emptyContent;
+ ExceptionCode ignore = 0;
+
+ ASSERT(hasShadowRoot());
+ Node* container = shadowRootList()->oldestShadowRoot()->firstChild();
+ if (container)
+ container->setTextContent(emptyContent, ignore);
+
+ // Mark the referenced ID as pending.
+ String id;
+ SVGURIReference::targetElementFromIRIString(href(), document(), &id);
+ if (!hasPendingResources() && !id.isEmpty())
+ document()->accessSVGExtensions()->addPendingResource(id, this);
}
bool SVGTRefElement::isSupportedAttribute(const QualifiedName& attrName)
@@ -204,9 +238,9 @@ RenderObject* SVGTRefElement::createRenderer(RenderArena* arena, RenderStyle*)
return new (arena) RenderSVGInline(this);
}
-bool SVGTRefElement::childShouldCreateRenderer(Node* child) const
+bool SVGTRefElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
- return child->isInShadowTree();
+ return childContext.node()->isInShadowTree();
}
bool SVGTRefElement::rendererIsNeeded(const NodeRenderingContext& context)
@@ -247,9 +281,9 @@ void SVGTRefElement::buildPendingResource()
if (!inDocument())
return;
- m_eventListener = SubtreeModificationEventListener::create(this, id);
- ASSERT(target->parentNode());
- target->parentNode()->addEventListener(eventNames().DOMSubtreeModifiedEvent, m_eventListener.get(), false);
+ m_eventListener = TargetListener::create(this, id);
+ target->addEventListener(eventNames().DOMSubtreeModifiedEvent, m_eventListener.get(), false);
+ target->addEventListener(eventNames().DOMNodeRemovedFromDocumentEvent, m_eventListener.get(), false);
}
void SVGTRefElement::insertedIntoDocument()
diff --git a/Source/WebCore/svg/SVGTRefElement.h b/Source/WebCore/svg/SVGTRefElement.h
index 17a8acd59..18cbded2f 100644
--- a/Source/WebCore/svg/SVGTRefElement.h
+++ b/Source/WebCore/svg/SVGTRefElement.h
@@ -27,7 +27,7 @@
namespace WebCore {
-class SubtreeModificationEventListener;
+class TargetListener;
class SVGTRefElement : public SVGTextPositioningElement,
public SVGURIReference {
@@ -35,17 +35,19 @@ public:
static PassRefPtr<SVGTRefElement> create(const QualifiedName&, Document*);
private:
- friend class SubtreeModificationEventListener;
+ friend class TargetListener;
SVGTRefElement(const QualifiedName&, Document*);
virtual ~SVGTRefElement();
+ void createShadowSubtree();
+
bool isSupportedAttribute(const QualifiedName&);
virtual void parseAttribute(Attribute*) OVERRIDE;
virtual void svgAttributeChanged(const QualifiedName&);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual bool childShouldCreateRenderer(Node*) const;
+ virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual void insertedIntoDocument();
@@ -55,13 +57,15 @@ private:
void updateReferencedText();
+ void detachTarget();
+
virtual void buildPendingResource();
BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGTRefElement)
DECLARE_ANIMATED_STRING(Href, href)
END_DECLARE_ANIMATED_PROPERTIES
- RefPtr<SubtreeModificationEventListener> m_eventListener;
+ RefPtr<TargetListener> m_eventListener;
};
} // namespace WebCore
diff --git a/Source/WebCore/svg/SVGTSpanElement.cpp b/Source/WebCore/svg/SVGTSpanElement.cpp
index 3219e6533..d13120d90 100644
--- a/Source/WebCore/svg/SVGTSpanElement.cpp
+++ b/Source/WebCore/svg/SVGTSpanElement.cpp
@@ -23,6 +23,7 @@
#if ENABLE(SVG)
#include "SVGTSpanElement.h"
+#include "NodeRenderingContext.h"
#include "RenderInline.h"
#include "RenderSVGTSpan.h"
#include "SVGNames.h"
@@ -45,15 +46,15 @@ RenderObject* SVGTSpanElement::createRenderer(RenderArena* arena, RenderStyle*)
return new (arena) RenderSVGTSpan(this);
}
-bool SVGTSpanElement::childShouldCreateRenderer(Node* child) const
+bool SVGTSpanElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
- if (child->isTextNode()
- || child->hasTagName(SVGNames::aTag)
+ if (childContext.node()->isTextNode()
+ || childContext.node()->hasTagName(SVGNames::aTag)
#if ENABLE(SVG_FONTS)
- || child->hasTagName(SVGNames::altGlyphTag)
+ || childContext.node()->hasTagName(SVGNames::altGlyphTag)
#endif
- || child->hasTagName(SVGNames::trefTag)
- || child->hasTagName(SVGNames::tspanTag))
+ || childContext.node()->hasTagName(SVGNames::trefTag)
+ || childContext.node()->hasTagName(SVGNames::tspanTag))
return true;
return false;
diff --git a/Source/WebCore/svg/SVGTSpanElement.h b/Source/WebCore/svg/SVGTSpanElement.h
index 287cab41a..5ebab4475 100644
--- a/Source/WebCore/svg/SVGTSpanElement.h
+++ b/Source/WebCore/svg/SVGTSpanElement.h
@@ -34,7 +34,7 @@ private:
SVGTSpanElement(const QualifiedName&, Document*);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual bool childShouldCreateRenderer(Node*) const;
+ virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
virtual bool rendererIsNeeded(const NodeRenderingContext&);
};
diff --git a/Source/WebCore/svg/SVGTests.idl b/Source/WebCore/svg/SVGTests.idl
index c914a7bc8..11d9856a6 100644
--- a/Source/WebCore/svg/SVGTests.idl
+++ b/Source/WebCore/svg/SVGTests.idl
@@ -35,7 +35,7 @@ module svg {
readonly attribute SVGStringList requiredExtensions;
readonly attribute SVGStringList systemLanguage;
- boolean hasExtension(in [Optional=CallWithDefaultValue] DOMString extension);
+ boolean hasExtension(in [Optional=DefaultIsUndefined] DOMString extension);
};
}
diff --git a/Source/WebCore/svg/SVGTextContentElement.cpp b/Source/WebCore/svg/SVGTextContentElement.cpp
index c8dfdc5f1..1efedac93 100644
--- a/Source/WebCore/svg/SVGTextContentElement.cpp
+++ b/Source/WebCore/svg/SVGTextContentElement.cpp
@@ -228,6 +228,27 @@ bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName)
return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName);
}
+bool SVGTextContentElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name().matches(XMLNames::spaceAttr))
+ return true;
+ return SVGStyledElement::isPresentationAttribute(attr);
+}
+
+void SVGTextContentElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+{
+ if (!isSupportedAttribute(attr->name()))
+ SVGStyledElement::collectStyleForAttribute(attr, style);
+ else if (attr->name().matches(XMLNames::spaceAttr)) {
+ DEFINE_STATIC_LOCAL(const AtomicString, preserveString, ("preserve"));
+
+ if (attr->value() == preserveString)
+ addPropertyToAttributeStyle(style, CSSPropertyWhiteSpace, CSSValuePre);
+ else
+ addPropertyToAttributeStyle(style, CSSPropertyWhiteSpace, CSSValueNowrap);
+ }
+}
+
void SVGTextContentElement::parseAttribute(Attribute* attr)
{
SVGParsingError parseError = NoError;
@@ -243,14 +264,6 @@ void SVGTextContentElement::parseAttribute(Attribute* attr)
} else if (SVGTests::parseAttribute(attr)
|| SVGExternalResourcesRequired::parseAttribute(attr)) {
} else if (SVGLangSpace::parseAttribute(attr)) {
- if (attr->name().matches(XMLNames::spaceAttr)) {
- DEFINE_STATIC_LOCAL(const AtomicString, preserveString, ("preserve"));
-
- if (attr->value() == preserveString)
- addCSSProperty(CSSPropertyWhiteSpace, CSSValuePre);
- else
- addCSSProperty(CSSPropertyWhiteSpace, CSSValueNowrap);
- }
} else
ASSERT_NOT_REACHED();
diff --git a/Source/WebCore/svg/SVGTextContentElement.h b/Source/WebCore/svg/SVGTextContentElement.h
index d45bea6a1..91ae378f8 100644
--- a/Source/WebCore/svg/SVGTextContentElement.h
+++ b/Source/WebCore/svg/SVGTextContentElement.h
@@ -104,6 +104,8 @@ protected:
bool isSupportedAttribute(const QualifiedName&);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
+ virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void svgAttributeChanged(const QualifiedName&);
virtual bool selfHasRelativeLengths() const;
diff --git a/Source/WebCore/svg/SVGTextContentElement.idl b/Source/WebCore/svg/SVGTextContentElement.idl
index cdd32e9fc..6ce8a5302 100644
--- a/Source/WebCore/svg/SVGTextContentElement.idl
+++ b/Source/WebCore/svg/SVGTextContentElement.idl
@@ -42,20 +42,20 @@ module svg {
long getNumberOfChars();
float getComputedTextLength();
- float getSubStringLength(in [Optional=CallWithDefaultValue,IsIndex] unsigned long offset,
- in [Optional=CallWithDefaultValue,IsIndex] unsigned long length)
+ float getSubStringLength(in [Optional=DefaultIsUndefined,IsIndex] unsigned long offset,
+ in [Optional=DefaultIsUndefined,IsIndex] unsigned long length)
raises(DOMException);
- SVGPoint getStartPositionOfChar(in [Optional=CallWithDefaultValue,IsIndex] unsigned long offset)
+ SVGPoint getStartPositionOfChar(in [Optional=DefaultIsUndefined,IsIndex] unsigned long offset)
raises(DOMException);
- SVGPoint getEndPositionOfChar(in [Optional=CallWithDefaultValue,IsIndex] unsigned long offset)
+ SVGPoint getEndPositionOfChar(in [Optional=DefaultIsUndefined,IsIndex] unsigned long offset)
raises(DOMException);
- SVGRect getExtentOfChar(in [Optional=CallWithDefaultValue,IsIndex] unsigned long offset)
+ SVGRect getExtentOfChar(in [Optional=DefaultIsUndefined,IsIndex] unsigned long offset)
raises(DOMException);
- float getRotationOfChar(in [Optional=CallWithDefaultValue,IsIndex] unsigned long offset)
+ float getRotationOfChar(in [Optional=DefaultIsUndefined,IsIndex] unsigned long offset)
raises(DOMException);
- long getCharNumAtPosition(in [Optional=CallWithDefaultValue] SVGPoint point);
- void selectSubString(in [Optional=CallWithDefaultValue,IsIndex] unsigned long offset,
- in [Optional=CallWithDefaultValue,IsIndex] unsigned long length)
+ long getCharNumAtPosition(in [Optional=DefaultIsUndefined] SVGPoint point);
+ void selectSubString(in [Optional=DefaultIsUndefined,IsIndex] unsigned long offset,
+ in [Optional=DefaultIsUndefined,IsIndex] unsigned long length)
raises(DOMException);
};
diff --git a/Source/WebCore/svg/SVGTextElement.cpp b/Source/WebCore/svg/SVGTextElement.cpp
index 5d46d82b2..54a64a57e 100644
--- a/Source/WebCore/svg/SVGTextElement.cpp
+++ b/Source/WebCore/svg/SVGTextElement.cpp
@@ -26,6 +26,7 @@
#include "AffineTransform.h"
#include "Attribute.h"
#include "FloatRect.h"
+#include "NodeRenderingContext.h"
#include "RenderSVGResource.h"
#include "RenderSVGText.h"
#include "SVGElementInstance.h"
@@ -141,16 +142,16 @@ RenderObject* SVGTextElement::createRenderer(RenderArena* arena, RenderStyle*)
return new (arena) RenderSVGText(this);
}
-bool SVGTextElement::childShouldCreateRenderer(Node* child) const
+bool SVGTextElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
- if (child->isTextNode()
- || child->hasTagName(SVGNames::aTag)
+ if (childContext.node()->isTextNode()
+ || childContext.node()->hasTagName(SVGNames::aTag)
#if ENABLE(SVG_FONTS)
- || child->hasTagName(SVGNames::altGlyphTag)
+ || childContext.node()->hasTagName(SVGNames::altGlyphTag)
#endif
- || child->hasTagName(SVGNames::textPathTag)
- || child->hasTagName(SVGNames::trefTag)
- || child->hasTagName(SVGNames::tspanTag))
+ || childContext.node()->hasTagName(SVGNames::textPathTag)
+ || childContext.node()->hasTagName(SVGNames::trefTag)
+ || childContext.node()->hasTagName(SVGNames::tspanTag))
return true;
return false;
diff --git a/Source/WebCore/svg/SVGTextElement.h b/Source/WebCore/svg/SVGTextElement.h
index e8a419358..32118f5bb 100644
--- a/Source/WebCore/svg/SVGTextElement.h
+++ b/Source/WebCore/svg/SVGTextElement.h
@@ -53,7 +53,7 @@ private:
virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope mode) const { return SVGTransformable::localCoordinateSpaceTransform(mode); }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual bool childShouldCreateRenderer(Node*) const;
+ virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
virtual void svgAttributeChanged(const QualifiedName&);
diff --git a/Source/WebCore/svg/SVGTextPathElement.cpp b/Source/WebCore/svg/SVGTextPathElement.cpp
index 84c9a724a..c8cfdd294 100644
--- a/Source/WebCore/svg/SVGTextPathElement.cpp
+++ b/Source/WebCore/svg/SVGTextPathElement.cpp
@@ -24,6 +24,7 @@
#include "SVGTextPathElement.h"
#include "Attribute.h"
+#include "NodeRenderingContext.h"
#include "RenderSVGResource.h"
#include "RenderSVGTextPath.h"
#include "SVGElementInstance.h"
@@ -117,12 +118,12 @@ RenderObject* SVGTextPathElement::createRenderer(RenderArena* arena, RenderStyle
return new (arena) RenderSVGTextPath(this);
}
-bool SVGTextPathElement::childShouldCreateRenderer(Node* child) const
+bool SVGTextPathElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
{
- if (child->isTextNode()
- || child->hasTagName(SVGNames::aTag)
- || child->hasTagName(SVGNames::trefTag)
- || child->hasTagName(SVGNames::tspanTag))
+ if (childContext.node()->isTextNode()
+ || childContext.node()->hasTagName(SVGNames::aTag)
+ || childContext.node()->hasTagName(SVGNames::trefTag)
+ || childContext.node()->hasTagName(SVGNames::tspanTag))
return true;
return false;
diff --git a/Source/WebCore/svg/SVGTextPathElement.h b/Source/WebCore/svg/SVGTextPathElement.h
index 499c80d58..99bf6221c 100644
--- a/Source/WebCore/svg/SVGTextPathElement.h
+++ b/Source/WebCore/svg/SVGTextPathElement.h
@@ -122,7 +122,7 @@ private:
virtual void svgAttributeChanged(const QualifiedName&);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual bool childShouldCreateRenderer(Node*) const;
+ virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const;
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual bool selfHasRelativeLengths() const;
diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp
index fd7f2d217..e342ee4ad 100644
--- a/Source/WebCore/svg/SVGUseElement.cpp
+++ b/Source/WebCore/svg/SVGUseElement.cpp
@@ -345,14 +345,21 @@ bool SVGUseElement::willRecalcStyle(StyleChange change)
if (SVGElement* shadowRoot = m_targetElementInstance->shadowTreeElement())
shadowRoot->setNeedsStyleRecalc();
}
+ // Do not do style calculation during shadow tree construction because it may cause nodes to
+ // be attached before they should be. Style recalc will happen when the tree is constructed
+ // and explicitly attached.
+ if (m_updatesBlocked)
+ return false;
return true;
}
void SVGUseElement::didRecalcStyle(StyleChange change)
{
// Assure that the shadow tree has not been marked for recreation, while we're building it.
- if (m_updatesBlocked)
- ASSERT(!m_needsShadowTreeRecreation);
+ if (m_updatesBlocked && m_needsShadowTreeRecreation) {
+ // We are about to recreate the tree while in the middle of recreating the tree.
+ return;
+ }
RenderSVGShadowTreeRootContainer* shadowRoot = static_cast<RenderSVGShadowTreeRootContainer*>(renderer());
if (!shadowRoot)
diff --git a/Source/WebCore/svg/animation/SMILTime.h b/Source/WebCore/svg/animation/SMILTime.h
index f7276c3ce..18abdae59 100644
--- a/Source/WebCore/svg/animation/SMILTime.h
+++ b/Source/WebCore/svg/animation/SMILTime.h
@@ -55,6 +55,32 @@ private:
double m_time;
};
+class SMILTimeWithOrigin {
+public:
+ enum Origin {
+ ParserOrigin,
+ ScriptOrigin
+ };
+
+ SMILTimeWithOrigin()
+ : m_origin(ParserOrigin)
+ {
+ }
+
+ SMILTimeWithOrigin(const SMILTime& time, Origin origin)
+ : m_time(time)
+ , m_origin(origin)
+ {
+ }
+
+ const SMILTime& time() const { return m_time; }
+ bool originIsScript() const { return m_origin == ScriptOrigin; }
+
+private:
+ SMILTime m_time;
+ Origin m_origin;
+};
+
inline bool operator==(const SMILTime& a, const SMILTime& b) { return a.isFinite() && a.value() == b.value(); }
inline bool operator!(const SMILTime& a) { return !a.isFinite() || !a.value(); }
inline bool operator!=(const SMILTime& a, const SMILTime& b) { return !operator==(a, b); }
@@ -62,6 +88,7 @@ inline bool operator>(const SMILTime& a, const SMILTime& b) { return a.value() >
inline bool operator<(const SMILTime& a, const SMILTime& b) { return a.value() < b.value(); }
inline bool operator>=(const SMILTime& a, const SMILTime& b) { return a.value() > b.value() || operator==(a, b); }
inline bool operator<=(const SMILTime& a, const SMILTime& b) { return a.value() < b.value() || operator==(a, b); }
+inline bool operator<(const SMILTimeWithOrigin& a, const SMILTimeWithOrigin& b) { return a.time() < b.time(); }
SMILTime operator+(const SMILTime&, const SMILTime&);
SMILTime operator-(const SMILTime&, const SMILTime&);
diff --git a/Source/WebCore/svg/animation/SMILTimeContainer.cpp b/Source/WebCore/svg/animation/SMILTimeContainer.cpp
index 82369e9cd..692f28b5f 100644
--- a/Source/WebCore/svg/animation/SMILTimeContainer.cpp
+++ b/Source/WebCore/svg/animation/SMILTimeContainer.cpp
@@ -123,13 +123,13 @@ void SMILTimeContainer::resume()
void SMILTimeContainer::setElapsed(SMILTime time)
{
+ // If the documment didn't begin yet, record a new start time, we'll seek to once its possible.
if (!m_beginTime) {
m_presetStartTime = time.value();
return;
}
- double now = currentTime();
- m_beginTime = now - time.value();
+ m_beginTime = currentTime() - time.value();
m_accumulatedPauseTime = 0;
Vector<SVGSMILElement*> toReset;
@@ -137,8 +137,7 @@ void SMILTimeContainer::setElapsed(SMILTime time)
for (unsigned n = 0; n < toReset.size(); ++n)
toReset[n]->reset();
- if (isPaused())
- updateAnimations(now - m_beginTime - m_accumulatedPauseTime);
+ updateAnimations(time);
}
void SMILTimeContainer::startTimer(SMILTime fireTime, SMILTime minimumDelay)
@@ -157,8 +156,7 @@ void SMILTimeContainer::timerFired(Timer<SMILTimeContainer>*)
{
ASSERT(m_beginTime);
ASSERT(!m_pauseTime);
- SMILTime elapsed = this->elapsed();
- updateAnimations(elapsed);
+ updateAnimations(elapsed());
}
void SMILTimeContainer::updateDocumentOrderIndexes()
@@ -221,49 +219,20 @@ String SMILTimeContainer::baseValueFor(ElementAttributePair key)
ASSERT(attributeName != anyQName());
String baseValue;
if (SVGAnimationElement::isTargetAttributeCSSProperty(targetElement, attributeName))
- baseValue = computedStyle(targetElement)->getPropertyValue(cssPropertyID(attributeName.localName()));
+ baseValue = CSSComputedStyleDeclaration::create(targetElement)->getPropertyValue(cssPropertyID(attributeName.localName()));
else
baseValue = targetElement->getAttribute(attributeName);
m_savedBaseValues.add(key, baseValue);
return baseValue;
}
-void SMILTimeContainer::sampleAnimationAtTime(const String& elementId, double newTime)
-{
- ASSERT(m_beginTime);
- ASSERT(!isPaused());
-
- // Fast-forward to the time DRT wants to sample
- m_timer.stop();
-
- updateAnimations(elapsed(), newTime, elementId);
-}
-
-void SMILTimeContainer::updateAnimations(SMILTime elapsed, double nextManualSampleTime, const String& nextSamplingTarget)
+void SMILTimeContainer::updateAnimations(SMILTime elapsed)
{
SMILTime earliersFireTime = SMILTime::unresolved();
Vector<SVGSMILElement*> toAnimate;
copyToVector(m_scheduledAnimations, toAnimate);
- if (nextManualSampleTime) {
- SMILTime samplingDiff;
- for (unsigned n = 0; n < toAnimate.size(); ++n) {
- SVGSMILElement* animation = toAnimate[n];
- ASSERT(animation->timeContainer() == this);
-
- SVGElement* targetElement = animation->targetElement();
- // FIXME: This should probably be using getIdAttribute instead of idForStyleResolution.
- if (!targetElement || !targetElement->hasID() || targetElement->idForStyleResolution() != nextSamplingTarget)
- continue;
-
- samplingDiff = animation->intervalBegin();
- break;
- }
-
- elapsed = SMILTime(nextManualSampleTime) + samplingDiff;
- }
-
// Sort according to priority. Elements with later begin time have higher priority.
// In case of a tie, document order decides.
// FIXME: This should also consider timing relationships between the elements. Dependents
diff --git a/Source/WebCore/svg/animation/SMILTimeContainer.h b/Source/WebCore/svg/animation/SMILTimeContainer.h
index a2d0b8fed..d4d06da48 100644
--- a/Source/WebCore/svg/animation/SMILTimeContainer.h
+++ b/Source/WebCore/svg/animation/SMILTimeContainer.h
@@ -63,15 +63,12 @@ public:
void setDocumentOrderIndexesDirty() { m_documentOrderIndexesDirty = true; }
- // Move to a specific time. Only used for DRT testing purposes.
- void sampleAnimationAtTime(const String& elementId, double seconds);
-
private:
SMILTimeContainer(SVGSVGElement* owner);
void timerFired(Timer<SMILTimeContainer>*);
void startTimer(SMILTime fireTime, SMILTime minimumDelay = 0);
- void updateAnimations(SMILTime elapsed, double nextManualSampleTime = 0, const String& nextSamplingTarget = String());
+ void updateAnimations(SMILTime elapsed);
void updateDocumentOrderIndexes();
void sortByPriority(Vector<SVGSMILElement*>& smilElements, SMILTime elapsed);
diff --git a/Source/WebCore/svg/animation/SVGSMILElement.cpp b/Source/WebCore/svg/animation/SVGSMILElement.cpp
index 790e27d81..dda170bf9 100644
--- a/Source/WebCore/svg/animation/SVGSMILElement.cpp
+++ b/Source/WebCore/svg/animation/SVGSMILElement.cpp
@@ -134,7 +134,7 @@ SVGSMILElement::SVGSMILElement(const QualifiedName& tagName, Document* doc)
, m_cachedMin(invalidCachedTime)
, m_cachedMax(invalidCachedTime)
{
- reset();
+ resolveFirstInterval();
}
SVGSMILElement::~SVGSMILElement()
@@ -168,6 +168,14 @@ static inline QualifiedName constructQualifiedName(const SVGElement* svgElement,
return QualifiedName(nullAtom, localName, namespaceURI);
}
+static inline void clearTimesWithDynamicOrigins(Vector<SMILTimeWithOrigin>& timeList)
+{
+ for (int i = timeList.size() - 1; i >= 0; --i) {
+ if (timeList[i].originIsScript())
+ timeList.remove(i);
+ }
+}
+
void SVGSMILElement::reset()
{
m_activeState = Inactive;
@@ -178,7 +186,6 @@ void SVGSMILElement::reset()
m_lastPercent = 0;
m_lastRepeat = 0;
m_nextProgressTime = 0;
-
resolveFirstInterval();
}
@@ -200,7 +207,7 @@ void SVGSMILElement::insertedIntoDocument()
// "If no attribute is present, the default begin value (an offset-value of 0) must be evaluated."
if (!fastHasAttribute(SVGNames::beginAttr))
- m_beginTimes.append(0);
+ m_beginTimes.append(SMILTimeWithOrigin());
if (m_isWaitingForFirstInterval) {
resolveFirstInterval();
@@ -282,7 +289,7 @@ SMILTime SVGSMILElement::parseClockValue(const String& data)
return result;
}
-static void sortTimeList(Vector<SMILTime>& timeList)
+static void sortTimeList(Vector<SMILTimeWithOrigin>& timeList)
{
std::sort(timeList.begin(), timeList.end());
}
@@ -364,12 +371,12 @@ bool SVGSMILElement::isSMILElement(Node* node)
void SVGSMILElement::parseBeginOrEnd(const String& parseString, BeginOrEnd beginOrEnd)
{
- Vector<SMILTime>& timeList = beginOrEnd == Begin ? m_beginTimes : m_endTimes;
+ Vector<SMILTimeWithOrigin>& timeList = beginOrEnd == Begin ? m_beginTimes : m_endTimes;
if (beginOrEnd == End)
m_hasEndEventConditions = false;
HashSet<double> existing;
for (unsigned n = 0; n < timeList.size(); ++n)
- existing.add(timeList[n].value());
+ existing.add(timeList[n].time().value());
Vector<String> splitString;
parseString.split(';', splitString);
for (unsigned n = 0; n < splitString.size(); ++n) {
@@ -377,7 +384,7 @@ void SVGSMILElement::parseBeginOrEnd(const String& parseString, BeginOrEnd begin
if (value.isUnresolved())
parseCondition(splitString[n], beginOrEnd);
else if (!existing.contains(value.value()))
- timeList.append(value);
+ timeList.append(SMILTimeWithOrigin(value, SMILTimeWithOrigin::ParserOrigin));
}
sortTimeList(timeList);
}
@@ -513,17 +520,32 @@ SVGElement* SVGSMILElement::targetElement()
ContainerNode* target = href.isEmpty() ? parentNode() : SVGURIReference::targetElementFromIRIString(href, document());
if (!target || !target->isSVGElement())
return 0;
-
+
m_targetElement = static_cast<SVGElement*>(target);
document()->accessSVGExtensions()->addAnimationElementToTarget(this, m_targetElement);
+
+ targetElementDidChange(m_targetElement);
+
return m_targetElement;
}
-SMILTime SVGSMILElement::elapsed() const
+void SVGSMILElement::resetTargetElement()
+{
+ m_targetElement = 0;
+
+ // Force the animation to recompute values that are only calculated when an animation becomes active.
+ // Failing to do this means that a target reset and change during active animation may result in
+ // invalid state.
+ m_activeState = Inactive;
+
+ targetElementDidChange(0);
+}
+
+SMILTime SVGSMILElement::elapsed() const
{
return m_timeContainer ? m_timeContainer->elapsed() : 0;
-}
-
+}
+
bool SVGSMILElement::isInactive() const
{
return m_activeState == Inactive;
@@ -616,67 +638,67 @@ SMILTime SVGSMILElement::simpleDuration() const
{
return min(dur(), SMILTime::indefinite());
}
-
-void SVGSMILElement::addBeginTime(SMILTime eventTime, SMILTime beginTime)
+
+void SVGSMILElement::addBeginTime(SMILTime eventTime, SMILTime beginTime, SMILTimeWithOrigin::Origin origin)
{
- m_beginTimes.append(beginTime);
+ m_beginTimes.append(SMILTimeWithOrigin(beginTime, origin));
sortTimeList(m_beginTimes);
beginListChanged(eventTime);
}
-
-void SVGSMILElement::addEndTime(SMILTime eventTime, SMILTime endTime)
+
+void SVGSMILElement::addEndTime(SMILTime eventTime, SMILTime endTime, SMILTimeWithOrigin::Origin origin)
{
- m_endTimes.append(endTime);
+ m_endTimes.append(SMILTimeWithOrigin(endTime, origin));
sortTimeList(m_endTimes);
endListChanged(eventTime);
}
-
-inline SMILTime extractTimeFromVector(const SMILTime* position)
+
+inline SMILTime extractTimeFromVector(const SMILTimeWithOrigin* position)
{
- return *position;
+ return position->time();
}
SMILTime SVGSMILElement::findInstanceTime(BeginOrEnd beginOrEnd, SMILTime minimumTime, bool equalsMinimumOK) const
{
- const Vector<SMILTime>& list = beginOrEnd == Begin ? m_beginTimes : m_endTimes;
+ const Vector<SMILTimeWithOrigin>& list = beginOrEnd == Begin ? m_beginTimes : m_endTimes;
int sizeOfList = list.size();
if (!sizeOfList)
return beginOrEnd == Begin ? SMILTime::unresolved() : SMILTime::indefinite();
- const SMILTime* result = binarySearch<const SMILTime, SMILTime, extractTimeFromVector>(list.begin(), sizeOfList, minimumTime, WTF::KeyMustNotBePresentInArray);
+ const SMILTimeWithOrigin* result = binarySearch<const SMILTimeWithOrigin, SMILTime, extractTimeFromVector>(list.begin(), sizeOfList, minimumTime, WTF::KeyMustNotBePresentInArray);
int indexOfResult = result - list.begin();
-
- if (sizeOfList - 1 > indexOfResult && list[indexOfResult] < minimumTime)
+ if (sizeOfList - 1 > indexOfResult && list[indexOfResult].time() < minimumTime)
++indexOfResult;
ASSERT(indexOfResult < sizeOfList);
+ const SMILTime& currentTime = list[indexOfResult].time();
// "The special value "indefinite" does not yield an instance time in the begin list."
- if (list[indexOfResult].isIndefinite() && beginOrEnd == Begin)
+ if (currentTime.isIndefinite() && beginOrEnd == Begin)
return SMILTime::unresolved();
- if (list[indexOfResult] < minimumTime)
+ if (currentTime < minimumTime)
return beginOrEnd == Begin ? SMILTime::unresolved() : SMILTime::indefinite();
// If the equals is NOT accepted, we have to find a bigger one.
- if (list[indexOfResult] == minimumTime && !equalsMinimumOK) {
+ if (currentTime == minimumTime && !equalsMinimumOK) {
if (indexOfResult + 1 >= sizeOfList)
return beginOrEnd == Begin ? SMILTime::unresolved() : SMILTime::indefinite();
}
- while (indexOfResult < sizeOfList - 1 && list[indexOfResult] == list[indexOfResult + 1])
+ while (indexOfResult < sizeOfList - 1 && currentTime == list[indexOfResult + 1].time())
++indexOfResult;
- if (list[indexOfResult] > minimumTime)
- return list[indexOfResult];
- if (list[indexOfResult] == minimumTime) {
+ if (currentTime > minimumTime)
+ return currentTime;
+ if (currentTime == minimumTime) {
if (indexOfResult + 1 < sizeOfList - 1)
- return list[indexOfResult + 1];
+ return list[indexOfResult + 1].time();
return beginOrEnd == Begin ? SMILTime::unresolved() : SMILTime::indefinite();
}
- return list[indexOfResult];
+ return currentTime;
}
SMILTime SVGSMILElement::repeatingDuration() const
@@ -1041,7 +1063,13 @@ void SVGSMILElement::beginByLinkActivation()
SMILTime elapsed = this->elapsed();
addBeginTime(elapsed, elapsed);
}
-
+
+void SVGSMILElement::endedActiveInterval()
+{
+ clearTimesWithDynamicOrigins(m_beginTimes);
+ clearTimesWithDynamicOrigins(m_endTimes);
+}
+
}
#endif
diff --git a/Source/WebCore/svg/animation/SVGSMILElement.h b/Source/WebCore/svg/animation/SVGSMILElement.h
index 334f97573..9e1dfd014 100644
--- a/Source/WebCore/svg/animation/SVGSMILElement.h
+++ b/Source/WebCore/svg/animation/SVGSMILElement.h
@@ -54,7 +54,7 @@ public:
SMILTimeContainer* timeContainer() const { return m_timeContainer.get(); }
SVGElement* targetElement();
- void resetTargetElement() { m_targetElement = 0; }
+ void resetTargetElement();
const QualifiedName& attributeName() const { return m_attributeName; }
void beginByLinkActivation();
@@ -109,15 +109,18 @@ public:
virtual void applyResultsToTarget() = 0;
protected:
- void addBeginTime(SMILTime eventTime, SMILTime endTime);
- void addEndTime(SMILTime eventTime, SMILTime endTime);
+ void addBeginTime(SMILTime eventTime, SMILTime endTime, SMILTimeWithOrigin::Origin = SMILTimeWithOrigin::ParserOrigin);
+ void addEndTime(SMILTime eventTime, SMILTime endTime, SMILTimeWithOrigin::Origin = SMILTimeWithOrigin::ParserOrigin);
void setInactive() { m_activeState = Inactive; }
+ // Sub-classes may need to take action when the target is changed.
+ virtual void targetElementDidChange(SVGElement*) { }
+
private:
virtual void startedActiveInterval() = 0;
virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) = 0;
- virtual void endedActiveInterval() = 0;
+ void endedActiveInterval();
enum BeginOrEnd {
Begin,
@@ -199,8 +202,8 @@ private:
TimeDependentSet m_timeDependents;
// Instance time lists
- Vector<SMILTime> m_beginTimes;
- Vector<SMILTime> m_endTimes;
+ Vector<SMILTimeWithOrigin> m_beginTimes;
+ Vector<SMILTimeWithOrigin> m_endTimes;
// This is the upcoming or current interval
SMILTime m_intervalBegin;
@@ -230,4 +233,3 @@ private:
#endif // ENABLE(SVG)
#endif // SVGSMILElement_h
-
diff --git a/Source/WebCore/svg/graphics/SVGImage.cpp b/Source/WebCore/svg/graphics/SVGImage.cpp
index bbcc91b52..7e1ce2854 100644
--- a/Source/WebCore/svg/graphics/SVGImage.cpp
+++ b/Source/WebCore/svg/graphics/SVGImage.cpp
@@ -337,12 +337,6 @@ bool SVGImage::dataChanged(bool allDataReceived)
#endif
static InspectorClient* dummyInspectorClient = new EmptyInspectorClient;
pageClients.inspectorClient = dummyInspectorClient;
-#if ENABLE(DEVICE_ORIENTATION)
- static DeviceMotionClient* dummyDeviceMotionClient = new EmptyDeviceMotionClient;
- pageClients.deviceMotionClient = dummyDeviceMotionClient;
- static DeviceOrientationClient* dummyDeviceOrientationClient = new EmptyDeviceOrientationClient;
- pageClients.deviceOrientationClient = dummyDeviceOrientationClient;
-#endif
// FIXME: If this SVG ends up loading itself, we might leak the world.
// The Cache code does not know about CachedImages holding Frames and
diff --git a/Source/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h b/Source/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h
index e6bd013eb..6e4c4879d 100644
--- a/Source/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h
+++ b/Source/WebCore/svg/properties/SVGAnimatedPropertySynchronizer.h
@@ -37,15 +37,14 @@ struct SVGAnimatedPropertySynchronizer<true> {
// Attribute directly to avoid a call to Element::attributeChanged
// that could cause the SVGElement to erroneously reset its properties.
// svg/dom/SVGStringList-basics.xhtml exercises this behavior.
- NamedNodeMap* namedAttrMap = ownerElement->ensureUpdatedAttributes();
- Attribute* old = namedAttrMap->getAttributeItem(attrName);
+ ElementAttributeData* attributeData = ownerElement->ensureUpdatedAttributeData();
+ Attribute* old = attributeData->getAttributeItem(attrName);
if (old && value.isNull())
- namedAttrMap->removeAttribute(old->name());
+ attributeData->removeAttribute(old->name(), ownerElement);
else if (!old && !value.isNull())
- namedAttrMap->addAttribute(ownerElement->createAttribute(attrName, value));
+ attributeData->addAttribute(Attribute::create(attrName, value), ownerElement);
else if (old && !value.isNull())
old->setValue(value);
-
}
};
diff --git a/Source/WebCore/svg/svgtags.in b/Source/WebCore/svg/svgtags.in
index e12a5542f..9c6422962 100644
--- a/Source/WebCore/svg/svgtags.in
+++ b/Source/WebCore/svg/svgtags.in
@@ -11,7 +11,7 @@ altGlyphItem
#endif
animate
animateColor
-animateMotion JSInterfaceName=SVGElement
+animateMotion
animateTransform
set
circle
@@ -64,7 +64,7 @@ g
#if ENABLE_SVG_FONTS
glyph
glyphRef
-hkern interfaceName=SVGHKernElement, JSInterfaceName=SVGElement
+hkern interfaceName=SVGHKernElement
#endif
image
line
@@ -75,7 +75,7 @@ metadata
#if ENABLE_SVG_FONTS
missing_glyph
#endif
-mpath interfaceName=SVGMPathElement, JSInterfaceName=SVGElement
+mpath interfaceName=SVGMPathElement
path
pattern
polygon