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 |
index ce043ce2e8a411e156c0fe32d246d0d2142cc473..00d2d2cc27bf56b86c6186e2e8a534d50d3fc5f0 100644 |
--- a/third_party/WebKit/Source/platform/graphics/paint/ScrollPaintPropertyNode.h |
+++ b/third_party/WebKit/Source/platform/graphics/paint/ScrollPaintPropertyNode.h |
@@ -8,6 +8,7 @@ |
#include "platform/PlatformExport.h" |
#include "platform/geometry/FloatSize.h" |
#include "platform/graphics/paint/TransformPaintPropertyNode.h" |
+#include "platform/scroll/MainThreadScrollingReason.h" |
#include "wtf/PassRefPtr.h" |
#include "wtf/RefCounted.h" |
#include "wtf/RefPtr.h" |
@@ -16,13 +17,19 @@ |
namespace blink { |
-// A scroll node contains auxiliary scrolling information for compositor-thread |
-// scrolling and includes how far an area can be scrolled, which |
-// |TransformPaintPropertyNode| contains the scroll offset, etc. |
+using MainThreadScrollingReasons = uint32_t; |
+ |
+// A scroll node contains auxiliary scrolling information for threaded scrolling |
+// which includes how far an area can be scrolled, which transform node contains |
+// the scroll offset, etc. |
+// |
+// Main thread scrolling reasons force scroll updates to go to the main thread |
+// and can have dependencies on other nodes. For example, all parents of a |
+// scroll node with background attachment fixed set should also have it set. |
class PLATFORM_EXPORT ScrollPaintPropertyNode : public RefCounted<ScrollPaintPropertyNode> { |
public: |
static PassRefPtr<ScrollPaintPropertyNode> create( |
- PassRefPtr<const ScrollPaintPropertyNode> parent, |
+ PassRefPtr<ScrollPaintPropertyNode> parent, |
PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation, |
const IntSize& clip, |
const IntSize& bounds, |
@@ -32,7 +39,7 @@ public: |
return adoptRef(new ScrollPaintPropertyNode(std::move(parent), std::move(scrollOffsetTranslation), clip, bounds, userScrollableHorizontal, userScrollableVertical)); |
} |
- void update(PassRefPtr<const ScrollPaintPropertyNode> parent, PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation, const IntSize& clip, const IntSize& bounds, bool userScrollableHorizontal, bool userScrollableVertical) |
+ void update(PassRefPtr<ScrollPaintPropertyNode> parent, PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation, const IntSize& clip, const IntSize& bounds, bool userScrollableHorizontal, bool userScrollableVertical) |
{ |
DCHECK(parent != this); |
m_parent = parent; |
@@ -42,9 +49,10 @@ public: |
m_bounds = bounds; |
m_userScrollableHorizontal = userScrollableHorizontal; |
m_userScrollableVertical = userScrollableVertical; |
+ m_mainThreadScrollingReasons = 0; |
} |
- const ScrollPaintPropertyNode* parent() const { return m_parent.get(); } |
+ ScrollPaintPropertyNode* parent() const { return m_parent.get(); } |
// Transform that the scroll is relative to. |
const TransformPaintPropertyNode* scrollOffsetTranslation() const { return m_scrollOffsetTranslation.get(); } |
@@ -58,9 +66,23 @@ public: |
bool userScrollableHorizontal() const { return m_userScrollableHorizontal; } |
bool userScrollableVertical() const { return m_userScrollableVertical; } |
+ // Return reason bitfield with values from cc::MainThreadScrollingReason. |
+ MainThreadScrollingReasons mainThreadScrollingReasons() const |
+ { |
+ return m_mainThreadScrollingReasons; |
+ } |
+ bool hasMainThreadScrollingReasons(MainThreadScrollingReasons reasons) const |
+ { |
+ return m_mainThreadScrollingReasons & reasons; |
+ } |
+ void addMainThreadScrollingReasons(MainThreadScrollingReasons reasons) |
+ { |
+ m_mainThreadScrollingReasons |= reasons; |
+ } |
+ |
private: |
ScrollPaintPropertyNode( |
- PassRefPtr<const ScrollPaintPropertyNode> parent, |
+ PassRefPtr<ScrollPaintPropertyNode> parent, |
PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation, |
IntSize clip, |
IntSize bounds, |
@@ -72,17 +94,18 @@ private: |
, m_bounds(bounds) |
, m_userScrollableHorizontal(userScrollableHorizontal) |
, m_userScrollableVertical(userScrollableVertical) |
+ , m_mainThreadScrollingReasons(0) |
{ |
DCHECK(m_scrollOffsetTranslation->matrix().isIdentityOr2DTranslation()); |
} |
- RefPtr<const ScrollPaintPropertyNode> m_parent; |
+ RefPtr<ScrollPaintPropertyNode> m_parent; |
RefPtr<const TransformPaintPropertyNode> m_scrollOffsetTranslation; |
IntSize m_clip; |
IntSize m_bounds; |
bool m_userScrollableHorizontal; |
bool m_userScrollableVertical; |
- // TODO(pdr): Add main thread scrolling reasons. |
+ MainThreadScrollingReasons m_mainThreadScrollingReasons; |
// 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. |