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

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

Issue 2907053004: GSB uses delta_hints to calculate scrolling chain. (Closed)
Patch Set: review comments addressed. Created 3 years, 6 months 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/NodeOrString.h" 5 #include "bindings/core/v8/NodeOrString.h"
6 #include "core/dom/ClientRect.h" 6 #include "core/dom/ClientRect.h"
7 #include "core/exported/WebRemoteFrameImpl.h" 7 #include "core/exported/WebRemoteFrameImpl.h"
8 #include "core/frame/BrowserControls.h" 8 #include "core/frame/BrowserControls.h"
9 #include "core/frame/FrameTestHelpers.h" 9 #include "core/frame/FrameTestHelpers.h"
10 #include "core/frame/LocalFrameView.h" 10 #include "core/frame/LocalFrameView.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 int delta_x, 144 int delta_x,
145 int delta_y) { 145 int delta_y) {
146 WebGestureEvent event(type, WebInputEvent::kNoModifiers, 146 WebGestureEvent event(type, WebInputEvent::kNoModifiers,
147 WebInputEvent::kTimeStampForTesting); 147 WebInputEvent::kTimeStampForTesting);
148 event.source_device = device; 148 event.source_device = device;
149 event.x = 100; 149 event.x = 100;
150 event.y = 100; 150 event.y = 100;
151 if (type == WebInputEvent::kGestureScrollUpdate) { 151 if (type == WebInputEvent::kGestureScrollUpdate) {
152 event.data.scroll_update.delta_x = delta_x; 152 event.data.scroll_update.delta_x = delta_x;
153 event.data.scroll_update.delta_y = delta_y; 153 event.data.scroll_update.delta_y = delta_y;
154 } else if (type == WebInputEvent::kGestureScrollBegin) {
155 event.data.scroll_begin.delta_x_hint = delta_x;
156 event.data.scroll_begin.delta_y_hint = delta_y;
154 } 157 }
155 return WebCoalescedInputEvent(event); 158 return WebCoalescedInputEvent(event);
156 } 159 }
157 160
158 WebViewBase* InitializeInternal(const std::string& url, 161 WebViewBase* InitializeInternal(const std::string& url,
159 FrameTestHelpers::TestWebViewClient* client) { 162 FrameTestHelpers::TestWebViewClient* client) {
160 RuntimeEnabledFeatures::SetSetRootScrollerEnabled(true); 163 RuntimeEnabledFeatures::SetSetRootScrollerEnabled(true);
161 164
162 helper_.InitializeAndLoad(url, nullptr, client, nullptr, 165 helper_.InitializeAndLoad(url, nullptr, client, nullptr,
163 &ConfigureSettings); 166 &ConfigureSettings);
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 widget = local_frame->FrameWidget(); 738 widget = local_frame->FrameWidget();
736 widget->Resize(WebSize(400, 400)); 739 widget->Resize(WebSize(400, 400));
737 } 740 }
738 741
739 Document* document = local_frame->GetFrameView()->GetFrame().GetDocument(); 742 Document* document = local_frame->GetFrameView()->GetFrame().GetDocument();
740 Element* container = document->getElementById("container"); 743 Element* container = document->getElementById("container");
741 744
742 // Try scrolling in the iframe. 745 // Try scrolling in the iframe.
743 { 746 {
744 widget->HandleInputEvent( 747 widget->HandleInputEvent(
745 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin)); 748 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin, 0, -100));
746 widget->HandleInputEvent(GenerateWheelGestureEvent( 749 widget->HandleInputEvent(GenerateWheelGestureEvent(
747 WebInputEvent::kGestureScrollUpdate, 0, -100)); 750 WebInputEvent::kGestureScrollUpdate, 0, -100));
748 widget->HandleInputEvent( 751 widget->HandleInputEvent(
749 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd)); 752 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd));
750 EXPECT_EQ(100, container->scrollTop()); 753 EXPECT_EQ(100, container->scrollTop());
751 } 754 }
752 755
753 // Set the container Element as the root scroller. 756 // Set the container Element as the root scroller.
754 { 757 {
755 NonThrowableExceptionState non_throw; 758 NonThrowableExceptionState non_throw;
756 document->setRootScroller(container, non_throw); 759 document->setRootScroller(container, non_throw);
757 EXPECT_EQ(container, document->rootScroller()); 760 EXPECT_EQ(container, document->rootScroller());
758 } 761 }
759 762
760 // Try scrolling in the iframe now that it has a root scroller set. 763 // Try scrolling in the iframe now that it has a root scroller set.
761 { 764 {
762 widget->HandleInputEvent( 765 widget->HandleInputEvent(
763 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin)); 766 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin, 0, -100));
764 widget->HandleInputEvent(GenerateWheelGestureEvent( 767 widget->HandleInputEvent(GenerateWheelGestureEvent(
765 WebInputEvent::kGestureScrollUpdate, 0, -100)); 768 WebInputEvent::kGestureScrollUpdate, 0, -100));
766 widget->HandleInputEvent( 769 widget->HandleInputEvent(
767 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd)); 770 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd));
768 771
769 // TODO(bokan): This doesn't work right now because we notice in 772 // TODO(bokan): This doesn't work right now because we notice in
770 // Element::nativeApplyScroll that the container is the 773 // Element::nativeApplyScroll that the container is the
771 // effectiveRootScroller but the only way we expect to get to 774 // effectiveRootScroller but the only way we expect to get to
772 // nativeApplyScroll is if the effective scroller had its applyScroll 775 // nativeApplyScroll is if the effective scroller had its applyScroll
773 // ViewportScrollCallback removed. Keep the scrolls to guard crashes 776 // ViewportScrollCallback removed. Keep the scrolls to guard crashes
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1243 // Ensure the target and container weren't put into the same layer. 1246 // Ensure the target and container weren't put into the same layer.
1244 ASSERT_NE(ToLayoutBox(target->GetLayoutObject())->EnclosingLayer(), 1247 ASSERT_NE(ToLayoutBox(target->GetLayoutObject())->EnclosingLayer(),
1245 ToLayoutBox(container->GetLayoutObject())->Layer()); 1248 ToLayoutBox(container->GetLayoutObject())->Layer());
1246 1249
1247 CheckHitTestAtBottomOfScreen(); 1250 CheckHitTestAtBottomOfScreen();
1248 } 1251 }
1249 1252
1250 } // namespace 1253 } // namespace
1251 1254
1252 } // namespace blink 1255 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698