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.
4 
5 #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_OBJECT_PAINTER_H_
6 #define THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_OBJECT_PAINTER_H_
7 
8 #include "third_party/blink/renderer/core/paint/object_painter_base.h"
9 #include "third_party/blink/renderer/core/style/computed_style_constants.h"
10 #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
11 #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
12 
13 namespace blink {
14 
15 class LayoutObject;
16 struct PaintInfo;
17 struct PhysicalOffset;
18 
19 class ObjectPainter : public ObjectPainterBase {
20   STACK_ALLOCATED();
21 
22  public:
ObjectPainter(const LayoutObject & layout_object)23   ObjectPainter(const LayoutObject& layout_object)
24       : layout_object_(layout_object) {}
25 
26   void PaintOutline(const PaintInfo&, const PhysicalOffset& paint_offset);
27   void PaintInlineChildrenOutlines(const PaintInfo&);
28   void AddURLRectIfNeeded(const PaintInfo&, const PhysicalOffset& paint_offset);
29 
30   // Paints the object atomically as if it created a new stacking context, for:
31   // - inline blocks, inline tables, inline-level replaced elements (Section
32   //   7.2.1.4 in http://www.w3.org/TR/CSS2/zindex.html#painting-order),
33   // - non-positioned floating objects (Section 5 in
34   //   http://www.w3.org/TR/CSS2/zindex.html#painting-order),
35   // - flex items (http://www.w3.org/TR/css-flexbox-1/#painting),
36   // - grid items (http://www.w3.org/TR/css-grid-1/#z-order),
37   // - custom scrollbar parts.
38   // Also see core/paint/README.md.
39   //
40   // It is expected that the caller will call this function independent of the
41   // value of paintInfo.phase, and this function will do atomic paint (for
42   // kForeground), normal paint (for kSelection and kTextClip) or nothing (other
43   // paint phases) according to paintInfo.phase.
44   void PaintAllPhasesAtomically(const PaintInfo&);
45 
46   const LayoutObject& layout_object_;
47 };
48 
49 }  // namespace blink
50 
51 #endif
52