Commit 3174752f authored by Adithya Srinivasan's avatar Adithya Srinivasan Committed by Commit Bot

Portals: Update cursor inside portal

A portal's content frame does not receive mouse events, so update the
cursor in the outer frame.

Bug: 949978
Change-Id: I2badbe68a01b7fad881926b81db5057281472a1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095149
Commit-Queue: Adithya Srinivasan <adithyas@chromium.org>
Reviewed-by: default avatarJeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748823}
parent 2fb6b42b
......@@ -69,6 +69,7 @@
#include "third_party/blink/renderer/core/html/html_dialog_element.h"
#include "third_party/blink/renderer/core/html/html_frame_element_base.h"
#include "third_party/blink/renderer/core/html/html_frame_set_element.h"
#include "third_party/blink/renderer/core/html/portal/html_portal_element.h"
#include "third_party/blink/renderer/core/input/event_handling_util.h"
#include "third_party/blink/renderer/core/input/input_device_capabilities.h"
#include "third_party/blink/renderer/core/input/touch_action_util.h"
......@@ -1021,6 +1022,8 @@ WebInputEventResult EventHandler::HandleMouseMoveOrLeaveEvent(
}
WebInputEventResult event_result = WebInputEventResult::kNotHandled;
bool is_portal =
mev.InnerElement() && IsA<HTMLPortalElement>(*mev.InnerElement());
bool is_remote_frame = false;
LocalFrame* new_subframe = event_handling_util::GetTargetSubframe(
mev, capturing_mouse_events_element_, &is_remote_frame);
......@@ -1057,7 +1060,7 @@ WebInputEventResult EventHandler::HandleMouseMoveOrLeaveEvent(
scrollbar->MouseMoved(mev.Event());
}
LocalFrameView* view = frame_->View();
if (!is_remote_frame && view) {
if ((!is_remote_frame || is_portal) && view) {
EventHandler::OptionalCursor optional_cursor =
SelectCursor(mev.GetHitTestLocation(), mev.GetHitTestResult());
if (optional_cursor.IsCursorChange()) {
......
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<body>
<portal src="resources/simple-portal.html" style="cursor:pointer;"></portal>
<script>
promise_test(async () => {
await new Promise(r => window.onload = r);
let portal = document.querySelector('portal');
let actions = new test_driver.Actions()
.pointerMove(20, 20, {origin: portal});
actions.send();
await new Promise(r => portal.onpointermove = r);
assert_equals('type=Hand hotSpot=0,0', internals.getCurrentCursorInfo());
}, 'test that cursor is updated over portal');
</script>
</body>
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