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_INLINE_FLOW_BOX_PAINTER_H_
6 #define THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_INLINE_FLOW_BOX_PAINTER_H_
7 
8 #include "third_party/blink/renderer/core/layout/geometry/physical_rect.h"
9 #include "third_party/blink/renderer/core/paint/box_model_object_painter.h"
10 #include "third_party/blink/renderer/core/paint/inline_box_painter_base.h"
11 #include "third_party/blink/renderer/core/style/shadow_data.h"
12 #include "third_party/blink/renderer/platform/graphics/graphics_types.h"
13 #include "third_party/blink/renderer/platform/text/text_direction.h"
14 #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
15 
16 namespace blink {
17 
18 class InlineFlowBox;
19 class IntRect;
20 class LayoutRect;
21 class LayoutUnit;
22 struct PaintInfo;
23 
24 class InlineFlowBoxPainter : public InlineBoxPainterBase {
25   STACK_ALLOCATED();
26 
27  public:
28   InlineFlowBoxPainter(const InlineFlowBox&);
29 
30   void Paint(const PaintInfo&,
31              const PhysicalOffset& paint_offset,
32              const LayoutUnit line_top,
33              const LayoutUnit line_bottom);
34 
35   LayoutRect FrameRectClampedToLineTopAndBottomIfNeeded() const;
36 
37  private:
38   // LayoutNG version adapters.
39   PhysicalRect PaintRectForImageStrip(const PhysicalRect& rect,
40                                       TextDirection direction) const override;
41   void PaintNormalBoxShadow(const PaintInfo& info,
42                             const ComputedStyle& style,
43                             const PhysicalRect& rect) override;
44   void PaintInsetBoxShadow(const PaintInfo& info,
45                            const ComputedStyle& style,
46                            const PhysicalRect& rect) override;
47   BorderPaintingType GetBorderPaintType(
48       const PhysicalRect& adjusted_frame_rect,
49       IntRect& adjusted_clip_rect,
50       bool object_has_multiple_boxes) const override;
51 
52   void PaintBackgroundBorderShadow(const PaintInfo&,
53                                    const PhysicalOffset& paint_offset);
54   void PaintMask(const PaintInfo&, const PhysicalOffset& paint_offset);
55 
56   PhysicalRect AdjustedFrameRect(const PhysicalOffset& paint_offset) const;
57   IntRect VisualRect(const PhysicalRect& adjusted_frame_rect) const;
58 
59   // Expands the bounds of the current paint chunk for hit test, and records
60   // special touch action if any. This should be called in the background paint
61   // phase even if there is no other painted content.
62   void RecordHitTestData(const PaintInfo&, const PhysicalOffset& paint_offset);
63 
64   const InlineFlowBox& inline_flow_box_;
65 };
66 
67 }  // namespace blink
68 
69 #endif  // THIRD_PARTY_BLINK_RENDERER_CORE_PAINT_INLINE_FLOW_BOX_PAINTER_H_
70