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

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

Issue 2299533002: WIP: Construct SPV2's scroll paint property tree (Closed)
Patch Set: Add more paint property builder tests, update comments/documentation" 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/graphics/paint/ScrollPaintPropertyNode.h
diff --git a/third_party/WebKit/Source/platform/graphics/paint/ScrollPaintPropertyNode.h b/third_party/WebKit/Source/platform/graphics/paint/ScrollPaintPropertyNode.h
new file mode 100644
index 0000000000000000000000000000000000000000..a87581d9c4aeddbcf542da02b1cae742460b32c3
--- /dev/null
+++ b/third_party/WebKit/Source/platform/graphics/paint/ScrollPaintPropertyNode.h
@@ -0,0 +1,97 @@
+// Copyright 2016 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 ScrollPaintPropertyNode_h
+#define ScrollPaintPropertyNode_h
+
+#include "platform/PlatformExport.h"
+#include "platform/geometry/FloatSize.h"
+#include "platform/graphics/paint/TransformPaintPropertyNode.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefCounted.h"
+#include "wtf/RefPtr.h"
+
+#include <iosfwd>
+
+namespace blink {
+
+// A scroll node contains auxillary scrolling information about areas that
+// respond to user input and how far they can be scrolled. The actual scroll
+// offset is applied in an associated TransformPaintPropertyNode.
+class PLATFORM_EXPORT ScrollPaintPropertyNode : public RefCounted<ScrollPaintPropertyNode> {
+public:
+ static PassRefPtr<ScrollPaintPropertyNode> create(
+ PassRefPtr<const ScrollPaintPropertyNode> parent,
+ PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation,
+ const FloatSize& clip,
+ const FloatSize& bounds,
+ bool userScrollableHorizontal,
+ bool userScrollableVertical)
+ {
+ return adoptRef(new ScrollPaintPropertyNode(parent, scrollOffsetTranslation, clip, bounds, userScrollableHorizontal, userScrollableVertical));
+ }
+
+ void update(PassRefPtr<const ScrollPaintPropertyNode> parent, PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation, const FloatSize& clip, const FloatSize& bounds, bool userScrollableHorizontal, bool userScrollableVertical)
+ {
+ m_parent = parent;
+ DCHECK(scrollOffsetTranslation->matrix().isIdentityOr2DTranslation());
+ m_scrollOffsetTranslation = scrollOffsetTranslation;
+ m_clip = clip;
+ m_bounds = bounds;
+ m_userScrollableHorizontal = userScrollableHorizontal;
+ m_userScrollableVertical = userScrollableVertical;
+ }
+
+ const ScrollPaintPropertyNode* parent() const { return m_parent.get(); }
+
+ // Transform that the scroll is relative to.
+ const TransformPaintPropertyNode* scrollOffsetTranslation() const { return m_scrollOffsetTranslation.get(); }
+
+ // The clipped area that contains the scrolled content. In the common case
+ // this is the area that could respond to user input.
+ const FloatSize& clip() const { return m_clip; }
+
+ // The bounds of the content that is scrolled.
+ const FloatSize& bounds() const { return m_bounds; }
+
+ bool userScrollableHorizontal() const { return m_userScrollableHorizontal; }
+ bool userScrollableVertical() const { return m_userScrollableVertical; }
+
+private:
+ ScrollPaintPropertyNode(
+ PassRefPtr<const ScrollPaintPropertyNode> parent,
+ PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation,
+ FloatSize clip,
+ FloatSize bounds,
+ bool userScrollableHorizontal,
+ bool userScrollableVertical)
+ : m_parent(parent)
+ , m_scrollOffsetTranslation(scrollOffsetTranslation)
+ , m_clip(clip)
+ , m_bounds(bounds)
+ , m_userScrollableHorizontal(userScrollableHorizontal)
+ , m_userScrollableVertical(userScrollableVertical)
+ {
+ DCHECK(m_scrollOffsetTranslation->matrix().isIdentityOr2DTranslation());
+ }
+
+ RefPtr<const ScrollPaintPropertyNode> m_parent;
+ RefPtr<const TransformPaintPropertyNode> m_scrollOffsetTranslation;
+ FloatSize m_clip;
+ FloatSize m_bounds;
+ bool m_userScrollableHorizontal;
+ bool m_userScrollableVertical;
+ // TODO(pdr): Add main thread scrolling reasons.
+ // TODO(pdr): Add an offset for the clip and bounds to the transform.
+ // TODO(pdr): Add 2 bits for whether this is a viewport scroll node.
+ // TODO(pdr): Add a bit for whether this is affected by page scale.
+};
+
+// Redeclared here to avoid ODR issues.
+// See platform/testing/PaintPrinters.h.
+void PrintTo(const ScrollPaintPropertyNode&, std::ostream*);
+
+} // namespace blink
+
+#endif // ScrollPaintPropertyNode_h

Powered by Google App Engine
This is Rietveld 408576698