| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 if (!textShouldBePainted(textLayoutObject)) | 56 if (!textShouldBePainted(textLayoutObject)) |
| 57 return; | 57 return; |
| 58 | 58 |
| 59 LayoutObject& parentLayoutObject = m_svgInlineTextBox.parent()->layoutObject
(); | 59 LayoutObject& parentLayoutObject = m_svgInlineTextBox.parent()->layoutObject
(); |
| 60 const ComputedStyle& style = parentLayoutObject.styleRef(); | 60 const ComputedStyle& style = parentLayoutObject.styleRef(); |
| 61 | 61 |
| 62 { | 62 { |
| 63 DrawingRecorder recorder(*paintInfo.context, m_svgInlineTextBox, Display
Item::paintPhaseToDrawingType(paintInfo.phase), paintInfo.rect); | 63 DrawingRecorder recorder(*paintInfo.context, m_svgInlineTextBox, Display
Item::paintPhaseToDrawingType(paintInfo.phase), paintInfo.rect); |
| 64 if (!recorder.canUseCachedDrawing()) { | 64 if (!recorder.canUseCachedDrawing()) { |
| 65 InlineTextBoxPainter(m_svgInlineTextBox).paintDocumentMarkers( | 65 InlineTextBoxPainter(m_svgInlineTextBox).paintDocumentMarkers( |
| 66 paintInfo.context, FloatPoint(paintOffset), style, | 66 paintInfo.context, paintOffset, style, |
| 67 textLayoutObject.scaledFont(), true); | 67 textLayoutObject.scaledFont(), true); |
| 68 | 68 |
| 69 if (!m_svgInlineTextBox.textFragments().isEmpty()) | 69 if (!m_svgInlineTextBox.textFragments().isEmpty()) |
| 70 paintTextFragments(paintInfo, parentLayoutObject); | 70 paintTextFragments(paintInfo, parentLayoutObject); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 if (style.hasOutline() && parentLayoutObject.isLayoutInline()) | 74 if (style.hasOutline() && parentLayoutObject.isLayoutInline()) |
| 75 InlinePainter(toLayoutInline(parentLayoutObject)).paintOutline(paintInfo
, paintOffset); | 75 InlinePainter(toLayoutInline(parentLayoutObject)).paintOutline(paintInfo
, paintOffset); |
| 76 } | 76 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 StyleDifference diff; | 396 StyleDifference diff; |
| 397 diff.setNeedsPaintInvalidationObject(); | 397 diff.setNeedsPaintInvalidationObject(); |
| 398 SVGResourcesCache::clientStyleChanged(&m_svgInlineTextBox.parent()->layo
utObject(), diff, style); | 398 SVGResourcesCache::clientStyleChanged(&m_svgInlineTextBox.parent()->layo
utObject(), diff, style); |
| 399 } | 399 } |
| 400 | 400 |
| 401 // Eventually draw text using regular style from the end position of the sel
ection to the end of the current chunk part | 401 // Eventually draw text using regular style from the end position of the sel
ection to the end of the current chunk part |
| 402 if (endPosition < static_cast<int>(fragment.length) && !paintSelectedTextOnl
y) | 402 if (endPosition < static_cast<int>(fragment.length) && !paintSelectedTextOnl
y) |
| 403 paintTextWithShadows(paintInfo, style, textRun, fragment, endPosition, f
ragment.length, resourceMode); | 403 paintTextWithShadows(paintInfo, style, textRun, fragment, endPosition, f
ragment.length, resourceMode); |
| 404 } | 404 } |
| 405 | 405 |
| 406 void SVGInlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* context, con
st FloatPoint&, DocumentMarker* marker, const ComputedStyle& style, const Font&
font) | 406 void SVGInlineTextBoxPainter::paintTextMatchMarker(GraphicsContext* context, con
st LayoutPoint&, DocumentMarker* marker, const ComputedStyle& style, const Font&
font) |
| 407 { | 407 { |
| 408 // SVG is only interested in the TextMatch markers. | 408 // SVG is only interested in the TextMatch markers. |
| 409 if (marker->type() != DocumentMarker::TextMatch) | 409 if (marker->type() != DocumentMarker::TextMatch) |
| 410 return; | 410 return; |
| 411 | 411 |
| 412 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(m_svgInlineTex
tBox.layoutObject()); | 412 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(m_svgInlineTex
tBox.layoutObject()); |
| 413 | 413 |
| 414 AffineTransform fragmentTransform; | 414 AffineTransform fragmentTransform; |
| 415 for (InlineTextBox* box = textLayoutObject.firstTextBox(); box; box = box->n
extTextBox()) { | 415 for (InlineTextBox* box = textLayoutObject.firstTextBox(); box; box = box->n
extTextBox()) { |
| 416 if (!box->isSVGInlineTextBox()) | 416 if (!box->isSVGInlineTextBox()) |
| (...skipping 29 matching lines...) Expand all Loading... |
| 446 if (!fragmentTransform.isIdentity()) | 446 if (!fragmentTransform.isIdentity()) |
| 447 context->concatCTM(fragmentTransform); | 447 context->concatCTM(fragmentTransform); |
| 448 context->setFillColor(color); | 448 context->setFillColor(color); |
| 449 context->fillRect(fragmentRect, color); | 449 context->fillRect(fragmentRect, color); |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 } | 452 } |
| 453 } | 453 } |
| 454 | 454 |
| 455 } // namespace blink | 455 } // namespace blink |
| OLD | NEW |