Index: third_party/WebKit/Source/core/paint/NGTextPainter.h |
diff --git a/third_party/WebKit/Source/core/paint/NGTextPainter.h b/third_party/WebKit/Source/core/paint/NGTextPainter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4c621687fb0346352728fbc1271ce12bec70970b |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/paint/NGTextPainter.h |
@@ -0,0 +1,67 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef NGTextPainter_h |
+#define NGTextPainter_h |
+ |
+#include "core/CoreExport.h" |
+#include "core/paint/TextPainterBase.h" |
+ |
+namespace blink { |
+ |
+class NGPhysicalTextFragment; |
+struct TextFragmentPaintInfo; |
+ |
+// Text painter for LayoutNG. Operates on NGPhysicalTextFragments. |
+class CORE_EXPORT NGTextPainter : public TextPainterBase { |
+ STACK_ALLOCATED(); |
+ |
+ public: |
+ NGTextPainter(GraphicsContext& context, |
+ const Font& font, |
+ const NGPhysicalTextFragment* text_fragment, |
+ const LayoutPoint& text_origin, |
+ const LayoutRect& text_bounds, |
+ bool horizontal) |
+ : TextPainterBase(context, font, text_origin, text_bounds, horizontal), |
+ text_fragment_(text_fragment) {} |
+ ~NGTextPainter() {} |
+ |
+ // void SetCombinedText(LayoutTextCombine* combined_text) { |
+ // combined_text_ = combined_text; |
+ //} |
+ |
+ void ClipDecorationsStripe(float upper, float stripe_width, float dilation); |
+ void Paint(unsigned start_offset, |
+ unsigned end_offset, |
+ unsigned length, |
+ const Style&); |
+ |
+ static Style TextPaintingStyle(const NGPhysicalTextFragment*, |
+ const ComputedStyle&, |
+ const PaintInfo&); |
+ static Style SelectionPaintingStyle(const NGPhysicalTextFragment*, |
+ bool have_selection, |
+ const PaintInfo&, |
+ const Style& text_style); |
+ |
+ private: |
+ template <PaintInternalStep step> |
+ void PaintInternalFragment(TextFragmentPaintInfo&, |
+ unsigned from, |
+ unsigned to); |
+ |
+ template <PaintInternalStep step> |
+ void PaintInternal(unsigned start_offset, |
+ unsigned end_offset, |
+ unsigned truncation_point); |
+ |
+ void PaintEmphasisMarkForCombinedText(); |
+ |
+ const NGPhysicalTextFragment* text_fragment_; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // TextPainter_h |