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

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

Issue 2506353002: Incrementally build main thread scrolling reasons [spv2] (Closed)
Patch Set: Cleanup comments Created 4 years, 1 month 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
index 18779c9575d83ab09284ac6d38ad5882814989b7..8062a4e57353c7697f5c11fe5f62ccd0027a280a 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/ScrollPaintPropertyNode.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/ScrollPaintPropertyNode.h
@@ -32,24 +32,29 @@ class PLATFORM_EXPORT ScrollPaintPropertyNode
static ScrollPaintPropertyNode* root();
static PassRefPtr<ScrollPaintPropertyNode> create(
- PassRefPtr<ScrollPaintPropertyNode> parent,
+ PassRefPtr<const ScrollPaintPropertyNode> parent,
PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation,
const IntSize& clip,
const IntSize& bounds,
bool userScrollableHorizontal,
- bool userScrollableVertical) {
+ bool userScrollableVertical,
+ bool threadedScrollingDisabled,
+ bool hasBackgroundAttachmentFixedDescendants) {
return adoptRef(new ScrollPaintPropertyNode(
std::move(parent), std::move(scrollOffsetTranslation), clip, bounds,
- userScrollableHorizontal, userScrollableVertical));
+ userScrollableHorizontal, userScrollableVertical,
+ threadedScrollingDisabled, hasBackgroundAttachmentFixedDescendants));
}
void update(
- PassRefPtr<ScrollPaintPropertyNode> parent,
+ PassRefPtr<const ScrollPaintPropertyNode> parent,
PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation,
const IntSize& clip,
const IntSize& bounds,
bool userScrollableHorizontal,
- bool userScrollableVertical) {
+ bool userScrollableVertical,
+ bool threadedScrollingDisabled,
+ bool hasBackgroundAttachmentFixedDescendants) {
DCHECK(!isRoot());
DCHECK(parent != this);
m_parent = parent;
@@ -59,10 +64,12 @@ class PLATFORM_EXPORT ScrollPaintPropertyNode
m_bounds = bounds;
m_userScrollableHorizontal = userScrollableHorizontal;
m_userScrollableVertical = userScrollableVertical;
- m_mainThreadScrollingReasons = 0;
+ m_threadedScrollingDisabled = threadedScrollingDisabled;
+ m_hasBackgroundAttachmentFixedDescendants =
+ hasBackgroundAttachmentFixedDescendants;
}
- ScrollPaintPropertyNode* parent() const { return m_parent.get(); }
+ const ScrollPaintPropertyNode* parent() const { return m_parent.get(); }
bool isRoot() const { return !m_parent; }
// Transform that the scroll is relative to.
@@ -81,15 +88,23 @@ class PLATFORM_EXPORT ScrollPaintPropertyNode
// Return reason bitfield with values from cc::MainThreadScrollingReason.
MainThreadScrollingReasons mainThreadScrollingReasons() const {
- return m_mainThreadScrollingReasons;
+ MainThreadScrollingReasons reasons = 0;
+ if (threadedScrollingDisabled())
+ reasons |= MainThreadScrollingReason::kThreadedScrollingDisabled;
+ if (hasBackgroundAttachmentFixedDescendants()) {
+ reasons |=
+ MainThreadScrollingReason::kHasBackgroundAttachmentFixedObjects;
+ }
+ return reasons;
}
- bool hasMainThreadScrollingReasons(MainThreadScrollingReasons reasons) const {
- return m_mainThreadScrollingReasons & reasons;
- }
- void addMainThreadScrollingReasons(MainThreadScrollingReasons reasons) {
- m_mainThreadScrollingReasons |= reasons;
+
+ // Main thread scrolling reason for the threaded scrolling disabled setting.
+ bool threadedScrollingDisabled() const { return m_threadedScrollingDisabled; }
+
+ // Main thread scrolling reason for background attachment fixed descendants.
+ bool hasBackgroundAttachmentFixedDescendants() const {
+ return m_hasBackgroundAttachmentFixedDescendants;
}
- void clearMainThreadScrollingReasons() { m_mainThreadScrollingReasons = 0; }
#if DCHECK_IS_ON()
// The clone function is used by FindPropertiesNeedingUpdate.h for recording
@@ -98,50 +113,57 @@ class PLATFORM_EXPORT ScrollPaintPropertyNode
RefPtr<ScrollPaintPropertyNode> cloned =
adoptRef(new ScrollPaintPropertyNode(
m_parent, m_scrollOffsetTranslation, m_clip, m_bounds,
- m_userScrollableHorizontal, m_userScrollableVertical));
- cloned->addMainThreadScrollingReasons(m_mainThreadScrollingReasons);
+ m_userScrollableHorizontal, m_userScrollableVertical,
+ m_threadedScrollingDisabled,
+ m_hasBackgroundAttachmentFixedDescendants));
return cloned;
}
// The equality operator is used by FindPropertiesNeedingUpdate.h for checking
// if a scroll node has changed.
bool operator==(const ScrollPaintPropertyNode& o) const {
- // TODO(pdr): Check main thread scrolling reason equality as well. We do
- // not yet mark nodes as needing a paint property update on main thread
- // scrolling reason changes. See: See: https://crbug.com/664672.
return m_parent == o.m_parent &&
m_scrollOffsetTranslation == o.m_scrollOffsetTranslation &&
m_clip == o.m_clip && m_bounds == o.m_bounds &&
m_userScrollableHorizontal == o.m_userScrollableHorizontal &&
- m_userScrollableVertical == o.m_userScrollableVertical;
+ m_userScrollableVertical == o.m_userScrollableVertical &&
+ m_threadedScrollingDisabled == o.m_threadedScrollingDisabled &&
+ m_hasBackgroundAttachmentFixedDescendants ==
+ o.m_hasBackgroundAttachmentFixedDescendants;
}
#endif
private:
ScrollPaintPropertyNode(
- PassRefPtr<ScrollPaintPropertyNode> parent,
+ PassRefPtr<const ScrollPaintPropertyNode> parent,
PassRefPtr<const TransformPaintPropertyNode> scrollOffsetTranslation,
IntSize clip,
IntSize bounds,
bool userScrollableHorizontal,
- bool userScrollableVertical)
+ bool userScrollableVertical,
+ bool threadedScrollingDisabled,
+ bool hasBackgroundAttachmentFixedDescendants)
Xianzhu 2016/11/17 19:03:04 Can we use named bit flags to replace the multiple
pdr. 2016/11/17 21:01:36 +1, this looks much better. Done.
: m_parent(parent),
m_scrollOffsetTranslation(scrollOffsetTranslation),
m_clip(clip),
m_bounds(bounds),
m_userScrollableHorizontal(userScrollableHorizontal),
m_userScrollableVertical(userScrollableVertical),
- m_mainThreadScrollingReasons(0) {
+ m_threadedScrollingDisabled(threadedScrollingDisabled),
+ m_hasBackgroundAttachmentFixedDescendants(
+ hasBackgroundAttachmentFixedDescendants) {
DCHECK(m_scrollOffsetTranslation->matrix().isIdentityOr2DTranslation());
}
- RefPtr<ScrollPaintPropertyNode> m_parent;
+ RefPtr<const ScrollPaintPropertyNode> m_parent;
RefPtr<const TransformPaintPropertyNode> m_scrollOffsetTranslation;
IntSize m_clip;
IntSize m_bounds;
- bool m_userScrollableHorizontal;
- bool m_userScrollableVertical;
- MainThreadScrollingReasons m_mainThreadScrollingReasons;
+ bool m_userScrollableHorizontal : 1;
+ bool m_userScrollableVertical : 1;
+ // The following bools are for main thread scrolling reasons.
+ bool m_threadedScrollingDisabled : 1;
+ bool m_hasBackgroundAttachmentFixedDescendants : 1;
// 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.

Powered by Google App Engine
This is Rietveld 408576698