Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / SVGRectElement.cpp
index 1a3399e..bf03bbb 100644 (file)
  */
 
 #include "config.h"
-
 #include "core/svg/SVGRectElement.h"
 
 #include "core/rendering/svg/RenderSVGRect.h"
-#include "core/rendering/svg/RenderSVGResource.h"
-#include "core/svg/SVGElementInstance.h"
 #include "core/svg/SVGLength.h"
 
-namespace WebCore {
+namespace blink {
 
 inline SVGRectElement::SVGRectElement(Document& document)
     : SVGGeometryElement(SVGNames::rectTag, document)
@@ -38,8 +35,6 @@ inline SVGRectElement::SVGRectElement(Document& document)
     , m_rx(SVGAnimatedLength::create(this, SVGNames::rxAttr, SVGLength::create(LengthModeWidth), ForbidNegativeLengths))
     , m_ry(SVGAnimatedLength::create(this, SVGNames::ryAttr, SVGLength::create(LengthModeHeight), ForbidNegativeLengths))
 {
-    ScriptWrappable::init(this);
-
     addToPropertyMap(m_x);
     addToPropertyMap(m_y);
     addToPropertyMap(m_width);
@@ -48,10 +43,7 @@ inline SVGRectElement::SVGRectElement(Document& document)
     addToPropertyMap(m_ry);
 }
 
-PassRefPtr<SVGRectElement> SVGRectElement::create(Document& document)
-{
-    return adoptRef(new SVGRectElement(document));
-}
+DEFINE_NODE_FACTORY(SVGRectElement)
 
 bool SVGRectElement::isSupportedAttribute(const QualifiedName& attrName)
 {
@@ -69,26 +61,7 @@ bool SVGRectElement::isSupportedAttribute(const QualifiedName& attrName)
 
 void SVGRectElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
 {
-    SVGParsingError parseError = NoError;
-
-    if (!isSupportedAttribute(name))
-        SVGGeometryElement::parseAttribute(name, value);
-    else if (name == SVGNames::xAttr)
-        m_x->setBaseValueAsString(value, parseError);
-    else if (name == SVGNames::yAttr)
-        m_y->setBaseValueAsString(value, parseError);
-    else if (name == SVGNames::rxAttr)
-        m_rx->setBaseValueAsString(value, parseError);
-    else if (name == SVGNames::ryAttr)
-        m_ry->setBaseValueAsString(value, parseError);
-    else if (name == SVGNames::widthAttr)
-        m_width->setBaseValueAsString(value, parseError);
-    else if (name == SVGNames::heightAttr)
-        m_height->setBaseValueAsString(value, parseError);
-    else
-        ASSERT_NOT_REACHED();
-
-    reportAttributeParsingError(parseError, name, value);
+    parseAttributeNew(name, value);
 }
 
 void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
@@ -98,7 +71,7 @@ void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
         return;
     }
 
-    SVGElementInstance::InvalidationGuard invalidationGuard(this);
+    SVGElement::InvalidationGuard invalidationGuard(this);
 
     bool isLengthAttribute = attrName == SVGNames::xAttr
                           || attrName == SVGNames::yAttr
@@ -116,7 +89,7 @@ void SVGRectElement::svgAttributeChanged(const QualifiedName& attrName)
 
     if (isLengthAttribute) {
         renderer->setNeedsShapeUpdate();
-        RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer);
+        markForLayoutAndParentResourceInvalidation(renderer);
         return;
     }
 
@@ -138,4 +111,4 @@ RenderObject* SVGRectElement::createRenderer(RenderStyle*)
     return new RenderSVGRect(this);
 }
 
-}
+} // namespace blink