| 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 LayoutPoint(m_svgInlineTextBox.topLeft() + paintOffset), | 48 m_svgInlineTextBox.topLeft(), |
| 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); |
| 54 return FloatRect(bounds); | 55 return FloatRect(bounds); |
| 55 } | 56 } |
| 56 | 57 |
| 57 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) | 58 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoin
t& paintOffset) |
| 58 { | 59 { |
| 59 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); | 60 ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPh
aseSelection); |
| 60 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation); | 61 ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation); |
| 61 | 62 |
| 62 if (m_svgInlineTextBox.getLineLayoutItem().style()->visibility() != VISIBLE) | 63 if (m_svgInlineTextBox.getLineLayoutItem().style()->visibility() != VISIBLE) |
| 63 return; | 64 return; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 stateSaver.save(); | 516 stateSaver.save(); |
| 516 paintInfo.context.concatCTM(fragment.buildFragmentTransform()); | 517 paintInfo.context.concatCTM(fragment.buildFragmentTransform()); |
| 517 } | 518 } |
| 518 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment
(fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, style); | 519 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment
(fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, style); |
| 519 paintInfo.context.setFillColor(color); | 520 paintInfo.context.setFillColor(color); |
| 520 paintInfo.context.fillRect(fragmentRect); | 521 paintInfo.context.fillRect(fragmentRect); |
| 521 } | 522 } |
| 522 } | 523 } |
| 523 | 524 |
| 524 } // namespace blink | 525 } // namespace blink |
| OLD | NEW |