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 #ifndef SVGInlineTextBoxPainter_h | 5 #ifndef SVGInlineTextBoxPainter_h |
6 #define SVGInlineTextBoxPainter_h | 6 #define SVGInlineTextBoxPainter_h |
7 | 7 |
8 #include "core/style/ComputedStyleConstants.h" | 8 #include "core/style/ComputedStyleConstants.h" |
9 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" | 9 #include "core/layout/svg/LayoutSVGResourcePaintServer.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 class Font; | 14 class Font; |
15 struct PaintInfo; | 15 struct PaintInfo; |
16 class LayoutPoint; | 16 class LayoutPoint; |
17 class LayoutSVGInlineText; | 17 class LayoutSVGInlineText; |
18 class ComputedStyle; | 18 class ComputedStyle; |
19 class SVGInlineTextBox; | 19 class SVGInlineTextBox; |
20 struct SVGTextFragment; | 20 struct SVGTextFragment; |
| 21 class TextMatchMarker; |
21 class TextRun; | 22 class TextRun; |
22 class DocumentMarker; | |
23 | 23 |
24 struct SVGTextFragmentWithRange { | 24 struct SVGTextFragmentWithRange { |
25 SVGTextFragmentWithRange(const SVGTextFragment& fragment, | 25 SVGTextFragmentWithRange(const SVGTextFragment& fragment, |
26 int startPosition, | 26 int startPosition, |
27 int endPosition) | 27 int endPosition) |
28 : fragment(fragment), | 28 : fragment(fragment), |
29 startPosition(startPosition), | 29 startPosition(startPosition), |
30 endPosition(endPosition) {} | 30 endPosition(endPosition) {} |
31 const SVGTextFragment& fragment; | 31 const SVGTextFragment& fragment; |
32 int startPosition; | 32 int startPosition; |
33 int endPosition; | 33 int endPosition; |
34 }; | 34 }; |
35 | 35 |
36 class SVGInlineTextBoxPainter { | 36 class SVGInlineTextBoxPainter { |
37 STACK_ALLOCATED(); | 37 STACK_ALLOCATED(); |
38 | 38 |
39 public: | 39 public: |
40 SVGInlineTextBoxPainter(const SVGInlineTextBox& svgInlineTextBox) | 40 SVGInlineTextBoxPainter(const SVGInlineTextBox& svgInlineTextBox) |
41 : m_svgInlineTextBox(svgInlineTextBox) {} | 41 : m_svgInlineTextBox(svgInlineTextBox) {} |
42 void paint(const PaintInfo&, const LayoutPoint&); | 42 void paint(const PaintInfo&, const LayoutPoint&); |
43 void paintSelectionBackground(const PaintInfo&); | 43 void paintSelectionBackground(const PaintInfo&); |
44 void paintTextMatchMarkerForeground(const PaintInfo&, | 44 void paintTextMatchMarkerForeground(const PaintInfo&, |
45 const LayoutPoint&, | 45 const LayoutPoint&, |
46 const DocumentMarker&, | 46 const TextMatchMarker&, |
47 const ComputedStyle&, | 47 const ComputedStyle&, |
48 const Font&); | 48 const Font&); |
49 void paintTextMatchMarkerBackground(const PaintInfo&, | 49 void paintTextMatchMarkerBackground(const PaintInfo&, |
50 const LayoutPoint&, | 50 const LayoutPoint&, |
51 const DocumentMarker&, | 51 const TextMatchMarker&, |
52 const ComputedStyle&, | 52 const ComputedStyle&, |
53 const Font&); | 53 const Font&); |
54 | 54 |
55 private: | 55 private: |
56 bool shouldPaintSelection(const PaintInfo&) const; | 56 bool shouldPaintSelection(const PaintInfo&) const; |
57 FloatRect boundsForDrawingRecorder(const PaintInfo&, | 57 FloatRect boundsForDrawingRecorder(const PaintInfo&, |
58 const ComputedStyle&, | 58 const ComputedStyle&, |
59 const LayoutPoint&, | 59 const LayoutPoint&, |
60 bool includeSelectionRect) const; | 60 bool includeSelectionRect) const; |
61 void paintTextFragments(const PaintInfo&, LayoutObject&); | 61 void paintTextFragments(const PaintInfo&, LayoutObject&); |
(...skipping 10 matching lines...) Expand all Loading... |
72 int startPosition, | 72 int startPosition, |
73 int endPosition, | 73 int endPosition, |
74 const PaintFlags&); | 74 const PaintFlags&); |
75 void paintText(const PaintInfo&, | 75 void paintText(const PaintInfo&, |
76 const ComputedStyle&, | 76 const ComputedStyle&, |
77 const ComputedStyle& selectionStyle, | 77 const ComputedStyle& selectionStyle, |
78 const SVGTextFragment&, | 78 const SVGTextFragment&, |
79 LayoutSVGResourceMode, | 79 LayoutSVGResourceMode, |
80 bool shouldPaintSelection); | 80 bool shouldPaintSelection); |
81 Vector<SVGTextFragmentWithRange> collectTextMatches( | 81 Vector<SVGTextFragmentWithRange> collectTextMatches( |
82 const DocumentMarker&) const; | 82 const TextMatchMarker&) const; |
83 Vector<SVGTextFragmentWithRange> collectFragmentsInRange( | 83 Vector<SVGTextFragmentWithRange> collectFragmentsInRange( |
84 int startPosition, | 84 int startPosition, |
85 int endPosition) const; | 85 int endPosition) const; |
86 LayoutObject& inlineLayoutObject() const; | 86 LayoutObject& inlineLayoutObject() const; |
87 LayoutObject& parentInlineLayoutObject() const; | 87 LayoutObject& parentInlineLayoutObject() const; |
88 LayoutSVGInlineText& inlineText() const; | 88 LayoutSVGInlineText& inlineText() const; |
89 | 89 |
90 const SVGInlineTextBox& m_svgInlineTextBox; | 90 const SVGInlineTextBox& m_svgInlineTextBox; |
91 }; | 91 }; |
92 | 92 |
93 } // namespace blink | 93 } // namespace blink |
94 | 94 |
95 #endif // SVGInlineTextBoxPainter_h | 95 #endif // SVGInlineTextBoxPainter_h |
OLD | NEW |