[SVG2] Merge SVGStyledElement and SVGElement
https://bugs.webkit.org/show_bug.cgi?id=107386

Reviewed by Andreas Kling.

Source/WebCore:

Merge SVGStyledElement into SVGElement to simplify the SVG inheritance
model and match the SVG2 specification:
https://svgwg.org/svg2-draft/single-page.html#types-InterfaceSVGElement

Test: svg/dom/svg2-inheritance.html

* CMakeLists.txt:
* DerivedSources.cpp:
* DerivedSources.make:
* DerivedSources.pri:
* GNUmakefile.list.am:
* Target.pri:
* WebCore.order:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::alternativeText):
(WebCore::AccessibilityNodeObject::accessibilityDescription):
* css/SVGCSSStyleSelector.cpp:
* rendering/style/SVGRenderStyle.cpp:
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::RenderSVGContainer):
* rendering/svg/RenderSVGContainer.h:
* rendering/svg/RenderSVGHiddenContainer.cpp:
(WebCore::RenderSVGHiddenContainer::RenderSVGHiddenContainer):
* rendering/svg/RenderSVGHiddenContainer.h:
* rendering/svg/RenderSVGModelObject.cpp:
(WebCore::RenderSVGModelObject::RenderSVGModelObject):
(WebCore::getElementCTM):
* rendering/svg/RenderSVGModelObject.h:
* rendering/svg/RenderSVGResourceClipper.cpp:
(WebCore::RenderSVGResourceClipper::drawContentIntoMaskImage):
(WebCore::RenderSVGResourceClipper::calculateClipContentRepaintRect):
(WebCore::RenderSVGResourceClipper::hitTestClipContent):
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::RenderSVGResourceContainer):
* rendering/svg/RenderSVGResourceContainer.h:
* rendering/svg/RenderSVGResourceFilter.cpp:
* rendering/svg/RenderSVGResourceFilterPrimitive.h:
* rendering/svg/RenderSVGResourceMarker.cpp:
* rendering/svg/RenderSVGResourceMarker.h:
* rendering/svg/RenderSVGResourceMasker.cpp:
(WebCore::RenderSVGResourceMasker::drawContentIntoMaskImage):
(WebCore::RenderSVGResourceMasker::calculateMaskContentRepaintRect):
* rendering/svg/RenderSVGResourcePattern.cpp:
(WebCore::RenderSVGResourcePattern::createTileImage):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::RenderSVGRoot):
* rendering/svg/RenderSVGRoot.h:
* rendering/svg/RenderSVGViewportContainer.cpp:
(WebCore::RenderSVGViewportContainer::RenderSVGViewportContainer):
* rendering/svg/RenderSVGViewportContainer.h:
* rendering/svg/SVGRenderSupport.cpp:
(WebCore::SVGRenderSupport::layoutChildren):
* rendering/svg/SVGRenderTreeAsText.cpp:
* rendering/svg/SVGResources.cpp:
(WebCore::registerPendingResource):
* rendering/svg/SVGResourcesCache.cpp:
* svg/SVGAElement.cpp:
(WebCore::SVGAElement::title):
* svg/SVGAllInOne.cpp:
* svg/SVGAltGlyphDefElement.h:
* svg/SVGAltGlyphItemElement.h:
* svg/SVGAnimateElement.cpp:
* svg/SVGAnimatedType.cpp:
(WebCore::SVGAnimatedType::valueAsString):
(WebCore::SVGAnimatedType::setValueAsString):
* svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::isTargetAttributeCSSProperty):
(WebCore::SVGAnimationElement::computeCSSPropertyValue):
(WebCore::SVGAnimationElement::adjustForInheritance):
(WebCore::inheritsFromProperty):
* svg/SVGComponentTransferFunctionElement.h:
* svg/SVGCursorElement.h:
* svg/SVGDescElement.cpp:
(WebCore::SVGDescElement::SVGDescElement):
* svg/SVGDescElement.h:
* svg/SVGDescElement.idl:
* svg/SVGElement.cpp:
(WebCore::mapAttributeToCSSProperty):
(WebCore::cssPropertyToTypeMap):
(WebCore::SVGElement::SVGElement):
(WebCore::SVGElement::~SVGElement):
(WebCore::SVGElement::removedFrom):
(WebCore::SVGElement::parseAttribute):
(WebCore::SVGElement::animatedPropertyTypeForAttribute):
(WebCore::collectInstancesForSVGElement):
(WebCore::SVGElement::isAnimatableAttribute):
(WebCore::SVGElement::title):
(WebCore::SVGElement::rendererIsNeeded):
(WebCore::SVGElement::cssPropertyIdForSVGAttributeName):
(WebCore::SVGElement::isAnimatableCSSProperty):
(WebCore::SVGElement::isPresentationAttribute):
(WebCore::SVGElement::collectStyleForPresentationAttribute):
(WebCore::SVGElement::isKnownAttribute):
(WebCore::SVGElement::svgAttributeChanged):
(WebCore::SVGElement::insertedInto):
(WebCore::SVGElement::buildPendingResourcesIfNeeded):
(WebCore::SVGElement::childrenChanged):
(WebCore::SVGElement::getPresentationAttribute):
(WebCore::SVGElement::instanceUpdatesBlocked):
(WebCore::SVGElement::setInstanceUpdatesBlocked):
(WebCore::SVGElement::localCoordinateSpaceTransform):
(WebCore::SVGElement::updateRelativeLengthsInformation):
(WebCore::SVGElement::isMouseFocusable):
(WebCore::SVGElement::isKeyboardFocusable):
* svg/SVGElement.h:
(WebCore::SVGElement::supportsMarkers):
(WebCore::SVGElement::hasRelativeLengths):
(WebCore::SVGElement::needsPendingResourceHandling):
(WebCore::SVGElement::selfHasRelativeLengths):
(WebCore::SVGElement::updateRelativeLengthsInformation):
* svg/SVGElement.idl:
* svg/SVGElementInstance.cpp:
(WebCore::SVGElementInstance::invalidateAllInstancesOfElement):
(WebCore::SVGElementInstance::InstanceUpdateBlocker::InstanceUpdateBlocker):
* svg/SVGElementInstance.h:
* svg/SVGFEBlendElement.idl:
* svg/SVGFEColorMatrixElement.idl:
* svg/SVGFEComponentTransferElement.idl:
* svg/SVGFECompositeElement.idl:
* svg/SVGFEConvolveMatrixElement.idl:
* svg/SVGFEDiffuseLightingElement.idl:
* svg/SVGFEDisplacementMapElement.idl:
* svg/SVGFEDropShadowElement.idl:
* svg/SVGFEFloodElement.idl:
* svg/SVGFEGaussianBlurElement.idl:
* svg/SVGFEImageElement.idl:
* svg/SVGFELightElement.h:
* svg/SVGFEMergeElement.idl:
* svg/SVGFEMergeNodeElement.h:
* svg/SVGFEMorphologyElement.idl:
* svg/SVGFEOffsetElement.idl:
* svg/SVGFESpecularLightingElement.idl:
* svg/SVGFETileElement.idl:
* svg/SVGFETurbulenceElement.idl:
* svg/SVGFilterElement.cpp:
(WebCore::SVGFilterElement::SVGFilterElement):
(WebCore::SVGFilterElement::parseAttribute):
(WebCore::SVGFilterElement::svgAttributeChanged):
(WebCore::SVGFilterElement::childrenChanged):
* svg/SVGFilterElement.h:
* svg/SVGFilterElement.idl:
* svg/SVGFilterPrimitiveStandardAttributes.cpp:
(WebCore::SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes):
(WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute):
(WebCore::SVGFilterPrimitiveStandardAttributes::svgAttributeChanged):
(WebCore::SVGFilterPrimitiveStandardAttributes::childrenChanged):
(WebCore::SVGFilterPrimitiveStandardAttributes::rendererIsNeeded):
* svg/SVGFilterPrimitiveStandardAttributes.h:
* svg/SVGFontElement.cpp:
(WebCore::SVGFontElement::SVGFontElement):
* svg/SVGFontElement.h:
* svg/SVGFontFaceElement.cpp:
* svg/SVGFontFaceElement.h:
* svg/SVGFontFaceFormatElement.h:
* svg/SVGFontFaceNameElement.h:
* svg/SVGFontFaceSrcElement.h:
* svg/SVGFontFaceUriElement.h:
* svg/SVGGElement.cpp:
(WebCore::SVGGElement::rendererIsNeeded):
* svg/SVGGlyphElement.cpp:
(WebCore::SVGGlyphElement::SVGGlyphElement):
(WebCore::SVGGlyphElement::parseAttribute):
(WebCore::SVGGlyphElement::insertedInto):
(WebCore::SVGGlyphElement::removedFrom):
* svg/SVGGlyphElement.h:
* svg/SVGGlyphRefElement.cpp:
(WebCore::SVGGlyphRefElement::SVGGlyphRefElement):
(WebCore::SVGGlyphRefElement::parseAttribute):
* svg/SVGGlyphRefElement.h:
* svg/SVGGlyphRefElement.idl:
* svg/SVGGradientElement.cpp:
(WebCore::SVGGradientElement::SVGGradientElement):
(WebCore::SVGGradientElement::parseAttribute):
(WebCore::SVGGradientElement::svgAttributeChanged):
(WebCore::SVGGradientElement::childrenChanged):
* svg/SVGGradientElement.h:
* svg/SVGGradientElement.idl:
* svg/SVGGraphicsElement.cpp:
(WebCore::SVGGraphicsElement::SVGGraphicsElement):
(WebCore::SVGGraphicsElement::parseAttribute):
(WebCore::SVGGraphicsElement::svgAttributeChanged):
* svg/SVGGraphicsElement.h:
* svg/SVGGraphicsElement.idl:
* svg/SVGLocatable.cpp:
(WebCore::SVGLocatable::computeCTM):
* svg/SVGMPathElement.h:
* svg/SVGMarkerElement.cpp:
(WebCore::SVGMarkerElement::SVGMarkerElement):
(WebCore::SVGMarkerElement::parseAttribute):
(WebCore::SVGMarkerElement::svgAttributeChanged):
(WebCore::SVGMarkerElement::childrenChanged):
* svg/SVGMarkerElement.h:
* svg/SVGMarkerElement.idl:
* svg/SVGMaskElement.cpp:
(WebCore::SVGMaskElement::SVGMaskElement):
(WebCore::SVGMaskElement::parseAttribute):
(WebCore::SVGMaskElement::svgAttributeChanged):
(WebCore::SVGMaskElement::childrenChanged):
* svg/SVGMaskElement.h:
* svg/SVGMaskElement.idl:
* svg/SVGMetadataElement.h:
* svg/SVGMissingGlyphElement.cpp:
(WebCore::SVGMissingGlyphElement::SVGMissingGlyphElement):
* svg/SVGMissingGlyphElement.h:
* svg/SVGMissingGlyphElement.idl:
* svg/SVGPatternElement.cpp:
(WebCore::SVGPatternElement::SVGPatternElement):
(WebCore::SVGPatternElement::parseAttribute):
(WebCore::SVGPatternElement::svgAttributeChanged):
(WebCore::SVGPatternElement::childrenChanged):
* svg/SVGPatternElement.h:
* svg/SVGPatternElement.idl:
* svg/SVGScriptElement.h:
* svg/SVGStopElement.cpp:
(WebCore::SVGStopElement::SVGStopElement):
(WebCore::SVGStopElement::parseAttribute):
(WebCore::SVGStopElement::svgAttributeChanged):
* svg/SVGStopElement.h:
* svg/SVGStopElement.idl:
* svg/SVGStyleElement.h:
* svg/SVGStyledElement.cpp: Removed.
* svg/SVGStyledElement.h: Removed.
* svg/SVGStyledElement.idl: Removed.
* svg/SVGSymbolElement.cpp:
(WebCore::SVGSymbolElement::SVGSymbolElement):
(WebCore::SVGSymbolElement::parseAttribute):
(WebCore::SVGSymbolElement::svgAttributeChanged):
* svg/SVGSymbolElement.h:
* svg/SVGSymbolElement.idl:
* svg/SVGTRefElement.cpp:
(WebCore::SVGTRefElement::insertedInto):
(WebCore::SVGTRefElement::removedFrom):
* svg/SVGTitleElement.cpp:
(WebCore::SVGTitleElement::SVGTitleElement):
(WebCore::SVGTitleElement::insertedInto):
* svg/SVGTitleElement.h:
* svg/SVGTitleElement.idl:
* svg/SVGTransformable.cpp:
* svg/SVGUseElement.cpp:
(WebCore::SVGUseElement::selfHasRelativeLengths):
* svg/SVGViewElement.cpp:
(WebCore::SVGViewElement::SVGViewElement):
(WebCore::SVGViewElement::parseAttribute):
* svg/SVGViewElement.h:
* svg/animation/SVGSMILElement.h:
* svg/graphics/filters/SVGFEImage.cpp:
(WebCore::FEImage::platformApplySoftware):

LayoutTests:

Add layout test to validate the SVG2 inheritance model.

* svg/dom/svg2-inheritance-expected.txt: Added.
* svg/dom/svg2-inheritance.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154462 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/svg/SVGAElement.cpp b/Source/WebCore/svg/SVGAElement.cpp
index 784d560..d5ec6f6 100644
--- a/Source/WebCore/svg/SVGAElement.cpp
+++ b/Source/WebCore/svg/SVGAElement.cpp
@@ -83,7 +83,7 @@
         return title;
 
     // Otherwise, use the title of this element.
-    return SVGStyledElement::title();
+    return SVGElement::title();
 }
 
 bool SVGAElement::isSupportedAttribute(const QualifiedName& attrName)
diff --git a/Source/WebCore/svg/SVGAllInOne.cpp b/Source/WebCore/svg/SVGAllInOne.cpp
index a1c50e8..7b8185d 100644
--- a/Source/WebCore/svg/SVGAllInOne.cpp
+++ b/Source/WebCore/svg/SVGAllInOne.cpp
@@ -157,7 +157,6 @@
 #include "SVGStopElement.cpp"
 #include "SVGStringList.cpp"
 #include "SVGStyleElement.cpp"
-#include "SVGStyledElement.cpp"
 #include "SVGSwitchElement.cpp"
 #include "SVGSymbolElement.cpp"
 #include "SVGTRefElement.cpp"
diff --git a/Source/WebCore/svg/SVGAltGlyphDefElement.h b/Source/WebCore/svg/SVGAltGlyphDefElement.h
index ced3a10..0f409df 100644
--- a/Source/WebCore/svg/SVGAltGlyphDefElement.h
+++ b/Source/WebCore/svg/SVGAltGlyphDefElement.h
@@ -34,6 +34,8 @@
 
 private:
     SVGAltGlyphDefElement(const QualifiedName&, Document*);
+
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
 };
 
 }
diff --git a/Source/WebCore/svg/SVGAltGlyphItemElement.h b/Source/WebCore/svg/SVGAltGlyphItemElement.h
index 10dbab6..03c5a85 100644
--- a/Source/WebCore/svg/SVGAltGlyphItemElement.h
+++ b/Source/WebCore/svg/SVGAltGlyphItemElement.h
@@ -34,6 +34,8 @@
 
 private:
     SVGAltGlyphItemElement(const QualifiedName&, Document*);
+
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
 };
 
 }
diff --git a/Source/WebCore/svg/SVGAnimateElement.cpp b/Source/WebCore/svg/SVGAnimateElement.cpp
index dab7026..16595d1 100644
--- a/Source/WebCore/svg/SVGAnimateElement.cpp
+++ b/Source/WebCore/svg/SVGAnimateElement.cpp
@@ -30,8 +30,8 @@
 #include "QualifiedName.h"
 #include "RenderObject.h"
 #include "SVGAnimatorFactory.h"
+#include "SVGElement.h"
 #include "SVGNames.h"
