| Index: cc/layer_tree_impl.cc
|
| diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc
|
| index 6b04f7a872644397958872894809f11af8171c91..eeff39a96233ba9a717b2e44d06c5d0b7467d678 100644
|
| --- a/cc/layer_tree_impl.cc
|
| +++ b/cc/layer_tree_impl.cc
|
| @@ -120,6 +120,38 @@ void LayerTreeImpl::UpdateMaxScrollOffset() {
|
| root_scroll_layer_->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll));
|
| }
|
|
|
| +static gfx::Vector2dF toVector2dF(const gfx::Size& size) { return gfx::Vector2dF(size.width(), size.height()); }
|
| +static gfx::Vector2dF toVector2dF(const gfx::SizeF& size) { return gfx::Vector2dF(size.width(), size.height()); }
|
| +
|
| +void LayerTreeImpl::UpdateFixedPositionViewport() {
|
| + if (!root_scroll_layer_)
|
| + return;
|
| +
|
| + const gfx::Vector2dF total_scroll_offset = root_scroll_layer_->scrollOffset() + root_scroll_layer_->scrollDelta();
|
| + const gfx::Vector2dF layout_viewport_size = toVector2dF(pinch_zoom_viewport().layout_viewport_size());
|
| + const gfx::Vector2d desktop_compatibility_viewport_offset = root_scroll_layer_->desktopCompatibilityViewportOffsetFromScrollPosition();
|
| +
|
| + gfx::Vector2dF desktop_compatibility_viewport_offset_delta = root_scroll_layer_->desktopCompatibilityViewportOffsetFromScrollPositionDelta();
|
| +
|
| + // Make sure fixed position viewport contains the visible viewport
|
| + {
|
| + const gfx::Vector2dF offset_min = toVector2dF(pinch_zoom_viewport().LayoutSpaceViewportSize()) - layout_viewport_size;
|
| + desktop_compatibility_viewport_offset_delta.ClampToMin(offset_min - desktop_compatibility_viewport_offset);
|
| + const gfx::Vector2dF offset_max;
|
| + desktop_compatibility_viewport_offset_delta.ClampToMax(offset_max - desktop_compatibility_viewport_offset);
|
| + }
|
| +
|
| + // Clamp the fixed position viewport within the document bounds.
|
| + {
|
| + const gfx::Vector2dF offset_max = toVector2dF(ScrollableSize()) - layout_viewport_size - total_scroll_offset;
|
| + desktop_compatibility_viewport_offset_delta.ClampToMax(offset_max - desktop_compatibility_viewport_offset);
|
| + const gfx::Vector2dF offset_min = -total_scroll_offset;
|
| + desktop_compatibility_viewport_offset_delta.ClampToMin(offset_min - desktop_compatibility_viewport_offset);
|
| + }
|
| +
|
| + root_scroll_layer_->setDesktopCompatibilityViewportOffsetFromScrollPositionDelta(desktop_compatibility_viewport_offset_delta);
|
| +}
|
| +
|
| void LayerTreeImpl::UpdateDrawProperties() {
|
| render_surface_layer_list_.clear();
|
| if (!RootLayer())
|
|
|