Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: third_party/WebKit/Source/platform/graphics/paint/ScrollPaintPropertyNode.h

Issue 2320463002: [SPV2] Implement the blink-side scroll property tree (Closed)
Patch Set: Prevent circular reference caught by lsan Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 ScrollPaintPropertyNode_h
6 #define ScrollPaintPropertyNode_h
7
8 #include "platform/PlatformExport.h"
9 #include "platform/geometry/FloatSize.h"
10 #include "platform/graphics/paint/TransformPaintPropertyNode.h"
11 #include "wtf/PassRefPtr.h"
12 #include "wtf/RefCounted.h"
13 #include "wtf/RefPtr.h"
14
15 #include <iosfwd>
16
17 namespace blink {
18
19 // A scroll node contains auxiliary scrolling information for compositor-thread
20 // scrolling and includes how far an area can be scrolled, which
21 // |TransformPaintPropertyNode| contains the scroll offset, etc.
22 class PLATFORM_EXPORT ScrollPaintPropertyNode : public RefCounted<ScrollPaintPro pertyNode> {
23 public:
24 static PassRefPtr<ScrollPaintPropertyNode> create(
25 PassRefPtr<const ScrollPaintPropertyNode> parent,
26 PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation,
27 const IntSize& clip,
28 const IntSize& bounds,
29 bool userScrollableHorizontal,
30 bool userScrollableVertical)
31 {
32 return adoptRef(new ScrollPaintPropertyNode(std::move(parent), std::move (scrollOffsetTranslation), clip, bounds, userScrollableHorizontal, userScrollabl eVertical));
33 }
34
35 void update(PassRefPtr<const ScrollPaintPropertyNode> parent, PassRefPtr<con st TransformPaintPropertyNode> scrollOffsetTranslation, const IntSize& clip, con st IntSize& bounds, bool userScrollableHorizontal, bool userScrollableVertical)
36 {
37 DCHECK(parent != this);
38 m_parent = parent;
39 DCHECK(scrollOffsetTranslation->matrix().isIdentityOr2DTranslation());
40 m_scrollOffsetTranslation = scrollOffsetTranslation;
41 m_clip = clip;
42 m_bounds = bounds;
43 m_userScrollableHorizontal = userScrollableHorizontal;
44 m_userScrollableVertical = userScrollableVertical;
45 }
46
47 const ScrollPaintPropertyNode* parent() const { return m_parent.get(); }
48
49 // Transform that the scroll is relative to.
50 const TransformPaintPropertyNode* scrollOffsetTranslation() const { return m _scrollOffsetTranslation.get(); }
51
52 // The clipped area that contains the scrolled content.
53 const IntSize& clip() const { return m_clip; }
54
55 // The bounds of the content that is scrolled within |clip|.
56 const IntSize& bounds() const { return m_bounds; }
57
58 bool userScrollableHorizontal() const { return m_userScrollableHorizontal; }
59 bool userScrollableVertical() const { return m_userScrollableVertical; }
60
61 private:
62 ScrollPaintPropertyNode(
63 PassRefPtr<const ScrollPaintPropertyNode> parent,
64 PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation,
65 IntSize clip,
66 IntSize bounds,
67 bool userScrollableHorizontal,
68 bool userScrollableVertical)
69 : m_parent(parent)
70 , m_scrollOffsetTranslation(scrollOffsetTranslation)
71 , m_clip(clip)
72 , m_bounds(bounds)
73 , m_userScrollableHorizontal(userScrollableHorizontal)
74 , m_userScrollableVertical(userScrollableVertical)
75 {
76 DCHECK(m_scrollOffsetTranslation->matrix().isIdentityOr2DTranslation());
77 }
78
79 RefPtr<const ScrollPaintPropertyNode> m_parent;
80 RefPtr<const TransformPaintPropertyNode> m_scrollOffsetTranslation;
81 IntSize m_clip;
82 IntSize m_bounds;
83 bool m_userScrollableHorizontal;
84 bool m_userScrollableVertical;
85 // TODO(pdr): Add main thread scrolling reasons.
86 // TODO(pdr): Add an offset for the clip and bounds to the transform.
87 // TODO(pdr): Add 2 bits for whether this is a viewport scroll node.
88 // TODO(pdr): Add a bit for whether this is affected by page scale.
89 };
90
91 // Redeclared here to avoid ODR issues.
92 // See platform/testing/PaintPrinters.h.
93 void PrintTo(const ScrollPaintPropertyNode&, std::ostream*);
94
95 } // namespace blink
96
97 #endif // ScrollPaintPropertyNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698