-#include "SVGStyledElement.h"
 #include "StylePropertySet.h"
 
 namespace WebCore {
diff --git a/Source/WebCore/svg/SVGAnimatedType.cpp b/Source/WebCore/svg/SVGAnimatedType.cpp
index 33a18a7..b3fd7a0 100644
--- a/Source/WebCore/svg/SVGAnimatedType.cpp
+++ b/Source/WebCore/svg/SVGAnimatedType.cpp
@@ -251,7 +251,7 @@
         ASSERT(m_data.string);
         return *m_data.string;
 
-    // These types don't appear in the table in SVGStyledElement::cssPropertyToTypeMap() and thus don't need valueAsString() support.
+    // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need valueAsString() support.
     case AnimatedAngle:
     case AnimatedBoolean:
     case AnimatedEnumeration:
@@ -302,7 +302,7 @@
         *m_data.string = value;
         break;
 
-    // These types don't appear in the table in SVGStyledElement::cssPropertyToTypeMap() and thus don't need setValueAsString() support. 
+    // These types don't appear in the table in SVGElement::cssPropertyToTypeMap() and thus don't need setValueAsString() support. 
     case AnimatedAngle:
     case AnimatedBoolean:
     case AnimatedEnumeration:
diff --git a/Source/WebCore/svg/SVGAnimationElement.cpp b/Source/WebCore/svg/SVGAnimationElement.cpp
index f5de47a3..2d2d7eb 100644
--- a/Source/WebCore/svg/SVGAnimationElement.cpp
+++ b/Source/WebCore/svg/SVGAnimationElement.cpp
@@ -35,10 +35,10 @@
 #include "FloatConversion.h"
 #include "RenderObject.h"
 #include "SVGAnimateElement.h"
+#include "SVGElement.h"
 #include "SVGElementInstance.h"
 #include "SVGNames.h"
 #include "SVGParserUtilities.h"
-#include "SVGStyledElement.h"
 #include <wtf/MathExtras.h>
 
 namespace WebCore {
@@ -351,13 +351,9 @@
     return value == sum && animationMode() != ToAnimation;
 }
 
-bool SVGAnimationElement::isTargetAttributeCSSProperty(SVGElement* targetElement, const QualifiedName& attributeName)
+bool SVGAnimationElement::isTargetAttributeCSSProperty(SVGElement*, const QualifiedName& attributeName)
 {
-    ASSERT(targetElement);
-    if (!targetElement->isSVGStyledElement())
-        return false;
-
-    return SVGStyledElement::isAnimatableCSSProperty(attributeName);
+    return SVGElement::isAnimatableCSSProperty(attributeName);
 }
 
 SVGAnimationElement::ShouldApplyAnimation SVGAnimationElement::shouldApplyAnimation(SVGElement* targetElement, const QualifiedName& attributeName)
@@ -634,7 +630,6 @@
 void SVGAnimationElement::computeCSSPropertyValue(SVGElement* element, CSSPropertyID id, String& valueString)
 {
     ASSERT(element);
-    ASSERT(element->isSVGStyledElement());
 
     // Don't include any properties resulting from CSS Transitions/Animations or SMIL animations, as we want to retrieve the "base value".
     element->setUseOverrideComputedStyle(true);
@@ -654,19 +649,16 @@
         return;
 
     SVGElement* svgParent = toSVGElement(parent);
-    if (!svgParent->isSVGStyledElement())
-        return;
     computeCSSPropertyValue(svgParent, cssPropertyID(attributeName.localName()), value);
 }
 
-static bool inheritsFromProperty(SVGElement* targetElement, const QualifiedName& attributeName, const String& value)
+static bool inheritsFromProperty(SVGElement*, const QualifiedName& attributeName, const String& value)
 {
-    ASSERT(targetElement);
     DEFINE_STATIC_LOCAL(const AtomicString, inherit, ("inherit", AtomicString::ConstructFromLiteral));
     
-    if (value.isEmpty() || value != inherit || !targetElement->isSVGStyledElement())
+    if (value.isEmpty() || value != inherit)
         return false;
-    return SVGStyledElement::isAnimatableCSSProperty(attributeName);
+    return SVGElement::isAnimatableCSSProperty(attributeName);
 }
 
 void SVGAnimationElement::determinePropertyValueTypes(const String& from, const String& to)
diff --git a/Source/WebCore/svg/SVGComponentTransferFunctionElement.h b/Source/WebCore/svg/SVGComponentTransferFunctionElement.h
index 3ecb1f7..d5bf25f 100644
--- a/Source/WebCore/svg/SVGComponentTransferFunctionElement.h
+++ b/Source/WebCore/svg/SVGComponentTransferFunctionElement.h
@@ -80,6 +80,8 @@
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     virtual void svgAttributeChanged(const QualifiedName&);
+
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
     
 private:
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGComponentTransferFunctionElement)
diff --git a/Source/WebCore/svg/SVGCursorElement.h b/Source/WebCore/svg/SVGCursorElement.h
index a17ee36..8c5b3b3 100644
--- a/Source/WebCore/svg/SVGCursorElement.h
+++ b/Source/WebCore/svg/SVGCursorElement.h
@@ -54,6 +54,8 @@
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     virtual void svgAttributeChanged(const QualifiedName&);
 
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
+
     virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
 
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGCursorElement)
diff --git a/Source/WebCore/svg/SVGDescElement.cpp b/Source/WebCore/svg/SVGDescElement.cpp
index 200f748..dcebfb5 100644
--- a/Source/WebCore/svg/SVGDescElement.cpp
+++ b/Source/WebCore/svg/SVGDescElement.cpp
@@ -26,7 +26,7 @@
 namespace WebCore {
 
 inline SVGDescElement::SVGDescElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
 {
     ASSERT(hasTagName(SVGNames::descTag));
 }
diff --git a/Source/WebCore/svg/SVGDescElement.h b/Source/WebCore/svg/SVGDescElement.h
index 12fee82..8a5cc42 100644
--- a/Source/WebCore/svg/SVGDescElement.h
+++ b/Source/WebCore/svg/SVGDescElement.h
@@ -22,11 +22,11 @@
 #define SVGDescElement_h
 
 #if ENABLE(SVG)
-#include "SVGStyledElement.h"
+#include "SVGElement.h"
 
 namespace WebCore {
 
-class SVGDescElement FINAL : public SVGStyledElement {
+class SVGDescElement FINAL : public SVGElement {
 public:
     static PassRefPtr<SVGDescElement> create(const QualifiedName&, Document*);
 
diff --git a/Source/WebCore/svg/SVGDescElement.idl b/Source/WebCore/svg/SVGDescElement.idl
index 1346b47..db7b7d8 100644
--- a/Source/WebCore/svg/SVGDescElement.idl
+++ b/Source/WebCore/svg/SVGDescElement.idl
@@ -25,6 +25,6 @@
 
 [
     Conditional=SVG
-] interface SVGDescElement : SVGStyledElement {
+] interface SVGDescElement : SVGElement {
 };
 
diff --git a/Source/WebCore/svg/SVGElement.cpp b/Source/WebCore/svg/SVGElement.cpp
index 703af9e..541e48f 100644
--- a/Source/WebCore/svg/SVGElement.cpp
+++ b/Source/WebCore/svg/SVGElement.cpp
@@ -4,6 +4,7 @@
  * Copyright (C) 2008 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Alp Toker <alp@atoker.com>
  * Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
+ * Copyright (C) 2013 Samsung Electronics. 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
@@ -26,12 +27,20 @@
 #if ENABLE(SVG)
 #include "SVGElement.h"
 
+#include "Attr.h"
 #include "CSSCursorImageValue.h"
+#include "CSSParser.h"
 #include "DOMImplementation.h"
 #include "Document.h"
+#include "ElementTraversal.h"
 #include "Event.h"
+#include "EventNames.h"
 #include "HTMLNames.h"
 #include "RenderObject.h"
+#include "RenderSVGResource.h"
+#include "RenderSVGResourceClipper.h"
+#include "RenderSVGResourceFilter.h"
+#include "RenderSVGResourceMasker.h"
 #include "SVGCursorElement.h"
 #include "SVGDocumentExtensions.h"
 #include "SVGElementInstance.h"
@@ -39,19 +48,113 @@
 #include "SVGGraphicsElement.h"
 #include "SVGImageElement.h"
 #include "SVGNames.h"
+#include "SVGRenderStyle.h"
+#include "SVGRenderSupport.h"
 #include "SVGSVGElement.h"
+#include "SVGUseElement.h"
 #include "ScriptEventListener.h"
 #include "ShadowRoot.h"
 #include "XLinkNames.h"
 #include "XMLNames.h"
+#include <wtf/Assertions.h>
+#include <wtf/HashMap.h>
+#include <wtf/StdLibExtras.h>
+#include <wtf/text/WTFString.h>
+
 
 namespace WebCore {
 
+// Animated property definitions
+DEFINE_ANIMATED_STRING(SVGElement, HTMLNames::classAttr, ClassName, className)
+
+BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGElement)
+    REGISTER_LOCAL_ANIMATED_PROPERTY(className)
+END_REGISTER_ANIMATED_PROPERTIES
+
 using namespace HTMLNames;
+using namespace SVGNames;
+
+void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName)
+{
+    // FIXME: when CSS supports "transform-origin" the special case for transform_originAttr can be removed.
+    CSSPropertyID propertyId = cssPropertyID(attrName.localName());
+    if (!propertyId && attrName == transform_originAttr)
+        propertyId = CSSPropertyWebkitTransformOrigin; // cssPropertyID("-webkit-transform-origin")
+    ASSERT(propertyId > 0);
+    propertyNameToIdMap->set(attrName.localName().impl(), propertyId);
+}
+
+typedef HashMap<QualifiedName, AnimatedPropertyType> AttributeToPropertyTypeMap;
+static inline AttributeToPropertyTypeMap& cssPropertyToTypeMap()
+{
+    DEFINE_STATIC_LOCAL(AttributeToPropertyTypeMap, s_cssPropertyMap, ());
+
+    if (!s_cssPropertyMap.isEmpty())
+        return s_cssPropertyMap;
+
+    // Fill the map for the first use.
+    s_cssPropertyMap.set(alignment_baselineAttr, AnimatedString);
+    s_cssPropertyMap.set(baseline_shiftAttr, AnimatedString);
+    s_cssPropertyMap.set(buffered_renderingAttr, AnimatedString);
+    s_cssPropertyMap.set(clipAttr, AnimatedRect);
+    s_cssPropertyMap.set(clip_pathAttr, AnimatedString);
+    s_cssPropertyMap.set(clip_ruleAttr, AnimatedString);
+    s_cssPropertyMap.set(SVGNames::colorAttr, AnimatedColor);
+    s_cssPropertyMap.set(color_interpolationAttr, AnimatedString);
+    s_cssPropertyMap.set(color_interpolation_filtersAttr, AnimatedString);
+    s_cssPropertyMap.set(color_profileAttr, AnimatedString);
+    s_cssPropertyMap.set(color_renderingAttr, AnimatedString);
+    s_cssPropertyMap.set(cursorAttr, AnimatedString);
+    s_cssPropertyMap.set(displayAttr, AnimatedString);
+    s_cssPropertyMap.set(dominant_baselineAttr, AnimatedString);
+    s_cssPropertyMap.set(fillAttr, AnimatedColor);
+    s_cssPropertyMap.set(fill_opacityAttr, AnimatedNumber);
+    s_cssPropertyMap.set(fill_ruleAttr, AnimatedString);
+    s_cssPropertyMap.set(filterAttr, AnimatedString);
+    s_cssPropertyMap.set(flood_colorAttr, AnimatedColor);
+    s_cssPropertyMap.set(flood_opacityAttr, AnimatedNumber);
+    s_cssPropertyMap.set(font_familyAttr, AnimatedString);
+    s_cssPropertyMap.set(font_sizeAttr, AnimatedLength);
+    s_cssPropertyMap.set(font_stretchAttr, AnimatedString);
+    s_cssPropertyMap.set(font_styleAttr, AnimatedString);
+    s_cssPropertyMap.set(font_variantAttr, AnimatedString);
+    s_cssPropertyMap.set(font_weightAttr, AnimatedString);
+    s_cssPropertyMap.set(image_renderingAttr, AnimatedString);
+    s_cssPropertyMap.set(kerningAttr, AnimatedLength);
+    s_cssPropertyMap.set(letter_spacingAttr, AnimatedLength);
+    s_cssPropertyMap.set(lighting_colorAttr, AnimatedColor);
+    s_cssPropertyMap.set(marker_endAttr, AnimatedString);
+    s_cssPropertyMap.set(marker_midAttr, AnimatedString);
+    s_cssPropertyMap.set(marker_startAttr, AnimatedString);
+    s_cssPropertyMap.set(maskAttr, AnimatedString);
+    s_cssPropertyMap.set(mask_typeAttr, AnimatedString);
+    s_cssPropertyMap.set(opacityAttr, AnimatedNumber);
+    s_cssPropertyMap.set(overflowAttr, AnimatedString);
+    s_cssPropertyMap.set(pointer_eventsAttr, AnimatedString);
+    s_cssPropertyMap.set(shape_renderingAttr, AnimatedString);
+    s_cssPropertyMap.set(stop_colorAttr, AnimatedColor);
+    s_cssPropertyMap.set(stop_opacityAttr, AnimatedNumber);
+    s_cssPropertyMap.set(strokeAttr, AnimatedColor);
+    s_cssPropertyMap.set(stroke_dasharrayAttr, AnimatedLengthList);
+    s_cssPropertyMap.set(stroke_dashoffsetAttr, AnimatedLength);
+    s_cssPropertyMap.set(stroke_linecapAttr, AnimatedString);
+    s_cssPropertyMap.set(stroke_linejoinAttr, AnimatedString);
+    s_cssPropertyMap.set(stroke_miterlimitAttr, AnimatedNumber);
+    s_cssPropertyMap.set(stroke_opacityAttr, AnimatedNumber);
+    s_cssPropertyMap.set(stroke_widthAttr, AnimatedLength);
+    s_cssPropertyMap.set(text_anchorAttr, AnimatedString);
+    s_cssPropertyMap.set(text_decorationAttr, AnimatedString);
+    s_cssPropertyMap.set(text_renderingAttr, AnimatedString);
+    s_cssPropertyMap.set(vector_effectAttr, AnimatedString);
+    s_cssPropertyMap.set(visibilityAttr, AnimatedString);
+    s_cssPropertyMap.set(word_spacingAttr, AnimatedLength);
+    return s_cssPropertyMap;
+}
 
 SVGElement::SVGElement(const QualifiedName& tagName, Document* document)
     : StyledElement(tagName, document, CreateSVGElement)
 {
+    registerAnimatedPropertiesForSVGElement();
 }
 
 SVGElement::~SVGElement()
@@ -76,6 +179,11 @@
         it = rareDataMap.find(this);
         ASSERT(it != rareDataMap.end());
         rareDataMap.remove(it);
+
+        // Clear HasSVGRareData flag now so that we are in a consistent state when
+        // calling rebuildAllElementReferencesForTarget() and
+        // removeAllElementReferencesForTarget() below.
+        clearHasSVGRareData();
     }
     ASSERT(document());
     document()->accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);
@@ -174,6 +282,8 @@
 void SVGElement::removedFrom(ContainerNode* rootParent)
 {
     bool wasInDocument = rootParent->inDocument();
+    if (wasInDocument)
+        updateRelativeLengthsInformation(false, this);
 
     StyledElement::removedFrom(rootParent);
 
@@ -181,6 +291,7 @@
         document()->accessSVGExtensions()->rebuildAllElementReferencesForTarget(this);
         document()->accessSVGExtensions()->removeAllElementReferencesForTarget(this);
     }
+    SVGElementInstance::invalidateAllInstancesOfElement(this);
 }
 
 SVGSVGElement* SVGElement::ownerSVGElement() const
@@ -329,6 +440,8 @@
         setAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(this, name, value));
     else if (name == SVGNames::onactivateAttr)
         setAttributeEventListener(eventNames().DOMActivateEvent, createAttributeEventListener(this, name, value));
+    else if (name == HTMLNames::classAttr)
+        setClassNameBaseValue(value);
     else if (SVGLangSpace::parseAttribute(name, value)) {
     } else
         StyledElement::parseAttribute(name, value);
@@ -337,6 +450,13 @@
 void SVGElement::animatedPropertyTypeForAttribute(const QualifiedName& attributeName, Vector<AnimatedPropertyType>& propertyTypes)
 {
     localAttributeToPropertyMap().animatedPropertyTypeForAttribute(attributeName, propertyTypes);
+
+    if (!propertyTypes.isEmpty())
+        return;
+
+    AttributeToPropertyTypeMap& cssPropertyTypeMap = cssPropertyToTypeMap();
+    if (cssPropertyTypeMap.contains(attributeName))
+        propertyTypes.append(cssPropertyTypeMap.get(attributeName));
 }
 
 bool SVGElement::haveLoadedRequiredResources()
@@ -356,13 +476,9 @@
     if (element->containingShadowRoot())
         return;
 
-    if (!element->isSVGStyledElement())
-        return;
+    ASSERT(!element->instanceUpdatesBlocked());
 
-    SVGStyledElement* styledElement = toSVGStyledElement(element);
-    ASSERT(!styledElement->instanceUpdatesBlocked());
-
-    instances = styledElement->instancesForElement();
+    instances = element->instancesForElement();
 }
 
 bool SVGElement::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> prpListener, bool useCapture)
@@ -563,12 +679,6 @@
         nonConstThis->localAttributeToPropertyMap().synchronizeProperty(nonConstThis, name);
 }
 
