Commit de6781ce authored by David Bokan's avatar David Bokan Committed by Commit Bot

Fix for layer coordinates in root layer scrolls

This patch fixes MouseEvent.layerX and layerY when root-layer-scrolls is
enabled. The layer coordinates are calculated by subtracting from the
document location the layer offsets of each parent layer starting from
the current layer's parent. This yields the offset within the layer.

The repeated subtraction gets us back to the absolute coordinate space.
Pre-RLS, this was the same as document/content coordinates. With RLS
turned on, the LayoutView is the same size as the frame and clips and
scrolls its content. Thus, transforming through it yields frame
coordinates. Therefore, the change is to start from the event's absolute
location. With RLS off, the conversion yields a no-op so there's no
change. When RLS is on this accounts for the LayoutView's scroll offset.

Bug: 781431
Change-Id: Ib25859effbfb71516e5edb5173154c807ea98314
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_root_layer_scrolls
Reviewed-on: https://chromium-review.googlesource.com/798832
Commit-Queue: David Bokan <bokan@chromium.org>
Reviewed-by: default avatarStefan Zager <szager@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521279}
parent 91377e47
...@@ -3,7 +3,6 @@ crbug.com/417782 compositing/layer-creation/iframe-background-attachment-fixed.h ...@@ -3,7 +3,6 @@ crbug.com/417782 compositing/layer-creation/iframe-background-attachment-fixed.h
crbug.com/417782 compositing/squashing/squash-above-fixed-1.html [ Failure ] crbug.com/417782 compositing/squashing/squash-above-fixed-1.html [ Failure ]
crbug.com/417782 compositing/squashing/squash-above-fixed-3.html [ Failure ] crbug.com/417782 compositing/squashing/squash-above-fixed-3.html [ Failure ]
crbug.com/417782 compositing/visibility/visibility-image-layers-dynamic.html [ Failure ] crbug.com/417782 compositing/visibility/visibility-image-layers-dynamic.html [ Failure ]
crbug.com/417782 fast/dom/Window/window-xy-properties.html [ Failure ]
crbug.com/417782 [ Linux Mac ] fast/dom/horizontal-scrollbar-when-dir-change.html [ Failure ] crbug.com/417782 [ Linux Mac ] fast/dom/horizontal-scrollbar-when-dir-change.html [ Failure ]
crbug.com/417782 fast/dom/rtl-scroll-to-leftmost-and-resize.html [ Failure ] crbug.com/417782 fast/dom/rtl-scroll-to-leftmost-and-resize.html [ Failure ]
crbug.com/417782 fast/dom/scroll-reveal-left-overflow.html [ Failure ] crbug.com/417782 fast/dom/scroll-reveal-left-overflow.html [ Failure ]
......
...@@ -542,6 +542,9 @@ void MouseEvent::ComputeRelativePosition() { ...@@ -542,6 +542,9 @@ void MouseEvent::ComputeRelativePosition() {
n = n->parentNode(); n = n->parentNode();
if (n) { if (n) {
if (LocalFrameView* view = n->GetLayoutObject()->View()->GetFrameView())
layer_location_ = view->DocumentToAbsolute(page_location_);
// FIXME: This logic is a wrong implementation of convertToLayerCoords. // FIXME: This logic is a wrong implementation of convertToLayerCoords.
for (PaintLayer* layer = n->GetLayoutObject()->EnclosingLayer(); layer; for (PaintLayer* layer = n->GetLayoutObject()->EnclosingLayer(); layer;
layer = layer->Parent()) { layer = layer->Parent()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment