| 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 "core/paint/SVGInlineTextBoxPainter.h" | 5 #include "core/paint/SVGInlineTextBoxPainter.h" |
| 6 | 6 |
| 7 #include "core/editing/Editor.h" | 7 #include "core/editing/Editor.h" |
| 8 #include "core/editing/markers/DocumentMarkerController.h" | 8 #include "core/editing/markers/DocumentMarkerController.h" |
| 9 #include "core/editing/markers/RenderedDocumentMarker.h" | 9 #include "core/editing/markers/RenderedDocumentMarker.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 return textLayoutObject.scaledFont().fontDescription().computedPixelSize(); | 32 return textLayoutObject.scaledFont().fontDescription().computedPixelSize(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 bool SVGInlineTextBoxPainter::shouldPaintSelection(const PaintInfo& paintInfo) c
onst | 35 bool SVGInlineTextBoxPainter::shouldPaintSelection(const PaintInfo& paintInfo) c
onst |
| 36 { | 36 { |
| 37 return !paintInfo.isPrinting() && m_svgInlineTextBox.selectionState() != Sel
ectionNone; | 37 return !paintInfo.isPrinting() && m_svgInlineTextBox.selectionState() != Sel
ectionNone; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) | 40 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) |
| 41 { | 41 { |
| 42 ASSERT(paintInfo.shouldPaintWithinRoot(LineLayoutPaintShim::layoutObjectFrom
(m_svgInlineTextBox.lineLayoutItem()))); | |
| 43 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); | 42 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); |
| 44 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation); | 43 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation); |
| 45 | 44 |
| 46 if (m_svgInlineTextBox.lineLayoutItem().style()->visibility() != VISIBLE) | 45 if (m_svgInlineTextBox.lineLayoutItem().style()->visibility() != VISIBLE) |
| 47 return; | 46 return; |
| 48 | 47 |
| 49 // We're explicitly not supporting composition & custom underlines and custo
m highlighters -- unlike InlineTextBox. | 48 // We're explicitly not supporting composition & custom underlines and custo
m highlighters -- unlike InlineTextBox. |
| 50 // If we ever need that for SVG, it's very easy to refactor and reuse the co
de. | 49 // If we ever need that for SVG, it's very easy to refactor and reuse the co
de. |
| 51 | 50 |
| 52 if (paintInfo.phase == PaintPhaseSelection && !shouldPaintSelection(paintInf
o)) | 51 if (paintInfo.phase == PaintPhaseSelection && !shouldPaintSelection(paintInf
o)) |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 stateSaver.save(); | 496 stateSaver.save(); |
| 498 paintInfo.context.concatCTM(fragment.buildFragmentTransform()); | 497 paintInfo.context.concatCTM(fragment.buildFragmentTransform()); |
| 499 } | 498 } |
| 500 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment
(fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, style); | 499 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment
(fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, style); |
| 501 paintInfo.context.setFillColor(color); | 500 paintInfo.context.setFillColor(color); |
| 502 paintInfo.context.fillRect(fragmentRect); | 501 paintInfo.context.fillRect(fragmentRect); |
| 503 } | 502 } |
| 504 } | 503 } |
| 505 | 504 |
| 506 } // namespace blink | 505 } // namespace blink |
| OLD | NEW |