-SVGAttributeToPropertyMap& SVGElement::localAttributeToPropertyMap()
-{
-    DEFINE_STATIC_LOCAL(SVGAttributeToPropertyMap, emptyMap, ());
-    return emptyMap;
-}
-
 void SVGElement::synchronizeRequiredFeatures(SVGElement* contextElement)
 {
     ASSERT(contextElement);
@@ -735,12 +845,312 @@
     }
 
     if (name == classAttr)
-        return isSVGStyledElement();
+        return true;
 
     return animatableAttributes.contains(name);
 }
 #endif
 
+String SVGElement::title() const
+{
+    // According to spec, we should not return titles when hovering over root <svg> elements (those
+    // <title> elements are the title of the document, not a tooltip) so we instantly return.
+    if (isOutermostSVGSVGElement())
+        return String();
+
+    // Walk up the tree, to find out whether we're inside a <use> shadow tree, to find the right title.
+    if (isInShadowTree()) {
+        Element* shadowHostElement = toShadowRoot(treeScope()->rootNode())->hostElement();
+        // At this time, SVG nodes are not allowed in non-<use> shadow trees, so any shadow root we do
+        // have should be a use. The assert and following test is here to catch future shadow DOM changes
+        // that do enable SVG in a shadow tree.
+        ASSERT(!shadowHostElement || shadowHostElement->hasTagName(SVGNames::useTag));
+        if (shadowHostElement && shadowHostElement->hasTagName(SVGNames::useTag)) {
+            SVGUseElement* useElement = toSVGUseElement(shadowHostElement);
+
+            // If the <use> title is not empty we found the title to use.
+            String useTitle(useElement->title());
+            if (!useTitle.isEmpty())
+                return useTitle;
+        }
+    }
+
+    // If we aren't an instance in a <use> or the <use> title was not found, then find the first
+    // <title> child of this element.
+    Element* titleElement = ElementTraversal::firstWithin(this);
+    for (; titleElement; titleElement = ElementTraversal::nextSibling(titleElement)) {
+        if (titleElement->hasTagName(SVGNames::titleTag) && titleElement->isSVGElement())
+            break;
+    }
+
+    // If a title child was found, return the text contents.
+    if (titleElement)
+        return titleElement->innerText();
+
+    // Otherwise return a null/empty string.
+    return String();
+}
+
+bool SVGElement::rendererIsNeeded(const RenderStyle& style)
+{
+    // http://www.w3.org/TR/SVG/extend.html#PrivateData
+    // Prevent anything other than SVG renderers from appearing in our render tree
+    // Spec: SVG allows inclusion of elements from foreign namespaces anywhere
+    // with the SVG content. In general, the SVG user agent will include the unknown
+    // elements in the DOM but will otherwise ignore unknown elements.
+    if (!parentOrShadowHostElement() || parentOrShadowHostElement()->isSVGElement())
+        return StyledElement::rendererIsNeeded(style);
+
+    return false;
+}
+
+CSSPropertyID SVGElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
+{
+    if (!attrName.namespaceURI().isNull())
+        return CSSPropertyInvalid;
+
+    static HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap = 0;
+    if (!propertyNameToIdMap) {
+        propertyNameToIdMap = new HashMap<AtomicStringImpl*, CSSPropertyID>;
+        // This is a list of all base CSS and SVG CSS properties which are exposed as SVG XML attributes
+        mapAttributeToCSSProperty(propertyNameToIdMap, alignment_baselineAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, baseline_shiftAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, buffered_renderingAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, clipAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, clip_pathAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, clip_ruleAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, SVGNames::colorAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, color_interpolationAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, color_interpolation_filtersAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, color_profileAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, color_renderingAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, cursorAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, SVGNames::directionAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, displayAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, dominant_baselineAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, enable_backgroundAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, fillAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, fill_opacityAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, fill_ruleAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, filterAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, flood_colorAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, flood_opacityAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, font_familyAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, font_sizeAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, font_stretchAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, font_styleAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, font_variantAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, font_weightAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, glyph_orientation_horizontalAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, glyph_orientation_verticalAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, image_renderingAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, kerningAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, letter_spacingAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, lighting_colorAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, marker_endAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, marker_midAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, marker_startAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, maskAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, mask_typeAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, opacityAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, overflowAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, pointer_eventsAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, shape_renderingAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, stop_colorAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, stop_opacityAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, strokeAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_dasharrayAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_dashoffsetAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_linecapAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_linejoinAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_miterlimitAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_opacityAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_widthAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, text_anchorAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, text_decorationAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, text_renderingAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, transform_originAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, unicode_bidiAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, vector_effectAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, visibilityAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, word_spacingAttr);
+        mapAttributeToCSSProperty(propertyNameToIdMap, writing_modeAttr);
+    }
+
+    return propertyNameToIdMap->get(attrName.localName().impl());
+}
+
+bool SVGElement::isAnimatableCSSProperty(const QualifiedName& attrName)
+{
+    return cssPropertyToTypeMap().contains(attrName);
+}
+
+bool SVGElement::isPresentationAttribute(const QualifiedName& name) const
+{
+    if (cssPropertyIdForSVGAttributeName(name) > 0)
+        return true;
+    return StyledElement::isPresentationAttribute(name);
+}
+
+void SVGElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
+{
+    CSSPropertyID propertyID = cssPropertyIdForSVGAttributeName(name);
+    if (propertyID > 0)
+        addPropertyToPresentationAttributeStyle(style, propertyID, value);
+}
+
+bool SVGElement::isKnownAttribute(const QualifiedName& attrName)
+{
+    return isIdAttributeName(attrName);
+}
+
+void SVGElement::svgAttributeChanged(const QualifiedName& attrName)
+{
+    CSSPropertyID propId = cssPropertyIdForSVGAttributeName(attrName);
+    if (propId > 0) {
+        SVGElementInstance::invalidateAllInstancesOfElement(this);
+        return;
+    }
+
+    if (attrName == HTMLNames::classAttr) {
+        classAttributeChanged(className());
+        SVGElementInstance::invalidateAllInstancesOfElement(this);
+        return;
+    }
+
+    if (isIdAttributeName(attrName)) {
+        RenderObject* object = renderer();
+        // Notify resources about id changes, this is important as we cache resources by id in SVGDocumentExtensions
+        if (object && object->isSVGResourceContainer())
+            object->toRenderSVGResourceContainer()->idChanged();
+        if (inDocument())
+            buildPendingResourcesIfNeeded();
+        SVGElementInstance::invalidateAllInstancesOfElement(this);
+        return;
+    }
+}
+
+Node::InsertionNotificationRequest SVGElement::insertedInto(ContainerNode* rootParent)
+{
+    StyledElement::insertedInto(rootParent);
+    updateRelativeLengthsInformation();
+    buildPendingResourcesIfNeeded();
+    return InsertionDone;
+}
+
+void SVGElement::buildPendingResourcesIfNeeded()
+{
+    Document* document = this->document();
+    if (!needsPendingResourceHandling() || !document || !inDocument() || isInShadowTree())
+        return;
+
+    SVGDocumentExtensions* extensions = document->accessSVGExtensions();
+    String resourceId = getIdAttribute();
+    if (!extensions->hasPendingResource(resourceId))
+        return;
+
+    // Mark pending resources as pending for removal.
+    extensions->markPendingResourcesForRemoval(resourceId);
+
+    // Rebuild pending resources for each client of a pending resource that is being removed.
+    while (Element* clientElement = extensions->removeElementFromPendingResourcesForRemoval(resourceId)) {
+        ASSERT(clientElement->hasPendingResources());
+        if (clientElement->hasPendingResources()) {
+            clientElement->buildPendingResource();
+            extensions->clearHasPendingResourcesIfPossible(clientElement);
+        }
+    }
+}
+
+void SVGElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
+{
+    StyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+
+    // Invalidate all SVGElementInstances associated with us
+    if (!changedByParser)
+        SVGElementInstance::invalidateAllInstancesOfElement(this);
+}
+
+PassRefPtr<CSSValue> SVGElement::getPresentationAttribute(const String& name)
+{
+    if (!hasAttributesWithoutUpdate())
+        return 0;
+
+    QualifiedName attributeName(nullAtom, name, nullAtom);
+    const Attribute* attribute = findAttributeByName(attributeName);
+    if (!attribute)
+        return 0;
+
+    RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(SVGAttributeMode);
+    CSSPropertyID propertyID = cssPropertyIdForSVGAttributeName(attribute->name());
+    style->setProperty(propertyID, attribute->value());
+    RefPtr<CSSValue> cssValue = style->getPropertyCSSValue(propertyID);
+    return cssValue ? cssValue->cloneForCSSOM() : 0;
+}
+
+bool SVGElement::instanceUpdatesBlocked() const
+{
+    return hasSVGRareData() && svgRareData()->instanceUpdatesBlocked();
+}
+
+void SVGElement::setInstanceUpdatesBlocked(bool value)
+{
+    if (hasSVGRareData())
+        svgRareData()->setInstanceUpdatesBlocked(value);
+}
+
+AffineTransform SVGElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const
+{
+    // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement)
+    return AffineTransform();
+}
+
+void SVGElement::updateRelativeLengthsInformation(bool hasRelativeLengths, SVGElement* element)
+{
+    // If we're not yet in a document, this function will be called again from insertedInto(). Do nothing now.
+    if (!inDocument())
+        return;
+
+    // An element wants to notify us that its own relative lengths state changed.
+    // Register it in the relative length map, and register us in the parent relative length map.
+    // Register the parent in the grandparents map, etc. Repeat procedure until the root of the SVG tree.
+
+    if (hasRelativeLengths)
+        m_elementsWithRelativeLengths.add(element);
+    else {
+        if (!m_elementsWithRelativeLengths.contains(element)) {
+            // We were never registered. Do nothing.
+            return;
+        }
+
+        m_elementsWithRelativeLengths.remove(element);
+    }
+
+    // Find first styled parent node, and notify it that we've changed our relative length state.
+    ContainerNode* node = parentNode();
+    while (node) {
+        if (!node->isSVGElement())
+            break;
+
+        // Register us in the parent element map.
+        toSVGElement(node)->updateRelativeLengthsInformation(hasRelativeLengths, this);
+        break;
+    }
+}
+
+bool SVGElement::isMouseFocusable() const
+{
+    if (!isFocusable())
+        return false;
+    Element* eventTarget = const_cast<SVGElement*>(this);
+    return eventTarget->hasEventListeners(eventNames().focusinEvent) || eventTarget->hasEventListeners(eventNames().focusoutEvent);
+}
+
+bool SVGElement::isKeyboardFocusable(KeyboardEvent*) const
+{
+    return isMouseFocusable();
+}
+
 }
 
 #endif // ENABLE(SVG)
