OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NGTextPainter_h |
| 6 #define NGTextPainter_h |
| 7 |
| 8 #include "core/CoreExport.h" |
| 9 #include "core/paint/TextPainterBase.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 class NGPhysicalTextFragment; |
| 14 struct TextFragmentPaintInfo; |
| 15 |
| 16 // Text painter for LayoutNG. Operates on NGPhysicalTextFragments. |
| 17 class CORE_EXPORT NGTextPainter : public TextPainterBase { |
| 18 STACK_ALLOCATED(); |
| 19 |
| 20 public: |
| 21 NGTextPainter(GraphicsContext& context, |
| 22 const Font& font, |
| 23 const NGPhysicalTextFragment* text_fragment, |
| 24 const LayoutPoint& text_origin, |
| 25 const LayoutRect& text_bounds, |
| 26 bool horizontal) |
| 27 : TextPainterBase(context, font, text_origin, text_bounds, horizontal), |
| 28 text_fragment_(text_fragment) {} |
| 29 ~NGTextPainter() {} |
| 30 |
| 31 // void SetCombinedText(LayoutTextCombine* combined_text) { |
| 32 // combined_text_ = combined_text; |
| 33 //} |
| 34 |
| 35 void ClipDecorationsStripe(float upper, float stripe_width, float dilation); |
| 36 void Paint(unsigned start_offset, |
| 37 unsigned end_offset, |
| 38 unsigned length, |
| 39 const Style&); |
| 40 |
| 41 static Style TextPaintingStyle(const NGPhysicalTextFragment*, |
| 42 const ComputedStyle&, |
| 43 const PaintInfo&); |
| 44 static Style SelectionPaintingStyle(const NGPhysicalTextFragment*, |
| 45 bool have_selection, |
| 46 const PaintInfo&, |
| 47 const Style& text_style); |
| 48 |
| 49 private: |
| 50 template <PaintInternalStep step> |
| 51 void PaintInternalFragment(TextFragmentPaintInfo&, |
| 52 unsigned from, |
| 53 unsigned to); |
| 54 |
| 55 template <PaintInternalStep step> |
| 56 void PaintInternal(unsigned start_offset, |
| 57 unsigned end_offset, |
| 58 unsigned truncation_point); |
| 59 |
| 60 void PaintEmphasisMarkForCombinedText(); |
| 61 |
| 62 const NGPhysicalTextFragment* text_fragment_; |
| 63 }; |
| 64 |
| 65 } // namespace blink |
| 66 |
| 67 #endif // TextPainter_h |
OLD | NEW |