| 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 "platform/wtf/Allocator.h" | 10 #include "platform/wtf/Allocator.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 struct PaintInfo; | 14 struct PaintInfo; |
| 15 | 15 |
| 16 class Color; | 16 class Color; |
| 17 class CompositionUnderline; | |
| 18 class ComputedStyle; | 17 class ComputedStyle; |
| 19 class DocumentMarker; | 18 class DocumentMarker; |
| 20 class Font; | 19 class Font; |
| 21 class GraphicsContext; | 20 class GraphicsContext; |
| 22 class InlineTextBox; | 21 class InlineTextBox; |
| 23 class LayoutObject; | 22 class LayoutObject; |
| 24 class LayoutPoint; | 23 class LayoutPoint; |
| 25 class LayoutTextCombine; | 24 class LayoutTextCombine; |
| 25 class StyleableMarker; |
| 26 class TextMatchMarker; | 26 class TextMatchMarker; |
| 27 | 27 |
| 28 enum class DocumentMarkerPaintPhase { kForeground, kBackground }; | 28 enum class DocumentMarkerPaintPhase { kForeground, kBackground }; |
| 29 | 29 |
| 30 class InlineTextBoxPainter { | 30 class InlineTextBoxPainter { |
| 31 STACK_ALLOCATED(); | 31 STACK_ALLOCATED(); |
| 32 | 32 |
| 33 public: | 33 public: |
| 34 InlineTextBoxPainter(const InlineTextBox& inline_text_box) | 34 InlineTextBoxPainter(const InlineTextBox& inline_text_box) |
| 35 : inline_text_box_(inline_text_box) {} | 35 : inline_text_box_(inline_text_box) {} |
| (...skipping 19 matching lines...) Expand all Loading... |
| 55 const LayoutPoint& box_origin, | 55 const LayoutPoint& box_origin, |
| 56 const TextMatchMarker&, | 56 const TextMatchMarker&, |
| 57 const ComputedStyle&, | 57 const ComputedStyle&, |
| 58 const Font&); | 58 const Font&); |
| 59 | 59 |
| 60 static bool PaintsMarkerHighlights(const LayoutObject&); | 60 static bool PaintsMarkerHighlights(const LayoutObject&); |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 enum class PaintOptions { kNormal, kCombinedText }; | 63 enum class PaintOptions { kNormal, kCombinedText }; |
| 64 | 64 |
| 65 void PaintSingleCompositionBackgroundRun(GraphicsContext&, | 65 void PaintSingleMarkerBackgroundRun(GraphicsContext&, |
| 66 const LayoutPoint& box_origin, | 66 const LayoutPoint& box_origin, |
| 67 const ComputedStyle&, | 67 const ComputedStyle&, |
| 68 const Font&, | 68 const Font&, |
| 69 Color background_color, | 69 Color background_color, |
| 70 int start_pos, | 70 int start_pos, |
| 71 int end_pos); | 71 int end_pos); |
| 72 template <PaintOptions> | 72 template <PaintOptions> |
| 73 void PaintSelection(GraphicsContext&, | 73 void PaintSelection(GraphicsContext&, |
| 74 const LayoutRect& box_rect, | 74 const LayoutRect& box_rect, |
| 75 const ComputedStyle&, | 75 const ComputedStyle&, |
| 76 const Font&, | 76 const Font&, |
| 77 Color text_color, | 77 Color text_color, |
| 78 LayoutTextCombine* = nullptr); | 78 LayoutTextCombine* = nullptr); |
| 79 | 79 |
| 80 void PaintCompositionUnderline(GraphicsContext&, | 80 void PaintStyleableMarkerUnderline(GraphicsContext&, |
| 81 const LayoutPoint& box_origin, | 81 const LayoutPoint& box_origin, |
| 82 const CompositionUnderline&); | 82 const StyleableMarker&); |
| 83 unsigned UnderlinePaintStart(const CompositionUnderline&); | 83 unsigned MarkerPaintStart(const DocumentMarker&); |
| 84 unsigned UnderlinePaintEnd(const CompositionUnderline&); | 84 unsigned MarkerPaintEnd(const DocumentMarker&); |
| 85 bool ShouldPaintTextBox(const PaintInfo&); | 85 bool ShouldPaintTextBox(const PaintInfo&); |
| 86 void ExpandToIncludeNewlineForSelection(LayoutRect&); | 86 void ExpandToIncludeNewlineForSelection(LayoutRect&); |
| 87 LayoutObject& InlineLayoutObject() const; | 87 LayoutObject& InlineLayoutObject() const; |
| 88 | 88 |
| 89 const InlineTextBox& inline_text_box_; | 89 const InlineTextBox& inline_text_box_; |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 } // namespace blink | 92 } // namespace blink |
| 93 | 93 |
| 94 #endif // InlineTextBoxPainter_h | 94 #endif // InlineTextBoxPainter_h |
| OLD | NEW |