Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2587563002: Mouse up updates scrollbar hovered part if needed. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 10883 matching lines...) Expand 10 before | Expand all | Expand 10 after
10894 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0, 10894 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0,
10895 PlatformEvent::NoModifiers, TimeTicks::Now()); 10895 PlatformEvent::NoModifiers, TimeTicks::Now());
10896 document->frame()->eventHandler().handleMouseMoveEvent( 10896 document->frame()->eventHandler().handleMouseMoveEvent(
10897 mouseMoveOverDivAndScrollbar, Vector<PlatformMouseEvent>()); 10897 mouseMoveOverDivAndScrollbar, Vector<PlatformMouseEvent>());
10898 10898
10899 // Custom not change the DIV :hover 10899 // Custom not change the DIV :hover
10900 EXPECT_EQ(document->hoverNode(), scrollbarDiv); 10900 EXPECT_EQ(document->hoverNode(), scrollbarDiv);
10901 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart); 10901 EXPECT_EQ(hitTestResult.scrollbar()->hoveredPart(), ScrollbarPart::ThumbPart);
10902 } 10902 }
10903 10903
10904 TEST_F(WebFrameTest, MouseReleaseUpdatesScrollbarHoveredPart) {
10905 registerMockedHttpURLLoad("custom-scrollbar-hover.html");
10906 FrameTestHelpers::WebViewHelper webViewHelper;
10907 WebViewImpl* webView = webViewHelper.initializeAndLoad(
10908 m_baseURL + "custom-scrollbar-hover.html");
10909
10910 webViewHelper.resize(WebSize(200, 200));
10911
10912 webView->updateAllLifecyclePhases();
10913
10914 Document* document = toLocalFrame(webView->page()->mainFrame())->document();
10915
10916 Element* scrollbarDiv = document->getElementById("scrollbar");
10917 EXPECT_TRUE(scrollbarDiv);
10918
10919 ScrollableArea* scrollableArea =
10920 toLayoutBox(scrollbarDiv->layoutObject())->getScrollableArea();
10921
10922 EXPECT_TRUE(scrollableArea->verticalScrollbar());
10923 Scrollbar* scrollbar = scrollableArea->verticalScrollbar();
10924 EXPECT_EQ(scrollbar->pressedPart(), ScrollbarPart::NoPart);
10925 EXPECT_EQ(scrollbar->hoveredPart(), ScrollbarPart::NoPart);
10926
10927 // Mouse moved over the scrollbar.
10928 PlatformMouseEvent mouseMoveOverScrollbar(
10929 IntPoint(175, 1), IntPoint(175, 1),
10930 WebPointerProperties::Button::NoButton, PlatformEvent::MouseMoved, 0,
10931 PlatformEvent::NoModifiers, TimeTicks::Now());
10932 document->frame()->eventHandler().handleMouseMoveEvent(
10933 mouseMoveOverScrollbar, Vector<PlatformMouseEvent>());
10934 HitTestResult hitTestResult = webView->coreHitTestResultAt(WebPoint(175, 1));
10935 EXPECT_EQ(scrollbar->pressedPart(), ScrollbarPart::NoPart);
10936 EXPECT_EQ(scrollbar->hoveredPart(), ScrollbarPart::ThumbPart);
10937
10938 // Mouse pressed.
10939 PlatformMouseEvent mousePressEvent(
10940 IntPoint(175, 1), IntPoint(175, 1), WebPointerProperties::Button::Left,
10941 PlatformEvent::MousePressed, 0, PlatformEvent::Modifiers::LeftButtonDown,
10942 TimeTicks::Now());
10943 document->frame()->eventHandler().handleMousePressEvent(mousePressEvent);
10944 EXPECT_EQ(scrollbar->pressedPart(), ScrollbarPart::ThumbPart);
10945 EXPECT_EQ(scrollbar->hoveredPart(), ScrollbarPart::ThumbPart);
10946
10947 // Mouse moved off the scrollbar while still pressed.
10948 PlatformMouseEvent mouseMoveOffScrollbar(
10949 IntPoint(1, 1), IntPoint(1, 1), WebPointerProperties::Button::Left,
10950 PlatformEvent::MouseMoved, 0, PlatformEvent::Modifiers::LeftButtonDown,
10951 TimeTicks::Now());
10952 document->frame()->eventHandler().handleMouseLeaveEvent(
10953 mouseMoveOffScrollbar);
10954 EXPECT_EQ(scrollbar->pressedPart(), ScrollbarPart::ThumbPart);
10955 EXPECT_EQ(scrollbar->hoveredPart(), ScrollbarPart::ThumbPart);
10956
10957 // Mouse released.
10958 PlatformMouseEvent MouseReleaseEvent(
10959 IntPoint(1, 1), IntPoint(1, 1), WebPointerProperties::Button::Left,
10960 PlatformEvent::MouseReleased, 0, PlatformEvent::Modifiers::LeftButtonDown,
10961 TimeTicks::Now());
10962 document->frame()->eventHandler().handleMouseReleaseEvent(MouseReleaseEvent);
10963 EXPECT_EQ(scrollbar->pressedPart(), ScrollbarPart::NoPart);
10964 EXPECT_EQ(scrollbar->hoveredPart(), ScrollbarPart::NoPart);
10965 }
10966
10904 static void disableCompositing(WebSettings* settings) { 10967 static void disableCompositing(WebSettings* settings) {
10905 settings->setAcceleratedCompositingEnabled(false); 10968 settings->setAcceleratedCompositingEnabled(false);
10906 settings->setPreferCompositingToLCDTextEnabled(false); 10969 settings->setPreferCompositingToLCDTextEnabled(false);
10907 } 10970 }
10908 10971
10909 // Make sure overlay scrollbars on non-composited scrollers fade out and set 10972 // Make sure overlay scrollbars on non-composited scrollers fade out and set
10910 // the hidden bit as needed. 10973 // the hidden bit as needed.
10911 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) { 10974 TEST_F(WebFrameTest, TestNonCompositedOverlayScrollbarsFade) {
10912 FrameTestHelpers::WebViewHelper webViewHelper; 10975 FrameTestHelpers::WebViewHelper webViewHelper;
10913 WebViewImpl* webViewImpl = webViewHelper.initialize( 10976 WebViewImpl* webViewImpl = webViewHelper.initialize(
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
11095 11158
11096 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); 11159 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached());
11097 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); 11160 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading());
11098 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); 11161 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad());
11099 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); 11162 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents());
11100 11163
11101 webViewHelper.reset(); 11164 webViewHelper.reset();
11102 } 11165 }
11103 11166
11104 } // namespace blink 11167 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698