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 1a2ac756ebe0ce1ecfac18df0090bdcd735442e3..6c04ca440c0f2fc887ced43d982d2c585dc2d3db 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
@@ -21,6 +21,10 @@ namespace blink { |
void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPropertyTreeBuilderContext& context) |
{ |
+ Settings* settings = rootFrame.frame().settings(); |
+ if (settings && settings->rootLayerScrolls()) |
+ return; |
+ |
if (!rootFrame.rootTransform() || rootFrame.rootTransform()->parent()) { |
rootFrame.setRootTransform(TransformPaintPropertyNode::create(nullptr, TransformationMatrix(), FloatPoint3D())); |
rootFrame.setRootClip(ClipPaintPropertyNode::create(nullptr, rootFrame.rootTransform(), FloatRoundedRect(LayoutRect::infiniteIntRect()))); |
@@ -37,9 +41,32 @@ void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro |
void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropertyTreeBuilderContext& context) |
{ |
- // TODO(pdr): Creating paint properties for FrameView here will not be |
- // needed once settings()->rootLayerScrolls() is enabled. |
- // TODO(pdr): Make this conditional on the rootLayerScrolls setting. |
+ Settings* settings = frameView.frame().settings(); |
+ if (settings && settings->rootLayerScrolls()) { |
+ LayoutView* layoutView = frameView.layoutView(); |
+ if (!layoutView) |
+ return; |
+ |
+ if (!context.currentEffect) { |
+ DCHECK(frameView.frame().isLocalRoot()); |
+ context.currentEffect = layoutView->getMutableForPainting().ensureObjectPaintProperties().createOrUpdateEffect(nullptr, 1.0); |
+ } |
trchen
2016/08/17 05:57:47
I think we should not create effect nodes for Layo
szager1
2016/08/17 19:21:34
Done.
|
+ |
+ TransformationMatrix frameTranslate; |
+ frameTranslate.translate( |
+ frameView.x() + layoutView->location().x() + context.current.paintOffset.x(), |
+ frameView.y() + layoutView->location().y() + context.current.paintOffset.y()); |
trchen
2016/08/17 05:57:47
It feels weird. We should not include LayoutView l
szager1
2016/08/17 19:21:34
Once root layer scrolling is enabled, FrameView sh
trchen
2016/08/17 21:30:55
That'd be great! I tried to do that 2 weeks ago bu
szager1
2016/08/19 01:52:13
This entire patch is intended match old-world beha
|
+ context.current.transform = layoutView->getMutableForPainting().ensureObjectPaintProperties().createOrUpdatePaintOffsetTranslation( |
+ context.current.transform, frameTranslate, FloatPoint3D()); |
+ context.current.paintOffset = LayoutPoint(); |
+ context.current.clip = nullptr; // This will get set in updateOverflowClip(). |
+ context.current.renderingContextID = 0; |
+ context.current.shouldFlattenInheritedTransform = true; |
+ context.absolutePosition = context.current; |
+ context.containerForAbsolutePosition = nullptr; // This will get set in updateOutOfFlowContext(). |
+ context.fixedPosition = context.current; |
+ return; |
+ } |
TransformationMatrix frameTranslate; |
frameTranslate.translate(frameView.x() + context.current.paintOffset.x(), frameView.y() + context.current.paintOffset.y()); |
@@ -98,6 +125,9 @@ void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(const LayoutObject& |
} |
} |
+ if (object.isLayoutView()) |
pdr.
2016/08/17 04:30:41
Can you add a comment here about why we don't clea
trchen
2016/08/17 05:57:47
I'd rather add CHECK(!object.isLayoutView()) on li
szager1
2016/08/17 19:21:34
With root layer scrolling, every LayoutView must h
trchen
2016/08/17 21:30:55
Does that match the behavior of old-world composit
szager1
2016/08/19 01:52:13
I'm not sure what "long term" is here. Chromium i
|
+ return; |
+ |
if (ObjectPaintProperties* properties = object.getMutableForPainting().objectPaintProperties()) |
properties->clearPaintOffsetTranslation(); |
} |
@@ -169,6 +199,9 @@ void PaintPropertyTreeBuilder::updateTransform(const LayoutObject& object, Paint |
void PaintPropertyTreeBuilder::updateEffect(const LayoutObject& object, PaintPropertyTreeBuilderContext& context) |
{ |
+ if (object.isLayoutView()) |
+ return; |
+ |
if (!object.styleRef().hasOpacity()) { |
if (ObjectPaintProperties* properties = object.getMutableForPainting().objectPaintProperties()) |
properties->clearEffect(); |
@@ -321,7 +354,14 @@ void PaintPropertyTreeBuilder::updateScrollTranslation(const LayoutObject& objec |
DCHECK(layer); |
DoubleSize scrollOffset = layer->getScrollableArea()->scrollOffset(); |
- if (!scrollOffset.isZero() || layer->scrollsOverflow()) { |
+ if (object.isLayoutView()) { |
skobes
2016/08/17 01:38:24
Why does the LayoutView have a separate path here?
trchen
2016/08/17 05:57:47
Yea... I can't spot any difference either.
szager1
2016/08/17 19:21:34
The difference is that LayoutView will get a scrol
|
+ Settings* settings = object.document().settings(); |
+ if (settings && settings->rootLayerScrolls()) { |
+ context.current.transform = object.getMutableForPainting().ensureObjectPaintProperties().createOrUpdateScrollTranslation(context.current.transform, TransformationMatrix().translate(-scrollOffset.width(), -scrollOffset.height()), FloatPoint3D()); |
+ context.current.shouldFlattenInheritedTransform = false; |
+ return; |
+ } |
+ } else 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); |
@@ -341,9 +381,15 @@ void PaintPropertyTreeBuilder::updateOutOfFlowContext(const LayoutObject& object |
context.containerForAbsolutePosition = &object; |
} |
- // TODO(pdr): Remove the !object.isLayoutView() condition when removing FrameView |
- // paint properties for rootLayerScrolls. |
- if (!object.isLayoutView() && object.canContainFixedPositionObjects()) { |
+ if (object.isLayoutView()) { |
trchen
2016/08/17 05:57:47
It is unfortunate that canContainFixedPositionObje
szager1
2016/08/17 19:21:34
Be that as it may, I think that changing the retur
trchen
2016/08/17 21:30:55
I think it should return nullptr and the element w
szager1
2016/08/19 01:52:12
This is exactly the code that special-cases Layout
|
+ Settings* settings = object.document().settings(); |
+ if (settings && settings->rootLayerScrolls()) { |
+ context.fixedPosition = context.current; |
+ const TransformPaintPropertyNode* transform = object.objectPaintProperties()->paintOffsetTranslation(); |
+ DCHECK(transform); |
+ context.fixedPosition.transform = transform; |
+ } |
+ } else if (object.canContainFixedPositionObjects()) { |
context.fixedPosition = context.current; |
} else if (object.getMutableForPainting().objectPaintProperties() && object.objectPaintProperties()->cssClip()) { |
// CSS clip applies to all descendants, even if this object is not a containing block |