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

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: Update comment to not refer to hit testing, switch to IntSizes 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(parent, scrollOffsetTranslat ion, clip, bounds, userScrollableHorizontal, userScrollableVertical));
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 m_parent = parent;
38 DCHECK(scrollOffsetTranslation->matrix().isIdentityOr2DTranslation());
39 m_scrollOffsetTranslation = scrollOffsetTranslation;
40 m_clip = clip;
41 m_bounds = bounds;
42 m_userScrollableHorizontal = userScrollableHorizontal;
43 m_userScrollableVertical = userScrollableVertical;
44 }
45
46 const ScrollPaintPropertyNode* parent() const { return m_parent.get(); }
47
48 // Transform that the scroll is relative to.
49 const TransformPaintPropertyNode* scrollOffsetTranslation() const { return m _scrollOffsetTranslation.get(); }
50
51 // The clipped area that contains the scrolled content.
52 const IntSize& clip() const { return m_clip; }
53
54 // The bounds of the content that is scrolled within |clip|.
55 const IntSize& bounds() const { return m_bounds; }
56
57 bool userScrollableHorizontal() const { return m_userScrollableHorizontal; }
58 bool userScrollableVertical() const { return m_userScrollableVertical; }
59
60 private:
61 ScrollPaintPropertyNode(
62 PassRefPtr<const ScrollPaintPropertyNode> parent,
63 PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation,
64 IntSize clip,
65 IntSize bounds,
66 bool userScrollableHorizontal,
67 bool userScrollableVertical)
68 : m_parent(parent)
69 , m_scrollOffsetTranslation(scrollOffsetTranslation)
70 , m_clip(clip)
71 , m_bounds(bounds)
72 , m_userScrollableHorizontal(userScrollableHorizontal)
73 , m_userScrollableVertical(userScrollableVertical)
74 {
75 DCHECK(m_scrollOffsetTranslation->matrix().isIdentityOr2DTranslation());
76 }
77
78 RefPtr<const ScrollPaintPropertyNode> m_parent;
79 RefPtr<const TransformPaintPropertyNode> m_scrollOffsetTranslation;
80 IntSize m_clip;
81 IntSize m_bounds;
82 bool m_userScrollableHorizontal;
83 bool m_userScrollableVertical;
84 // TODO(pdr): Add main thread scrolling reasons.
85 // TODO(pdr): Add an offset for the clip and bounds to the transform.
86 // TODO(pdr): Add 2 bits for whether this is a viewport scroll node.
87 // TODO(pdr): Add a bit for whether this is affected by page scale.
88 };
89
90 // Redeclared here to avoid ODR issues.
91 // See platform/testing/PaintPrinters.h.
92 void PrintTo(const ScrollPaintPropertyNode&, std::ostream*);
93
94 } // namespace blink
95
96 #endif // ScrollPaintPropertyNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698