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 f57b66166d4eb51fe2e352176ad8449a072603d3..75e8503482cd3ba8d58b646c96ea60865f47e4e0 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilder.cpp |
@@ -28,12 +28,14 @@ void PaintPropertyTreeBuilder::buildTreeRootNodes(FrameView& rootFrame, PaintPro |
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(), FloatSize(), FloatSize(), 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(); |
} |
@@ -51,6 +53,8 @@ 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, FloatSize(), FloatSize(), false, false); |
context.current.paintOffset = LayoutPoint(); |
context.current.renderingContextID = 0; |
context.current.shouldFlattenInheritedTransform = true; |
@@ -81,12 +85,22 @@ void PaintPropertyTreeBuilder::buildTreeNodes(FrameView& frameView, PaintPropert |
else |
frameView.setScrollTranslation(TransformPaintPropertyNode::create(frameView.preTranslation(), frameScroll, FloatPoint3D())); |
+ FloatSize scrollClip = FloatSize(frameView.visibleContentSize()); |
+ FloatSize scrollBounds = FloatSize(frameView.contentsSize()); |
+ bool userScrollableHorizontal = frameView.userInputScrollable(HorizontalScrollbar); |
+ bool userScrollableVertical = frameView.userInputScrollable(VerticalScrollbar); |
+ if (ScrollPaintPropertyNode* existingScroll = frameView.scroll()) |
+ existingScroll->update(context.current.scroll, frameView.scrollTranslation(), scrollClip, scrollBounds, userScrollableHorizontal, userScrollableVertical); |
+ else |
+ frameView.setScroll(ScrollPaintPropertyNode::create(context.current.scroll, frameView.scrollTranslation(), scrollClip, scrollBounds, userScrollableHorizontal, userScrollableVertical)); |
+ |
// Initialize the context for current, absolute and fixed position cases. |
// They are the same, except that scroll translation does not apply to |
// fixed position descendants. |
context.current.transform = frameView.scrollTranslation(); |
context.current.paintOffset = LayoutPoint(); |
context.current.clip = frameView.contentClip(); |
+ context.current.scroll = frameView.scroll(); |
context.current.renderingContextID = 0; |
context.current.shouldFlattenInheritedTransform = true; |
context.absolutePosition = context.current; |
@@ -237,6 +251,7 @@ void PaintPropertyTreeBuilder::updateLocalBorderBoxContext(const LayoutObject& o |
wrapUnique(new ObjectPaintProperties::LocalBorderBoxProperties); |
borderBoxContext->paintOffset = context.current.paintOffset; |
borderBoxContext->propertyTreeState = PropertyTreeState(context.current.transform, context.current.clip, context.currentEffect); |
+ borderBoxContext->scroll = context.current.scroll; |
if (!context.current.clip) { |
DCHECK(object.isLayoutView()); |
@@ -354,7 +369,7 @@ void PaintPropertyTreeBuilder::updateSvgLocalToBorderBoxTransform(const LayoutOb |
context.current.renderingContextID = 0; |
} |
-void PaintPropertyTreeBuilder::updateScrollTranslation(const LayoutObject& object, PaintPropertyTreeBuilderContext& context) |
+void PaintPropertyTreeBuilder::updateScrollAndScrollTranslation(const LayoutObject& object, PaintPropertyTreeBuilderContext& context) |
{ |
if (object.isBoxModelObject() && object.hasOverflowClip()) { |
PaintLayer* layer = toLayoutBoxModelObject(object).layer(); |
@@ -365,13 +380,23 @@ void PaintPropertyTreeBuilder::updateScrollTranslation(const LayoutObject& objec |
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); |
+ |
+ FloatSize scrollClip = FloatSize(layer->getScrollableArea()->visibleContentRect().size()); |
+ FloatSize scrollBounds = FloatSize(layer->getScrollableArea()->contentsSize()); |
+ bool userScrollableHorizontal = layer->getScrollableArea()->userInputScrollable(HorizontalScrollbar); |
+ bool userScrollableVertical = layer->getScrollableArea()->userInputScrollable(VerticalScrollbar); |
+ context.current.scroll = object.getMutableForPainting().ensureObjectPaintProperties().createOrUpdateScroll( |
+ context.current.scroll, context.current.transform, scrollClip, scrollBounds, userScrollableHorizontal, userScrollableVertical); |
+ |
context.current.shouldFlattenInheritedTransform = false; |
return; |
} |
} |
- if (ObjectPaintProperties* properties = object.getMutableForPainting().objectPaintProperties()) |
+ if (ObjectPaintProperties* properties = object.getMutableForPainting().objectPaintProperties()) { |
properties->clearScrollTranslation(); |
+ properties->clearScroll(); |
+ } |
} |
void PaintPropertyTreeBuilder::updateOutOfFlowContext(const LayoutObject& object, PaintPropertyTreeBuilderContext& context) |
@@ -485,7 +510,7 @@ void PaintPropertyTreeBuilder::buildTreeNodesForChildren(const LayoutObject& obj |
updateOverflowClip(object, context); |
updatePerspective(object, context); |
updateSvgLocalToBorderBoxTransform(object, context); |
- updateScrollTranslation(object, context); |
+ updateScrollAndScrollTranslation(object, context); |
updateOutOfFlowContext(object, context); |
} |