Commit 571db837 authored by Ella Ge's avatar Ella Ge Committed by Commit Bot

set hit_layer to true when hit on scrollbar

When hit on a scrollbar, hit_layer can be false. It cause the
hit test result in child frame not pass to outer frame.
In this CL, force hit_layer to true when hit on frame scrollbar.

Bug: 806300
Change-Id: Ie2debd3d2eae626022af508b0c0962e39095fb17
Reviewed-on: https://chromium-review.googlesource.com/889518Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533273}
parent 77c436b9
...@@ -147,8 +147,10 @@ bool LayoutView::HitTestNoLifecycleUpdate(HitTestResult& result) { ...@@ -147,8 +147,10 @@ bool LayoutView::HitTestNoLifecycleUpdate(HitTestResult& result) {
IntPoint frame_point = GetFrameView()->ContentsToFrame( IntPoint frame_point = GetFrameView()->ContentsToFrame(
result.GetHitTestLocation().RoundedPoint()); result.GetHitTestLocation().RoundedPoint());
if (Scrollbar* frame_scrollbar = if (Scrollbar* frame_scrollbar =
GetFrameView()->ScrollbarAtFramePoint(frame_point)) GetFrameView()->ScrollbarAtFramePoint(frame_point)) {
result.SetScrollbar(frame_scrollbar); result.SetScrollbar(frame_scrollbar);
hit_layer = true;
}
// If hitTestResult include scrollbar, innerNode should be the parent of the // If hitTestResult include scrollbar, innerNode should be the parent of the
// scrollbar. // scrollbar.
......
...@@ -1656,6 +1656,55 @@ TEST_P(ScrollbarsTest, TallAndWidePercentageBodyShouldHaveScrollbars) { ...@@ -1656,6 +1656,55 @@ TEST_P(ScrollbarsTest, TallAndWidePercentageBodyShouldHaveScrollbars) {
EXPECT_TRUE(layout_viewport->HorizontalScrollbar()); EXPECT_TRUE(layout_viewport->HorizontalScrollbar());
} }
TEST_P(ScrollbarsTest, MouseOverIFrameScrollbar) {
WebView().Resize(WebSize(800, 600));
SimRequest main_resource("https://example.com/test.html", "text/html");
SimRequest frame_resource("https://example.com/iframe.html", "text/html");
LoadURL("https://example.com/test.html");
main_resource.Complete(R"HTML(
<!DOCTYPE html>
<style>
body {
margin: 0;
}
iframe {
width: 200px;
height: 200px;
}
</style>
<iframe id='iframe' src='iframe.html'>
</iframe>
)HTML");
frame_resource.Complete(R"HTML(
<!DOCTYPE html>
<style>
body {
margin: 0;
height :500px;
}
</style>
)HTML");
Compositor().BeginFrame();
Document& document = GetDocument();
Element* iframe = document.getElementById("iframe");
DCHECK(iframe);
// Ensure hittest has scrollbar.
HitTestResult hit_test_result = HitTest(196, 10);
EXPECT_TRUE(hit_test_result.InnerElement());
EXPECT_TRUE(hit_test_result.GetScrollbar());
EXPECT_TRUE(hit_test_result.GetScrollbar()->Enabled());
// Mouse over scrollbar.
HandleMouseMoveEvent(196, 5);
// IFRAME hover.
EXPECT_EQ(document.HoverElement(), iframe);
}
class ScrollbarTrackMarginsTest : public ScrollbarsTest { class ScrollbarTrackMarginsTest : public ScrollbarsTest {
public: public:
void PrepareTest(const String& track_style) { void PrepareTest(const String& track_style) {
......
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