summaryrefslogtreecommitdiff
path: root/Source/WebCore/rendering/svg/RenderSVGInline.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/rendering/svg/RenderSVGInline.cpp')
-rw-r--r--Source/WebCore/rendering/svg/RenderSVGInline.cpp55
1 files changed, 30 insertions, 25 deletions
diff --git a/Source/WebCore/rendering/svg/RenderSVGInline.cpp b/Source/WebCore/rendering/svg/RenderSVGInline.cpp
index f1f384e93..71489ad76 100644
--- a/Source/WebCore/rendering/svg/RenderSVGInline.cpp
+++ b/Source/WebCore/rendering/svg/RenderSVGInline.cpp
@@ -20,8 +20,6 @@
*/
#include "config.h"
-
-#if ENABLE(SVG)
#include "RenderSVGInline.h"
#include "RenderSVGInlineText.h"
@@ -32,8 +30,8 @@
namespace WebCore {
-RenderSVGInline::RenderSVGInline(SVGGraphicsElement& element, PassRef<RenderStyle> style)
- : RenderInline(element, std::move(style))
+RenderSVGInline::RenderSVGInline(SVGGraphicsElement& element, RenderStyle&& style)
+ : RenderInline(element, WTFMove(style))
{
setAlwaysCreateLineBoxes();
}
@@ -42,29 +40,29 @@ std::unique_ptr<InlineFlowBox> RenderSVGInline::createInlineFlowBox()
{
auto box = std::make_unique<SVGInlineFlowBox>(*this);
box->setHasVirtualLogicalHeight();
- return std::move(box);
+ return WTFMove(box);
}
FloatRect RenderSVGInline::objectBoundingBox() const
{
- if (const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this))
- return object->objectBoundingBox();
+ if (auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this))
+ return textAncestor->objectBoundingBox();
return FloatRect();
}
FloatRect RenderSVGInline::strokeBoundingBox() const
{
- if (const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this))
- return object->strokeBoundingBox();
+ if (auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this))
+ return textAncestor->strokeBoundingBox();
return FloatRect();
}
FloatRect RenderSVGInline::repaintRectInLocalCoordinates() const
{
- if (const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this))
- return object->repaintRectInLocalCoordinates();
+ if (auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this))
+ return textAncestor->repaintRectInLocalCoordinates();
return FloatRect();
}
@@ -74,9 +72,9 @@ LayoutRect RenderSVGInline::clippedOverflowRectForRepaint(const RenderLayerModel
return SVGRenderSupport::clippedOverflowRectForRepaint(*this, repaintContainer);
}
-void RenderSVGInline::computeFloatRectForRepaint(const RenderLayerModelObject* repaintContainer, FloatRect& repaintRect, bool fixed) const
+FloatRect RenderSVGInline::computeFloatRectForRepaint(const FloatRect& repaintRect, const RenderLayerModelObject* repaintContainer, bool fixed) const
{
- SVGRenderSupport::computeFloatRectForRepaint(*this, repaintContainer, repaintRect, fixed);
+ return SVGRenderSupport::computeFloatRectForRepaint(*this, repaintRect, repaintContainer, fixed);
}
void RenderSVGInline::mapLocalToContainer(const RenderLayerModelObject* repaintContainer, TransformState& transformState, MapCoordinatesFlags, bool* wasFixed) const
@@ -91,13 +89,13 @@ const RenderObject* RenderSVGInline::pushMappingToContainer(const RenderLayerMod
void RenderSVGInline::absoluteQuads(Vector<FloatQuad>& quads, bool* wasFixed) const
{
- const RenderObject* object = RenderSVGText::locateRenderSVGTextAncestor(this);
- if (!object)
+ auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this);
+ if (!textAncestor)
return;
- FloatRect textBoundingBox = object->strokeBoundingBox();
+ FloatRect textBoundingBox = textAncestor->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));
+ quads.append(localToAbsoluteQuad(FloatRect(textBoundingBox.x() + box->x(), textBoundingBox.y() + box->y(), box->logicalWidth(), box->logicalHeight()), UseTransforms, wasFixed));
}
void RenderSVGInline::willBeDestroyed()
@@ -114,30 +112,37 @@ void RenderSVGInline::styleDidChange(StyleDifference diff, const RenderStyle* ol
SVGResourcesCache::clientStyleChanged(*this, diff, style());
}
+void RenderSVGInline::updateFromStyle()
+{
+ RenderInline::updateFromStyle();
+
+ // SVG text layout code expects us to be an inline-level element.
+ setInline(true);
+}
+
void RenderSVGInline::addChild(RenderObject* child, RenderObject* beforeChild)
{
RenderInline::addChild(child, beforeChild);
SVGResourcesCache::clientWasAddedToTree(*child);
- if (RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(this))
- textRenderer->subtreeChildWasAdded(child);
+ if (auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this))
+ textAncestor->subtreeChildWasAdded(child);
}
void RenderSVGInline::removeChild(RenderObject& child)
{
SVGResourcesCache::clientWillBeRemovedFromTree(child);
- RenderSVGText* textRenderer = RenderSVGText::locateRenderSVGTextAncestor(this);
- if (!textRenderer) {
+ auto* textAncestor = RenderSVGText::locateRenderSVGTextAncestor(*this);
+ if (!textAncestor) {
RenderInline::removeChild(child);
return;
}
+
Vector<SVGTextLayoutAttributes*, 2> affectedAttributes;
- textRenderer->subtreeChildWillBeRemoved(&child, affectedAttributes);
+ textAncestor->subtreeChildWillBeRemoved(&child, affectedAttributes);
RenderInline::removeChild(child);
- textRenderer->subtreeChildWasRemoved(affectedAttributes);
+ textAncestor->subtreeChildWasRemoved(affectedAttributes);
}
}
-
-#endif // ENABLE(SVG)