summaryrefslogtreecommitdiff
path: root/chromium/third_party/WebKit/Source/core/paint/PrePaintTreeWalk.h
blob: 389bc7633823a171f2436fe3776e5d3d6ce9852b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright 2015 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 PrePaintTreeWalk_h
#define PrePaintTreeWalk_h

#include "core/paint/ClipRect.h"
#include "core/paint/PaintInvalidator.h"
#include "core/paint/PaintPropertyTreeBuilder.h"

namespace blink {

class LayoutObject;
class LocalFrameView;
struct PrePaintTreeWalkContext;

// This class walks the whole layout tree, beginning from the root
// LocalFrameView, across frame boundaries. Helper classes are called for each
// tree node to perform actual actions.  It expects to be invoked in InPrePaint
// phase.
class CORE_EXPORT PrePaintTreeWalk {
 public:
  PrePaintTreeWalk() {}
  void Walk(LocalFrameView& root_frame);

 private:
  void Walk(LocalFrameView&, const PrePaintTreeWalkContext&);
  void Walk(const LayoutObject&, const PrePaintTreeWalkContext&);

  // Invalidates paint-layer painting optimizations, such as subsequence caching
  // and empty paint phase optimizations if clips from the context have changed.
  ALWAYS_INLINE void InvalidatePaintLayerOptimizationsIfNeeded(
      const LayoutObject&,
      PrePaintTreeWalkContext&);

  bool ALWAYS_INLINE
  NeedsTreeBuilderContextUpdate(const LocalFrameView&,
                                const PrePaintTreeWalkContext&);
  bool ALWAYS_INLINE
  NeedsTreeBuilderContextUpdate(const LayoutObject&,
                                const PrePaintTreeWalkContext&);

  PaintPropertyTreeBuilder property_tree_builder_;
  PaintInvalidator paint_invalidator_;

  FRIEND_TEST_ALL_PREFIXES(PrePaintTreeWalkTest, ClipRects);
};

}  // namespace blink

#endif  // PrePaintTreeWalk_h