#ifndef RenderSVGRoot_h
#define RenderSVGRoot_h
#include "core/rendering/RenderReplaced.h"
#include "core/rendering/svg/SVGRenderSupport.h"
#include "platform/geometry/FloatRect.h"
namespace WebCore {
class AffineTransform;
class SVGElement;
class RenderSVGRoot FINAL : public RenderReplaced {
public:
explicit RenderSVGRoot(SVGElement*);
virtual ~RenderSVGRoot();
bool isEmbeddedThroughSVGImage() const;
bool isEmbeddedThroughFrameContainingSVGDocument() const;
virtual void computeIntrinsicRatioInformation(FloatSize& intrinsicSize, double& intrinsicRatio, bool& isPercentageIntrinsicSize) const OVERRIDE;
RenderObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); }
RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); }
const RenderObjectChildList* children() const { return &m_children; }
RenderObjectChildList* children() { return &m_children; }
bool isLayoutSizeChanged() const { return m_isLayoutSizeChanged; }
virtual void setNeedsBoundariesUpdate() OVERRIDE { m_needsBoundariesOrTransformUpdate = true; }
virtual void setNeedsTransformUpdate() OVERRIDE { m_needsBoundariesOrTransformUpdate = true; }
IntSize containerSize() const { return m_containerSize; }
void setContainerSize(const IntSize& containerSize)
{
if (m_containerSize != containerSize)
setNeedsLayout();
m_containerSize = containerSize;
}
virtual bool hasRelativeIntrinsicLogicalWidth() const OVERRIDE;
virtual bool hasRelativeLogicalHeight() const OVERRIDE;
virtual bool visibleForTouchAction() const OVERRIDE { return true; }
const AffineTransform& localToBorderBoxTransform() const { return m_localToBorderBoxTransform; }
private:
virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children(); }
virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { return children(); }
virtual const char* renderName() const OVERRIDE { return "RenderSVGRoot"; }
virtual bool isSVGRoot() const OVERRIDE { return true; }
virtual bool isSVG() const OVERRIDE { return true; }
virtual LayoutUnit computeReplacedLogicalWidth(ShouldComputePreferred = ComputeActual) const OVERRIDE;
virtual LayoutUnit computeReplacedLogicalHeight() const OVERRIDE;
virtual void layout() OVERRIDE;
virtual void paintReplaced(PaintInfo&, const LayoutPoint&) OVERRIDE;
virtual void willBeDestroyed() OVERRIDE;
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE;
virtual bool isChildAllowed(RenderObject*, RenderStyle*) const OVERRIDE;
virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) OVERRIDE;
virtual void removeChild(RenderObject*) OVERRIDE;
virtual bool canHaveWhitespaceChildren() const OVERRIDE { return false; }
virtual void insertedIntoTree() OVERRIDE;
virtual void willBeRemovedFromTree() OVERRIDE;
virtual const AffineTransform& localToParentTransform() const OVERRIDE;
virtual FloatRect objectBoundingBox() const OVERRIDE { return m_objectBoundingBox; }
virtual FloatRect strokeBoundingBox() const OVERRIDE { return m_strokeBoundingBox; }
virtual FloatRect repaintRectInLocalCoordinates() const OVERRIDE { return m_repaintBoundingBox; }
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) OVERRIDE;
virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const OVERRIDE;
virtual void computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const OVERRIDE;
virtual void mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState&, MapCoordinatesFlags = ApplyContainerFlip, bool* wasFixed = 0) const OVERRIDE;
virtual const RenderObject* pushMappingToContainer(const RenderLayerModelObject* ancestorToStopAt, RenderGeometryMap&) const OVERRIDE;
virtual bool canBeSelectionLeaf() const OVERRIDE { return false; }
virtual bool canHaveChildren() const OVERRIDE { return true; }
void updateCachedBoundaries();
void buildLocalToBorderBoxTransform();
RenderObjectChildList m_children;
IntSize m_containerSize;
FloatRect m_objectBoundingBox;
bool m_objectBoundingBoxValid;
FloatRect m_strokeBoundingBox;
FloatRect m_repaintBoundingBox;
mutable AffineTransform m_localToParentTransform;
AffineTransform m_localToBorderBoxTransform;
bool m_isLayoutSizeChanged : 1;
bool m_needsBoundariesOrTransformUpdate : 1;
};
DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderSVGRoot, isSVGRoot());
}
#endif