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..9dec56e13d70f4fb809a599c1743380e99d7bf5e 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,27 @@ 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; |
+ |
+ TransformationMatrix frameTranslate; |
+ frameTranslate.translate( |
+ frameView.x() + layoutView->location().x() + context.current.paintOffset.x(), |
+ frameView.y() + layoutView->location().y() + context.current.paintOffset.y()); |
+ 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 +120,9 @@ void PaintPropertyTreeBuilder::updatePaintOffsetTranslation(const LayoutObject& |
} |
} |
+ if (object.isLayoutView()) |
+ return; |
+ |
if (ObjectPaintProperties* properties = object.getMutableForPainting().objectPaintProperties()) |
properties->clearPaintOffsetTranslation(); |
} |
@@ -169,6 +194,14 @@ 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(layoutView.frameView()->frame().settings()->rootLayerScrolls()); |
+ 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(); |
@@ -320,8 +353,13 @@ void PaintPropertyTreeBuilder::updateScrollTranslation(const LayoutObject& objec |
PaintLayer* layer = toLayoutBoxModelObject(object).layer(); |
DCHECK(layer); |
DoubleSize scrollOffset = layer->getScrollableArea()->scrollOffset(); |
+ bool needsScrollTranslation = !scrollOffset.isZero() || layer->scrollsOverflow(); |
+ if (!needsScrollTranslation && object.isLayoutView()) { |
+ Settings* settings = object.document().settings(); |
+ needsScrollTranslation = (settings && settings->rootLayerScrolls()); |
+ } |
trchen
2016/08/17 21:30:55
This is difficult to read. How about this:
bool fo
szager1
2016/08/19 01:52:13
Done.
|
- if (!scrollOffset.isZero() || layer->scrollsOverflow()) { |
+ if (needsScrollTranslation) { |
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 +379,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()) { |
+ 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 |