diff options
Diffstat (limited to 'WebCore/rendering/SVGInlineTextBox.cpp')
-rw-r--r-- | WebCore/rendering/SVGInlineTextBox.cpp | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/WebCore/rendering/SVGInlineTextBox.cpp b/WebCore/rendering/SVGInlineTextBox.cpp index 8e498ad..a293124 100644 --- a/WebCore/rendering/SVGInlineTextBox.cpp +++ b/WebCore/rendering/SVGInlineTextBox.cpp @@ -295,17 +295,16 @@ void SVGInlineTextBox::paint(PaintInfo& paintInfo, int, int) ASSERT(!m_paintingResource); } -bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, RenderStyle* style) +bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, RenderObject* renderer, RenderStyle* style) { + ASSERT(renderer); + ASSERT(style); ASSERT(m_paintingResourceMode != ApplyToDefaultMode); - RenderObject* parentRenderer = parent()->renderer(); - ASSERT(parentRenderer); - if (m_paintingResourceMode & ApplyToFillMode) - m_paintingResource = RenderSVGResource::fillPaintingResource(parentRenderer, style); + m_paintingResource = RenderSVGResource::fillPaintingResource(renderer, style); else if (m_paintingResourceMode & ApplyToStrokeMode) - m_paintingResource = RenderSVGResource::strokePaintingResource(parentRenderer, style); + m_paintingResource = RenderSVGResource::strokePaintingResource(renderer, style); else { // We're either called for stroking or filling. ASSERT_NOT_REACHED(); @@ -314,7 +313,7 @@ bool SVGInlineTextBox::acquirePaintingResource(GraphicsContext*& context, Render if (!m_paintingResource) return false; - m_paintingResource->applyResource(parentRenderer, style, context, m_paintingResourceMode); + m_paintingResource->applyResource(renderer, style, context, m_paintingResourceMode); return true; } @@ -331,7 +330,7 @@ void SVGInlineTextBox::releasePaintingResource(GraphicsContext*& context) bool SVGInlineTextBox::prepareGraphicsContextForTextPainting(GraphicsContext*& context, TextRun& textRun, RenderStyle* style) { - bool acquiredResource = acquirePaintingResource(context, style); + bool acquiredResource = acquirePaintingResource(context, parent()->renderer(), style); #if ENABLE(SVG_FONTS) // SVG Fonts need access to the painting resource used to draw the current text chunk. @@ -508,21 +507,24 @@ void SVGInlineTextBox::paintDecoration(GraphicsContext* context, const FloatPoin if (hasDecorationFill) { m_paintingResourceMode = ApplyToFillMode; - paintDecorationWithStyle(context, textOrigin, decorationStyle, decoration); + paintDecorationWithStyle(context, textOrigin, decorationRenderer, decoration); } if (hasDecorationStroke) { m_paintingResourceMode = ApplyToStrokeMode; - paintDecorationWithStyle(context, textOrigin, decorationStyle, decoration); + paintDecorationWithStyle(context, textOrigin, decorationRenderer, decoration); } } -void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, const FloatPoint& textOrigin, RenderStyle* decorationStyle, ETextDecoration decoration) +void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, const FloatPoint& textOrigin, RenderObject* decorationRenderer, ETextDecoration decoration) { ASSERT(!m_paintingResource); ASSERT(m_paintingResourceMode != ApplyToDefaultMode); ASSERT(m_currentChunkPart.isValid()); + RenderStyle* decorationStyle = decorationRenderer->style(); + ASSERT(decorationStyle); + const Font& font = decorationStyle->font(); // The initial y value refers to overline position. @@ -534,7 +536,7 @@ void SVGInlineTextBox::paintDecorationWithStyle(GraphicsContext* context, const context->beginPath(); context->addPath(Path::createRectangle(FloatRect(x, y, m_currentChunkPart.width, thickness))); - if (acquirePaintingResource(context, decorationStyle)) + if (acquirePaintingResource(context, decorationRenderer, decorationStyle)) releasePaintingResource(context); context->restore(); @@ -614,9 +616,15 @@ void SVGInlineTextBox::paintText(GraphicsContext* context, const FloatPoint& tex paintTextWithShadows(context, textOrigin, style, textRun, 0, startPos); // Draw text using selection style from the start to the end position of the selection + if (style != selectionStyle) + SVGResourcesCache::clientStyleChanged(parent()->renderer(), StyleDifferenceRepaint, selectionStyle); + TextRun selectionTextRun(constructTextRun(selectionStyle)); paintTextWithShadows(context, textOrigin, selectionStyle, textRun, startPos, endPos); + if (style != selectionStyle) + SVGResourcesCache::clientStyleChanged(parent()->renderer(), StyleDifferenceRepaint, style); + // Eventually draw text using regular style from the end position of the selection to the end of the current chunk part if (endPos < m_currentChunkPart.length && !paintSelectedTextOnly) paintTextWithShadows(context, textOrigin, style, textRun, endPos, m_currentChunkPart.length); |