summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h')
-rw-r--r--chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h150
1 files changed, 64 insertions, 86 deletions
diff --git a/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h b/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h
index 65f8c69c30e..96ef6a1357d 100644
--- a/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h
+++ b/chromium/third_party/WebKit/Source/core/svg/SVGSVGElement.h
@@ -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
@@ -23,44 +24,35 @@
#include "core/svg/SVGAnimatedBoolean.h"
#include "core/svg/SVGAnimatedLength.h"
-#include "core/svg/SVGAnimatedPreserveAspectRatio.h"
-#include "core/svg/SVGAnimatedRect.h"
-#include "core/svg/SVGExternalResourcesRequired.h"
#include "core/svg/SVGFitToViewBox.h"
#include "core/svg/SVGGraphicsElement.h"
+#include "core/svg/SVGLengthTearOff.h"
+#include "core/svg/SVGPointTearOff.h"
#include "core/svg/SVGZoomAndPan.h"
-#include "wtf/WeakPtr.h"
namespace WebCore {
-class SVGAngle;
-class SVGMatrix;
-class SVGTransform;
+class SVGMatrixTearOff;
+class SVGAngleTearOff;
+class SVGNumberTearOff;
+class SVGTransformTearOff;
class SVGViewSpec;
class SVGViewElement;
class SMILTimeContainer;
class SVGSVGElement FINAL : public SVGGraphicsElement,
- public SVGExternalResourcesRequired,
public SVGFitToViewBox,
public SVGZoomAndPan {
public:
- static PassRefPtr<SVGSVGElement> create(Document&);
+ DECLARE_NODE_FACTORY(SVGSVGElement);
+#if !ENABLE(OILPAN)
using SVGGraphicsElement::ref;
using SVGGraphicsElement::deref;
-
- virtual bool isValid() const { return SVGTests::isValid(); }
- 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);
-
- SVGRect viewport() const;
+ PassRefPtr<SVGRectTearOff> viewport() const;
float pixelUnitToMillimeterX() const;
float pixelUnitToMillimeterY() const;
@@ -70,25 +62,17 @@ 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;
- SVGRect currentViewBoxRect() const;
+ FloatRect currentViewBoxRect() const;
float currentScale() const;
void setCurrentScale(float scale);
- SVGPoint& currentTranslate() { return m_translation; }
+ FloatPoint currentTranslate() { return m_translation->value(); }
void setCurrentTranslate(const FloatPoint&);
-
- // Only used from the bindings.
- void updateCurrentTranslate();
+ PassRefPtr<SVGPointTearOff> currentTranslateFromJavascript();
SMILTimeContainer* timeContainer() const { return m_timeContainer.get(); }
@@ -99,93 +83,87 @@ public:
float getCurrentTime() const;
void setCurrentTime(float seconds);
- unsigned suspendRedraw(unsigned maxWaitMilliseconds);
- void unsuspendRedraw(unsigned suspendHandleId);
- void unsuspendRedrawAll();
- void forceRedraw();
+ // Stubs for the deprecated 'redraw' interface.
+ unsigned suspendRedraw(unsigned) { return 1; }
+ void unsuspendRedraw(unsigned) { }
+ void unsuspendRedrawAll() { }
+ void forceRedraw() { }
- PassRefPtr<NodeList> getIntersectionList(const SVGRect&, SVGElement* referenceElement) const;
- PassRefPtr<NodeList> getEnclosureList(const SVGRect&, SVGElement* referenceElement) const;
- bool checkIntersection(SVGElement*, const SVGRect&) const;
- bool checkEnclosure(SVGElement*, const SVGRect&) 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 float createSVGNumber();
- static SVGLength createSVGLength();
- static SVGAngle createSVGAngle();
- static SVGPoint createSVGPoint();
- static SVGMatrix createSVGMatrix();
- static SVGRect createSVGRect();
- static SVGTransform createSVGTransform();
- static SVGTransform createSVGTransformFromMatrix(const SVGMatrix&);
+ static PassRefPtr<SVGNumberTearOff> createSVGNumber();
+ static PassRefPtr<SVGLengthTearOff> createSVGLength();
+ static PassRefPtr<SVGAngleTearOff> createSVGAngle();
+ static PassRefPtr<SVGPointTearOff> createSVGPoint();
+ static PassRefPtr<SVGMatrixTearOff> createSVGMatrix();
+ static PassRefPtr<SVGRectTearOff> createSVGRect();
+ 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 hasIntrinsicWidth() const;
+ bool hasIntrinsicHeight() const;
- bool widthAttributeEstablishesViewport() const;
- bool heightAttributeEstablishesViewport() 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(); }
- SVGZoomAndPanType zoomAndPan() const { return m_zoomAndPan; }
- void setZoomAndPan(unsigned short zoomAndPan) { m_zoomAndPan = SVGZoomAndPan::parseFromNumber(zoomAndPan); }
-
- bool hasEmptyViewBox() const { return viewBoxCurrentValue().isValid() && viewBoxCurrentValue().isEmpty(); }
+ 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*);
+ virtual RenderObject* createRenderer(RenderStyle*) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
virtual void removedFrom(ContainerNode*) OVERRIDE;
- virtual void svgAttributeChanged(const QualifiedName&);
+ virtual void svgAttributeChanged(const QualifiedName&) OVERRIDE;
- virtual bool selfHasRelativeLengths() const;
+ virtual bool selfHasRelativeLengths() const OVERRIDE;
void inheritViewAttributes(SVGViewElement*);
- enum CollectIntersectionOrEnclosure {
- CollectIntersectionList,
- CollectEnclosureList
+ void updateCurrentTranslate();
+
+ virtual void finishParsingChildren() OVERRIDE;
+
+ enum CheckIntersectionOrEnclosure {
+ CheckIntersection,
+ CheckEnclosure
};
- PassRefPtr<NodeList> collectIntersectionOrEnclosureList(const SVGRect&, SVGElement*, CollectIntersectionOrEnclosure) const;
+ bool checkIntersectionOrEnclosure(const SVGElement&, const FloatRect&, CheckIntersectionOrEnclosure) const;
+ PassRefPtrWillBeRawPtr<StaticNodeList> collectIntersectionOrEnclosureList(const FloatRect&, SVGElement*, CheckIntersectionOrEnclosure) const;
- BEGIN_DECLARE_ANIMATED_PROPERTIES(SVGSVGElement)
- DECLARE_ANIMATED_LENGTH(X, x)
- DECLARE_ANIMATED_LENGTH(Y, y)
- DECLARE_ANIMATED_LENGTH(Width, width)
- DECLARE_ANIMATED_LENGTH(Height, height)
- DECLARE_ANIMATED_BOOLEAN(ExternalResourcesRequired, externalResourcesRequired)
- DECLARE_ANIMATED_RECT(ViewBox, viewBox)
- DECLARE_ANIMATED_PRESERVEASPECTRATIO(PreserveAspectRatio, preserveAspectRatio)
- END_DECLARE_ANIMATED_PROPERTIES
+ RefPtr<SVGAnimatedLength> m_x;
+ RefPtr<SVGAnimatedLength> m_y;
+ RefPtr<SVGAnimatedLength> m_width;
+ RefPtr<SVGAnimatedLength> m_height;
- virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const;
+ virtual AffineTransform localCoordinateSpaceTransform(SVGElement::CTMScope) const OVERRIDE;
bool m_useCurrentView;
- SVGZoomAndPanType m_zoomAndPan;
- RefPtr<SMILTimeContainer> m_timeContainer;
- SVGPoint m_translation;
- RefPtr<SVGViewSpec> m_viewSpec;
- WeakPtrFactory<SVGSVGElement> m_weakFactory;
-};
+ RefPtrWillBeMember<SMILTimeContainer> m_timeContainer;
+ RefPtr<SVGPoint> m_translation;
+ RefPtrWillBeMember<SVGViewSpec> m_viewSpec;
-inline bool isSVGSVGElement(const Node& node)
-{
- return node.isSVGElement() && toSVGElement(node).isSVGSVGElement();
-}
-
-DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSVGElement);
+ friend class SVGCurrentTranslateTearOff;
+};
} // namespace WebCore