#ifndef RenderSVGRoot_h
#define RenderSVGRoot_h
#if ENABLE(SVG)
#include "FloatRect.h"
#include "RenderReplaced.h"
#include "SVGRenderSupport.h"
namespace WebCore {
class AffineTransform;
class SVGStyledElement;
class RenderSVGRoot : public RenderReplaced {
public:
explicit RenderSVGRoot(SVGStyledElement*);
virtual ~RenderSVGRoot();
bool isEmbeddedThroughSVGImage() const;
bool isEmbeddedThroughFrameContainingSVGDocument() const;
virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const;
const RenderObjectChildList* children() const { return &m_children; }
RenderObjectChildList* children() { return &m_children; }
bool isLayoutSizeChanged() const { return m_isLayoutSizeChanged; }
virtual void setNeedsBoundariesUpdate() { m_needsBoundariesOrTransformUpdate = true; }
virtual bool needsBoundariesUpdate() OVERRIDE { return m_needsBoundariesOrTransformUpdate; }
virtual void setNeedsTransformUpdate() { m_needsBoundariesOrTransformUpdate = true; }
IntSize containerSize() const { return m_containerSize; }
void setContainerSize(const IntSize& containerSize) { m_containerSize = containerSize; }
virtual bool hasRelativeDimensions() const;
virtual bool hasRelativeLogicalHeight() const;
const AffineTransform& localToBorderBoxTransform() const { return m_localToBorderBoxTransform; }
static void addResourceForClientInvalidation(RenderSVGResourceContainer*);
bool hasSVGShadow() const { return m_hasSVGShadow; }
void setHasSVGShadow(bool hasShadow) { m_hasSVGShadow = hasShadow; }
private:
virtual RenderObjectChildList* virtualChildren() { return children(); }
virtual const RenderObjectChildList* virtualChildren() const { return children(); }
virtual bool isSVGRoot() const { return true; }
virtual const char* renderName() const { return "RenderSVGRoot"; }
virtual LayoutUnit computeReplacedLogicalWidth(bool includeMaxWidth = true) const;
virtual LayoutUnit computeReplacedLogicalHeight() const;
virtual void layout();
virtual void paintReplaced(PaintInfo&, const LayoutPoint&);
virtual void willBeDestroyed();
virtual void styleWillChange(StyleDifference, const RenderStyle* newStyle);
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);
virtual void updateFromElement();
virtual const AffineTransform& localToParentTransform() const;
bool fillContains(const FloatPoint&) const;
bool strokeContains(const FloatPoint&) const;
virtual FloatRect objectBoundingBox() const { return m_objectBoundingBox; }
virtual FloatRect strokeBoundingBox() const { return m_strokeBoundingBox; }
virtual FloatRect repaintRectInLocalCoordinates() const { return m_repaintBoundingBox; }
virtual FloatRect repaintRectInLocalCoordinatesExcludingSVGShadow() const { return m_repaintBoundingBoxExcludingShadow; }
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const LayoutPoint& pointInContainer, const LayoutPoint& accumulatedOffset, HitTestAction);
virtual LayoutRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const;
virtual void computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const;
virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, ApplyContainerFlipOrNot = ApplyContainerFlip, bool* wasFixed = 0) const;
virtual const RenderObject* pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap&) const;
virtual bool canBeSelectionLeaf() const { return false; }
virtual bool canHaveChildren() const { return true; }
void updateCachedBoundaries();
void buildLocalToBorderBoxTransform();
RenderObjectChildList m_children;
IntSize m_containerSize;
FloatRect m_objectBoundingBox;
bool m_objectBoundingBoxValid;
FloatRect m_strokeBoundingBox;
FloatRect m_repaintBoundingBox;
FloatRect m_repaintBoundingBoxExcludingShadow;
mutable AffineTransform m_localToParentTransform;
AffineTransform m_localToBorderBoxTransform;
HashSet<RenderSVGResourceContainer*> m_resourcesNeedingToInvalidateClients;
bool m_isLayoutSizeChanged : 1;
bool m_needsBoundariesOrTransformUpdate : 1;
bool m_hasSVGShadow : 1;
};
inline RenderSVGRoot* toRenderSVGRoot(RenderObject* object)
{
ASSERT(!object || object->isSVGRoot());
return static_cast<RenderSVGRoot*>(object);
}
inline const RenderSVGRoot* toRenderSVGRoot(const RenderObject* object)
{
ASSERT(!object || object->isSVGRoot());
return static_cast<const RenderSVGRoot*>(object);
}
void toRenderSVGRoot(const RenderSVGRoot*);
}
#endif // ENABLE(SVG)
#endif // RenderSVGRoot_h