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

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: Merge branch 'master' into GSB_checks_delta_hints Created 3 years, 5 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 int delta_x, 149 int delta_x,
150 int delta_y) { 150 int delta_y) {
151 WebGestureEvent event(type, WebInputEvent::kNoModifiers, 151 WebGestureEvent event(type, WebInputEvent::kNoModifiers,
152 WebInputEvent::kTimeStampForTesting); 152 WebInputEvent::kTimeStampForTesting);
153 event.source_device = device; 153 event.source_device = device;
154 event.x = 100; 154 event.x = 100;
155 event.y = 100; 155 event.y = 100;
156 if (type == WebInputEvent::kGestureScrollUpdate) { 156 if (type == WebInputEvent::kGestureScrollUpdate) {
157 event.data.scroll_update.delta_x = delta_x; 157 event.data.scroll_update.delta_x = delta_x;
158 event.data.scroll_update.delta_y = delta_y; 158 event.data.scroll_update.delta_y = delta_y;
159 } else if (type == WebInputEvent::kGestureScrollBegin) {
160 event.data.scroll_begin.delta_x_hint = delta_x;
161 event.data.scroll_begin.delta_y_hint = delta_y;
159 } 162 }
160 return WebCoalescedInputEvent(event); 163 return WebCoalescedInputEvent(event);
161 } 164 }
162 165
163 WebViewBase* InitializeInternal(const std::string& url, 166 WebViewBase* InitializeInternal(const std::string& url,
164 FrameTestHelpers::TestWebViewClient* client) { 167 FrameTestHelpers::TestWebViewClient* client) {
165 RuntimeEnabledFeatures::SetSetRootScrollerEnabled(true); 168 RuntimeEnabledFeatures::SetSetRootScrollerEnabled(true);
166 169
167 helper_.InitializeAndLoad(url, nullptr, client, nullptr, 170 helper_.InitializeAndLoad(url, nullptr, client, nullptr,
168 &ConfigureSettings); 171 &ConfigureSettings);
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 widget = local_frame->FrameWidget(); 744 widget = local_frame->FrameWidget();
742 widget->Resize(WebSize(400, 400)); 745 widget->Resize(WebSize(400, 400));
743 } 746 }
744 747
745 Document* document = local_frame->GetFrameView()->GetFrame().GetDocument(); 748 Document* document = local_frame->GetFrameView()->GetFrame().GetDocument();
746 Element* container = document->getElementById("container"); 749 Element* container = document->getElementById("container");
747 750
748 // Try scrolling in the iframe. 751 // Try scrolling in the iframe.
749 { 752 {
750 widget->HandleInputEvent( 753 widget->HandleInputEvent(
751 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin)); 754 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin, 0, -100));
752 widget->HandleInputEvent(GenerateWheelGestureEvent( 755 widget->HandleInputEvent(GenerateWheelGestureEvent(
753 WebInputEvent::kGestureScrollUpdate, 0, -100)); 756 WebInputEvent::kGestureScrollUpdate, 0, -100));
754 widget->HandleInputEvent( 757 widget->HandleInputEvent(
755 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd)); 758 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd));
756 EXPECT_EQ(100, container->scrollTop()); 759 EXPECT_EQ(100, container->scrollTop());
757 } 760 }
758 761
759 // Set the container Element as the root scroller. 762 // Set the container Element as the root scroller.
760 { 763 {
761 NonThrowableExceptionState non_throw; 764 NonThrowableExceptionState non_throw;
762 document->setRootScroller(container, non_throw); 765 document->setRootScroller(container, non_throw);
763 EXPECT_EQ(container, document->rootScroller()); 766 EXPECT_EQ(container, document->rootScroller());
764 } 767 }
765 768
766 // Try scrolling in the iframe now that it has a root scroller set. 769 // Try scrolling in the iframe now that it has a root scroller set.
767 { 770 {
768 widget->HandleInputEvent( 771 widget->HandleInputEvent(
769 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin)); 772 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin, 0, -100));
770 widget->HandleInputEvent(GenerateWheelGestureEvent( 773 widget->HandleInputEvent(GenerateWheelGestureEvent(
771 WebInputEvent::kGestureScrollUpdate, 0, -100)); 774 WebInputEvent::kGestureScrollUpdate, 0, -100));
772 widget->HandleInputEvent( 775 widget->HandleInputEvent(
773 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd)); 776 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd));
774 777
775 // TODO(bokan): This doesn't work right now because we notice in 778 // TODO(bokan): This doesn't work right now because we notice in
776 // Element::nativeApplyScroll that the container is the 779 // Element::nativeApplyScroll that the container is the
777 // effectiveRootScroller but the only way we expect to get to 780 // effectiveRootScroller but the only way we expect to get to
778 // nativeApplyScroll is if the effective scroller had its applyScroll 781 // nativeApplyScroll is if the effective scroller had its applyScroll
779 // ViewportScrollCallback removed. Keep the scrolls to guard crashes 782 // ViewportScrollCallback removed. Keep the scrolls to guard crashes
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 // Ensure the target and container weren't put into the same layer. 1254 // Ensure the target and container weren't put into the same layer.
1252 ASSERT_NE(ToLayoutBox(target->GetLayoutObject())->EnclosingLayer(), 1255 ASSERT_NE(ToLayoutBox(target->GetLayoutObject())->EnclosingLayer(),
1253 ToLayoutBox(container->GetLayoutObject())->Layer()); 1256 ToLayoutBox(container->GetLayoutObject())->Layer());
1254 1257
1255 CheckHitTestAtBottomOfScreen(); 1258 CheckHitTestAtBottomOfScreen();
1256 } 1259 }
1257 1260
1258 } // namespace 1261 } // namespace
1259 1262
1260 } // namespace blink 1263 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698