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 FloatPoint; | 14 class FloatPoint; |
15 class Font; | 15 class Font; |
16 class GraphicsContext; | 16 class GraphicsContext; |
17 struct PaintInfo; | 17 struct PaintInfo; |
18 class LayoutPoint; | 18 class LayoutPoint; |
19 class ComputedStyle; | 19 class ComputedStyle; |
20 class SVGInlineTextBox; | 20 class SVGInlineTextBox; |
21 struct SVGTextFragment; | 21 struct SVGTextFragment; |
22 class TextRun; | 22 class TextRun; |
23 class DocumentMarker; | 23 class DocumentMarker; |
24 | 24 |
| 25 struct SVGTextFragmentWithRange { |
| 26 SVGTextFragmentWithRange(const SVGTextFragment& fragment, int startPosition,
int endPosition) |
| 27 : fragment(fragment) |
| 28 , startPosition(startPosition) |
| 29 , endPosition(endPosition) |
| 30 { |
| 31 } |
| 32 const SVGTextFragment& fragment; |
| 33 int startPosition; |
| 34 int endPosition; |
| 35 }; |
| 36 |
25 class SVGInlineTextBoxPainter { | 37 class SVGInlineTextBoxPainter { |
26 STACK_ALLOCATED(); | 38 STACK_ALLOCATED(); |
27 public: | 39 public: |
28 SVGInlineTextBoxPainter(const SVGInlineTextBox& svgInlineTextBox) : m_svgInl
ineTextBox(svgInlineTextBox) { } | 40 SVGInlineTextBoxPainter(const SVGInlineTextBox& svgInlineTextBox) : m_svgInl
ineTextBox(svgInlineTextBox) { } |
29 void paint(const PaintInfo&, const LayoutPoint&); | 41 void paint(const PaintInfo&, const LayoutPoint&); |
30 void paintSelectionBackground(const PaintInfo&); | 42 void paintSelectionBackground(const PaintInfo&); |
31 virtual void paintTextMatchMarker(GraphicsContext&, const LayoutPoint&, Docu
mentMarker*, const ComputedStyle&, const Font&); | 43 void paintTextMatchMarkerForeground(const PaintInfo&, const LayoutPoint&, Do
cumentMarker*, const ComputedStyle&, const Font&); |
| 44 void paintTextMatchMarkerBackground(const PaintInfo&, const LayoutPoint&, Do
cumentMarker*, const ComputedStyle&, const Font&); |
32 | 45 |
33 private: | 46 private: |
34 bool shouldPaintSelection(const PaintInfo&) const; | 47 bool shouldPaintSelection(const PaintInfo&) const; |
35 void paintTextFragments(const PaintInfo&, LayoutObject&); | 48 void paintTextFragments(const PaintInfo&, LayoutObject&); |
36 void paintDecoration(const PaintInfo&, TextDecoration, const SVGTextFragment
&); | 49 void paintDecoration(const PaintInfo&, TextDecoration, const SVGTextFragment
&); |
37 bool setupTextPaint(const PaintInfo&, const ComputedStyle&, LayoutSVGResourc
eMode, SkPaint&); | 50 bool setupTextPaint(const PaintInfo&, const ComputedStyle&, LayoutSVGResourc
eMode, SkPaint&); |
38 void paintText(const PaintInfo&, TextRun&, const SVGTextFragment&, int start
Position, int endPosition, const SkPaint&); | 51 void paintText(const PaintInfo&, TextRun&, const SVGTextFragment&, int start
Position, int endPosition, const SkPaint&); |
39 void paintText(const PaintInfo&, const ComputedStyle&, const ComputedStyle&
selectionStyle, const SVGTextFragment&, LayoutSVGResourceMode, bool shouldPaintS
election); | 52 void paintText(const PaintInfo&, const ComputedStyle&, const ComputedStyle&
selectionStyle, const SVGTextFragment&, LayoutSVGResourceMode, bool shouldPaintS
election); |
| 53 Vector<SVGTextFragmentWithRange> collectTextMatches(DocumentMarker*) const; |
| 54 Vector<SVGTextFragmentWithRange> collectFragmentsInRange(int startPosition,
int endPosition) const; |
40 | 55 |
41 const SVGInlineTextBox& m_svgInlineTextBox; | 56 const SVGInlineTextBox& m_svgInlineTextBox; |
42 }; | 57 }; |
43 | 58 |
44 } // namespace blink | 59 } // namespace blink |
45 | 60 |
46 #endif // SVGInlineTextBoxPainter_h | 61 #endif // SVGInlineTextBoxPainter_h |
OLD | NEW |