| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 case PT_MARKERS: | 284 case PT_MARKERS: |
| 285 break; | 285 break; |
| 286 default: | 286 default: |
| 287 ASSERT_NOT_REACHED(); | 287 ASSERT_NOT_REACHED(); |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 void SVGInlineTextBoxPainter::paintTextWithShadows(const PaintInfo& paintInfo, c
onst LayoutStyle& style, | 292 void SVGInlineTextBoxPainter::paintTextWithShadows(const PaintInfo& paintInfo, c
onst LayoutStyle& style, |
| 293 TextRun& textRun, const SVGTextFragment& fragment, int startPosition, int en
dPosition, | 293 TextRun& textRun, const SVGTextFragment& fragment, int startPosition, int en
dPosition, |
| 294 RenderSVGResourceMode resourceMode) | 294 LayoutSVGResourceMode resourceMode) |
| 295 { | 295 { |
| 296 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(m_svgInlineTextBox
.renderer()); | 296 RenderSVGInlineText& textRenderer = toRenderSVGInlineText(m_svgInlineTextBox
.renderer()); |
| 297 | 297 |
| 298 float scalingFactor = textRenderer.scalingFactor(); | 298 float scalingFactor = textRenderer.scalingFactor(); |
| 299 ASSERT(scalingFactor); | 299 ASSERT(scalingFactor); |
| 300 | 300 |
| 301 const Font& scaledFont = textRenderer.scaledFont(); | 301 const Font& scaledFont = textRenderer.scaledFont(); |
| 302 const ShadowList* shadowList = style.textShadow(); | 302 const ShadowList* shadowList = style.textShadow(); |
| 303 GraphicsContext* context = paintInfo.context; | 303 GraphicsContext* context = paintInfo.context; |
| 304 | 304 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 342 |
| 343 float baseline = scaledFont.fontMetrics().floatAscent(); | 343 float baseline = scaledFont.fontMetrics().floatAscent(); |
| 344 textRunPaintInfo.bounds = FloatRect(textOrigin.x(), textOrigin.y() - baselin
e, | 344 textRunPaintInfo.bounds = FloatRect(textOrigin.x(), textOrigin.y() - baselin
e, |
| 345 textSize.width(), textSize.height()); | 345 textSize.width(), textSize.height()); |
| 346 | 346 |
| 347 scaledFont.drawText(context, textRunPaintInfo, textOrigin); | 347 scaledFont.drawText(context, textRunPaintInfo, textOrigin); |
| 348 } | 348 } |
| 349 | 349 |
| 350 void SVGInlineTextBoxPainter::paintText(const PaintInfo& paintInfo, const Layout
Style& style, | 350 void SVGInlineTextBoxPainter::paintText(const PaintInfo& paintInfo, const Layout
Style& style, |
| 351 const LayoutStyle& selectionStyle, const SVGTextFragment& fragment, | 351 const LayoutStyle& selectionStyle, const SVGTextFragment& fragment, |
| 352 RenderSVGResourceMode resourceMode, bool shouldPaintSelection) | 352 LayoutSVGResourceMode resourceMode, bool shouldPaintSelection) |
| 353 { | 353 { |
| 354 int startPosition = 0; | 354 int startPosition = 0; |
| 355 int endPosition = 0; | 355 int endPosition = 0; |
| 356 if (shouldPaintSelection) { | 356 if (shouldPaintSelection) { |
| 357 m_svgInlineTextBox.selectionStartEnd(startPosition, endPosition); | 357 m_svgInlineTextBox.selectionStartEnd(startPosition, endPosition); |
| 358 shouldPaintSelection = m_svgInlineTextBox.mapStartEndPositionsIntoFragme
ntCoordinates(fragment, startPosition, endPosition); | 358 shouldPaintSelection = m_svgInlineTextBox.mapStartEndPositionsIntoFragme
ntCoordinates(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); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 439 |
| 440 fragmentRect = fragmentTransform.mapRect(fragmentRect); | 440 fragmentRect = fragmentTransform.mapRect(fragmentRect); |
| 441 markerRect.unite(fragmentRect); | 441 markerRect.unite(fragmentRect); |
| 442 } | 442 } |
| 443 } | 443 } |
| 444 | 444 |
| 445 toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer.localToAbsolu
teQuad(markerRect).enclosingBoundingBox()); | 445 toRenderedDocumentMarker(marker)->setRenderedRect(textRenderer.localToAbsolu
teQuad(markerRect).enclosingBoundingBox()); |
| 446 } | 446 } |
| 447 | 447 |
| 448 } // namespace blink | 448 } // namespace blink |
| OLD | NEW |