OLD | NEW |
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 Loading... |
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, true, nullptr, client, nullptr, | 165 helper_.InitializeAndLoad(url, true, nullptr, client, nullptr, |
163 &ConfigureSettings); | 166 &ConfigureSettings); |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 widget = local_frame->FrameWidget(); | 705 widget = local_frame->FrameWidget(); |
703 widget->Resize(WebSize(400, 400)); | 706 widget->Resize(WebSize(400, 400)); |
704 } | 707 } |
705 | 708 |
706 Document* document = local_frame->GetFrameView()->GetFrame().GetDocument(); | 709 Document* document = local_frame->GetFrameView()->GetFrame().GetDocument(); |
707 Element* container = document->getElementById("container"); | 710 Element* container = document->getElementById("container"); |
708 | 711 |
709 // Try scrolling in the iframe. | 712 // Try scrolling in the iframe. |
710 { | 713 { |
711 widget->HandleInputEvent( | 714 widget->HandleInputEvent( |
712 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin)); | 715 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin, 0, -100)); |
713 widget->HandleInputEvent(GenerateWheelGestureEvent( | 716 widget->HandleInputEvent(GenerateWheelGestureEvent( |
714 WebInputEvent::kGestureScrollUpdate, 0, -100)); | 717 WebInputEvent::kGestureScrollUpdate, 0, -100)); |
715 widget->HandleInputEvent( | 718 widget->HandleInputEvent( |
716 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd)); | 719 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd)); |
717 EXPECT_EQ(100, container->scrollTop()); | 720 EXPECT_EQ(100, container->scrollTop()); |
718 } | 721 } |
719 | 722 |
720 // Set the container Element as the root scroller. | 723 // Set the container Element as the root scroller. |
721 { | 724 { |
722 NonThrowableExceptionState non_throw; | 725 NonThrowableExceptionState non_throw; |
723 document->setRootScroller(container, non_throw); | 726 document->setRootScroller(container, non_throw); |
724 EXPECT_EQ(container, document->rootScroller()); | 727 EXPECT_EQ(container, document->rootScroller()); |
725 } | 728 } |
726 | 729 |
727 // Try scrolling in the iframe now that it has a root scroller set. | 730 // Try scrolling in the iframe now that it has a root scroller set. |
728 { | 731 { |
729 widget->HandleInputEvent( | 732 widget->HandleInputEvent( |
730 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin)); | 733 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollBegin, 0, -100)); |
731 widget->HandleInputEvent(GenerateWheelGestureEvent( | 734 widget->HandleInputEvent(GenerateWheelGestureEvent( |
732 WebInputEvent::kGestureScrollUpdate, 0, -100)); | 735 WebInputEvent::kGestureScrollUpdate, 0, -100)); |
733 widget->HandleInputEvent( | 736 widget->HandleInputEvent( |
734 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd)); | 737 GenerateWheelGestureEvent(WebInputEvent::kGestureScrollEnd)); |
735 | 738 |
736 // TODO(bokan): This doesn't work right now because we notice in | 739 // TODO(bokan): This doesn't work right now because we notice in |
737 // Element::nativeApplyScroll that the container is the | 740 // Element::nativeApplyScroll that the container is the |
738 // effectiveRootScroller but the only way we expect to get to | 741 // effectiveRootScroller but the only way we expect to get to |
739 // nativeApplyScroll is if the effective scroller had its applyScroll | 742 // nativeApplyScroll is if the effective scroller had its applyScroll |
740 // ViewportScrollCallback removed. Keep the scrolls to guard crashes | 743 // ViewportScrollCallback removed. Keep the scrolls to guard crashes |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 // Ensure the target and container weren't put into the same layer. | 1216 // Ensure the target and container weren't put into the same layer. |
1214 ASSERT_NE(ToLayoutBox(target->GetLayoutObject())->EnclosingLayer(), | 1217 ASSERT_NE(ToLayoutBox(target->GetLayoutObject())->EnclosingLayer(), |
1215 ToLayoutBox(container->GetLayoutObject())->Layer()); | 1218 ToLayoutBox(container->GetLayoutObject())->Layer()); |
1216 | 1219 |
1217 CheckHitTestAtBottomOfScreen(); | 1220 CheckHitTestAtBottomOfScreen(); |
1218 } | 1221 } |
1219 | 1222 |
1220 } // namespace | 1223 } // namespace |
1221 | 1224 |
1222 } // namespace blink | 1225 } // namespace blink |
OLD | NEW |