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 InlineTextBoxPainter_h | 5 #ifndef InlineTextBoxPainter_h |
6 #define InlineTextBoxPainter_h | 6 #define InlineTextBoxPainter_h |
7 | 7 |
8 #include "core/style/ComputedStyleConstants.h" | 8 #include "core/style/ComputedStyleConstants.h" |
9 #include "platform/geometry/LayoutRect.h" | 9 #include "platform/geometry/LayoutRect.h" |
10 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
11 | 11 |
12 namespace blink { | 12 namespace blink { |
13 | 13 |
14 struct CompositionUnderline; | 14 struct CompositionUnderline; |
15 struct PaintInfo; | 15 struct PaintInfo; |
16 | 16 |
17 class Color; | 17 class Color; |
18 class ComputedStyle; | 18 class ComputedStyle; |
19 class DocumentMarker; | 19 class DocumentMarker; |
20 class FloatPoint; | 20 class FloatPoint; |
21 class FloatRect; | 21 class FloatRect; |
22 class Font; | 22 class Font; |
23 class GraphicsContext; | 23 class GraphicsContext; |
24 class InlineTextBox; | 24 class InlineTextBox; |
25 class LayoutPoint; | 25 class LayoutPoint; |
26 class LayoutTextCombine; | 26 class LayoutTextCombine; |
27 | 27 |
| 28 enum class DocumentMarkerPaintPhase { Foreground, Background }; |
| 29 |
28 class InlineTextBoxPainter { | 30 class InlineTextBoxPainter { |
29 STACK_ALLOCATED(); | 31 STACK_ALLOCATED(); |
30 public: | 32 public: |
31 InlineTextBoxPainter(const InlineTextBox& inlineTextBox) : m_inlineTextBox(i
nlineTextBox) { } | 33 InlineTextBoxPainter(const InlineTextBox& inlineTextBox) : m_inlineTextBox(i
nlineTextBox) { } |
32 | 34 |
33 void paint(const PaintInfo&, const LayoutPoint&); | 35 void paint(const PaintInfo&, const LayoutPoint&); |
34 void paintDocumentMarkers(GraphicsContext&, const LayoutPoint& boxOrigin, co
nst ComputedStyle&, const Font&, bool background); | 36 void paintDocumentMarkers(const PaintInfo&, const LayoutPoint& boxOrigin, co
nst ComputedStyle&, const Font&, DocumentMarkerPaintPhase); |
35 void paintDocumentMarker(GraphicsContext&, const LayoutPoint& boxOrigin, Doc
umentMarker*, const ComputedStyle&, const Font&, bool grammar); | 37 void paintDocumentMarker(GraphicsContext&, const LayoutPoint& boxOrigin, Doc
umentMarker*, const ComputedStyle&, const Font&, bool grammar); |
36 void paintTextMatchMarker(GraphicsContext&, const LayoutPoint& boxOrigin, Do
cumentMarker*, const ComputedStyle&, const Font&); | 38 void paintTextMatchMarkerForeground(const PaintInfo&, const LayoutPoint& box
Origin, DocumentMarker*, const ComputedStyle&, const Font&); |
| 39 void paintTextMatchMarkerBackground(const PaintInfo&, const LayoutPoint& box
Origin, DocumentMarker*, const ComputedStyle&, const Font&); |
37 | 40 |
38 static void removeFromTextBlobCache(const InlineTextBox&); | 41 static void removeFromTextBlobCache(const InlineTextBox&); |
39 | 42 |
40 private: | 43 private: |
41 enum class PaintOptions { Normal, CombinedText }; | 44 enum class PaintOptions { Normal, CombinedText }; |
42 | 45 |
43 void paintCompositionBackgrounds(GraphicsContext&, const LayoutPoint& boxOri
gin, const ComputedStyle&, const Font&, bool useCustomUnderlines); | 46 void paintCompositionBackgrounds(GraphicsContext&, const LayoutPoint& boxOri
gin, const ComputedStyle&, const Font&, bool useCustomUnderlines); |
44 void paintSingleCompositionBackgroundRun(GraphicsContext&, const LayoutPoint
& boxOrigin, const ComputedStyle&, const Font&, Color backgroundColor, int start
Pos, int endPos); | 47 void paintSingleCompositionBackgroundRun(GraphicsContext&, const LayoutPoint
& boxOrigin, const ComputedStyle&, const Font&, Color backgroundColor, int start
Pos, int endPos); |
45 template <PaintOptions> | 48 template <PaintOptions> |
46 void paintSelection(GraphicsContext&, const LayoutRect& boxRect, const Compu
tedStyle&, const Font&, Color textColor, LayoutTextCombine* = nullptr); | 49 void paintSelection(GraphicsContext&, const LayoutRect& boxRect, const Compu
tedStyle&, const Font&, Color textColor, LayoutTextCombine* = nullptr); |
47 void paintDecoration(const PaintInfo&, const LayoutPoint& boxOrigin, TextDec
oration); | 50 void paintDecoration(const PaintInfo&, const LayoutPoint& boxOrigin, TextDec
oration); |
48 void paintCompositionUnderline(GraphicsContext&, const LayoutPoint& boxOrigi
n, const CompositionUnderline&); | 51 void paintCompositionUnderline(GraphicsContext&, const LayoutPoint& boxOrigi
n, const CompositionUnderline&); |
49 unsigned underlinePaintStart(const CompositionUnderline&); | 52 unsigned underlinePaintStart(const CompositionUnderline&); |
50 unsigned underlinePaintEnd(const CompositionUnderline&); | 53 unsigned underlinePaintEnd(const CompositionUnderline&); |
51 bool shouldPaintTextBox(const PaintInfo&); | 54 bool shouldPaintTextBox(const PaintInfo&); |
52 void expandToIncludeNewlineForSelection(LayoutRect&); | 55 void expandToIncludeNewlineForSelection(LayoutRect&); |
53 | 56 |
54 const InlineTextBox& m_inlineTextBox; | 57 const InlineTextBox& m_inlineTextBox; |
55 }; | 58 }; |
56 | 59 |
57 } // namespace blink | 60 } // namespace blink |
58 | 61 |
59 #endif // InlineTextBoxPainter_h | 62 #endif // InlineTextBoxPainter_h |
OLD | NEW |