Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / svg / SVGSVGElement.h
index 0941693..4b0130f 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
  * Copyright (C) 2004, 2005, 2006, 2007, 2010 Rob Buis <buis@kde.org>
+ * Copyright (C) 2014 Google, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
 #include "core/svg/SVGPointTearOff.h"
 #include "core/svg/SVGZoomAndPan.h"
 
-namespace WebCore {
+namespace blink {
 
-class SVGAngle;
-class SVGMatrix;
+class SVGMatrixTearOff;
+class SVGAngleTearOff;
 class SVGNumberTearOff;
-class SVGTransform;
+class SVGTransformTearOff;
 class SVGViewSpec;
 class SVGViewElement;
 class SMILTimeContainer;
@@ -42,21 +43,16 @@ class SMILTimeContainer;
 class SVGSVGElement FINAL : public SVGGraphicsElement,
                             public SVGFitToViewBox,
                             public SVGZoomAndPan {
+    DEFINE_WRAPPERTYPEINFO();
 public:
-    static PassRefPtr<SVGSVGElement> create(Document&);
+    DECLARE_NODE_FACTORY(SVGSVGElement);
 
+#if !ENABLE(OILPAN)
     using SVGGraphicsElement::ref;
     using SVGGraphicsElement::deref;
-
-    virtual bool supportsFocus() const OVERRIDE { return hasFocusEventListeners(); }
+#endif
 
     // 'SVGSVGElement' functions
-    const AtomicString& contentScriptType() const;
-    void setContentScriptType(const AtomicString& type);
-
-    const AtomicString& contentStyleType() const;
-    void setContentStyleType(const AtomicString& type);
-
     PassRefPtr<SVGRectTearOff> viewport() const;
 
     float pixelUnitToMillimeterX() const;
@@ -67,14 +63,8 @@ public:
     bool useCurrentView() const { return m_useCurrentView; }
     SVGViewSpec* currentView();
 
-    enum ConsiderCSSMode {
-        RespectCSSProperties,
-        IgnoreCSSProperties
-    };
-
-    // RenderSVGRoot wants to query the intrinsic size, by only examining the width/height attributes.
-    Length intrinsicWidth(ConsiderCSSMode = RespectCSSProperties) const;
-    Length intrinsicHeight(ConsiderCSSMode = RespectCSSProperties) const;
+    Length intrinsicWidth() const;
+    Length intrinsicHeight() const;
     FloatSize currentViewportSize() const;
     FloatRect currentViewBoxRect() const;
 
@@ -100,42 +90,42 @@ public:
     void unsuspendRedrawAll() { }
     void forceRedraw() { }
 
-    PassRefPtr<NodeList> getIntersectionList(PassRefPtr<SVGRectTearOff>, SVGElement* referenceElement) const;
-    PassRefPtr<NodeList> getEnclosureList(PassRefPtr<SVGRectTearOff>, SVGElement* referenceElement) const;
+    PassRefPtrWillBeRawPtr<StaticNodeList> getIntersectionList(PassRefPtr<SVGRectTearOff>, SVGElement* referenceElement) const;
+    PassRefPtrWillBeRawPtr<StaticNodeList> getEnclosureList(PassRefPtr<SVGRectTearOff>, SVGElement* referenceElement) const;
     bool checkIntersection(SVGElement*, PassRefPtr<SVGRectTearOff>) const;
     bool checkEnclosure(SVGElement*, PassRefPtr<SVGRectTearOff>) const;
     void deselectAll();
 
     static PassRefPtr<SVGNumberTearOff> createSVGNumber();
     static PassRefPtr<SVGLengthTearOff> createSVGLength();
-    static SVGAngle createSVGAngle();
+    static PassRefPtr<SVGAngleTearOff> createSVGAngle();
     static PassRefPtr<SVGPointTearOff> createSVGPoint();
-    static SVGMatrix createSVGMatrix();
+    static PassRefPtr<SVGMatrixTearOff> createSVGMatrix();
     static PassRefPtr<SVGRectTearOff> createSVGRect();
-    static SVGTransform createSVGTransform();
-    static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&);
+    static PassRefPtr<SVGTransformTearOff> createSVGTransform();
+    static PassRefPtr<SVGTransformTearOff> createSVGTransformFromMatrix(PassRefPtr<SVGMatrixTearOff>);
 
     AffineTransform viewBoxToViewTransform(float viewWidth, float viewHeight) const;
 
     void setupInitialView(const String& fragmentIdentifier, Element* anchorNode);
 
-    Element* getElementById(const AtomicString&) const;
-
-    bool widthAttributeEstablishesViewport() const;
-    bool heightAttributeEstablishesViewport() const;
+    bool hasIntrinsicWidth() const;
+    bool hasIntrinsicHeight() const;
 
     SVGAnimatedLength* x() const { return m_x.get(); }
     SVGAnimatedLength* y() const { return m_y.get(); }
     SVGAnimatedLength* width() const { return m_width.get(); }
     SVGAnimatedLength* height() const { return m_height.get(); }
 
+    virtual void trace(Visitor*) OVERRIDE;
+
 private:
     explicit SVGSVGElement(Document&);
     virtual ~SVGSVGElement();
 
-    virtual bool isSVGSVGElement() const OVERRIDE { return true; }
-
     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 bool rendererIsNeeded(const RenderStyle&) OVERRIDE;
     virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
@@ -151,37 +141,31 @@ private:
 
     void updateCurrentTranslate();
 
-    enum CollectIntersectionOrEnclosure {
-        CollectIntersectionList,
-        CollectEnclosureList
+    virtual void finishParsingChildren() OVERRIDE;
+
+    enum CheckIntersectionOrEnclosure {
+        CheckIntersection,
+        CheckEnclosure
     };
 
-    PassRefPtr<NodeList> collectIntersectionOrEnclosureList(const FloatRect&, SVGElement*, CollectIntersectionOrEnclosure) const;
+    bool checkIntersectionOrEnclosure(const SVGElement&, const FloatRect&, CheckIntersectionOrEnclosure) const;
+    PassRefPtrWillBeRawPtr<StaticNodeList> collectIntersectionOrEnclosureList(const FloatRect&, SVGElement*, CheckIntersectionOrEnclosure) const;
 
     RefPtr<SVGAnimatedLength> m_x;
     RefPtr<SVGAnimatedLength> m_y;
     RefPtr<SVGAnimatedLength> m_width;
     RefPtr<SVGAnimatedLength> m_height;
-    BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement)
-    END_DECLARE_ANIMATED_PROPERTIES
 
     virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const OVERRIDE;
 
     bool m_useCurrentView;
-    RefPtr<SMILTimeContainer> m_timeContainer;
+    RefPtrWillBeMember<SMILTimeContainer> m_timeContainer;
     RefPtr<SVGPoint> m_translation;
-    RefPtr<SVGViewSpec> m_viewSpec;
+    RefPtrWillBeMember<SVGViewSpec> m_viewSpec;
 
     friend class SVGCurrentTranslateTearOff;
 };
 
-inline bool isSVGSVGElement(const Node& node)
-{
-    return node.isSVGElement() && toSVGElement(node).isSVGSVGElement();
-}
+} // namespace blink
 
-DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSVGElement);
-
-} // namespace WebCore
-
-#endif
+#endif // SVGSVGElement_h