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

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

Issue 2359063002: Add static root property tree nodes [spv2] (Closed)
Patch Set: Restore PaintPropertyTreeGraphBuilder root node printing 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/core/paint/PaintPropertyTreeBuilder.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
index 0ce6ff6e4306a250840b5e70777ef9786ecd3089..e865b4025c9ebe78df5878752cef66db106e8c0b 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -20,28 +20,49 @@
namespace blink {
-void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPropertyTreeBuilderContext& context)
+namespace {
+ TransformPaintPropertyNode* rootTransformNode()
+ {
+ DEFINE_STATIC_REF(TransformPaintPropertyNode, rootTransform, (TransformPaintPropertyNode::create(nullptr, TransformationMatrix(), FloatPoint3D())));
+ return rootTransform;
+ }
+
+ ClipPaintPropertyNode* rootClipNode()
+ {
+ DEFINE_STATIC_REF(ClipPaintPropertyNode, rootClip, (ClipPaintPropertyNode::create(nullptr, rootTransformNode(), FloatRoundedRect(LayoutRect::infiniteIntRect()))));
+ return rootClip;
+ }
+
+ EffectPaintPropertyNode* rootEffectNode()
+ {
+ DEFINE_STATIC_REF(EffectPaintPropertyNode, rootEffect, (EffectPaintPropertyNode::create(nullptr, 1.0)));
+ return rootEffect;
+ }
+
+ ScrollPaintPropertyNode* rootScrollNode()
+ {
+ DEFINE_STATIC_REF(ScrollPaintPropertyNode, rootScroll, (ScrollPaintPropertyNode::create(nullptr, rootTransformNode(), IntSize(), IntSize(), false, false)));
+ return rootScroll;
+ }
+}
+
+PaintPropertyTreeBuilderContext PaintPropertyTreeBuilder::setupInitialContext()
{
+ PaintPropertyTreeBuilderContext context;
+
+ // TODO(pdr): Update the root layer scrolling paths to use the static root nodes.
if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
- return;
+ return context;
- if (!rootFrame.rootTransform() || rootFrame.rootTransform()->parent()) {
- rootFrame.setRootTransform(TransformPaintPropertyNode::create(nullptr, TransformationMatrix(), FloatPoint3D()));
- rootFrame.setRootClip(ClipPaintPropertyNode::create(nullptr, rootFrame.rootTransform(), FloatRoundedRect(LayoutRect::infiniteIntRect())));
- rootFrame.setRootEffect(EffectPaintPropertyNode::create(nullptr, 1.0));
- rootFrame.setRootScroll(ScrollPaintPropertyNode::create(nullptr, rootFrame.rootTransform(), IntSize(), IntSize(), false, false));
- } else {
- DCHECK(rootFrame.rootClip() && !rootFrame.rootClip()->parent());
- DCHECK(rootFrame.rootEffect() && !rootFrame.rootEffect()->parent());
- DCHECK(rootFrame.rootScroll() && !rootFrame.rootScroll()->parent());
- // Ensure main thread scroll reasons are reset.
- rootFrame.rootScroll()->update(nullptr, rootFrame.rootTransform(), IntSize(), IntSize(), false, false);
- }
+ context.current.transform = context.absolutePosition.transform = context.fixedPosition.transform = rootTransformNode();
+ context.current.scroll = context.absolutePosition.scroll = context.fixedPosition.scroll = rootScrollNode();
+ context.current.clip = context.absolutePosition.clip = context.fixedPosition.clip = rootClipNode();
+ context.currentEffect = rootEffectNode();
+
+ // Ensure scroll tree properties are reset. They will be rebuilt during the tree walk.
+ rootScrollNode()->clearMainThreadScrollingReasons();
- context.current.transform = context.absolutePosition.transform = context.fixedPosition.transform = rootFrame.rootTransform();
- context.current.scroll = rootFrame.rootScroll();
- context.current.clip = context.absolutePosition.clip = context.fixedPosition.clip = rootFrame.rootClip();
- context.currentEffect = rootFrame.rootEffect();
+ return context;
}
void createOrUpdateFrameViewPreTranslation(FrameView& frameView,
@@ -156,6 +177,9 @@ void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert
context.fixedPosition = context.current;
context.fixedPosition.transform = frameView.preTranslation();
context.fixedPosition.scroll = initialScroll;
+
+ std::unique_ptr<PropertyTreeState> contentsState(new PropertyTreeState(context.current.transform, context.current.clip, context.currentEffect, context.current.scroll));
+ frameView.setTotalPropertyTreeStateForContents(std::move(contentsState));
}
void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)

Powered by Google App Engine
This is Rietveld 408576698