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 27 matching lines...) Expand all Loading... |
38 return !paintInfo.isPrinting() && m_svgInlineTextBox.getSelectionState() !=
SelectionNone; | 38 return !paintInfo.isPrinting() && m_svgInlineTextBox.getSelectionState() !=
SelectionNone; |
39 } | 39 } |
40 | 40 |
41 FloatRect SVGInlineTextBoxPainter::boundsForDrawingRecorder( | 41 FloatRect SVGInlineTextBoxPainter::boundsForDrawingRecorder( |
42 const LayoutPoint& paintOffset, bool includeSelectionRect) const | 42 const LayoutPoint& paintOffset, bool includeSelectionRect) const |
43 { | 43 { |
44 // We compute the paint rect with what looks like the logical values, to mat
ch the | 44 // We compute the paint rect with what looks like the logical values, to mat
ch the |
45 // computation in SVGInlineTextBox::calculateBoundaries, and the fact that v
ertical (etc) | 45 // computation in SVGInlineTextBox::calculateBoundaries, and the fact that v
ertical (etc) |
46 // layouts are handled by SVGTextLayoutEngine. | 46 // layouts are handled by SVGTextLayoutEngine. |
47 LayoutRect bounds( | 47 LayoutRect bounds( |
48 m_svgInlineTextBox.topLeft(), | 48 LayoutPoint(m_svgInlineTextBox.topLeft() + paintOffset), |
49 LayoutSize(m_svgInlineTextBox.logicalWidth(), m_svgInlineTextBox.logical
Height())); | 49 LayoutSize(m_svgInlineTextBox.logicalWidth(), m_svgInlineTextBox.logical
Height())); |
50 if (includeSelectionRect) { | 50 if (includeSelectionRect) { |
51 bounds.unite(m_svgInlineTextBox.localSelectionRect( | 51 bounds.unite(m_svgInlineTextBox.localSelectionRect( |
52 m_svgInlineTextBox.start(), m_svgInlineTextBox.start() + m_svgInline
TextBox.len())); | 52 m_svgInlineTextBox.start(), m_svgInlineTextBox.start() + m_svgInline
TextBox.len())); |
53 } | 53 } |
54 bounds.moveBy(paintOffset); | |
55 return FloatRect(bounds); | 54 return FloatRect(bounds); |
56 } | 55 } |
57 | 56 |
58 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) | 57 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) |
59 { | 58 { |
60 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); | 59 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); |
61 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation); | 60 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation); |
62 | 61 |
63 if (m_svgInlineTextBox.getLineLayoutItem().style()->visibility() != VISIBLE) | 62 if (m_svgInlineTextBox.getLineLayoutItem().style()->visibility() != VISIBLE) |
64 return; | 63 return; |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 stateSaver.save(); | 515 stateSaver.save(); |
517 paintInfo.context.concatCTM(fragment.buildFragmentTransform()); | 516 paintInfo.context.concatCTM(fragment.buildFragmentTransform()); |
518 } | 517 } |
519 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment
(fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, style); | 518 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment
(fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, style); |
520 paintInfo.context.setFillColor(color); | 519 paintInfo.context.setFillColor(color); |
521 paintInfo.context.fillRect(fragmentRect); | 520 paintInfo.context.fillRect(fragmentRect); |
522 } | 521 } |
523 } | 522 } |
524 | 523 |
525 } // namespace blink | 524 } // namespace blink |
OLD | NEW |