| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/paint/SVGInlineTextBoxPainter.h" | 6 #include "core/paint/SVGInlineTextBoxPainter.h" |
| 7 | 7 |
| 8 #include "core/dom/DocumentMarkerController.h" | 8 #include "core/dom/DocumentMarkerController.h" |
| 9 #include "core/dom/RenderedDocumentMarker.h" | 9 #include "core/dom/RenderedDocumentMarker.h" |
| 10 #include "core/editing/Editor.h" | 10 #include "core/editing/Editor.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 if (!hasFill) | 71 if (!hasFill) |
| 72 hasFill = svgSelectionStyle.hasFill(); | 72 hasFill = svgSelectionStyle.hasFill(); |
| 73 if (!hasVisibleStroke) | 73 if (!hasVisibleStroke) |
| 74 hasVisibleStroke = svgSelectionStyle.hasVisibleStroke(); | 74 hasVisibleStroke = svgSelectionStyle.hasVisibleStroke(); |
| 75 } else { | 75 } else { |
| 76 selectionStyle = style; | 76 selectionStyle = style; |
| 77 } | 77 } |
| 78 } | 78 } |
| 79 | 79 |
| 80 if (SVGRenderSupport::isRenderingClipPathAsMaskImage(textRenderer)) { | 80 if (paintInfo.isRenderingClipPathAsMaskImage()) { |
| 81 hasFill = true; | 81 hasFill = true; |
| 82 hasVisibleStroke = false; | 82 hasVisibleStroke = false; |
| 83 } | 83 } |
| 84 | 84 |
| 85 AffineTransform fragmentTransform; | 85 AffineTransform fragmentTransform; |
| 86 unsigned textFragmentsSize = m_svgInlineTextBox.textFragments().size(); | 86 unsigned textFragmentsSize = m_svgInlineTextBox.textFragments().size(); |
| 87 for (unsigned i = 0; i < textFragmentsSize; ++i) { | 87 for (unsigned i = 0; i < textFragmentsSize; ++i) { |
| 88 SVGTextFragment& fragment = m_svgInlineTextBox.textFragments().at(i); | 88 SVGTextFragment& fragment = m_svgInlineTextBox.textFragments().at(i); |
| 89 | 89 |
| 90 GraphicsContextStateSaver stateSaver(*paintInfo.context, false); | 90 GraphicsContextStateSaver stateSaver(*paintInfo.context, false); |
| 91 fragment.buildFragmentTransform(fragmentTransform); | 91 fragment.buildFragmentTransform(fragmentTransform); |
| 92 if (!fragmentTransform.isIdentity()) { | 92 if (!fragmentTransform.isIdentity()) { |
| 93 stateSaver.save(); | 93 stateSaver.save(); |
| 94 paintInfo.context->concatCTM(fragmentTransform); | 94 paintInfo.context->concatCTM(fragmentTransform); |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Spec: All text decorations except line-through should be drawn before
the text is filled and stroked; thus, the text is rendered on top of these deco
rations. | 97 // Spec: All text decorations except line-through should be drawn before
the text is filled and stroked; thus, the text is rendered on top of these deco
rations. |
| 98 unsigned decorations = style->textDecorationsInEffect(); | 98 unsigned decorations = style->textDecorationsInEffect(); |
| 99 if (decorations & TextDecorationUnderline) | 99 if (decorations & TextDecorationUnderline) |
| 100 paintDecoration(paintInfo.context, TextDecorationUnderline, fragment
); | 100 paintDecoration(paintInfo, TextDecorationUnderline, fragment); |
| 101 if (decorations & TextDecorationOverline) | 101 if (decorations & TextDecorationOverline) |
| 102 paintDecoration(paintInfo.context, TextDecorationOverline, fragment)
; | 102 paintDecoration(paintInfo, TextDecorationOverline, fragment); |
| 103 | 103 |
| 104 for (int i = 0; i < 3; i++) { | 104 for (int i = 0; i < 3; i++) { |
| 105 switch (svgStyle.paintOrderType(i)) { | 105 switch (svgStyle.paintOrderType(i)) { |
| 106 case PT_FILL: | 106 case PT_FILL: |
| 107 // Fill text | 107 // Fill text |
| 108 if (hasFill) { | 108 if (hasFill) { |
| 109 paintText(paintInfo.context, style, selectionStyle, fragment
, | 109 paintText(paintInfo, style, selectionStyle, fragment, |
| 110 ApplyToFillMode, hasSelection, paintSelectedTextOnly); | 110 ApplyToFillMode, hasSelection, paintSelectedTextOnly); |
| 111 } | 111 } |
| 112 break; | 112 break; |
| 113 case PT_STROKE: | 113 case PT_STROKE: |
| 114 // Stroke text | 114 // Stroke text |
| 115 if (hasVisibleStroke) { | 115 if (hasVisibleStroke) { |
| 116 paintText(paintInfo.context, style, selectionStyle, fragment
, | 116 paintText(paintInfo, style, selectionStyle, fragment, |
| 117 ApplyToStrokeMode, hasSelection, paintSelectedTextOnly); | 117 ApplyToStrokeMode, hasSelection, paintSelectedTextOnly); |
| 118 } | 118 } |
| 119 break; | 119 break; |
| 120 case PT_MARKERS: | 120 case PT_MARKERS: |
| 121 // Markers don't apply to text | 121 // Markers don't apply to text |
| 122 break; | 122 break; |
| 123 default: | 123 default: |
| 124 ASSERT_NOT_REACHED(); | 124 ASSERT_NOT_REACHED(); |
| 125 break; | 125 break; |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Spec: Line-through should be drawn after the text is filled and strok
ed; thus, the line-through is rendered on top of the text. | 129 // Spec: Line-through should be drawn after the text is filled and strok
ed; thus, the line-through is rendered on top of the text. |
| 130 if (decorations & TextDecorationLineThrough) | 130 if (decorations & TextDecorationLineThrough) |
| 131 paintDecoration(paintInfo.context, TextDecorationLineThrough, fragme
nt); | 131 paintDecoration(paintInfo, TextDecorationLineThrough, fragment); |
| 132 } | 132 } |
| 133 | 133 |
| 134 // finally, paint the outline if any | 134 // finally, paint the outline if any |
| 135 if (style->hasOutline() && parentRenderer.isRenderInline()) | 135 if (style->hasOutline() && parentRenderer.isRenderInline()) |
| 136 InlinePainter(toRenderInline(parentRenderer)).paintOutline(paintInfo, pa
intOffset); | 136 InlinePainter(toRenderInline(parentRenderer)).paintOutline(paintInfo, pa
intOffset); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void SVGInlineTextBoxPainter::paintSelectionBackground(PaintInfo& paintInfo) | 139 void SVGInlineTextBoxPainter::paintSelectionBackground(PaintInfo& paintInfo) |
| 140 { | 140 { |
| 141 if (m_svgInlineTextBox.renderer().style()->visibility() != VISIBLE) | 141 if (m_svgInlineTextBox.renderer().style()->visibility() != VISIBLE) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 if (renderer->style() && renderer->style()->textDecoration() != TextDeco
rationNone) | 196 if (renderer->style() && renderer->style()->textDecoration() != TextDeco
rationNone) |
| 197 break; | 197 break; |
| 198 | 198 |
| 199 parentBox = parentBox->parent(); | 199 parentBox = parentBox->parent(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 ASSERT(renderer); | 202 ASSERT(renderer); |
| 203 return renderer; | 203 return renderer; |
| 204 } | 204 } |
| 205 | 205 |
| 206 | |
| 207 // Offset from the baseline for |decoration|. Positive offsets are above the bas
eline. | 206 // Offset from the baseline for |decoration|. Positive offsets are above the bas
eline. |
| 208 static inline float baselineOffsetForDecoration(TextDecoration decoration, const
FontMetrics& fontMetrics, float thickness) | 207 static inline float baselineOffsetForDecoration(TextDecoration decoration, const
FontMetrics& fontMetrics, float thickness) |
| 209 { | 208 { |
| 210 // FIXME: For SVG Fonts we need to use the attributes defined in the <font-f
ace> if specified. | 209 // FIXME: For SVG Fonts we need to use the attributes defined in the <font-f
ace> if specified. |
| 211 // Compatible with Batik/Presto. | 210 // Compatible with Batik/Presto. |
| 212 if (decoration == TextDecorationUnderline) | 211 if (decoration == TextDecorationUnderline) |
| 213 return -thickness * 1.5f; | 212 return -thickness * 1.5f; |
| 214 if (decoration == TextDecorationOverline) | 213 if (decoration == TextDecorationOverline) |
| 215 return fontMetrics.floatAscent() - thickness; | 214 return fontMetrics.floatAscent() - thickness; |
| 216 if (decoration == TextDecorationLineThrough) | 215 if (decoration == TextDecorationLineThrough) |
| 217 return fontMetrics.floatAscent() * 3 / 8.0f; | 216 return fontMetrics.floatAscent() * 3 / 8.0f; |
| 218 | 217 |
| 219 ASSERT_NOT_REACHED(); | 218 ASSERT_NOT_REACHED(); |
| 220 return 0.0f; | 219 return 0.0f; |
| 221 } | 220 } |
| 222 | 221 |
| 223 static inline float thicknessForDecoration(TextDecoration, const Font& font) | 222 static inline float thicknessForDecoration(TextDecoration, const Font& font) |
| 224 { | 223 { |
| 225 // FIXME: For SVG Fonts we need to use the attributes defined in the <font-f
ace> if specified. | 224 // FIXME: For SVG Fonts we need to use the attributes defined in the <font-f
ace> if specified. |
| 226 // Compatible with Batik/Presto | 225 // Compatible with Batik/Presto |
| 227 return font.fontDescription().computedSize() / 20.0f; | 226 return font.fontDescription().computedSize() / 20.0f; |
| 228 } | 227 } |
| 229 | 228 |
| 230 void SVGInlineTextBoxPainter::paintDecoration(GraphicsContext* context, TextDeco
ration decoration, const SVGTextFragment& fragment) | 229 void SVGInlineTextBoxPainter::paintDecoration(PaintInfo& paintInfo, TextDecorati
on decoration, const SVGTextFragment& fragment) |
| 231 { | 230 { |
| 232 if (m_svgInlineTextBox.renderer().style()->textDecorationsInEffect() == Text
DecorationNone) | 231 if (m_svgInlineTextBox.renderer().style()->textDecorationsInEffect() == Text
DecorationNone) |
| 233 return; | 232 return; |
| 234 | 233 |
| 235 if (fragment.width <= 0) | 234 if (fragment.width <= 0) |
| 236 return; | 235 return; |
| 237 | 236 |
| 238 // Find out which render style defined the text-decoration, as its fill/stro
ke properties have to be used for drawing instead of ours. | 237 // Find out which render style defined the text-decoration, as its fill/stro
ke properties have to be used for drawing instead of ours. |
| 239 RenderObject* decorationRenderer = findRenderObjectDefininingTextDecoration(
m_svgInlineTextBox.parent()); | 238 RenderObject* decorationRenderer = findRenderObjectDefininingTextDecoration(
m_svgInlineTextBox.parent()); |
| 240 RenderStyle* decorationStyle = decorationRenderer->style(); | 239 RenderStyle* decorationStyle = decorationRenderer->style(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 257 | 256 |
| 258 Path path; | 257 Path path; |
| 259 path.addRect(FloatRect(decorationOrigin, FloatSize(fragment.width, thickness
/ scalingFactor))); | 258 path.addRect(FloatRect(decorationOrigin, FloatSize(fragment.width, thickness
/ scalingFactor))); |
| 260 | 259 |
| 261 const SVGRenderStyle& svgDecorationStyle = decorationStyle->svgStyle(); | 260 const SVGRenderStyle& svgDecorationStyle = decorationStyle->svgStyle(); |
| 262 | 261 |
| 263 for (int i = 0; i < 3; i++) { | 262 for (int i = 0; i < 3; i++) { |
| 264 switch (svgDecorationStyle.paintOrderType(i)) { | 263 switch (svgDecorationStyle.paintOrderType(i)) { |
| 265 case PT_FILL: | 264 case PT_FILL: |
| 266 if (svgDecorationStyle.hasFill()) { | 265 if (svgDecorationStyle.hasFill()) { |
| 267 GraphicsContextStateSaver stateSaver(*context, false); | 266 GraphicsContextStateSaver stateSaver(*paintInfo.context, false); |
| 268 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, decorat
ionStyle, *decorationRenderer, ApplyToFillMode)) | 267 if (!SVGRenderSupport::updateGraphicsContext(paintInfo, stateSav
er, decorationStyle, *decorationRenderer, ApplyToFillMode)) |
| 269 break; | 268 break; |
| 270 context->fillPath(path); | 269 paintInfo.context->fillPath(path); |
| 271 } | 270 } |
| 272 break; | 271 break; |
| 273 case PT_STROKE: | 272 case PT_STROKE: |
| 274 if (svgDecorationStyle.hasVisibleStroke()) { | 273 if (svgDecorationStyle.hasVisibleStroke()) { |
| 275 // FIXME: Non-scaling stroke is not applied here. | 274 // FIXME: Non-scaling stroke is not applied here. |
| 276 GraphicsContextStateSaver stateSaver(*context, false); | 275 GraphicsContextStateSaver stateSaver(*paintInfo.context, false); |
| 277 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, decorat
ionStyle, *decorationRenderer, ApplyToStrokeMode)) | 276 if (!SVGRenderSupport::updateGraphicsContext(paintInfo, stateSav
er, decorationStyle, *decorationRenderer, ApplyToStrokeMode)) |
| 278 break; | 277 break; |
| 279 context->strokePath(path); | 278 paintInfo.context->strokePath(path); |
| 280 } | 279 } |
| 281 break; | 280 break; |
| 282 case PT_MARKERS: | 281 case PT_MARKERS: |
| 283 break; | 282 break; |
| 284 default: | 283 default: |
| 285 ASSERT_NOT_REACHED(); | 284 ASSERT_NOT_REACHED(); |
| 286 } | 285 } |
| 287 } | 286 } |
| 288 } | 287 } |
| 289 | 288 |
| 290 void SVGInlineTextBoxPainter::paintTextWithShadows(GraphicsContext* context, Ren
derStyle* style, | 289 void SVGInlineTextBoxPainter::paintTextWithShadows(PaintInfo& paintInfo, RenderS
tyle* style, |
| 291 TextRun& textRun, const SVGTextFragment& fragment, int startPosition, int en
dPosition, | 290 TextRun& textRun, const SVGTextFragment& fragment, int startPosition, int en
dPosition, |
| 292 RenderSVGResourceMode resourceMode) | 291 RenderSVGResourceMode resourceMode) |
| 293 { | 292 { |
| 294 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(m_svgInlineTextBox
.renderer()); | 293 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(m_svgInlineTextBox
.renderer()); |
| 295 | 294 |
| 296 float scalingFactor = textRenderer.scalingFactor(); | 295 float scalingFactor = textRenderer.scalingFactor(); |
| 297 ASSERT(scalingFactor); | 296 ASSERT(scalingFactor); |
| 298 | 297 |
| 299 const Font& scaledFont = textRenderer.scaledFont(); | 298 const Font& scaledFont = textRenderer.scaledFont(); |
| 300 const ShadowList* shadowList = style->textShadow(); | 299 const ShadowList* shadowList = style->textShadow(); |
| 300 GraphicsContext* context = paintInfo.context; |
| 301 | 301 |
| 302 // Text shadows are disabled when printing. http://crbug.com/258321 | 302 // Text shadows are disabled when printing. http://crbug.com/258321 |
| 303 bool hasShadow = shadowList && !context->printing(); | 303 bool hasShadow = shadowList && !context->printing(); |
| 304 | 304 |
| 305 FloatPoint textOrigin(fragment.x, fragment.y); | 305 FloatPoint textOrigin(fragment.x, fragment.y); |
| 306 FloatSize textSize(fragment.width, fragment.height); | 306 FloatSize textSize(fragment.width, fragment.height); |
| 307 AffineTransform paintServerTransform; | 307 AffineTransform paintServerTransform; |
| 308 const AffineTransform* additionalPaintServerTransform = 0; | 308 const AffineTransform* additionalPaintServerTransform = 0; |
| 309 | 309 |
| 310 GraphicsContextStateSaver stateSaver(*context, false); | 310 GraphicsContextStateSaver stateSaver(*context, false); |
| 311 if (scalingFactor != 1) { | 311 if (scalingFactor != 1) { |
| 312 textOrigin.scale(scalingFactor, scalingFactor); | 312 textOrigin.scale(scalingFactor, scalingFactor); |
| 313 textSize.scale(scalingFactor); | 313 textSize.scale(scalingFactor); |
| 314 stateSaver.save(); | 314 stateSaver.save(); |
| 315 context->scale(1 / scalingFactor, 1 / scalingFactor); | 315 context->scale(1 / scalingFactor, 1 / scalingFactor); |
| 316 // Adjust the paint-server coordinate space. | 316 // Adjust the paint-server coordinate space. |
| 317 paintServerTransform.scale(scalingFactor); | 317 paintServerTransform.scale(scalingFactor); |
| 318 additionalPaintServerTransform = &paintServerTransform; | 318 additionalPaintServerTransform = &paintServerTransform; |
| 319 } | 319 } |
| 320 | 320 |
| 321 // FIXME: Non-scaling stroke is not applied here. | 321 // FIXME: Non-scaling stroke is not applied here. |
| 322 | 322 |
| 323 if (!SVGRenderSupport::updateGraphicsContext(stateSaver, style, m_svgInlineT
extBox.parent()->renderer(), resourceMode, additionalPaintServerTransform)) | 323 if (!SVGRenderSupport::updateGraphicsContext(paintInfo, stateSaver, style, m
_svgInlineTextBox.parent()->renderer(), resourceMode, additionalPaintServerTrans
form)) |
| 324 return; | 324 return; |
| 325 | 325 |
| 326 if (hasShadow) { | 326 if (hasShadow) { |
| 327 stateSaver.saveIfNeeded(); | 327 stateSaver.saveIfNeeded(); |
| 328 context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::S
hadowRespectsAlpha)); | 328 context->setDrawLooper(shadowList->createDrawLooper(DrawLooperBuilder::S
hadowRespectsAlpha)); |
| 329 } | 329 } |
| 330 | 330 |
| 331 context->setTextDrawingMode(resourceMode == ApplyToFillMode ? TextModeFill :
TextModeStroke); | 331 context->setTextDrawingMode(resourceMode == ApplyToFillMode ? TextModeFill :
TextModeStroke); |
| 332 | 332 |
| 333 if (scalingFactor != 1 && resourceMode == ApplyToStrokeMode) | 333 if (scalingFactor != 1 && resourceMode == ApplyToStrokeMode) |
| 334 context->setStrokeThickness(context->strokeThickness() * scalingFactor); | 334 context->setStrokeThickness(context->strokeThickness() * scalingFactor); |
| 335 | 335 |
| 336 TextRunPaintInfo textRunPaintInfo(textRun); | 336 TextRunPaintInfo textRunPaintInfo(textRun); |
| 337 textRunPaintInfo.from = startPosition; | 337 textRunPaintInfo.from = startPosition; |
| 338 textRunPaintInfo.to = endPosition; | 338 textRunPaintInfo.to = endPosition; |
| 339 | 339 |
| 340 float baseline = scaledFont.fontMetrics().floatAscent(); | 340 float baseline = scaledFont.fontMetrics().floatAscent(); |
| 341 textRunPaintInfo.bounds = FloatRect(textOrigin.x(), textOrigin.y() - baselin
e, | 341 textRunPaintInfo.bounds = FloatRect(textOrigin.x(), textOrigin.y() - baselin
e, |
| 342 textSize.width(), textSize.height()); | 342 textSize.width(), textSize.height()); |
| 343 | 343 |
| 344 scaledFont.drawText(context, textRunPaintInfo, textOrigin); | 344 scaledFont.drawText(context, textRunPaintInfo, textOrigin); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void SVGInlineTextBoxPainter::paintText(GraphicsContext* context, RenderStyle* s
tyle, | 347 void SVGInlineTextBoxPainter::paintText(PaintInfo& paintInfo, RenderStyle* style
, |
| 348 RenderStyle* selectionStyle, const SVGTextFragment& fragment, | 348 RenderStyle* selectionStyle, const SVGTextFragment& fragment, |
| 349 RenderSVGResourceMode resourceMode, bool hasSelection, bool paintSelectedTex
tOnly) | 349 RenderSVGResourceMode resourceMode, bool hasSelection, bool paintSelectedTex
tOnly) |
| 350 { | 350 { |
| 351 ASSERT(style); | 351 ASSERT(style); |
| 352 ASSERT(selectionStyle); | 352 ASSERT(selectionStyle); |
| 353 | 353 |
| 354 int startPosition = 0; | 354 int startPosition = 0; |
| 355 int endPosition = 0; | 355 int endPosition = 0; |
| 356 if (hasSelection) { | 356 if (hasSelection) { |
| 357 m_svgInlineTextBox.selectionStartEnd(startPosition, endPosition); | 357 m_svgInlineTextBox.selectionStartEnd(startPosition, endPosition); |
| 358 hasSelection = m_svgInlineTextBox.mapStartEndPositionsIntoFragmentCoordi
nates(fragment, startPosition, endPosition); | 358 hasSelection = m_svgInlineTextBox.mapStartEndPositionsIntoFragmentCoordi
nates(fragment, startPosition, endPosition); |
| 359 } | 359 } |
| 360 | 360 |
| 361 // Fast path if there is no selection, just draw the whole chunk part using
the regular style | 361 // Fast path if there is no selection, just draw the whole chunk part using
the regular style |
| 362 TextRun textRun = m_svgInlineTextBox.constructTextRun(style, fragment); | 362 TextRun textRun = m_svgInlineTextBox.constructTextRun(style, fragment); |
| 363 if (!hasSelection || startPosition >= endPosition) { | 363 if (!hasSelection || startPosition >= endPosition) { |
| 364 paintTextWithShadows(context, style, textRun, fragment, 0, fragment.leng
th, resourceMode); | 364 paintTextWithShadows(paintInfo, style, textRun, fragment, 0, fragment.le
ngth, resourceMode); |
| 365 return; | 365 return; |
| 366 } | 366 } |
| 367 | 367 |
| 368 // Eventually draw text using regular style until the start position of the
selection | 368 // Eventually draw text using regular style until the start position of the
selection |
| 369 if (startPosition > 0 && !paintSelectedTextOnly) | 369 if (startPosition > 0 && !paintSelectedTextOnly) |
| 370 paintTextWithShadows(context, style, textRun, fragment, 0, startPosition
, resourceMode); | 370 paintTextWithShadows(paintInfo, style, textRun, fragment, 0, startPositi
on, resourceMode); |
| 371 | 371 |
| 372 // Draw text using selection style from the start to the end position of the
selection | 372 // Draw text using selection style from the start to the end position of the
selection |
| 373 if (style != selectionStyle) { | 373 if (style != selectionStyle) { |
| 374 StyleDifference diff; | 374 StyleDifference diff; |
| 375 diff.setNeedsPaintInvalidationObject(); | 375 diff.setNeedsPaintInvalidationObject(); |
| 376 SVGResourcesCache::clientStyleChanged(&m_svgInlineTextBox.parent()->rend
erer(), diff, selectionStyle); | 376 SVGResourcesCache::clientStyleChanged(&m_svgInlineTextBox.parent()->rend
erer(), diff, selectionStyle); |
| 377 } | 377 } |
| 378 | 378 |
| 379 paintTextWithShadows(context, selectionStyle, textRun, fragment, startPositi
on, endPosition, resourceMode); | 379 paintTextWithShadows(paintInfo, selectionStyle, textRun, fragment, startPosi
tion, endPosition, resourceMode); |
| 380 | 380 |
| 381 if (style != selectionStyle) { | 381 if (style != selectionStyle) { |
| 382 StyleDifference diff; | 382 StyleDifference diff; |
| 383 diff.setNeedsPaintInvalidationObject(); | 383 diff.setNeedsPaintInvalidationObject(); |
| 384 SVGResourcesCache::clientStyleChanged(&m_svgInlineTextBox.parent()->rend
erer(), diff, style); | 384 SVGResourcesCache::clientStyleChanged(&m_svgInlineTextBox.parent()->rend
erer(), diff, style); |
| 385 } | 385 } |
| 386 | 386 |
| 387 // Eventually draw text using regular style from the end position of the sel
ection to the end of the current chunk part | 387 // Eventually draw text using regular style from the end position of the sel
ection to the end of the current chunk part |
| 388 if (endPosition < static_cast<int>(fragment.length) && !paintSelectedTextOnl
y) | 388 if (endPosition < static_cast<int>(fragment.length) && !paintSelectedTextOnl
y) |
| 389 paintTextWithShadows(context, style, textRun, fragment, endPosition, fra
gment.length, resourceMode); | 389 paintTextWithShadows(paintInfo, style, textRun, fragment, endPosition, f
ragment.length, resourceMode); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void SVGInlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* context, con
st FloatPoint&, DocumentMarker* marker, RenderStyle* style, const Font& font) | 392 void SVGInlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* context, con
st FloatPoint&, DocumentMarker* marker, RenderStyle* style, const Font& font) |
| 393 { | 393 { |
| 394 // SVG is only interested in the TextMatch markers. | 394 // SVG is only interested in the TextMatch markers. |
| 395 if (marker->type() != DocumentMarker::TextMatch) | 395 if (marker->type() != DocumentMarker::TextMatch) |
| 396 return; | 396 return; |
| 397 | 397 |
| 398 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(m_svgInlineTextBox
.renderer()); | 398 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(m_svgInlineTextBox
.renderer()); |
| 399 | 399 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 438 |
| 439 fragmentRect = fragmentTransform.mapRect(fragmentRect); | 439 fragmentRect = fragmentTransform.mapRect(fragmentRect); |
| 440 markerRect.unite(fragmentRect); | 440 markerRect.unite(fragmentRect); |
| 441 } | 441 } |
| 442 } | 442 } |
| 443 | 443 |
| 444 toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer.localToAbsolu
teQuad(markerRect).enclosingBoundingBox()); | 444 toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer.localToAbsolu
teQuad(markerRect).enclosingBoundingBox()); |
| 445 } | 445 } |
| 446 | 446 |
| 447 } // namespace blink | 447 } // namespace blink |
| OLD | NEW |