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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 static bool hasShadow(const PaintInfo& paintInfo, const ComputedStyle& style) { | 44 static bool hasShadow(const PaintInfo& paintInfo, const ComputedStyle& style) { |
45 // Text shadows are disabled when printing. http://crbug.com/258321 | 45 // Text shadows are disabled when printing. http://crbug.com/258321 |
46 return style.textShadow() && !paintInfo.isPrinting(); | 46 return style.textShadow() && !paintInfo.isPrinting(); |
47 } | 47 } |
48 | 48 |
49 FloatRect SVGInlineTextBoxPainter::boundsForDrawingRecorder( | 49 FloatRect SVGInlineTextBoxPainter::boundsForDrawingRecorder( |
50 const PaintInfo& paintInfo, | 50 const PaintInfo& paintInfo, |
51 const ComputedStyle& style, | 51 const ComputedStyle& style, |
52 const LayoutPoint& paintOffset, | 52 const LayoutPoint& paintOffset, |
53 bool includeSelectionRect) const { | 53 bool includeSelectionRect) const { |
54 // We compute the paint rect with what looks like the logical values, to match | 54 LayoutRect bounds( |
55 // the computation in SVGInlineTextBox::calculateBoundaries, and the fact that | 55 m_svgInlineTextBox.locationIncludingFlipping() + paintOffset, |
56 // vertical (etc) layouts are handled by SVGTextLayoutEngine. | 56 m_svgInlineTextBox.size()); |
57 LayoutRect bounds(LayoutPoint(m_svgInlineTextBox.topLeft() + paintOffset), | |
58 LayoutSize(m_svgInlineTextBox.logicalWidth(), | |
59 m_svgInlineTextBox.logicalHeight())); | |
60 if (hasShadow(paintInfo, style)) | 57 if (hasShadow(paintInfo, style)) |
61 bounds.expand(style.textShadow()->rectOutsetsIncludingOriginal()); | 58 bounds.expand(style.textShadow()->rectOutsetsIncludingOriginal()); |
62 if (includeSelectionRect) { | 59 if (includeSelectionRect) { |
63 bounds.unite(m_svgInlineTextBox.localSelectionRect( | 60 bounds.unite(m_svgInlineTextBox.localSelectionRect( |
64 m_svgInlineTextBox.start(), | 61 m_svgInlineTextBox.start(), |
65 m_svgInlineTextBox.start() + m_svgInlineTextBox.len())); | 62 m_svgInlineTextBox.start() + m_svgInlineTextBox.len())); |
66 } | 63 } |
67 return FloatRect(bounds); | 64 return FloatRect(bounds); |
68 } | 65 } |
69 | 66 |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 } | 646 } |
650 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment( | 647 FloatRect fragmentRect = m_svgInlineTextBox.selectionRectForTextFragment( |
651 fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, | 648 fragment, textMatchInfo.startPosition, textMatchInfo.endPosition, |
652 style); | 649 style); |
653 paintInfo.context.setFillColor(color); | 650 paintInfo.context.setFillColor(color); |
654 paintInfo.context.fillRect(fragmentRect); | 651 paintInfo.context.fillRect(fragmentRect); |
655 } | 652 } |
656 } | 653 } |
657 | 654 |
658 } // namespace blink | 655 } // namespace blink |
OLD | NEW |