RenderSVGInline.cpp [plain text]
#include "config.h"
#if ENABLE(SVG)
#include "RenderSVGInline.h"
#include "RenderSVGInlineText.h"
#include "RenderSVGResource.h"
#include "RenderSVGText.h"
#include "SVGInlineFlowBox.h"
#include "SVGResourcesCache.h"
namespace WebCore {
RenderSVGInline::RenderSVGInline(Node* n)
: RenderInline(n)
{
setAlwaysCreateLineBoxes();
}
InlineFlowBox* RenderSVGInline::createInlineFlowBox()
{
InlineFlowBox* box = new (renderArena()) SVGInlineFlowBox(this);
box->setHasVirtualLogicalHeight();
return box;
}
FloatRect RenderSVGInline::objectBoundingBox() const
{
if (const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this))
return object->objectBoundingBox();
return FloatRect();
}
FloatRect RenderSVGInline::strokeBoundingBox() const
{
if (const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this))
return object->strokeBoundingBox();
return FloatRect();
}
FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const
{
if (const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this))
return object->repaintRectInLocalCoordinates();
return FloatRect();
}
LayoutRect RenderSVGInline::clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer) const
{
return SVGRenderSupport::clippedOverflowRectForRepaint(this, repaintContainer);
}
void RenderSVGInline::computeFloatRectForRepaint(RenderBoxModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const
{
SVGRenderSupport::computeFloatRectForRepaint(this, repaintContainer, repaintRect, fixed);
}
void RenderSVGInline::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool , bool , TransformState& transformState, ApplyContainerFlipOrNot, bool* wasFixed) const
{
SVGRenderSupport::mapLocalToContainer(this, repaintContainer, transformState, wasFixed);
}
const RenderObject* RenderSVGInline::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const
{
return SVGRenderSupport::pushMappingToContainer(this, ancestorToStopAt, geometryMap);
}
void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
{
const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this);
if (!object)
return;
FloatRect textBoundingBox = object->strokeBoundingBox();
for (InlineFlowBox* box = firstLineBox(); box; box = box->nextLineBox())
quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight()), false, wasFixed));
}
void RenderSVGInline::willBeDestroyed()
{
SVGResourcesCache::clientDestroyed(this);
RenderInline::willBeDestroyed();
}
void RenderSVGInline::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
{
if (diff == StyleDifferenceLayout)
setNeedsBoundariesUpdate();
RenderInline::styleWillChange(diff, newStyle);
}
void RenderSVGInline::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle)
{
RenderInline::styleDidChange(diff, oldStyle);
SVGResourcesCache::clientStyleChanged(this, diff, style());
}
void RenderSVGInline::updateFromElement()
{
RenderInline::updateFromElement();
SVGResourcesCache::clientUpdatedFromElement(this, style());
}
void RenderSVGInline::addChild(RenderObject* child, RenderObject* beforeChild)
{
RenderInline::addChild(child, beforeChild);
if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(this))
textRenderer->layoutAttributesChanged(child);
}
}
#endif // ENABLE(SVG)