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"
14 struct CompositionUnderline
;
23 class GraphicsContext
;
26 class LayoutTextCombine
;
28 class InlineTextBoxPainter
{
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
&);
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
;
59 #endif // InlineTextBoxPainter_h