#include "core/rendering/svg/RenderSVGText.h"
+#include "core/editing/PositionWithAffinity.h"
#include "core/rendering/HitTestRequest.h"
#include "core/rendering/HitTestResult.h"
-#include "core/rendering/LayoutRepainter.h"
#include "core/rendering/PaintInfo.h"
#include "core/rendering/PointerEventsHitRules.h"
#include "core/rendering/style/ShadowList.h"
#include "platform/geometry/TransformState.h"
#include "platform/graphics/GraphicsContextStateSaver.h"
-namespace WebCore {
+namespace blink {
RenderSVGText::RenderSVGText(SVGTextElement* node)
: RenderSVGBlock(node)
return toRenderSVGText(start);
}
-void RenderSVGText::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, bool fixed) const
+void RenderSVGText::mapRectToPaintInvalidationBacking(const RenderLayerModelObject* paintInvalidationContainer, LayoutRect& rect, ViewportConstrainedPosition, const PaintInvalidationState* paintInvalidationState) const
{
- FloatRect repaintRect = rect;
- computeFloatRectForPaintInvalidation(paintInvalidationContainer, repaintRect, fixed);
- rect = enclosingLayoutRect(repaintRect);
+ FloatRect paintInvalidationRect = rect;
+ computeFloatRectForPaintInvalidation(paintInvalidationContainer, paintInvalidationRect, paintInvalidationState);
+ rect = enclosingLayoutRect(paintInvalidationRect);
}
static inline void collectLayoutAttributes(RenderObject* text, Vector<SVGTextLayoutAttributes*>& attributes)
}
}
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
// Verify that m_layoutAttributes only differs by a maximum of one entry.
for (size_t i = 0; i < size; ++i)
ASSERT(m_layoutAttributes.find(newLayoutAttributes[i]) != kNotFound || newLayoutAttributes[i] == attributes);
static inline void checkLayoutAttributesConsistency(RenderSVGText* text, Vector<SVGTextLayoutAttributes*>& expectedLayoutAttributes)
{
-#ifndef NDEBUG
+#if ENABLE(ASSERT)
Vector<SVGTextLayoutAttributes*> newLayoutAttributes;
collectLayoutAttributes(text, newLayoutAttributes);
ASSERT(newLayoutAttributes == expectedLayoutAttributes);
subtreeStyleDidChange();
- LayoutRepainter repainter(*this, SVGRenderSupport::checkForSVGRepaintDuringLayout(this));
-
bool updateCachedBoundariesInParents = false;
if (m_needsTransformUpdate) {
m_localTransform = toSVGTextElement(node())->animatedLocalTransform();
LayoutUnit afterEdge = borderAfter() + paddingAfter() + scrollbarLogicalHeight();
setLogicalHeight(beforeEdge);
- LayoutUnit repaintLogicalTop = 0;
- LayoutUnit repaintLogicalBottom = 0;
- layoutInlineChildren(true, repaintLogicalTop, repaintLogicalBottom, afterEdge);
+ LayoutUnit paintInvalidationLogicalTop = 0;
+ LayoutUnit paintInvalidationLogicalBottom = 0;
+ layoutInlineChildren(true, paintInvalidationLogicalTop, paintInvalidationLogicalBottom, afterEdge);
if (m_needsReordering)
m_needsReordering = false;
if (updateCachedBoundariesInParents)
RenderSVGBlock::setNeedsBoundariesUpdate();
- repainter.repaintAfterLayout();
clearNeedsLayout();
}
bool isVisible = (style()->visibility() == VISIBLE);
if (isVisible || !hitRules.requireVisible) {
if ((hitRules.canHitBoundingBox && !objectBoundingBox().isEmpty())
- || (hitRules.canHitStroke && (style()->svgStyle()->hasStroke() || !hitRules.requireStroke))
- || (hitRules.canHitFill && (style()->svgStyle()->hasFill() || !hitRules.requireFill))) {
- FloatPoint localPoint = localToParentTransform().inverse().mapPoint(pointInParent);
-
- if (!SVGRenderSupport::pointInClippingArea(this, localPoint))
+ || (hitRules.canHitStroke && (style()->svgStyle().hasStroke() || !hitRules.requireStroke))
+ || (hitRules.canHitFill && (style()->svgStyle().hasFill() || !hitRules.requireFill))) {
+ FloatPoint localPoint;
+ if (!SVGRenderSupport::transformToUserSpaceAndCheckClipping(this, localToParentTransform(), pointInParent, localPoint))
return false;
+
if (hitRules.canHitBoundingBox && !objectBoundingBox().contains(localPoint))
return false;
void RenderSVGText::paint(PaintInfo& paintInfo, const LayoutPoint&)
{
- if (paintInfo.context->paintingDisabled())
- return;
-
if (paintInfo.phase != PaintPhaseForeground
&& paintInfo.phase != PaintPhaseSelection)
return;
FloatRect RenderSVGText::strokeBoundingBox() const
{
FloatRect strokeBoundaries = objectBoundingBox();
- const SVGRenderStyle* svgStyle = style()->svgStyle();
- if (!svgStyle->hasStroke())
+ const SVGRenderStyle& svgStyle = style()->svgStyle();
+ if (!svgStyle.hasStroke())
return strokeBoundaries;
ASSERT(node());
ASSERT(node()->isSVGElement());
SVGLengthContext lengthContext(toSVGElement(node()));
- strokeBoundaries.inflate(svgStyle->strokeWidth()->value(lengthContext));
+ strokeBoundaries.inflate(svgStyle.strokeWidth()->value(lengthContext));
return strokeBoundaries;
}
FloatRect RenderSVGText::paintInvalidationRectInLocalCoordinates() const
{
- FloatRect repaintRect = strokeBoundingBox();
- SVGRenderSupport::intersectRepaintRectWithResources(this, repaintRect);
+ FloatRect paintInvalidationRect = strokeBoundingBox();
+ SVGRenderSupport::intersectPaintInvalidationRectWithResources(this, paintInvalidationRect);
if (const ShadowList* textShadow = style()->textShadow())
- textShadow->adjustRectForShadow(repaintRect);
+ textShadow->adjustRectForShadow(paintInvalidationRect);
- return repaintRect;
+ return paintInvalidationRect;
}
void RenderSVGText::addChild(RenderObject* child, RenderObject* beforeChild)
subtreeChildWasRemoved(affectedAttributes);
}
-// Fix for <rdar://problem/8048875>. We should not render :first-line CSS Style
-// in a SVG text element context.
-RenderBlock* RenderSVGText::firstLineBlock() const
-{
- return 0;
-}
-
-// Fix for <rdar://problem/8048875>. We should not render :first-letter CSS Style
-// in a SVG text element context.
-void RenderSVGText::updateFirstLetter()
-{
-}
-
}