diff --git a/Source/WebCore/svg/SVGElement.h b/Source/WebCore/svg/SVGElement.h
index 75e05f9..f833521 100644
--- a/Source/WebCore/svg/SVGElement.h
+++ b/Source/WebCore/svg/SVGElement.h
@@ -1,7 +1,8 @@
 /*
  * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org>
+ * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
  * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Samsung Electronics. 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
@@ -23,6 +24,8 @@
 #define SVGElement_h
 
 #if ENABLE(SVG)
+#include "CSSPropertyNames.h"
+#include "SVGAnimatedString.h"
 #include "SVGLangSpace.h"
 #include "SVGLocatable.h"
 #include "SVGParsingError.h"
@@ -30,11 +33,15 @@
 #include "StyledElement.h"
 #include "Timer.h"
 #include <wtf/HashMap.h>
+#include <wtf/HashSet.h>
+#include <wtf/PassRefPtr.h>
 
 namespace WebCore {
 
 class AffineTransform;
 class CSSCursorImageValue;
+class CSSStyleDeclaration;
+class CSSValue;
 class Document;
 class SVGAttributeToPropertyMap;
 class SVGCursorElement;
@@ -43,6 +50,8 @@
 class SVGElementRareData;
 class SVGSVGElement;
 
+void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName);
+
 class SVGElement : public StyledElement, public SVGLangSpace {
 public:
     bool isOutermostSVGSVGElement() const;
@@ -53,9 +62,19 @@
     SVGSVGElement* ownerSVGElement() const;
     SVGElement* viewportElement() const;
 
+    virtual String title() const OVERRIDE;
+    static bool isAnimatableCSSProperty(const QualifiedName&);
+    bool isKnownAttribute(const QualifiedName&);
+    PassRefPtr<CSSValue> getPresentationAttribute(const String& name);
+    virtual bool supportsMarkers() const { return false; }
+    bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); }
+    virtual bool needsPendingResourceHandling() const { return true; }
+    bool instanceUpdatesBlocked() const;
+    void setInstanceUpdatesBlocked(bool);
+    virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
+
     SVGDocumentExtensions* accessDocumentSVGExtensions();
 
-    virtual bool isSVGStyledElement() const { return false; }
     virtual bool isSVGGraphicsElement() const { return false; }
     virtual bool isSVGSVGElement() const { return false; }
     virtual bool isFilterEffect() const { return false; }
@@ -65,7 +84,7 @@
     // For SVGTests
     virtual bool isValid() const { return true; }
 
-    virtual void svgAttributeChanged(const QualifiedName&) { }
+    virtual void svgAttributeChanged(const QualifiedName&);
 
     virtual void animatedPropertyTypeForAttribute(const QualifiedName&, Vector<AnimatedPropertyType>&);
 
@@ -102,8 +121,6 @@
     virtual void synchronizeRequiredExtensions() { }
     virtual void synchronizeSystemLanguage() { }
 
-    virtual SVGAttributeToPropertyMap& localAttributeToPropertyMap();
-
 #ifndef NDEBUG
     bool isAnimatableAttribute(const QualifiedName&) const;
 #endif
@@ -125,6 +142,7 @@
     SVGElement(const QualifiedName&, Document*);
     virtual ~SVGElement();
 
+    virtual bool rendererIsNeeded(const RenderStyle&);
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
 
     virtual void finishParsingChildren();
@@ -137,6 +155,15 @@
     SVGElementRareData& ensureSVGRareData();
 
     void reportAttributeParsingError(SVGParsingError, const QualifiedName&, const AtomicString&);
+    static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName&);
+
+    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
+    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
+    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
+    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+    virtual bool selfHasRelativeLengths() const { return false; }
+    void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
+    void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGElement*);
 
 private:
     friend class SVGElementInstance;
@@ -149,13 +176,21 @@
     virtual RenderStyle* virtualComputedStyle(PseudoId pseudoElementSpecifier = NOPSEUDO) { return computedStyle(pseudoElementSpecifier); }
     virtual bool willRecalcStyle(Style::Change);
 
-    virtual bool rendererIsNeeded(const RenderStyle&) { return false; }
-
     virtual bool isSupported(StringImpl* feature, StringImpl* version) const;
 
     void mapInstanceToElement(SVGElementInstance*);
     void removeInstanceMapping(SVGElementInstance*);
 
+    void buildPendingResourcesIfNeeded();
+    virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE;
+    virtual bool isMouseFocusable() const OVERRIDE;
+
+    HashSet<SVGElement*> m_elementsWithRelativeLengths;
+
+    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGElement)
+        DECLARE_ANIMATED_STRING(ClassName, className)
+    END_DECLARE_ANIMATED_PROPERTIES
+
 };
 
 struct SVGAttributeHashTranslator {
diff --git a/Source/WebCore/svg/SVGElement.idl b/Source/WebCore/svg/SVGElement.idl
index ecef281..24f067b 100644
--- a/Source/WebCore/svg/SVGElement.idl
+++ b/Source/WebCore/svg/SVGElement.idl
@@ -30,5 +30,10 @@
 
     attribute DOMString xmllang;
     attribute DOMString xmlspace;
+
+    readonly attribute SVGAnimatedString className;
+    readonly attribute CSSStyleDeclaration style;
+
+    CSSValue getPresentationAttribute([Default=Undefined] optional DOMString name);
 };
 
diff --git a/Source/WebCore/svg/SVGElementInstance.cpp b/Source/WebCore/svg/SVGElementInstance.cpp
index c3c625b..89da2b9 100644
--- a/Source/WebCore/svg/SVGElementInstance.cpp
+++ b/Source/WebCore/svg/SVGElementInstance.cpp
@@ -185,7 +185,7 @@
     if (!element || !element->inDocument())
         return;
 
-    if (element->isSVGStyledElement() && toSVGStyledElement(element)->instanceUpdatesBlocked())
+    if (element->instanceUpdatesBlocked())
         return;
 
     const HashSet<SVGElementInstance*>& set = element->instancesForElement();
@@ -259,7 +259,7 @@
 }
 
 SVGElementInstance::InstanceUpdateBlocker::InstanceUpdateBlocker(SVGElement* targetElement)
-    : m_targetElement(targetElement->isSVGStyledElement() ? toSVGStyledElement(targetElement) : 0)
+    : m_targetElement(targetElement)
 {
     if (m_targetElement)
         m_targetElement->setInstanceUpdatesBlocked(true);
diff --git a/Source/WebCore/svg/SVGElementInstance.h b/Source/WebCore/svg/SVGElementInstance.h
index b30d35d..40b08ac 100644
--- a/Source/WebCore/svg/SVGElementInstance.h
+++ b/Source/WebCore/svg/SVGElementInstance.h
@@ -35,7 +35,7 @@
 class Document;
 class SVGElement;
 class SVGElementInstanceList;
-class SVGStyledElement;
+class SVGElement;
 class SVGUseElement;
 
 // SVGElementInstance mimics Node, but without providing all its functionality
@@ -91,7 +91,7 @@
         ~InstanceUpdateBlocker();
 
     private:
-        SVGStyledElement* m_targetElement;
+        SVGElement* m_targetElement;
     };
     
     static void invalidateAllInstancesOfElement(SVGElement*);
diff --git a/Source/WebCore/svg/SVGFEBlendElement.idl b/Source/WebCore/svg/SVGFEBlendElement.idl
index d70f297..48334e1 100644
--- a/Source/WebCore/svg/SVGFEBlendElement.idl
+++ b/Source/WebCore/svg/SVGFEBlendElement.idl
@@ -26,7 +26,7 @@
 [
     Conditional=SVG&FILTERS,
     DoNotCheckConstants
-] interface SVGFEBlendElement : SVGStyledElement {
+] interface SVGFEBlendElement : SVGElement {
     // Blend Mode Types
     const unsigned short SVG_FEBLEND_MODE_UNKNOWN  = 0;
     const unsigned short SVG_FEBLEND_MODE_NORMAL   = 1;
diff --git a/Source/WebCore/svg/SVGFEColorMatrixElement.idl b/Source/WebCore/svg/SVGFEColorMatrixElement.idl
index 656ee40..fe2de50 100644
--- a/Source/WebCore/svg/SVGFEColorMatrixElement.idl
+++ b/Source/WebCore/svg/SVGFEColorMatrixElement.idl
@@ -26,7 +26,7 @@
 [
     Conditional=SVG&FILTERS,
     DoNotCheckConstants
-] interface SVGFEColorMatrixElement : SVGStyledElement {
+] interface SVGFEColorMatrixElement : SVGElement {
     // Color Matrix Types
     const unsigned short SVG_FECOLORMATRIX_TYPE_UNKNOWN          = 0;
     const unsigned short SVG_FECOLORMATRIX_TYPE_MATRIX           = 1;
diff --git a/Source/WebCore/svg/SVGFEComponentTransferElement.idl b/Source/WebCore/svg/SVGFEComponentTransferElement.idl
index 5052549..84fe938 100644
--- a/Source/WebCore/svg/SVGFEComponentTransferElement.idl
+++ b/Source/WebCore/svg/SVGFEComponentTransferElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFEComponentTransferElement : SVGStyledElement {
+] interface SVGFEComponentTransferElement : SVGElement {
     readonly attribute SVGAnimatedString in1;
 };
 
diff --git a/Source/WebCore/svg/SVGFECompositeElement.idl b/Source/WebCore/svg/SVGFECompositeElement.idl
index a64cc47..8022698 100644
--- a/Source/WebCore/svg/SVGFECompositeElement.idl
+++ b/Source/WebCore/svg/SVGFECompositeElement.idl
@@ -26,7 +26,7 @@
 [
     Conditional=SVG&FILTERS,
     DoNotCheckConstants
-] interface SVGFECompositeElement : SVGStyledElement {
+] interface SVGFECompositeElement : SVGElement {
     // Composite Operators
     const unsigned short SVG_FECOMPOSITE_OPERATOR_UNKNOWN    = 0;
     const unsigned short SVG_FECOMPOSITE_OPERATOR_OVER       = 1;
diff --git a/Source/WebCore/svg/SVGFEConvolveMatrixElement.idl b/Source/WebCore/svg/SVGFEConvolveMatrixElement.idl
index fcd8c57..275582a 100644
--- a/Source/WebCore/svg/SVGFEConvolveMatrixElement.idl
+++ b/Source/WebCore/svg/SVGFEConvolveMatrixElement.idl
@@ -26,7 +26,7 @@
 [
     Conditional=SVG&FILTERS,
     DoNotCheckConstants
-] interface SVGFEConvolveMatrixElement : SVGStyledElement {
+] interface SVGFEConvolveMatrixElement : SVGElement {
     // Edge Mode Values
     const unsigned short SVG_EDGEMODE_UNKNOWN   = 0;
     const unsigned short SVG_EDGEMODE_DUPLICATE = 1;
diff --git a/Source/WebCore/svg/SVGFEDiffuseLightingElement.idl b/Source/WebCore/svg/SVGFEDiffuseLightingElement.idl
index c436669..f5d2ecc 100644
--- a/Source/WebCore/svg/SVGFEDiffuseLightingElement.idl
+++ b/Source/WebCore/svg/SVGFEDiffuseLightingElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFEDiffuseLightingElement : SVGStyledElement {
+] interface SVGFEDiffuseLightingElement : SVGElement {
     readonly attribute SVGAnimatedString in1;
     readonly attribute SVGAnimatedNumber surfaceScale;
     readonly attribute SVGAnimatedNumber diffuseConstant;
diff --git a/Source/WebCore/svg/SVGFEDisplacementMapElement.idl b/Source/WebCore/svg/SVGFEDisplacementMapElement.idl
index b8a0525..e9efab8 100644
--- a/Source/WebCore/svg/SVGFEDisplacementMapElement.idl
+++ b/Source/WebCore/svg/SVGFEDisplacementMapElement.idl
@@ -26,7 +26,7 @@
 [
     Conditional=SVG&FILTERS,
     DoNotCheckConstants
-] interface SVGFEDisplacementMapElement : SVGStyledElement {
+] interface SVGFEDisplacementMapElement : SVGElement {
     // Channel Selectors
     const unsigned short SVG_CHANNEL_UNKNOWN = 0;
     const unsigned short SVG_CHANNEL_R       = 1;
diff --git a/Source/WebCore/svg/SVGFEDropShadowElement.idl b/Source/WebCore/svg/SVGFEDropShadowElement.idl
index 6a5a96a..a531fe4 100644
--- a/Source/WebCore/svg/SVGFEDropShadowElement.idl
+++ b/Source/WebCore/svg/SVGFEDropShadowElement.idl
@@ -19,7 +19,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFEDropShadowElement : SVGStyledElement {
+] interface SVGFEDropShadowElement : SVGElement {
     readonly attribute SVGAnimatedString in1;
     readonly attribute SVGAnimatedNumber dx;
     readonly attribute SVGAnimatedNumber dy;
diff --git a/Source/WebCore/svg/SVGFEFloodElement.idl b/Source/WebCore/svg/SVGFEFloodElement.idl
index d408925..bd5abc8 100644
--- a/Source/WebCore/svg/SVGFEFloodElement.idl
+++ b/Source/WebCore/svg/SVGFEFloodElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFEFloodElement : SVGStyledElement {
+] interface SVGFEFloodElement : SVGElement {
 };
 
 SVGFEFloodElement implements SVGFilterPrimitiveStandardAttributes;
diff --git a/Source/WebCore/svg/SVGFEGaussianBlurElement.idl b/Source/WebCore/svg/SVGFEGaussianBlurElement.idl
index 88eb5d0..2a78e17 100644
--- a/Source/WebCore/svg/SVGFEGaussianBlurElement.idl
+++ b/Source/WebCore/svg/SVGFEGaussianBlurElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFEGaussianBlurElement : SVGStyledElement {
+] interface SVGFEGaussianBlurElement : SVGElement {
     readonly attribute SVGAnimatedString in1;
     readonly attribute SVGAnimatedNumber stdDeviationX;
     readonly attribute SVGAnimatedNumber stdDeviationY;
diff --git a/Source/WebCore/svg/SVGFEImageElement.idl b/Source/WebCore/svg/SVGFEImageElement.idl
index dc0d99b..0ac6055 100644
--- a/Source/WebCore/svg/SVGFEImageElement.idl
+++ b/Source/WebCore/svg/SVGFEImageElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFEImageElement : SVGStyledElement {
+] interface SVGFEImageElement : SVGElement {
     readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
 };
 
diff --git a/Source/WebCore/svg/SVGFELightElement.h b/Source/WebCore/svg/SVGFELightElement.h
index 755c652..833c240 100644
--- a/Source/WebCore/svg/SVGFELightElement.h
+++ b/Source/WebCore/svg/SVGFELightElement.h
@@ -38,6 +38,8 @@
 protected:
     SVGFELightElement(const QualifiedName&, Document*);
 
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
+
 private:
     bool isSupportedAttribute(const QualifiedName&);
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
diff --git a/Source/WebCore/svg/SVGFEMergeElement.idl b/Source/WebCore/svg/SVGFEMergeElement.idl
index ed25f7e..6a99009 100644
--- a/Source/WebCore/svg/SVGFEMergeElement.idl
+++ b/Source/WebCore/svg/SVGFEMergeElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFEMergeElement : SVGStyledElement {
+] interface SVGFEMergeElement : SVGElement {
 };
 
 SVGFEMergeElement implements SVGFilterPrimitiveStandardAttributes;
diff --git a/Source/WebCore/svg/SVGFEMergeNodeElement.h b/Source/WebCore/svg/SVGFEMergeNodeElement.h
index 50b9ba2..bd248f82 100644
--- a/Source/WebCore/svg/SVGFEMergeNodeElement.h
+++ b/Source/WebCore/svg/SVGFEMergeNodeElement.h
@@ -38,6 +38,8 @@
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     virtual void svgAttributeChanged(const QualifiedName&);
 
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
+
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGFEMergeNodeElement)
         DECLARE_ANIMATED_STRING(In1, in1)
     END_DECLARE_ANIMATED_PROPERTIES
diff --git a/Source/WebCore/svg/SVGFEMorphologyElement.idl b/Source/WebCore/svg/SVGFEMorphologyElement.idl
index ba6481c..ec4c423 100644
--- a/Source/WebCore/svg/SVGFEMorphologyElement.idl
+++ b/Source/WebCore/svg/SVGFEMorphologyElement.idl
@@ -26,7 +26,7 @@
 [
     Conditional=SVG&FILTERS,
     DoNotCheckConstants
-] interface SVGFEMorphologyElement : SVGStyledElement {
+] interface SVGFEMorphologyElement : SVGElement {
     // Morphology Operators
     const unsigned short SVG_MORPHOLOGY_OPERATOR_UNKNOWN  = 0;
     const unsigned short SVG_MORPHOLOGY_OPERATOR_ERODE    = 1;
diff --git a/Source/WebCore/svg/SVGFEOffsetElement.idl b/Source/WebCore/svg/SVGFEOffsetElement.idl
index 7a9f15a..eb95e74 100644
--- a/Source/WebCore/svg/SVGFEOffsetElement.idl
+++ b/Source/WebCore/svg/SVGFEOffsetElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFEOffsetElement : SVGStyledElement {
+] interface SVGFEOffsetElement : SVGElement {
     readonly attribute SVGAnimatedString in1;
     readonly attribute SVGAnimatedNumber dx;
     readonly attribute SVGAnimatedNumber dy;
diff --git a/Source/WebCore/svg/SVGFESpecularLightingElement.idl b/Source/WebCore/svg/SVGFESpecularLightingElement.idl
index 93ad773..0e4e9ee 100644
--- a/Source/WebCore/svg/SVGFESpecularLightingElement.idl
+++ b/Source/WebCore/svg/SVGFESpecularLightingElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFESpecularLightingElement : SVGStyledElement {
+] interface SVGFESpecularLightingElement : SVGElement {
     readonly attribute SVGAnimatedString in1;
     readonly attribute SVGAnimatedNumber surfaceScale;
     readonly attribute SVGAnimatedNumber specularConstant;
diff --git a/Source/WebCore/svg/SVGFETileElement.idl b/Source/WebCore/svg/SVGFETileElement.idl
index 251a548..5cae1a1 100644
--- a/Source/WebCore/svg/SVGFETileElement.idl
+++ b/Source/WebCore/svg/SVGFETileElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFETileElement : SVGStyledElement {
+] interface SVGFETileElement : SVGElement {
     readonly attribute SVGAnimatedString in1;
 };
 
diff --git a/Source/WebCore/svg/SVGFETurbulenceElement.idl b/Source/WebCore/svg/SVGFETurbulenceElement.idl
index 76d1913..0804fb5 100644
--- a/Source/WebCore/svg/SVGFETurbulenceElement.idl
+++ b/Source/WebCore/svg/SVGFETurbulenceElement.idl
@@ -26,7 +26,7 @@
 [
     Conditional=SVG&FILTERS,
     DoNotCheckConstants
-] interface SVGFETurbulenceElement : SVGStyledElement {
+] interface SVGFETurbulenceElement : SVGElement {
     // Turbulence Types
     const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN      = 0;
     const unsigned short SVG_TURBULENCE_TYPE_FRACTALNOISE = 1;
diff --git a/Source/WebCore/svg/SVGFilterElement.cpp b/Source/WebCore/svg/SVGFilterElement.cpp
index afd85b4..36e1923 100644
--- a/Source/WebCore/svg/SVGFilterElement.cpp
+++ b/Source/WebCore/svg/SVGFilterElement.cpp
@@ -63,7 +63,7 @@
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGFilterElement::SVGFilterElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
     , m_filterUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
     , m_primitiveUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
     , m_x(LengthModeWidth, "-10%")
@@ -126,7 +126,7 @@
     SVGParsingError parseError = NoError;
 
     if (!isSupportedAttribute(name))
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
     else if (name == SVGNames::filterUnitsAttr) {
         SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
         if (propertyValue > 0)
@@ -161,7 +161,7 @@
 void SVGFilterElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (!isSupportedAttribute(attrName)) {
-        SVGStyledElement::svgAttributeChanged(attrName);
+        SVGElement::svgAttributeChanged(attrName);
         return;
     }
 
@@ -179,7 +179,7 @@
 
 void SVGFilterElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
-    SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+    SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
 
     if (changedByParser)
         return;
diff --git a/Source/WebCore/svg/SVGFilterElement.h b/Source/WebCore/svg/SVGFilterElement.h
index 3351c60..bce6ea6 100644
--- a/Source/WebCore/svg/SVGFilterElement.h
+++ b/Source/WebCore/svg/SVGFilterElement.h
@@ -28,15 +28,15 @@
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedInteger.h"
 #include "SVGAnimatedLength.h"
+#include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGNames.h"
-#include "SVGStyledElement.h"
 #include "SVGURIReference.h"
 #include "SVGUnitTypes.h"
 
 namespace WebCore {
 
-class SVGFilterElement FINAL : public SVGStyledElement,
+class SVGFilterElement FINAL : public SVGElement,
                                public SVGURIReference,
                                public SVGExternalResourcesRequired {
 public:
diff --git a/Source/WebCore/svg/SVGFilterElement.idl b/Source/WebCore/svg/SVGFilterElement.idl
index f3e252d..8f5be1d 100644
--- a/Source/WebCore/svg/SVGFilterElement.idl
+++ b/Source/WebCore/svg/SVGFilterElement.idl
@@ -26,7 +26,7 @@
 
 [
     Conditional=SVG&FILTERS
-] interface SVGFilterElement : SVGStyledElement {
+] interface SVGFilterElement : SVGElement {
     readonly attribute SVGAnimatedEnumeration filterUnits;
     readonly attribute SVGAnimatedEnumeration primitiveUnits;
     readonly attribute SVGAnimatedLength      x;
diff --git a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
index 65d8063..2bd43f8 100644
--- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
+++ b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
@@ -27,11 +27,11 @@
 #include "Attribute.h"
 #include "FilterEffect.h"
 #include "RenderSVGResourceFilterPrimitive.h"
+#include "SVGElement.h"
 #include "SVGElementInstance.h"
 #include "SVGFilterBuilder.h"
 #include "SVGLength.h"
 #include "SVGNames.h"
-#include "SVGStyledElement.h"
 #include "SVGUnitTypes.h"
 
 namespace WebCore {
@@ -49,11 +49,11 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
     REGISTER_LOCAL_ANIMATED_PROPERTY(result)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 SVGFilterPrimitiveStandardAttributes::SVGFilterPrimitiveStandardAttributes(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
     , m_x(LengthModeWidth, "0%")
     , m_y(LengthModeHeight, "0%")
     , m_width(LengthModeWidth, "100%")
@@ -82,7 +82,7 @@
     SVGParsingError parseError = NoError;
 
     if (!isSupportedAttribute(name))
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
     else if (name == SVGNames::xAttr)
         setXBaseValue(SVGLength::construct(LengthModeWidth, value, parseError));
     else if (name == SVGNames::yAttr)
@@ -109,7 +109,7 @@
 void SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (!isSupportedAttribute(attrName)) {
-        SVGStyledElement::svgAttributeChanged(attrName);
+        SVGElement::svgAttributeChanged(attrName);
         return;
     }
 
@@ -119,7 +119,7 @@
 
 void SVGFilterPrimitiveStandardAttributes::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
-    SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+    SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
 
     if (!changedByParser)
         invalidate();
@@ -149,7 +149,7 @@
 bool SVGFilterPrimitiveStandardAttributes::rendererIsNeeded(const RenderStyle& style)
 {
     if (parentNode() && (parentNode()->hasTagName(SVGNames::filterTag)))
-        return SVGStyledElement::rendererIsNeeded(style);
+        return SVGElement::rendererIsNeeded(style);
 
     return false;
 }
diff --git a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
index ee6b70f..98f91d4 100644
--- a/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
+++ b/Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h
@@ -26,7 +26,7 @@
 #include "RenderSVGResourceFilterPrimitive.h"
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedString.h"
-#include "SVGStyledElement.h"
+#include "SVGElement.h"
 
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
@@ -37,7 +37,7 @@
 class FilterEffect;
 class SVGFilterBuilder;
 
-class SVGFilterPrimitiveStandardAttributes : public SVGStyledElement {
+class SVGFilterPrimitiveStandardAttributes : public SVGElement {
 public:
     void setStandardAttributes(FilterEffect*) const;
 
diff --git a/Source/WebCore/svg/SVGFontElement.cpp b/Source/WebCore/svg/SVGFontElement.cpp
index c8ea3c8..ada5562 100644
--- a/Source/WebCore/svg/SVGFontElement.cpp
+++ b/Source/WebCore/svg/SVGFontElement.cpp
@@ -41,11 +41,11 @@
 
 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFontElement)
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGFontElement::SVGFontElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document) 
+    : SVGElement(tagName, document) 
     , m_missingGlyph(0)
     , m_isGlyphCacheValid(false)
 {
diff --git a/Source/WebCore/svg/SVGFontElement.h b/Source/WebCore/svg/SVGFontElement.h
index d8703ec..01fe6c2 100644
--- a/Source/WebCore/svg/SVGFontElement.h
+++ b/Source/WebCore/svg/SVGFontElement.h
@@ -24,11 +24,11 @@
 
 #if ENABLE(SVG_FONTS)
 #include "SVGAnimatedBoolean.h"
+#include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGGlyphMap.h"
 #include "SVGNames.h"
 #include "SVGParserUtilities.h"
-#include "SVGStyledElement.h"
 
 namespace WebCore {
 
@@ -52,7 +52,7 @@
 
 class SVGMissingGlyphElement;    
 
-class SVGFontElement FINAL : public SVGStyledElement
+class SVGFontElement FINAL : public SVGElement
                            , public SVGExternalResourcesRequired {
 public:
     static PassRefPtr<SVGFontElement> create(const QualifiedName&, Document*);
diff --git a/Source/WebCore/svg/SVGFontFaceElement.cpp b/Source/WebCore/svg/SVGFontFaceElement.cpp
index ffeed32..f350256 100644
--- a/Source/WebCore/svg/SVGFontFaceElement.cpp
+++ b/Source/WebCore/svg/SVGFontFaceElement.cpp
@@ -60,54 +60,6 @@
     return adoptRef(new SVGFontFaceElement(tagName, document));
 }
 
-static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
-{
-    if (!attrName.namespaceURI().isNull())
-        return CSSPropertyInvalid;
-    
-    static HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap = 0;
-    if (!propertyNameToIdMap) {
-        propertyNameToIdMap = new HashMap<AtomicStringImpl*, CSSPropertyID>;
-        // This is a list of all @font-face CSS properties which are exposed as SVG XML attributes
-        // Those commented out are not yet supported by WebCore's style system
-        // mapAttributeToCSSProperty(propertyNameToIdMap, accent_heightAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, alphabeticAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, ascentAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, bboxAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, cap_heightAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, descentAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_familyAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_sizeAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_stretchAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_styleAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_variantAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_weightAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, hangingAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, ideographicAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, mathematicalAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, overline_positionAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, overline_thicknessAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, panose_1Attr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, slopeAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, stemhAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, stemvAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_positionAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, strikethrough_thicknessAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, underline_positionAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, underline_thicknessAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, unicode_rangeAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, units_per_emAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, v_alphabeticAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, v_hangingAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, v_ideographicAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, v_mathematicalAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, widthsAttr);
-        // mapAttributeToCSSProperty(propertyNameToIdMap, x_heightAttr);
-    }
-    
-    return propertyNameToIdMap->get(attrName.localName().impl());
-}
-
 void SVGFontFaceElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {    
     CSSPropertyID propId = cssPropertyIdForSVGAttributeName(name);
diff --git a/Source/WebCore/svg/SVGFontFaceElement.h b/Source/WebCore/svg/SVGFontFaceElement.h
index b34e65c..5a551ec 100644
--- a/Source/WebCore/svg/SVGFontFaceElement.h
+++ b/Source/WebCore/svg/SVGFontFaceElement.h
@@ -61,6 +61,8 @@
     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
     virtual void removedFrom(ContainerNode*) OVERRIDE;
 
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
+
     RefPtr<StyleRuleFontFace> m_fontFaceRule;
     SVGFontElement* m_fontElement;
 };
diff --git a/Source/WebCore/svg/SVGFontFaceFormatElement.h b/Source/WebCore/svg/SVGFontFaceFormatElement.h
index 9e61daa..6fa77b8 100644
--- a/Source/WebCore/svg/SVGFontFaceFormatElement.h
+++ b/Source/WebCore/svg/SVGFontFaceFormatElement.h
@@ -33,6 +33,7 @@
     SVGFontFaceFormatElement(const QualifiedName&, Document*);
 
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/svg/SVGFontFaceNameElement.h b/Source/WebCore/svg/SVGFontFaceNameElement.h
index 068d577..03253b9 100644
--- a/Source/WebCore/svg/SVGFontFaceNameElement.h
+++ b/Source/WebCore/svg/SVGFontFaceNameElement.h
@@ -35,6 +35,8 @@
 
 private:
     SVGFontFaceNameElement(const QualifiedName&, Document*);
+
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/svg/SVGFontFaceSrcElement.h b/Source/WebCore/svg/SVGFontFaceSrcElement.h
index d2b1977..150ac69 100644
--- a/Source/WebCore/svg/SVGFontFaceSrcElement.h
+++ b/Source/WebCore/svg/SVGFontFaceSrcElement.h
@@ -37,6 +37,7 @@
     SVGFontFaceSrcElement(const QualifiedName&, Document*);
     
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/svg/SVGFontFaceUriElement.h b/Source/WebCore/svg/SVGFontFaceUriElement.h
index 1640c6a..dcc6e87 100644
--- a/Source/WebCore/svg/SVGFontFaceUriElement.h
+++ b/Source/WebCore/svg/SVGFontFaceUriElement.h
@@ -43,6 +43,7 @@
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
     virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
 
     void loadFont();
 
diff --git a/Source/WebCore/svg/SVGGElement.cpp b/Source/WebCore/svg/SVGGElement.cpp
index 31c0a0c..492ac9f 100644
--- a/Source/WebCore/svg/SVGGElement.cpp
+++ b/Source/WebCore/svg/SVGGElement.cpp
@@ -103,7 +103,7 @@
 
 bool SVGGElement::rendererIsNeeded(const RenderStyle&)
 {
-    // Unlike SVGStyledElement::rendererIsNeeded(), we still create renderers, even if
+    // Unlike SVGElement::rendererIsNeeded(), we still create renderers, even if
     // display is set to 'none' - which is special to SVG <g> container elements.
     return parentOrShadowHostElement() && parentOrShadowHostElement()->isSVGElement();
 }
diff --git a/Source/WebCore/svg/SVGGlyphElement.cpp b/Source/WebCore/svg/SVGGlyphElement.cpp
index 83d053b..1c493a3 100644
--- a/Source/WebCore/svg/SVGGlyphElement.cpp
+++ b/Source/WebCore/svg/SVGGlyphElement.cpp
@@ -34,7 +34,7 @@
 namespace WebCore {
 
 inline SVGGlyphElement::SVGGlyphElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
 {
     ASSERT(hasTagName(SVGNames::glyphTag));
 }
@@ -56,20 +56,20 @@
     if (name == SVGNames::dAttr)
         invalidateGlyphCache();
     else
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
 }
 
 Node::InsertionNotificationRequest SVGGlyphElement::insertedInto(ContainerNode* rootParent)
 {
     invalidateGlyphCache();
-    return SVGStyledElement::insertedInto(rootParent);
+    return SVGElement::insertedInto(rootParent);
 }
 
 void SVGGlyphElement::removedFrom(ContainerNode* rootParent)
 {
     if (rootParent->inDocument())
         invalidateGlyphCache();
-    SVGStyledElement::removedFrom(rootParent);
+    SVGElement::removedFrom(rootParent);
 }
 
 static inline SVGGlyph::ArabicForm parseArabicForm(const AtomicString& value)
diff --git a/Source/WebCore/svg/SVGGlyphElement.h b/Source/WebCore/svg/SVGGlyphElement.h
index 668bb86..27cc092 100644
--- a/Source/WebCore/svg/SVGGlyphElement.h
+++ b/Source/WebCore/svg/SVGGlyphElement.h
@@ -23,14 +23,14 @@
 #define SVGGlyphElement_h
 
 #if ENABLE(SVG_FONTS)
+#include "SVGElement.h"
 #include "SVGGlyph.h"
-#include "SVGStyledElement.h"
 
 namespace WebCore {
 
 class SVGFontData;
 
-class SVGGlyphElement FINAL : public SVGStyledElement {
+class SVGGlyphElement FINAL : public SVGElement {
 public:
     static PassRefPtr<SVGGlyphElement> create(const QualifiedName&, Document*);
 
diff --git a/Source/WebCore/svg/SVGGlyphRefElement.cpp b/Source/WebCore/svg/SVGGlyphRefElement.cpp
index 7283749..11b8e1f 100644
--- a/Source/WebCore/svg/SVGGlyphRefElement.cpp
+++ b/Source/WebCore/svg/SVGGlyphRefElement.cpp
@@ -35,11 +35,11 @@
 
 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGlyphRefElement)
     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGGlyphRefElement::SVGGlyphRefElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
     , m_x(0)
     , m_y(0)
     , m_dx(0)
@@ -81,7 +81,7 @@
     else {
         if (SVGURIReference::parseAttribute(name, value))
             return;
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
     }
 }
 
diff --git a/Source/WebCore/svg/SVGGlyphRefElement.h b/Source/WebCore/svg/SVGGlyphRefElement.h
index 62c5bef..b4a44ae 100644
--- a/Source/WebCore/svg/SVGGlyphRefElement.h
+++ b/Source/WebCore/svg/SVGGlyphRefElement.h
@@ -21,12 +21,12 @@
 #define SVGGlyphRefElement_h
 
 #if ENABLE(SVG) && ENABLE(SVG_FONTS)
-#include "SVGStyledElement.h"
+#include "SVGElement.h"
 #include "SVGURIReference.h"
 
 namespace WebCore {
 
-class SVGGlyphRefElement FINAL : public SVGStyledElement,
+class SVGGlyphRefElement FINAL : public SVGElement,
                                  public SVGURIReference {
 public:
     static PassRefPtr<SVGGlyphRefElement> create(const QualifiedName&, Document*);
diff --git a/Source/WebCore/svg/SVGGlyphRefElement.idl b/Source/WebCore/svg/SVGGlyphRefElement.idl
index 9fc9fee..8602710 100644
--- a/Source/WebCore/svg/SVGGlyphRefElement.idl
+++ b/Source/WebCore/svg/SVGGlyphRefElement.idl
@@ -19,7 +19,7 @@
 
 [
     Conditional=SVG&SVG_FONTS
-] interface SVGGlyphRefElement : SVGStyledElement {
+] interface SVGGlyphRefElement : SVGElement {
     // FIXME: Use [Reflect] after https://bugs.webkit.org/show_bug.cgi?id=64843 is fixed.
     [SetterRaisesException] attribute DOMString glyphRef;
     [Reflect] attribute DOMString format;
diff --git a/Source/WebCore/svg/SVGGradientElement.cpp b/Source/WebCore/svg/SVGGradientElement.cpp
index 8d398b6..bef44fa 100644
--- a/Source/WebCore/svg/SVGGradientElement.cpp
+++ b/Source/WebCore/svg/SVGGradientElement.cpp
@@ -52,11 +52,11 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(gradientTransform)
     REGISTER_LOCAL_ANIMATED_PROPERTY(href)
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
 END_REGISTER_ANIMATED_PROPERTIES
  
 SVGGradientElement::SVGGradientElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
     , m_spreadMethod(SVGSpreadMethodPad)
     , m_gradientUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
 {
@@ -79,7 +79,7 @@
 void SVGGradientElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (!isSupportedAttribute(name)) {
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
         return;
     }
 
@@ -116,7 +116,7 @@
 void SVGGradientElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (!isSupportedAttribute(attrName)) {
-        SVGStyledElement::svgAttributeChanged(attrName);
+        SVGElement::svgAttributeChanged(attrName);
         return;
     }
 
@@ -128,7 +128,7 @@
     
 void SVGGradientElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
-    SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+    SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
 
     if (changedByParser)
         return;
diff --git a/Source/WebCore/svg/SVGGradientElement.h b/Source/WebCore/svg/SVGGradientElement.h
index ae8a4cf..661ac4e 100644
--- a/Source/WebCore/svg/SVGGradientElement.h
+++ b/Source/WebCore/svg/SVGGradientElement.h
@@ -26,9 +26,9 @@
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedTransformList.h"
+#include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGNames.h"
-#include "SVGStyledElement.h"
 #include "SVGURIReference.h"
 #include "SVGUnitTypes.h"
 
@@ -74,7 +74,7 @@
     }
 };
 
-class SVGGradientElement : public SVGStyledElement,
+class SVGGradientElement : public SVGElement,
                            public SVGURIReference,
                            public SVGExternalResourcesRequired {
 public:
diff --git a/Source/WebCore/svg/SVGGradientElement.idl b/Source/WebCore/svg/SVGGradientElement.idl
index 762bbe9..993be34 100644
--- a/Source/WebCore/svg/SVGGradientElement.idl
+++ b/Source/WebCore/svg/SVGGradientElement.idl
@@ -26,7 +26,7 @@
 [
     Conditional=SVG,
     DoNotCheckConstants
-] interface SVGGradientElement : SVGStyledElement {
+] interface SVGGradientElement : SVGElement {
     // Spread Method Types
     const unsigned short SVG_SPREADMETHOD_UNKNOWN = 0;
     const unsigned short SVG_SPREADMETHOD_PAD     = 1;
diff --git a/Source/WebCore/svg/SVGGraphicsElement.cpp b/Source/WebCore/svg/SVGGraphicsElement.cpp
index 3814d86..f6d0a4a 100644
--- a/Source/WebCore/svg/SVGGraphicsElement.cpp
+++ b/Source/WebCore/svg/SVGGraphicsElement.cpp
@@ -38,12 +38,12 @@
 
 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGGraphicsElement)
     REGISTER_LOCAL_ANIMATED_PROPERTY(transform)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
 END_REGISTER_ANIMATED_PROPERTIES
 
 SVGGraphicsElement::SVGGraphicsElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
 {
     registerAnimatedPropertiesForSVGGraphicsElement();
 }
@@ -104,7 +104,7 @@
 void SVGGraphicsElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (!isSupportedAttribute(name)) {
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
         return;
     }
 
@@ -125,7 +125,7 @@
 void SVGGraphicsElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (!isSupportedAttribute(attrName)) {
-        SVGStyledElement::svgAttributeChanged(attrName);
+        SVGElement::svgAttributeChanged(attrName);
         return;
     }
 
diff --git a/Source/WebCore/svg/SVGGraphicsElement.h b/Source/WebCore/svg/SVGGraphicsElement.h
index b8aa818..764692c 100644
--- a/Source/WebCore/svg/SVGGraphicsElement.h
+++ b/Source/WebCore/svg/SVGGraphicsElement.h
@@ -23,7 +23,7 @@
 
 #if ENABLE(SVG)
 #include "SVGAnimatedTransformList.h"
-#include "SVGStyledElement.h"
+#include "SVGElement.h"
 #include "SVGTests.h"
 #include "SVGTransformable.h"
 
@@ -32,7 +32,7 @@
 class AffineTransform;
 class Path;
 
-class SVGGraphicsElement : public SVGStyledElement, public SVGTransformable, public SVGTests {
+class SVGGraphicsElement : public SVGElement, public SVGTransformable, public SVGTests {
 public:
     virtual ~SVGGraphicsElement();
 
diff --git a/Source/WebCore/svg/SVGGraphicsElement.idl b/Source/WebCore/svg/SVGGraphicsElement.idl
index f96e2319..9fb0b62 100644
--- a/Source/WebCore/svg/SVGGraphicsElement.idl
+++ b/Source/WebCore/svg/SVGGraphicsElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG
-] interface SVGGraphicsElement : SVGStyledElement {
+] interface SVGGraphicsElement : SVGElement {
     readonly attribute SVGAnimatedTransformList transform;
 
     readonly attribute SVGElement nearestViewportElement;
diff --git a/Source/WebCore/svg/SVGLocatable.cpp b/Source/WebCore/svg/SVGLocatable.cpp
index 006d45d..5ffdb5e 100644
--- a/Source/WebCore/svg/SVGLocatable.cpp
+++ b/Source/WebCore/svg/SVGLocatable.cpp
@@ -89,8 +89,7 @@
         if (!currentElement->isSVGElement())
             break;
 
-        if (toSVGElement(currentElement)->isSVGStyledElement())
-            ctm = toSVGStyledElement(currentElement)->localCoordinateSpaceTransform(mode).multiply(ctm);
+        ctm = toSVGElement(currentElement)->localCoordinateSpaceTransform(mode).multiply(ctm);
 
         // For getCTM() computation, stop at the nearest viewport element
         if (currentElement == stopAtElement)
diff --git a/Source/WebCore/svg/SVGMPathElement.h b/Source/WebCore/svg/SVGMPathElement.h
index 79d4f10..654cfde 100644
--- a/Source/WebCore/svg/SVGMPathElement.h
+++ b/Source/WebCore/svg/SVGMPathElement.h
@@ -56,6 +56,8 @@
     virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
     virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
 
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
+
     void notifyParentOfPathChange(ContainerNode*);
 
     BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGMPathElement)
diff --git a/Source/WebCore/svg/SVGMarkerElement.cpp b/Source/WebCore/svg/SVGMarkerElement.cpp
index 1d41db8..6eef257 100644
--- a/Source/WebCore/svg/SVGMarkerElement.cpp
+++ b/Source/WebCore/svg/SVGMarkerElement.cpp
@@ -70,11 +70,11 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
     REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGMarkerElement::SVGMarkerElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
     , m_refX(LengthModeWidth)
     , m_refY(LengthModeHeight)
     , m_markerWidth(LengthModeWidth, "3")
@@ -131,7 +131,7 @@
     SVGParsingError parseError = NoError;
 
     if (!isSupportedAttribute(name))
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
     else if (name == SVGNames::markerUnitsAttr) {
         SVGMarkerUnitsType propertyValue = SVGPropertyTraits<SVGMarkerUnitsType>::fromString(value);
         if (propertyValue > 0)
@@ -163,7 +163,7 @@
 void SVGMarkerElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (!isSupportedAttribute(attrName)) {
-        SVGStyledElement::svgAttributeChanged(attrName);
+        SVGElement::svgAttributeChanged(attrName);
         return;
     }
 
@@ -181,7 +181,7 @@
 
 void SVGMarkerElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
-    SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+    SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
 
     if (changedByParser)
         return;
diff --git a/Source/WebCore/svg/SVGMarkerElement.h b/Source/WebCore/svg/SVGMarkerElement.h
index 6844349..321bef5 100644
--- a/Source/WebCore/svg/SVGMarkerElement.h
+++ b/Source/WebCore/svg/SVGMarkerElement.h
@@ -28,9 +28,9 @@
 #include "SVGAnimatedLength.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "SVGAnimatedRect.h"
+#include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGFitToViewBox.h"
-#include "SVGStyledElement.h"
 
 namespace WebCore {
 
@@ -94,7 +94,7 @@
     }
 };
 
-class SVGMarkerElement FINAL : public SVGStyledElement,
+class SVGMarkerElement FINAL : public SVGElement,
                                public SVGExternalResourcesRequired,
                                public SVGFitToViewBox {
 public:
diff --git a/Source/WebCore/svg/SVGMarkerElement.idl b/Source/WebCore/svg/SVGMarkerElement.idl
index 7186389..e44b025 100644
--- a/Source/WebCore/svg/SVGMarkerElement.idl
+++ b/Source/WebCore/svg/SVGMarkerElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG
-] interface SVGMarkerElement : SVGStyledElement {
+] interface SVGMarkerElement : SVGElement {
     // Marker Unit Types
     const unsigned short SVG_MARKERUNITS_UNKNOWN        = 0;
     const unsigned short SVG_MARKERUNITS_USERSPACEONUSE = 1;
diff --git a/Source/WebCore/svg/SVGMaskElement.cpp b/Source/WebCore/svg/SVGMaskElement.cpp
index 099aadf..aaf6efa 100644
--- a/Source/WebCore/svg/SVGMaskElement.cpp
+++ b/Source/WebCore/svg/SVGMaskElement.cpp
@@ -53,12 +53,12 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(width)
     REGISTER_LOCAL_ANIMATED_PROPERTY(height)
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGMaskElement::SVGMaskElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
     , m_maskUnits(SVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX)
     , m_maskContentUnits(SVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE)
     , m_x(LengthModeWidth, "-10%")
@@ -99,7 +99,7 @@
     SVGParsingError parseError = NoError;
 
     if (!isSupportedAttribute(name))
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
     else if (name == SVGNames::maskUnitsAttr) {
         SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
         if (propertyValue > 0)
@@ -130,7 +130,7 @@
 void SVGMaskElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (!isSupportedAttribute(attrName)) {
-        SVGStyledElement::svgAttributeChanged(attrName);
+        SVGElement::svgAttributeChanged(attrName);
         return;
     }
 
@@ -148,7 +148,7 @@
 
 void SVGMaskElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
-    SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+    SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
 
     if (changedByParser)
         return;
diff --git a/Source/WebCore/svg/SVGMaskElement.h b/Source/WebCore/svg/SVGMaskElement.h
index 7c9d4a0..595ec3e 100644
--- a/Source/WebCore/svg/SVGMaskElement.h
+++ b/Source/WebCore/svg/SVGMaskElement.h
@@ -24,15 +24,15 @@
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedLength.h"
+#include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGNames.h"
-#include "SVGStyledElement.h"
 #include "SVGTests.h"
 #include "SVGUnitTypes.h"
 
 namespace WebCore {
 
-class SVGMaskElement FINAL : public SVGStyledElement,
+class SVGMaskElement FINAL : public SVGElement,
                              public SVGTests,
                              public SVGExternalResourcesRequired {
 public:
diff --git a/Source/WebCore/svg/SVGMaskElement.idl b/Source/WebCore/svg/SVGMaskElement.idl
index 049a8db..62969f2 100644
--- a/Source/WebCore/svg/SVGMaskElement.idl
+++ b/Source/WebCore/svg/SVGMaskElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG
-] interface SVGMaskElement : SVGStyledElement {
+] interface SVGMaskElement : SVGElement {
     readonly attribute SVGAnimatedEnumeration maskUnits;
     readonly attribute SVGAnimatedEnumeration maskContentUnits;
 
diff --git a/Source/WebCore/svg/SVGMetadataElement.h b/Source/WebCore/svg/SVGMetadataElement.h
index 7ec6d54..ba6c660 100644
--- a/Source/WebCore/svg/SVGMetadataElement.h
+++ b/Source/WebCore/svg/SVGMetadataElement.h
@@ -32,6 +32,8 @@
 
 private:
     SVGMetadataElement(const QualifiedName&, Document*);
+
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/svg/SVGMissingGlyphElement.cpp b/Source/WebCore/svg/SVGMissingGlyphElement.cpp
index 5c98015..dc72d33 100644
--- a/Source/WebCore/svg/SVGMissingGlyphElement.cpp
+++ b/Source/WebCore/svg/SVGMissingGlyphElement.cpp
@@ -26,7 +26,7 @@
 namespace WebCore {
 
 inline SVGMissingGlyphElement::SVGMissingGlyphElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
 {
     ASSERT(hasTagName(SVGNames::missing_glyphTag));
 }
diff --git a/Source/WebCore/svg/SVGMissingGlyphElement.h b/Source/WebCore/svg/SVGMissingGlyphElement.h
index 48140ad..5e611c5 100644
--- a/Source/WebCore/svg/SVGMissingGlyphElement.h
+++ b/Source/WebCore/svg/SVGMissingGlyphElement.h
@@ -21,11 +21,11 @@
 #define SVGMissingGlyphElement_h
 
 #if ENABLE(SVG_FONTS)
-#include "SVGStyledElement.h"
+#include "SVGElement.h"
 
 namespace WebCore {
 
-class SVGMissingGlyphElement FINAL : public SVGStyledElement {
+class SVGMissingGlyphElement FINAL : public SVGElement {
 public:
     static PassRefPtr<SVGMissingGlyphElement> create(const QualifiedName&, Document*);
 
diff --git a/Source/WebCore/svg/SVGMissingGlyphElement.idl b/Source/WebCore/svg/SVGMissingGlyphElement.idl
index 647741a..9a0e3e6 100644
--- a/Source/WebCore/svg/SVGMissingGlyphElement.idl
+++ b/Source/WebCore/svg/SVGMissingGlyphElement.idl
@@ -25,6 +25,6 @@
 
 [
     Conditional=SVG&SVG_FONTS
-] interface SVGMissingGlyphElement : SVGStyledElement {
+] interface SVGMissingGlyphElement : SVGElement {
 };
 
diff --git a/Source/WebCore/svg/SVGPatternElement.cpp b/Source/WebCore/svg/SVGPatternElement.cpp
index 0cd3df9..0241500 100644
--- a/Source/WebCore/svg/SVGPatternElement.cpp
+++ b/Source/WebCore/svg/SVGPatternElement.cpp
@@ -69,12 +69,12 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
     REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) 
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
     REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGPatternElement::SVGPatternElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
     , m_x(LengthModeWidth)
     , m_y(LengthModeHeight)
     , m_width(LengthModeWidth)
@@ -116,7 +116,7 @@
     SVGParsingError parseError = NoError;
 
     if (!isSupportedAttribute(name))
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
     else if (name == SVGNames::patternUnitsAttr) {
         SVGUnitTypes::SVGUnitType propertyValue = SVGPropertyTraits<SVGUnitTypes::SVGUnitType>::fromString(value);
         if (propertyValue > 0)
@@ -155,7 +155,7 @@
 void SVGPatternElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (!isSupportedAttribute(attrName)) {
-        SVGStyledElement::svgAttributeChanged(attrName);
+        SVGElement::svgAttributeChanged(attrName);
         return;
     }
 
@@ -173,7 +173,7 @@
 
 void SVGPatternElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
 {
-    SVGStyledElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
+    SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
 
     if (changedByParser)
         return;
diff --git a/Source/WebCore/svg/SVGPatternElement.h b/Source/WebCore/svg/SVGPatternElement.h
index 2dabad4..6db6596 100644
--- a/Source/WebCore/svg/SVGPatternElement.h
+++ b/Source/WebCore/svg/SVGPatternElement.h
@@ -28,10 +28,10 @@
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "SVGAnimatedRect.h"
 #include "SVGAnimatedTransformList.h"
+#include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGFitToViewBox.h"
 #include "SVGNames.h"
-#include "SVGStyledElement.h"
 #include "SVGTests.h"
 #include "SVGURIReference.h"
 #include "SVGUnitTypes.h"
@@ -40,7 +40,7 @@
 
 struct PatternAttributes;
  
-class SVGPatternElement FINAL : public SVGStyledElement,
+class SVGPatternElement FINAL : public SVGElement,
                                 public SVGURIReference,
                                 public SVGTests,
                                 public SVGExternalResourcesRequired,
diff --git a/Source/WebCore/svg/SVGPatternElement.idl b/Source/WebCore/svg/SVGPatternElement.idl
index 262a033..50d1385 100644
--- a/Source/WebCore/svg/SVGPatternElement.idl
+++ b/Source/WebCore/svg/SVGPatternElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG
-] interface SVGPatternElement : SVGStyledElement {
+] interface SVGPatternElement : SVGElement {
     readonly attribute SVGAnimatedEnumeration   patternUnits;
     readonly attribute SVGAnimatedEnumeration   patternContentUnits;
     readonly attribute SVGAnimatedTransformList patternTransform;
diff --git a/Source/WebCore/svg/SVGScriptElement.h b/Source/WebCore/svg/SVGScriptElement.h
index 43c2411..99b9d87 100644
--- a/Source/WebCore/svg/SVGScriptElement.h
+++ b/Source/WebCore/svg/SVGScriptElement.h
@@ -71,6 +71,7 @@
     virtual void dispatchLoadEvent() { SVGExternalResourcesRequired::dispatchLoadEvent(this); }
 
     virtual PassRefPtr<Element> cloneElementWithoutAttributesAndChildren();
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
 
     // SVGExternalResourcesRequired
     virtual void setHaveFiredLoadEvent(bool haveFiredLoadEvent) { ScriptElement::setHaveFiredLoadEvent(haveFiredLoadEvent); }
diff --git a/Source/WebCore/svg/SVGStopElement.cpp b/Source/WebCore/svg/SVGStopElement.cpp
index 7309ecd..52626b3 100644
--- a/Source/WebCore/svg/SVGStopElement.cpp
+++ b/Source/WebCore/svg/SVGStopElement.cpp
@@ -38,11 +38,11 @@
 
 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGStopElement)
     REGISTER_LOCAL_ANIMATED_PROPERTY(offset)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGStopElement::SVGStopElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
     , m_offset(0)
 {
     ASSERT(hasTagName(SVGNames::stopTag));
@@ -65,7 +65,7 @@
 void SVGStopElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (!isSupportedAttribute(name)) {
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
         return;
     }
 
@@ -83,7 +83,7 @@
 void SVGStopElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (!isSupportedAttribute(attrName)) {
-        SVGStyledElement::svgAttributeChanged(attrName);
+        SVGElement::svgAttributeChanged(attrName);
         return;
     }
 
diff --git a/Source/WebCore/svg/SVGStopElement.h b/Source/WebCore/svg/SVGStopElement.h
index c93a9ff..6679a71 100644
--- a/Source/WebCore/svg/SVGStopElement.h
+++ b/Source/WebCore/svg/SVGStopElement.h
@@ -23,11 +23,11 @@
 
 #if ENABLE(SVG)
 #include "SVGAnimatedNumber.h"
-#include "SVGStyledElement.h"
+#include "SVGElement.h"
 
 namespace WebCore {
 
-class SVGStopElement FINAL : public SVGStyledElement {
+class SVGStopElement FINAL : public SVGElement {
 public:
     static PassRefPtr<SVGStopElement> create(const QualifiedName&, Document*);
 
diff --git a/Source/WebCore/svg/SVGStopElement.idl b/Source/WebCore/svg/SVGStopElement.idl
index 86413f7..8411974 100644
--- a/Source/WebCore/svg/SVGStopElement.idl
+++ b/Source/WebCore/svg/SVGStopElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG
-] interface SVGStopElement : SVGStyledElement {
+] interface SVGStopElement : SVGElement {
     readonly attribute SVGAnimatedNumber offset;
 };
 
diff --git a/Source/WebCore/svg/SVGStyleElement.h b/Source/WebCore/svg/SVGStyleElement.h
index 033ee59..3d23871 100644
--- a/Source/WebCore/svg/SVGStyleElement.h
+++ b/Source/WebCore/svg/SVGStyleElement.h
@@ -56,6 +56,8 @@
     virtual void removedFrom(ContainerNode*) OVERRIDE;
     virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
+
     virtual void finishParsingChildren();
 
     virtual bool isLoading() const { return m_styleSheetOwner.isLoading(); }
diff --git a/Source/WebCore/svg/SVGStyledElement.cpp b/Source/WebCore/svg/SVGStyledElement.cpp
deleted file mode 100644
index b5da77d..0000000
--- a/Source/WebCore/svg/SVGStyledElement.cpp
+++ /dev/null
@@ -1,487 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2004, 2005, 2007, 2008 Rob Buis <buis@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-
-#if ENABLE(SVG)
-#include "SVGStyledElement.h"
-
-#include "Attr.h"
-#include "CSSParser.h"
-#include "Document.h"
-#include "ElementTraversal.h"
-#include "EventNames.h"
-#include "HTMLNames.h"
-#include "RenderObject.h"
-#include "RenderSVGResource.h"
-#include "RenderSVGResourceClipper.h"
-#include "RenderSVGResourceFilter.h"
-#include "RenderSVGResourceMasker.h"
-#include "SVGElement.h"
-#include "SVGElementInstance.h"
-#include "SVGElementRareData.h"
-#include "SVGNames.h"
-#include "SVGRenderStyle.h"
-#include "SVGRenderSupport.h"
-#include "SVGSVGElement.h"
-#include "SVGUseElement.h"
-#include "ShadowRoot.h"
-#include <wtf/Assertions.h>
-#include <wtf/HashMap.h>
-#include <wtf/StdLibExtras.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-// Animated property definitions
-DEFINE_ANIMATED_STRING(SVGStyledElement, HTMLNames::classAttr, ClassName, className)
-
-BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGStyledElement)
-    REGISTER_LOCAL_ANIMATED_PROPERTY(className)
-END_REGISTER_ANIMATED_PROPERTIES
-
-using namespace SVGNames;
-
-void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName)
-{
-    // FIXME: when CSS supports "transform-origin" the special case for transform_originAttr can be removed.
-    CSSPropertyID propertyId = cssPropertyID(attrName.localName());
-    if (!propertyId && attrName == transform_originAttr)
-        propertyId = CSSPropertyWebkitTransformOrigin; // cssPropertyID("-webkit-transform-origin")
-    ASSERT(propertyId > 0);
-    propertyNameToIdMap->set(attrName.localName().impl(), propertyId);
-}
-
-SVGStyledElement::SVGStyledElement(const QualifiedName& tagName, Document* document)
-    : SVGElement(tagName, document)
-{
-    registerAnimatedPropertiesForSVGStyledElement();
-}
-
-String SVGStyledElement::title() const
-{
-    // According to spec, we should not return titles when hovering over root <svg> elements (those
-    // <title> elements are the title of the document, not a tooltip) so we instantly return.
-    if (isOutermostSVGSVGElement())
-        return String();
-
-    // Walk up the tree, to find out whether we're inside a <use> shadow tree, to find the right title.
-    if (isInShadowTree()) {
-        Element* shadowHostElement = toShadowRoot(treeScope()->rootNode())->hostElement();
-        // At this time, SVG nodes are not allowed in non-<use> shadow trees, so any shadow root we do
-        // have should be a use. The assert and following test is here to catch future shadow DOM changes
-        // that do enable SVG in a shadow tree.
-        ASSERT(!shadowHostElement || shadowHostElement->hasTagName(SVGNames::useTag));
-        if (shadowHostElement && shadowHostElement->hasTagName(SVGNames::useTag)) {
-            SVGUseElement* useElement = toSVGUseElement(shadowHostElement);
- 
-            // If the <use> title is not empty we found the title to use.
-            String useTitle(useElement->title());
-            if (!useTitle.isEmpty())
-               return useTitle;
-        }
-    }
-
-    // If we aren't an instance in a <use> or the <use> title was not found, then find the first
-    // <title> child of this element.
-    Element* titleElement = ElementTraversal::firstWithin(this);
-    for (; titleElement; titleElement = ElementTraversal::nextSibling(titleElement)) {
-        if (titleElement->hasTagName(SVGNames::titleTag) && titleElement->isSVGElement())
-            break;
-    }
-
-    // If a title child was found, return the text contents.
-    if (titleElement)
-        return titleElement->innerText();
-    
-    // Otherwise return a null/empty string.
-    return String();
-}
-
-bool SVGStyledElement::rendererIsNeeded(const RenderStyle& style)
-{
-    // http://www.w3.org/TR/SVG/extend.html#PrivateData
-    // Prevent anything other than SVG renderers from appearing in our render tree
-    // Spec: SVG allows inclusion of elements from foreign namespaces anywhere
-    // with the SVG content. In general, the SVG user agent will include the unknown
-    // elements in the DOM but will otherwise ignore unknown elements. 
-    if (!parentOrShadowHostElement() || parentOrShadowHostElement()->isSVGElement())
-        return StyledElement::rendererIsNeeded(style);
-
-    return false;
-}
-
-CSSPropertyID SVGStyledElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attrName)
-{
-    if (!attrName.namespaceURI().isNull())
-        return CSSPropertyInvalid;
-    
-    static HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap = 0;
-    if (!propertyNameToIdMap) {
-        propertyNameToIdMap = new HashMap<AtomicStringImpl*, CSSPropertyID>;
-        // This is a list of all base CSS and SVG CSS properties which are exposed as SVG XML attributes
-        mapAttributeToCSSProperty(propertyNameToIdMap, alignment_baselineAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, baseline_shiftAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, buffered_renderingAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, clipAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, clip_pathAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, clip_ruleAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, SVGNames::colorAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, color_interpolationAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, color_interpolation_filtersAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, color_profileAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, color_renderingAttr); 
-        mapAttributeToCSSProperty(propertyNameToIdMap, cursorAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, SVGNames::directionAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, displayAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, dominant_baselineAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, enable_backgroundAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, fillAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, fill_opacityAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, fill_ruleAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, filterAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, flood_colorAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, flood_opacityAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_familyAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_sizeAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_stretchAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_styleAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_variantAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, font_weightAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, glyph_orientation_horizontalAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, glyph_orientation_verticalAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, image_renderingAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, kerningAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, letter_spacingAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, lighting_colorAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, marker_endAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, marker_midAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, marker_startAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, maskAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, mask_typeAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, opacityAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, overflowAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, pointer_eventsAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, shape_renderingAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, stop_colorAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, stop_opacityAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, strokeAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_dasharrayAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_dashoffsetAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_linecapAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_linejoinAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_miterlimitAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_opacityAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, stroke_widthAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, text_anchorAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, text_decorationAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, text_renderingAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, transform_originAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, unicode_bidiAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, vector_effectAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, visibilityAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, word_spacingAttr);
-        mapAttributeToCSSProperty(propertyNameToIdMap, writing_modeAttr);
-    }
-    
-    return propertyNameToIdMap->get(attrName.localName().impl());
-}
-
-typedef HashMap<QualifiedName, AnimatedPropertyType> AttributeToPropertyTypeMap;
-static inline AttributeToPropertyTypeMap& cssPropertyToTypeMap()
-{
-    DEFINE_STATIC_LOCAL(AttributeToPropertyTypeMap, s_cssPropertyMap, ());
-
-    if (!s_cssPropertyMap.isEmpty())
-        return s_cssPropertyMap;
-
-    // Fill the map for the first use.
-    s_cssPropertyMap.set(alignment_baselineAttr, AnimatedString);
-    s_cssPropertyMap.set(baseline_shiftAttr, AnimatedString);
-    s_cssPropertyMap.set(buffered_renderingAttr, AnimatedString);
-    s_cssPropertyMap.set(clipAttr, AnimatedRect);
-    s_cssPropertyMap.set(clip_pathAttr, AnimatedString);
-    s_cssPropertyMap.set(clip_ruleAttr, AnimatedString);
-    s_cssPropertyMap.set(SVGNames::colorAttr, AnimatedColor);
-    s_cssPropertyMap.set(color_interpolationAttr, AnimatedString);
-    s_cssPropertyMap.set(color_interpolation_filtersAttr, AnimatedString);
-    s_cssPropertyMap.set(color_profileAttr, AnimatedString);
-    s_cssPropertyMap.set(color_renderingAttr, AnimatedString); 
-    s_cssPropertyMap.set(cursorAttr, AnimatedString);
-    s_cssPropertyMap.set(displayAttr, AnimatedString);
-    s_cssPropertyMap.set(dominant_baselineAttr, AnimatedString);
-    s_cssPropertyMap.set(fillAttr, AnimatedColor);
-    s_cssPropertyMap.set(fill_opacityAttr, AnimatedNumber);
-    s_cssPropertyMap.set(fill_ruleAttr, AnimatedString);
-    s_cssPropertyMap.set(filterAttr, AnimatedString);
-    s_cssPropertyMap.set(flood_colorAttr, AnimatedColor);
-    s_cssPropertyMap.set(flood_opacityAttr, AnimatedNumber);
-    s_cssPropertyMap.set(font_familyAttr, AnimatedString);
-    s_cssPropertyMap.set(font_sizeAttr, AnimatedLength);
-    s_cssPropertyMap.set(font_stretchAttr, AnimatedString);
-    s_cssPropertyMap.set(font_styleAttr, AnimatedString);
-    s_cssPropertyMap.set(font_variantAttr, AnimatedString);
-    s_cssPropertyMap.set(font_weightAttr, AnimatedString);
-    s_cssPropertyMap.set(image_renderingAttr, AnimatedString);
-    s_cssPropertyMap.set(kerningAttr, AnimatedLength);
-    s_cssPropertyMap.set(letter_spacingAttr, AnimatedLength);
-    s_cssPropertyMap.set(lighting_colorAttr, AnimatedColor);
-    s_cssPropertyMap.set(marker_endAttr, AnimatedString);
-    s_cssPropertyMap.set(marker_midAttr, AnimatedString);
-    s_cssPropertyMap.set(marker_startAttr, AnimatedString);
-    s_cssPropertyMap.set(maskAttr, AnimatedString);
-    s_cssPropertyMap.set(mask_typeAttr, AnimatedString);
-    s_cssPropertyMap.set(opacityAttr, AnimatedNumber);
-    s_cssPropertyMap.set(overflowAttr, AnimatedString);
-    s_cssPropertyMap.set(pointer_eventsAttr, AnimatedString);
-    s_cssPropertyMap.set(shape_renderingAttr, AnimatedString);
-    s_cssPropertyMap.set(stop_colorAttr, AnimatedColor);
-    s_cssPropertyMap.set(stop_opacityAttr, AnimatedNumber);
-    s_cssPropertyMap.set(strokeAttr, AnimatedColor);
-    s_cssPropertyMap.set(stroke_dasharrayAttr, AnimatedLengthList);
-    s_cssPropertyMap.set(stroke_dashoffsetAttr, AnimatedLength);
-    s_cssPropertyMap.set(stroke_linecapAttr, AnimatedString);
-    s_cssPropertyMap.set(stroke_linejoinAttr, AnimatedString);
-    s_cssPropertyMap.set(stroke_miterlimitAttr, AnimatedNumber);
-    s_cssPropertyMap.set(stroke_opacityAttr, AnimatedNumber);
-    s_cssPropertyMap.set(stroke_widthAttr, AnimatedLength);
-    s_cssPropertyMap.set(text_anchorAttr, AnimatedString);
-    s_cssPropertyMap.set(text_decorationAttr, AnimatedString);
-    s_cssPropertyMap.set(text_renderingAttr, AnimatedString);
-    s_cssPropertyMap.set(vector_effectAttr, AnimatedString);
-    s_cssPropertyMap.set(visibilityAttr, AnimatedString);
-    s_cssPropertyMap.set(word_spacingAttr, AnimatedLength);
-    return s_cssPropertyMap;
-}
-
-void SVGStyledElement::animatedPropertyTypeForAttribute(const QualifiedName& attrName, Vector<AnimatedPropertyType>& propertyTypes)
-{
-    SVGElement::animatedPropertyTypeForAttribute(attrName, propertyTypes);
-    if (!propertyTypes.isEmpty())
-        return;
-
-    AttributeToPropertyTypeMap& cssPropertyTypeMap = cssPropertyToTypeMap();
-    if (cssPropertyTypeMap.contains(attrName))
-        propertyTypes.append(cssPropertyTypeMap.get(attrName));
-}
-
-bool SVGStyledElement::isAnimatableCSSProperty(const QualifiedName& attrName)
-{
-    return cssPropertyToTypeMap().contains(attrName);
-}
-
-bool SVGStyledElement::isPresentationAttribute(const QualifiedName& name) const
-{
-    if (SVGStyledElement::cssPropertyIdForSVGAttributeName(name) > 0)
-        return true;
-    return SVGElement::isPresentationAttribute(name);
-}
-
-void SVGStyledElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
-{
-    CSSPropertyID propertyID = SVGStyledElement::cssPropertyIdForSVGAttributeName(name);
-    if (propertyID > 0)
-        addPropertyToPresentationAttributeStyle(style, propertyID, value);
-}
-
-void SVGStyledElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
-{
-    // 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
-    // tell StyledElement about the change to avoid parsing the class list twice
-    if (name == HTMLNames::classAttr) {
-        setClassNameBaseValue(value);
-        return;
-    }
-
-    // id is handled by StyledElement which SVGElement inherits from
-    SVGElement::parseAttribute(name, value);
-}
-
-bool SVGStyledElement::isKnownAttribute(const QualifiedName& attrName)
-{
-    return isIdAttributeName(attrName);
-}
-
-void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName)
-{
-    CSSPropertyID propId = SVGStyledElement::cssPropertyIdForSVGAttributeName(attrName);
-    if (propId > 0) {
-        SVGElementInstance::invalidateAllInstancesOfElement(this);
-        return;
-    }
-
-    if (attrName == HTMLNames::classAttr) {
-        classAttributeChanged(className());
-        SVGElementInstance::invalidateAllInstancesOfElement(this);
-        return;
-    }
-
-    if (isIdAttributeName(attrName)) {
-        RenderObject* object = renderer();
-        // Notify resources about id changes, this is important as we cache resources by id in SVGDocumentExtensions
-        if (object && object->isSVGResourceContainer())
-            object->toRenderSVGResourceContainer()->idChanged();
-        if (inDocument())
-            buildPendingResourcesIfNeeded();
-        SVGElementInstance::invalidateAllInstancesOfElement(this);
-        return;
-    }
-}
-
-Node::InsertionNotificationRequest SVGStyledElement::insertedInto(ContainerNode* rootParent)
-{
-    SVGElement::insertedInto(rootParent);
-    updateRelativeLengthsInformation();
-    buildPendingResourcesIfNeeded();
-    return InsertionDone;
-}
-
-void SVGStyledElement::buildPendingResourcesIfNeeded()
-{
-    Document* document = this->document();
-    if (!needsPendingResourceHandling() || !document || !inDocument() || isInShadowTree())
-        return;
-
-    SVGDocumentExtensions* extensions = document->accessSVGExtensions();
-    String resourceId = getIdAttribute();
-    if (!extensions->hasPendingResource(resourceId))
-        return;
-
-    // Mark pending resources as pending for removal.
-    extensions->markPendingResourcesForRemoval(resourceId);
-
-    // Rebuild pending resources for each client of a pending resource that is being removed.
-    while (Element* clientElement = extensions->removeElementFromPendingResourcesForRemoval(resourceId)) {
-        ASSERT(clientElement->hasPendingResources());
-        if (clientElement->hasPendingResources()) {
-            clientElement->buildPendingResource();
-            extensions->clearHasPendingResourcesIfPossible(clientElement);
-        }
-    }
-}
-
-void SVGStyledElement::removedFrom(ContainerNode* rootParent)
-{
-    if (rootParent->inDocument())
-        updateRelativeLengthsInformation(false, this);
-    SVGElement::removedFrom(rootParent);
-    SVGElementInstance::invalidateAllInstancesOfElement(this);
-}
-
-void SVGStyledElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
-{
-    SVGElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
-
-    // Invalidate all SVGElementInstances associated with us
-    if (!changedByParser)
-        SVGElementInstance::invalidateAllInstancesOfElement(this);
-}
-
-PassRefPtr<CSSValue> SVGStyledElement::getPresentationAttribute(const String& name)
-{
-    if (!hasAttributesWithoutUpdate())
-        return 0;
-
-    QualifiedName attributeName(nullAtom, name, nullAtom);
-    const Attribute* attribute = findAttributeByName(attributeName);
-    if (!attribute)
-        return 0;
-
-    RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(SVGAttributeMode);
-    CSSPropertyID propertyID = SVGStyledElement::cssPropertyIdForSVGAttributeName(attribute->name());
-    style->setProperty(propertyID, attribute->value());
-    RefPtr<CSSValue> cssValue = style->getPropertyCSSValue(propertyID);
-    return cssValue ? cssValue->cloneForCSSOM() : 0;
-}
-
-bool SVGStyledElement::instanceUpdatesBlocked() const
-{
-    return hasSVGRareData() && svgRareData()->instanceUpdatesBlocked();
-}
-
-void SVGStyledElement::setInstanceUpdatesBlocked(bool value)
-{
-    if (hasSVGRareData())
-        svgRareData()->setInstanceUpdatesBlocked(value);
-}
-
-AffineTransform SVGStyledElement::localCoordinateSpaceTransform(SVGLocatable::CTMScope) const
-{
-    // To be overriden by SVGGraphicsElement (or as special case SVGTextElement and SVGPatternElement)
-    return AffineTransform();
-}
-
-void SVGStyledElement::updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement* element)
-{
-    // If we're not yet in a document, this function will be called again from insertedInto(). Do nothing now.
-    if (!inDocument())
-        return;
-
-    // An element wants to notify us that its own relative lengths state changed.
-    // Register it in the relative length map, and register us in the parent relative length map.
-    // Register the parent in the grandparents map, etc. Repeat procedure until the root of the SVG tree.
-
-    if (hasRelativeLengths)
-        m_elementsWithRelativeLengths.add(element);
-    else {
-        if (!m_elementsWithRelativeLengths.contains(element)) {
-            // We were never registered. Do nothing.
-            return;
-        }
-
-        m_elementsWithRelativeLengths.remove(element);
-    }
-
-    // Find first styled parent node, and notify it that we've changed our relative length state.
-    ContainerNode* node = parentNode();
-    while (node) {
-        if (!node->isSVGElement())
-            break;
-
-        SVGElement* element = toSVGElement(node);
-        if (!element->isSVGStyledElement()) {
-            node = node->parentNode();
-            continue;
-        }
-
-        // Register us in the parent element map.
-        toSVGStyledElement(element)->updateRelativeLengthsInformation(hasRelativeLengths, this);
-        break;
-    }
-}
-
-bool SVGStyledElement::isMouseFocusable() const
-{
-    if (!isFocusable())
-        return false;
-    Element* eventTarget = const_cast<SVGStyledElement *>(this);
-    return eventTarget->hasEventListeners(eventNames().focusinEvent) || eventTarget->hasEventListeners(eventNames().focusoutEvent);
-}
-
-bool SVGStyledElement::isKeyboardFocusable(KeyboardEvent*) const
-{
-    return isMouseFocusable();
-}
-
-}
-
-#endif // ENABLE(SVG)
diff --git a/Source/WebCore/svg/SVGStyledElement.h b/Source/WebCore/svg/SVGStyledElement.h
deleted file mode 100644
index 38c947c..0000000
--- a/Source/WebCore/svg/SVGStyledElement.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006, 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
- * Copyright (C) 2004, 2005, 2007 Rob Buis <buis@kde.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef SVGStyledElement_h
-#define SVGStyledElement_h
-
-#if ENABLE(SVG)
-#include "CSSPropertyNames.h"
-#include "SVGAnimatedString.h"
-#include "SVGElement.h"
-#include "SVGLocatable.h"
-#include <wtf/HashSet.h>
-#include <wtf/PassRefPtr.h>
-
-namespace WebCore {
-
-void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, CSSPropertyID>* propertyNameToIdMap, const QualifiedName& attrName);
-
-class CSSValue;
-class CSSStyleDeclaration;
-
-// FIXME(webkit.org/b/107386): SVGStyledElement should be merged into SVGElement as specified by SVG2.
-class SVGStyledElement : public SVGElement {
-public:
-    virtual String title() const OVERRIDE;
-
-    bool hasRelativeLengths() const { return !m_elementsWithRelativeLengths.isEmpty(); }
-
-    virtual bool supportsMarkers() const { return false; }
-
-    PassRefPtr<CSSValue> getPresentationAttribute(const String& name);
-
-    bool isKnownAttribute(const QualifiedName&);
-
-    bool instanceUpdatesBlocked() const;
-    void setInstanceUpdatesBlocked(bool);
-
-    virtual void animatedPropertyTypeForAttribute(const QualifiedName&, Vector<AnimatedPropertyType>&);
-    static bool isAnimatableCSSProperty(const QualifiedName&);
-
-    virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const;
-
-    virtual bool needsPendingResourceHandling() const { return true; }
-
-protected: 
-    SVGStyledElement(const QualifiedName&, Document*);
-    virtual bool rendererIsNeeded(const RenderStyle&);
-
-    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;
-    virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
-    virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) OVERRIDE;
-    virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
-
-    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
-    virtual void removedFrom(ContainerNode*) OVERRIDE;
-    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
-
-    static CSSPropertyID cssPropertyIdForSVGAttributeName(const QualifiedName&);
-    void updateRelativeLengthsInformation() { updateRelativeLengthsInformation(selfHasRelativeLengths(), this); }
-    void updateRelativeLengthsInformation(bool hasRelativeLengths, SVGStyledElement*);
-
-    virtual bool selfHasRelativeLengths() const { return false; }
-
-private:
-    virtual bool isSVGStyledElement() const OVERRIDE FINAL { return true; }
-
-    virtual bool isKeyboardFocusable(KeyboardEvent*) const OVERRIDE;
-    virtual bool isMouseFocusable() const OVERRIDE;
-
-    void buildPendingResourcesIfNeeded();
-
-    HashSet<SVGStyledElement*> m_elementsWithRelativeLengths;
-
-    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGStyledElement)
-        DECLARE_ANIMATED_STRING(ClassName, className)
-    END_DECLARE_ANIMATED_PROPERTIES
-};
-
-inline SVGStyledElement* toSVGStyledElement(Node* node)
-{
-    ASSERT_WITH_SECURITY_IMPLICATION(!node || (node->isStyledElement() && node->isSVGElement()));
-    return static_cast<SVGStyledElement*>(node);
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(SVG)
-#endif // SVGStyledElement
diff --git a/Source/WebCore/svg/SVGStyledElement.idl b/Source/WebCore/svg/SVGStyledElement.idl
deleted file mode 100644
index f7f9490..0000000
--- a/Source/WebCore/svg/SVGStyledElement.idl
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
- * Copyright (C) 2007 Rob Buis <rwlbuis@gmail.com>
- * Copyright (C) 2006 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
- */
-
-[
-    NoInterfaceObject,
-    Conditional=SVG
-] interface SVGStyledElement : SVGElement {
-    readonly attribute SVGAnimatedString className;
-    readonly attribute CSSStyleDeclaration style;
-
-    CSSValue getPresentationAttribute([Default=Undefined] optional DOMString name);
-};
-
diff --git a/Source/WebCore/svg/SVGSymbolElement.cpp b/Source/WebCore/svg/SVGSymbolElement.cpp
index ddc7675..2d6d05d 100644
--- a/Source/WebCore/svg/SVGSymbolElement.cpp
+++ b/Source/WebCore/svg/SVGSymbolElement.cpp
@@ -39,11 +39,11 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
     REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) 
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGSymbolElement::SVGSymbolElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
 {
     ASSERT(hasTagName(SVGNames::symbolTag));
     registerAnimatedPropertiesForSVGSymbolElement();
@@ -68,7 +68,7 @@
 void SVGSymbolElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (!isSupportedAttribute(name)) {
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
         return;
     }
 
@@ -85,7 +85,7 @@
 void SVGSymbolElement::svgAttributeChanged(const QualifiedName& attrName)
 {
     if (!isSupportedAttribute(attrName)) {
-        SVGStyledElement::svgAttributeChanged(attrName);
+        SVGElement::svgAttributeChanged(attrName);
         return;
     }
 
diff --git a/Source/WebCore/svg/SVGSymbolElement.h b/Source/WebCore/svg/SVGSymbolElement.h
index 6bbdfd7..d3e24f5 100644
--- a/Source/WebCore/svg/SVGSymbolElement.h
+++ b/Source/WebCore/svg/SVGSymbolElement.h
@@ -25,13 +25,13 @@
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "SVGAnimatedRect.h"
+#include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGFitToViewBox.h"
-#include "SVGStyledElement.h"
 
 namespace WebCore {
 
-class SVGSymbolElement FINAL : public SVGStyledElement,
+class SVGSymbolElement FINAL : public SVGElement,
                                public SVGExternalResourcesRequired,
                                public SVGFitToViewBox {
 public:
diff --git a/Source/WebCore/svg/SVGSymbolElement.idl b/Source/WebCore/svg/SVGSymbolElement.idl
index 17914ef..75b9913 100644
--- a/Source/WebCore/svg/SVGSymbolElement.idl
+++ b/Source/WebCore/svg/SVGSymbolElement.idl
@@ -25,7 +25,7 @@
 
 [
     Conditional=SVG
-] interface SVGSymbolElement : SVGStyledElement {
+] interface SVGSymbolElement : SVGElement {
 };
 
 SVGSymbolElement implements SVGExternalResourcesRequired;
diff --git a/Source/WebCore/svg/SVGTRefElement.cpp b/Source/WebCore/svg/SVGTRefElement.cpp
index 6fdbf9a5..7fe07a7 100644
--- a/Source/WebCore/svg/SVGTRefElement.cpp
+++ b/Source/WebCore/svg/SVGTRefElement.cpp
@@ -277,7 +277,7 @@
 
 Node::InsertionNotificationRequest SVGTRefElement::insertedInto(ContainerNode* rootParent)
 {
-    SVGStyledElement::insertedInto(rootParent);
+    SVGElement::insertedInto(rootParent);
     if (rootParent->inDocument())
         buildPendingResource();
     return InsertionDone;
@@ -285,7 +285,7 @@
 
 void SVGTRefElement::removedFrom(ContainerNode* rootParent)
 {
-    SVGStyledElement::removedFrom(rootParent);
+    SVGElement::removedFrom(rootParent);
     if (rootParent->inDocument())
         m_targetListener->detach();
 }
diff --git a/Source/WebCore/svg/SVGTitleElement.cpp b/Source/WebCore/svg/SVGTitleElement.cpp
index 51706f0..ae939a9 100644
--- a/Source/WebCore/svg/SVGTitleElement.cpp
+++ b/Source/WebCore/svg/SVGTitleElement.cpp
@@ -28,7 +28,7 @@
 namespace WebCore {
 
 inline SVGTitleElement::SVGTitleElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
 {
     ASSERT(hasTagName(SVGNames::titleTag));
 }
@@ -40,7 +40,7 @@
 
 Node::InsertionNotificationRequest SVGTitleElement::insertedInto(ContainerNode* rootParent)
 {
-    SVGStyledElement::insertedInto(rootParent);
+    SVGElement::insertedInto(rootParent);
     if (!rootParent->inDocument())
         return InsertionDone;
     if (firstChild())
diff --git a/Source/WebCore/svg/SVGTitleElement.h b/Source/WebCore/svg/SVGTitleElement.h
index 0e3b99d..e4de48c 100644
--- a/Source/WebCore/svg/SVGTitleElement.h
+++ b/Source/WebCore/svg/SVGTitleElement.h
@@ -22,11 +22,11 @@
 #define SVGTitleElement_h
 #if ENABLE(SVG)
 
-#include "SVGStyledElement.h"
+#include "SVGElement.h"
 
 namespace WebCore {
 
-class SVGTitleElement FINAL : public SVGStyledElement {
+class SVGTitleElement FINAL : public SVGElement {
 public:
     static PassRefPtr<SVGTitleElement> create(const QualifiedName&, Document*);
 
diff --git a/Source/WebCore/svg/SVGTitleElement.idl b/Source/WebCore/svg/SVGTitleElement.idl
index 9895c7a..8b506c9 100644
--- a/Source/WebCore/svg/SVGTitleElement.idl
+++ b/Source/WebCore/svg/SVGTitleElement.idl
@@ -25,6 +25,6 @@
 
 [
     Conditional=SVG
-] interface SVGTitleElement : SVGStyledElement {
+] interface SVGTitleElement : SVGElement {
 };
 
diff --git a/Source/WebCore/svg/SVGTransformable.cpp b/Source/WebCore/svg/SVGTransformable.cpp
index 094ced9..99c55375 100644
--- a/Source/WebCore/svg/SVGTransformable.cpp
+++ b/Source/WebCore/svg/SVGTransformable.cpp
@@ -26,9 +26,9 @@
 
 #include "AffineTransform.h"
 #include "FloatConversion.h"
+#include "SVGElement.h"
 #include "SVGNames.h"
 #include "SVGParserUtilities.h"
-#include "SVGStyledElement.h"
 #include "SVGTransformList.h"
 
 namespace WebCore {
diff --git a/Source/WebCore/svg/SVGUseElement.cpp b/Source/WebCore/svg/SVGUseElement.cpp
index d0cbe70..d6b674b 100644
--- a/Source/WebCore/svg/SVGUseElement.cpp
+++ b/Source/WebCore/svg/SVGUseElement.cpp
@@ -940,10 +940,10 @@
         return false;
 
     SVGElement* element = m_targetElementInstance->correspondingElement();
-    if (!element || !element->isSVGStyledElement())
+    if (!element)
         return false;
 
-    return toSVGStyledElement(element)->hasRelativeLengths();
+    return element->hasRelativeLengths();
 }
 
 void SVGUseElement::notifyFinished(CachedResource* resource)
diff --git a/Source/WebCore/svg/SVGViewElement.cpp b/Source/WebCore/svg/SVGViewElement.cpp
index 7d010a4..e823dea 100644
--- a/Source/WebCore/svg/SVGViewElement.cpp
+++ b/Source/WebCore/svg/SVGViewElement.cpp
@@ -40,11 +40,11 @@
     REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired)
     REGISTER_LOCAL_ANIMATED_PROPERTY(viewBox)
     REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio)
-    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledElement)
+    REGISTER_PARENT_ANIMATED_PROPERTIES(SVGElement)
 END_REGISTER_ANIMATED_PROPERTIES
 
 inline SVGViewElement::SVGViewElement(const QualifiedName& tagName, Document* document)
-    : SVGStyledElement(tagName, document)
+    : SVGElement(tagName, document)
     , m_zoomAndPan(SVGZoomAndPanMagnify)
     , m_viewTarget(SVGNames::viewTargetAttr)
 {
@@ -72,7 +72,7 @@
 void SVGViewElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
     if (!isSupportedAttribute(name)) {
-        SVGStyledElement::parseAttribute(name, value);
+        SVGElement::parseAttribute(name, value);
         return;
     }
 
diff --git a/Source/WebCore/svg/SVGViewElement.h b/Source/WebCore/svg/SVGViewElement.h
index 4d2e603..983f984 100644
--- a/Source/WebCore/svg/SVGViewElement.h
+++ b/Source/WebCore/svg/SVGViewElement.h
@@ -25,23 +25,23 @@
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "SVGAnimatedRect.h"
+#include "SVGElement.h"
 #include "SVGExternalResourcesRequired.h"
 #include "SVGFitToViewBox.h"
 #include "SVGStringList.h"
-#include "SVGStyledElement.h"
 #include "SVGZoomAndPan.h"
 
 namespace WebCore {
 
-class SVGViewElement FINAL : public SVGStyledElement,
+class SVGViewElement FINAL : public SVGElement,
                              public SVGExternalResourcesRequired,
                              public SVGFitToViewBox,
                              public SVGZoomAndPan {
 public:
     static PassRefPtr<SVGViewElement> create(const QualifiedName&, Document*);
 
-    using SVGStyledElement::ref;
-    using SVGStyledElement::deref;
+    using SVGElement::ref;
+    using SVGElement::deref;
 
     SVGStringList& viewTarget() { return m_viewTarget; }
     SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }
diff --git a/Source/WebCore/svg/animation/SVGSMILElement.h b/Source/WebCore/svg/animation/SVGSMILElement.h
index 16ba838..f7150f3 100644
--- a/Source/WebCore/svg/animation/SVGSMILElement.h
+++ b/Source/WebCore/svg/animation/SVGSMILElement.h
@@ -116,6 +116,8 @@
 
     void setInactive() { m_activeState = Inactive; }
 
+    virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
+
     // Sub-classes may need to take action when the target is changed.
     virtual void setTargetElement(SVGElement*);
     virtual void setAttributeName(const QualifiedName&);
diff --git a/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp b/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp
index 092736d..57b8545 100644
--- a/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp
+++ b/Source/WebCore/svg/graphics/filters/SVGFEImage.cpp
@@ -30,10 +30,10 @@
 #include "GraphicsContext.h"
 #include "RenderObject.h"
 #include "RenderTreeAsText.h"
+#include "SVGElement.h"
 #include "SVGFilter.h"
 #include "SVGPreserveAspectRatio.h"
 #include "SVGRenderingContext.h"
-#include "SVGStyledElement.h"
 #include "SVGURIReference.h"
 #include "TextStream.h"
 
@@ -126,7 +126,7 @@
         resultImage->context()->concatCTM(absoluteTransform);
 
         SVGElement* contextNode = toSVGElement(renderer->node());
-        if (contextNode->isSVGStyledElement() && toSVGStyledElement(contextNode)->hasRelativeLengths()) {
+        if (contextNode->hasRelativeLengths()) {
             SVGLengthContext lengthContext(contextNode);
             float width = 0;
             float height = 0;