Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / core / paint / InlineTextBoxPainter.h
blob05d7e443afd01e2ef710db3975890ebfe7f9c76e
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
3 // found in the LICENSE file.
5 #ifndef InlineTextBoxPainter_h
6 #define InlineTextBoxPainter_h
8 #include "core/style/ComputedStyleConstants.h"
9 #include "platform/geometry/LayoutRect.h"
10 #include "wtf/Allocator.h"
12 namespace blink {
14 struct CompositionUnderline;
15 struct PaintInfo;
17 class Color;
18 class ComputedStyle;
19 class DocumentMarker;
20 class FloatPoint;
21 class FloatRect;
22 class Font;
23 class GraphicsContext;
24 class InlineTextBox;
25 class LayoutPoint;
26 class LayoutTextCombine;
28 class InlineTextBoxPainter {
29 STACK_ALLOCATED();
30 public:
31 InlineTextBoxPainter(InlineTextBox& inlineTextBox) : m_inlineTextBox(inlineTextBox) { }
33 void paint(const PaintInfo&, const LayoutPoint&);
34 void paintDocumentMarkers(GraphicsContext*, const LayoutPoint& boxOrigin, const ComputedStyle&, const Font&, bool background);
35 void paintDocumentMarker(GraphicsContext*, const LayoutPoint& boxOrigin, DocumentMarker*, const ComputedStyle&, const Font&, bool grammar);
36 void paintTextMatchMarker(GraphicsContext*, const LayoutPoint& boxOrigin, DocumentMarker*, const ComputedStyle&, const Font&);
38 static void removeFromTextBlobCache(InlineTextBox&);
40 private:
41 enum class PaintOptions { Normal, CombinedText };
43 void paintCompositionBackgrounds(GraphicsContext*, const LayoutPoint& boxOrigin, const ComputedStyle&, const Font&, bool useCustomUnderlines);
44 void paintSingleCompositionBackgroundRun(GraphicsContext*, const LayoutPoint& boxOrigin, const ComputedStyle&, const Font&, Color backgroundColor, int startPos, int endPos);
45 template <PaintOptions>
46 void paintSelection(GraphicsContext*, const LayoutRect& boxRect, const ComputedStyle&, const Font&, Color textColor, LayoutTextCombine* = nullptr);
47 void paintDecoration(const PaintInfo&, const LayoutPoint& boxOrigin, TextDecoration);
48 void paintCompositionUnderline(GraphicsContext*, const LayoutPoint& boxOrigin, const CompositionUnderline&);
49 unsigned underlinePaintStart(const CompositionUnderline&);
50 unsigned underlinePaintEnd(const CompositionUnderline&);
51 bool shouldPaintTextBox(const PaintInfo&);
52 void expandToIncludeNewlineForSelection(LayoutRect&);
54 InlineTextBox& m_inlineTextBox;
57 } // namespace blink
59 #endif // InlineTextBoxPainter_h