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 LayoutObject; |
25 class LayoutPoint; | 26 class LayoutPoint; |
26 class LayoutTextCombine; | 27 class LayoutTextCombine; |
27 | 28 |
28 enum class DocumentMarkerPaintPhase { Foreground, Background }; | 29 enum class DocumentMarkerPaintPhase { Foreground, Background }; |
29 | 30 |
30 class InlineTextBoxPainter { | 31 class InlineTextBoxPainter { |
31 STACK_ALLOCATED(); | 32 STACK_ALLOCATED(); |
32 public: | 33 public: |
33 InlineTextBoxPainter(const InlineTextBox& inlineTextBox) : m_inlineTextBox(i
nlineTextBox) { } | 34 InlineTextBoxPainter(const InlineTextBox& inlineTextBox) : m_inlineTextBox(i
nlineTextBox) { } |
34 | 35 |
35 void paint(const PaintInfo&, const LayoutPoint&); | 36 void paint(const PaintInfo&, const LayoutPoint&); |
36 void paintDocumentMarkers(const PaintInfo&, const LayoutPoint& boxOrigin, co
nst ComputedStyle&, const Font&, DocumentMarkerPaintPhase); | 37 void paintDocumentMarkers(const PaintInfo&, const LayoutPoint& boxOrigin, co
nst ComputedStyle&, const Font&, DocumentMarkerPaintPhase); |
37 void paintDocumentMarker(GraphicsContext&, const LayoutPoint& boxOrigin, Doc
umentMarker*, const ComputedStyle&, const Font&, bool grammar); | 38 void paintDocumentMarker(GraphicsContext&, const LayoutPoint& boxOrigin, Doc
umentMarker*, const ComputedStyle&, const Font&, bool grammar); |
38 void paintTextMatchMarkerForeground(const PaintInfo&, const LayoutPoint& box
Origin, DocumentMarker*, const ComputedStyle&, const Font&); | 39 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&); | 40 void paintTextMatchMarkerBackground(const PaintInfo&, const LayoutPoint& box
Origin, DocumentMarker*, const ComputedStyle&, const Font&); |
40 | 41 |
41 static void removeFromTextBlobCache(const InlineTextBox&); | 42 static void removeFromTextBlobCache(const InlineTextBox&); |
| 43 static bool paintsMarkerHighlights(const LayoutObject&); |
42 | 44 |
43 private: | 45 private: |
44 enum class PaintOptions { Normal, CombinedText }; | 46 enum class PaintOptions { Normal, CombinedText }; |
45 | 47 |
46 void paintCompositionBackgrounds(GraphicsContext&, const LayoutPoint& boxOri
gin, const ComputedStyle&, const Font&, bool useCustomUnderlines); | 48 void paintCompositionBackgrounds(GraphicsContext&, const LayoutPoint& boxOri
gin, const ComputedStyle&, const Font&, bool useCustomUnderlines); |
47 void paintSingleCompositionBackgroundRun(GraphicsContext&, const LayoutPoint
& boxOrigin, const ComputedStyle&, const Font&, Color backgroundColor, int start
Pos, int endPos); | 49 void paintSingleCompositionBackgroundRun(GraphicsContext&, const LayoutPoint
& boxOrigin, const ComputedStyle&, const Font&, Color backgroundColor, int start
Pos, int endPos); |
48 template <PaintOptions> | 50 template <PaintOptions> |
49 void paintSelection(GraphicsContext&, const LayoutRect& boxRect, const Compu
tedStyle&, const Font&, Color textColor, LayoutTextCombine* = nullptr); | 51 void paintSelection(GraphicsContext&, const LayoutRect& boxRect, const Compu
tedStyle&, const Font&, Color textColor, LayoutTextCombine* = nullptr); |
50 void paintDecoration(const PaintInfo&, const LayoutPoint& boxOrigin, TextDec
oration); | 52 void paintDecoration(const PaintInfo&, const LayoutPoint& boxOrigin, TextDec
oration); |
51 void paintCompositionUnderline(GraphicsContext&, const LayoutPoint& boxOrigi
n, const CompositionUnderline&); | 53 void paintCompositionUnderline(GraphicsContext&, const LayoutPoint& boxOrigi
n, const CompositionUnderline&); |
52 unsigned underlinePaintStart(const CompositionUnderline&); | 54 unsigned underlinePaintStart(const CompositionUnderline&); |
53 unsigned underlinePaintEnd(const CompositionUnderline&); | 55 unsigned underlinePaintEnd(const CompositionUnderline&); |
54 bool shouldPaintTextBox(const PaintInfo&); | 56 bool shouldPaintTextBox(const PaintInfo&); |
55 void expandToIncludeNewlineForSelection(LayoutRect&); | 57 void expandToIncludeNewlineForSelection(LayoutRect&); |
56 | 58 |
57 const InlineTextBox& m_inlineTextBox; | 59 const InlineTextBox& m_inlineTextBox; |
58 }; | 60 }; |
59 | 61 |
60 } // namespace blink | 62 } // namespace blink |
61 | 63 |
62 #endif // InlineTextBoxPainter_h | 64 #endif // InlineTextBoxPainter_h |
OLD | NEW |