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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayer.cpp

Issue 2667373002: Ensure PaintArtifactCompositor assigns a scroll tree index to all cc layers (Closed)
Patch Set: Created 3 years, 11 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/core/paint/PaintLayer.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
index 72d15516de546026111c895369e7654ec2283d76..48e57126a4c7b52cf21a1e05b264edbf21bd42f2 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayer.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -328,21 +328,6 @@ void PaintLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus() {
}
}
-static const ScrollPaintPropertyNode* nearestScrollNode(
- const TransformPaintPropertyNode* transform) {
- if (const auto* scrollNode = transform->scrollNode())
- return scrollNode;
- for (const auto* ancestor = transform->parent(); ancestor;
- ancestor = ancestor->parent()) {
- if (const auto* scrollNode = ancestor->scrollNode())
- return scrollNode;
- }
- // The root transform node references the root scroll node so a scroll node
- // should always exist.
- NOTREACHED();
- return nullptr;
-}
-
bool PaintLayer::sticksToViewport() const {
if (layoutObject()->style()->position() != FixedPosition &&
layoutObject()->style()->position() != StickyPosition)
@@ -352,26 +337,21 @@ bool PaintLayer::sticksToViewport() const {
// An option for improving this is to cache the nearest scroll node in
// the local border box properties.
if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+ const auto* viewProperties = layoutObject()->view()->paintProperties();
const ScrollPaintPropertyNode* ancestorTargetScrollNode;
if (layoutObject()->style()->position() == FixedPosition) {
- ancestorTargetScrollNode =
- nearestScrollNode(layoutObject()
- ->view()
- ->paintProperties()
- ->localBorderBoxProperties()
- ->transform());
+ ancestorTargetScrollNode = viewProperties->localBorderBoxProperties()
+ ->transform()
+ ->findEnclosingScrollNode();
} else {
- ancestorTargetScrollNode = nearestScrollNode(layoutObject()
- ->view()
- ->paintProperties()
- ->contentsProperties()
- ->transform());
+ ancestorTargetScrollNode = viewProperties->contentsProperties()
+ ->transform()
+ ->findEnclosingScrollNode();
}
- return nearestScrollNode(layoutObject()
- ->paintProperties()
- ->localBorderBoxProperties()
- ->transform()) == ancestorTargetScrollNode;
+ const auto* properties = layoutObject()->paintProperties();
+ const auto* transform = properties->localBorderBoxProperties()->transform();
+ return transform->findEnclosingScrollNode() == ancestorTargetScrollNode;
}
return (layoutObject()->style()->position() == FixedPosition &&

Powered by Google App Engine
This is Rietveld 408576698