Skip to content

Commit

Permalink
Fix PointerEventManager::HandleResizerDrag
Browse files Browse the repository at this point in the history
PointerEventManager::HandleResizerDrag should use the frame of
the hittest result not frame_.

This is the final fix needed to get the web_test
fast/scrolling/resize-iframe-corner-tracking-touch.html passing.

Bug: 1248581
Change-Id: I4cc7fa81f093dbf9fd5bd89a1ce7e3736ffd647f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4021410
Reviewed-by: Robert Flack <flackr@chromium.org>
Reviewed-by: Mustaq Ahmed <mustaq@chromium.org>
Commit-Queue: David Awogbemila <awogbemila@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1075190}
  • Loading branch information
David Awogbemila authored and Chromium LUCI CQ committed Nov 23, 2022
1 parent 5ed7c87 commit e7410b3
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 17 deletions.
Expand Up @@ -768,9 +768,9 @@ bool PointerEventManager::HandleResizerDrag(
if (!layer->GetScrollableArea())
return false;

gfx::Point p = frame_->View()->ConvertFromRootFrame(
gfx::ToFlooredPoint(event.PositionInWidget()));

gfx::Point p =
pointer_event_target.target_frame->View()->ConvertFromRootFrame(
gfx::ToFlooredPoint(event.PositionInWidget()));
if (layer->GetScrollableArea()->IsAbsolutePointInResizeControl(
p, kResizerForTouch)) {
resize_scrollable_area_ = layer->GetScrollableArea();
Expand Down
1 change: 0 additions & 1 deletion third_party/blink/web_tests/TestExpectations
Expand Up @@ -5893,7 +5893,6 @@ crbug.com/1311128 external/wpt/paint-timing/fcp-only/fcp-document-opacity-text.h

# Scroll Unification known issues (go/su-web-tests) for enabling in test:
crbug.com/1311431 [ Mac ] fast/scroll-behavior/overscroll-behavior.html [ Failure Pass ]
crbug.com/1248581 fast/scrolling/resize-iframe-corner-tracking-touch.html [ Failure Pass ]
crbug.com/1312036 virtual/hidpi/fast/scrolling/scrollbars/dsf-ready/mouse-interactions-dsf-2.html [ Failure Pass ]

# These tests fail on SwiftShader FEMU due to a change in log/exp implementation.
Expand Down
Expand Up @@ -9,8 +9,8 @@

</style>

<iframe id="iframe1" src="resources/resize-corner-tracking-touch-iframe.html"
style="resize:both; width: 200px; height: 200px"></iframe>
<iframe id="iframe1" src="resources/resize-corner-tracking-touch-child-iframe.html"
style="resize:both; width: 400px; height: 400px;"></iframe>

<script type="text/javascript">
async function touchDrag(target, offset, delta) {
Expand Down Expand Up @@ -58,7 +58,7 @@
}

async function setupTest(scrollTop = 50) {
resetStyle('iframe1', 'resize:both; width: 200px; height: 200px;');
resetStyle('iframe1', 'resize:both; width: 400px; height: 400px;');

// Scroll the page first to test that resize works with a scrolled page.
document.scrollingElement.scrollTop = scrollTop;
Expand Down Expand Up @@ -93,15 +93,35 @@
promise_test(async () => {
await setupTest(/* scrollTop */ 150);

const iframe = document.getElementById("iframe1");
const rect = iframe.getBoundingClientRect();
const target = iframe.contentDocument.getElementById("textarea2");
const oldBounds = target.getBoundingClientRect();

await touchDrag(target, {x: rect.left - 6, y: rect.top - 7},
{dx: 20, dy: 10});
assert_resize(target, oldBounds);
}, 'Touch drag inside the resizer area of a textarea inside an iframe ' +
const outer_iframe = document.getElementById("iframe1");
const outer_rect = outer_iframe.getBoundingClientRect();
const inner_iframe = outer_iframe.contentDocument.getElementById("inner-iframe");
const inner_rect = inner_iframe.getBoundingClientRect();
const textarea = inner_iframe.contentDocument.getElementById("textarea2");

const left_offset = outer_rect.left + inner_rect.left - 6;
const top_offset = outer_rect.top + inner_rect.top - 7;

const oldBounds = textarea.getBoundingClientRect();
await touchDrag(textarea, {x: left_offset, y: top_offset}, {dx: 20, dy: 10});
assert_resize(textarea, oldBounds);
}, 'Touch drag inside the resizer of a textarea within an iframe within another iframe ' +
'will resize the textarea.');

promise_test(async () => {
await setupTest(/* scrollTop */ 150);

const outer_iframe = document.getElementById("iframe1");
const outer_rect = outer_iframe.getBoundingClientRect();
const inner_iframe = outer_iframe.contentDocument.getElementById("inner-iframe");

const left_offset = outer_rect.left - 6;
const top_offset = outer_rect.top - 7;

const oldBounds = inner_iframe.getBoundingClientRect();
await touchDrag(inner_iframe, {x: left_offset, y: top_offset}, {dx: 20, dy: 10});
assert_resize(inner_iframe, oldBounds);
}, 'Touch drag inside the resizer of an iframe within another iframe ' +
'will resize the inner iframe.');
};
</script>
@@ -0,0 +1,7 @@
<!DOCTYPE html>
<html>
<body>
<iframe id="inner-iframe" src="resize-corner-tracking-touch-grandchild-iframe.html"
style="resize:both; width: 200px; height: 200px;"></iframe>
</body>
</html>
@@ -1,4 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!DOCTYPE html>
<html>
<body>
<textarea id="textarea2" style="resize:both; width: 100px; height: 100px;">hello</textarea>
Expand Down

0 comments on commit e7410b3

Please sign in to comment.