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

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

Issue 2330863003: Switch to null root property tree nodes [spv2] (Closed)
Patch Set: Rebase from space 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 051eac477996558eea600be5ff4714efb73cbe8d..28e61ae0b1140ac63a4c8f8338bd4b8a7925f83b 100644
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp
@@ -20,27 +20,6 @@
namespace blink {
-void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPropertyTreeBuilderContext& context)
-{
- if (RuntimeEnabledFeatures::rootLayerScrollingEnabled())
- return;
-
- 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());
- }
-
- 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();
-}
-
void createOrUpdateFrameViewPreTranslation(FrameView& frameView,
PassRefPtr<const TransformPaintPropertyNode> parent,
const TransformationMatrix& matrix,
@@ -104,8 +83,6 @@ void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert
frameView.y() + layoutView->location().y() + context.current.paintOffset.y());
context.current.transform = layoutView->getMutableForPainting().ensureObjectPaintProperties().createOrUpdatePaintOffsetTranslation(
context.current.transform, frameTranslate, FloatPoint3D());
- context.current.scroll = layoutView->getMutableForPainting().ensureObjectPaintProperties().createOrUpdateScroll(
- context.current.scroll, context.current.transform, IntSize(), IntSize(), false, false);
context.current.paintOffset = LayoutPoint();
context.current.renderingContextID = 0;
context.current.shouldFlattenInheritedTransform = true;
@@ -123,18 +100,18 @@ void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert
createOrUpdateFrameViewContentClip(frameView, context.current.clip, frameView.preTranslation(), contentClip);
DoubleSize scrollOffset = frameView.scrollOffsetDouble();
- TransformationMatrix frameScroll;
- frameScroll.translate(-scrollOffset.width(), -scrollOffset.height());
- // TODO(pdr): A scroll translation should not be needed when frameView.isScrollable() is false.
- createOrUpdateFrameViewScrollTranslation(frameView, frameView.preTranslation(), frameScroll, FloatPoint3D());
+ if (frameView.isScrollable() || !scrollOffset.isZero()) {
+ TransformationMatrix frameScroll;
+ frameScroll.translate(-scrollOffset.width(), -scrollOffset.height());
+ createOrUpdateFrameViewScrollTranslation(frameView, frameView.preTranslation(), frameScroll, FloatPoint3D());
- if (frameView.isScrollable()) {
IntSize scrollClip = frameView.visibleContentSize();
IntSize scrollBounds = frameView.contentsSize();
bool userScrollableHorizontal = frameView.userInputScrollable(HorizontalScrollbar);
bool userScrollableVertical = frameView.userInputScrollable(VerticalScrollbar);
createOrUpdateFrameViewScroll(frameView, context.current.scroll, frameView.scrollTranslation(), scrollClip, scrollBounds, userScrollableHorizontal, userScrollableVertical);
} else {
+ frameView.setScrollTranslation(nullptr);
frameView.setScroll(nullptr);
}
@@ -142,7 +119,7 @@ void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert
// They are the same, except that scroll translation does not apply to
// fixed position descendants.
const ScrollPaintPropertyNode* initialScroll = context.current.scroll;
- context.current.transform = frameView.scrollTranslation();
+ context.current.transform = frameView.scrollTranslation() ? frameView.scrollTranslation() : frameView.preTranslation();
context.current.paintOffset = LayoutPoint();
context.current.clip = frameView.contentClip();
context.current.scroll = frameView.scroll() ? frameView.scroll() : initialScroll;
@@ -251,14 +228,6 @@ void PaintPropertyTreeBuilder::updateTransform(const LayoutObject& object, Paint
void PaintPropertyTreeBuilder::updateEffect(const LayoutObject& object, PaintPropertyTreeBuilderContext& context)
{
- if (object.isLayoutView() && !context.currentEffect) {
- const LayoutView& layoutView = toLayoutView(object);
- DCHECK(RuntimeEnabledFeatures::rootLayerScrollingEnabled());
- DCHECK(layoutView.frameView()->frame().isMainFrame());
- context.currentEffect = layoutView.getMutableForPainting().ensureObjectPaintProperties().createOrUpdateEffect(nullptr, 1.0);
- return;
- }
-
if (!object.styleRef().hasOpacity()) {
if (ObjectPaintProperties* properties = object.getMutableForPainting().objectPaintProperties())
properties->clearEffect();
@@ -299,14 +268,6 @@ void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o
borderBoxContext->geometryPropertyTreeState = GeometryPropertyTreeState(context.current.transform, context.current.clip, context.currentEffect);
borderBoxContext->scroll = context.current.scroll;
- if (!context.current.clip) {
- DCHECK(object.isLayoutView());
- DCHECK(toLayoutView(object).frameView()->frame().isMainFrame());
- DCHECK(RuntimeEnabledFeatures::rootLayerScrollingEnabled());
- borderBoxContext->geometryPropertyTreeState.clip = ClipPaintPropertyNode::create(nullptr, context.current.transform, FloatRoundedRect(LayoutRect::infiniteIntRect()));
- context.current.clip = borderBoxContext->geometryPropertyTreeState.clip.get();
- }
-
object.getMutableForPainting().ensureObjectPaintProperties().setLocalBorderBoxProperties(std::move(borderBoxContext));
}
@@ -421,8 +382,7 @@ void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation(const LayoutObje
PaintLayer* layer = toLayoutBoxModelObject(object).layer();
DCHECK(layer);
DoubleSize scrollOffset = layer->getScrollableArea()->scrollOffset();
- bool forceScrollingForLayoutView = object.isLayoutView() && RuntimeEnabledFeatures::rootLayerScrollingEnabled();
- if (forceScrollingForLayoutView || !scrollOffset.isZero() || layer->scrollsOverflow()) {
+ if (!scrollOffset.isZero() || layer->scrollsOverflow()) {
TransformationMatrix matrix = TransformationMatrix().translate(-scrollOffset.width(), -scrollOffset.height());
context.current.transform = object.getMutableForPainting().ensureObjectPaintProperties().createOrUpdateScrollTranslation(
context.current.transform, matrix, FloatPoint3D(), context.current.shouldFlattenInheritedTransform, context.current.renderingContextID);
@@ -431,9 +391,8 @@ void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation(const LayoutObje
IntSize scrollBounds = layer->getScrollableArea()->contentsSize();
bool userScrollableHorizontal = layer->getScrollableArea()->userInputScrollable(HorizontalScrollbar);
bool userScrollableVertical = layer->getScrollableArea()->userInputScrollable(VerticalScrollbar);
- const ScrollPaintPropertyNode* parentScrollNode = forceScrollingForLayoutView ? nullptr : context.current.scroll;
context.current.scroll = object.getMutableForPainting().ensureObjectPaintProperties().createOrUpdateScroll(
- parentScrollNode, context.current.transform, scrollClip, scrollBounds, userScrollableHorizontal, userScrollableVertical);
+ context.current.scroll, context.current.transform, scrollClip, scrollBounds, userScrollableHorizontal, userScrollableVertical);
context.current.shouldFlattenInheritedTransform = false;
return;
@@ -459,6 +418,7 @@ void PaintPropertyTreeBuilder::updateOutOfFlowContext(const LayoutObject& object
const TransformPaintPropertyNode* transform = object.objectPaintProperties()->paintOffsetTranslation();
DCHECK(transform);
context.fixedPosition.transform = transform;
+ context.fixedPosition.scroll = nullptr;
}
} else if (object.canContainFixedPositionObjects()) {
context.fixedPosition = context.current;

Powered by Google App Engine
This is Rietveld 408576698