| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 if (paintInfo.phase == PaintPhaseSelection && !shouldPaintSelection()) | 52 if (paintInfo.phase == PaintPhaseSelection && !shouldPaintSelection()) |
| 53 return; | 53 return; |
| 54 | 54 |
| 55 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(m_svgInlineTex
tBox.layoutObject()); | 55 LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(m_svgInlineTex
tBox.layoutObject()); |
| 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 DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType(pai
ntInfo.phase); |
| 63 DrawingRecorder recorder(*paintInfo.context, m_svgInlineTextBox, Display
Item::paintPhaseToDrawingType(paintInfo.phase), paintInfo.rect); | 63 if (!DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_svgIn
lineTextBox, displayItemType)) { |
| 64 if (!recorder.canUseCachedDrawing()) { | 64 DrawingRecorder recorder(*paintInfo.context, m_svgInlineTextBox, display
ItemType, paintInfo.rect); |
| 65 InlineTextBoxPainter(m_svgInlineTextBox).paintDocumentMarkers( | 65 InlineTextBoxPainter(m_svgInlineTextBox).paintDocumentMarkers( |
| 66 paintInfo.context, 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 } | |
| 72 } | 71 } |
| 73 | 72 |
| 74 if (style.hasOutline() && parentLayoutObject.isLayoutInline()) | 73 if (style.hasOutline() && parentLayoutObject.isLayoutInline()) |
| 75 InlinePainter(toLayoutInline(parentLayoutObject)).paintOutline(paintInfo
, paintOffset); | 74 InlinePainter(toLayoutInline(parentLayoutObject)).paintOutline(paintInfo
, paintOffset); |
| 76 } | 75 } |
| 77 | 76 |
| 78 void SVGInlineTextBoxPainter::paintTextFragments(const PaintInfo& paintInfo, Lay
outObject& parentLayoutObject) | 77 void SVGInlineTextBoxPainter::paintTextFragments(const PaintInfo& paintInfo, Lay
outObject& parentLayoutObject) |
| 79 { | 78 { |
| 80 const ComputedStyle& style = parentLayoutObject.styleRef(); | 79 const ComputedStyle& style = parentLayoutObject.styleRef(); |
| 81 const SVGComputedStyle& svgStyle = style.svgStyle(); | 80 const SVGComputedStyle& svgStyle = style.svgStyle(); |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 if (!fragmentTransform.isIdentity()) | 445 if (!fragmentTransform.isIdentity()) |
| 447 context->concatCTM(fragmentTransform); | 446 context->concatCTM(fragmentTransform); |
| 448 context->setFillColor(color); | 447 context->setFillColor(color); |
| 449 context->fillRect(fragmentRect, color); | 448 context->fillRect(fragmentRect, color); |
| 450 } | 449 } |
| 451 } | 450 } |
| 452 } | 451 } |
| 453 } | 452 } |
| 454 | 453 |
| 455 } // namespace blink | 454 } // namespace blink |
| OLD | NEW |