| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
| 6 | 6 |
| 7 #include <tuple> | 7 #include <tuple> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 for (std::vector<gfx::Rect>::const_iterator iter = rects_.begin(); | 96 for (std::vector<gfx::Rect>::const_iterator iter = rects_.begin(); |
| 97 iter != rects_.end(); ++iter) { | 97 iter != rects_.end(); ++iter) { |
| 98 if ((*iter).Contains(point)) | 98 if ((*iter).Contains(point)) |
| 99 return true; | 99 return true; |
| 100 } | 100 } |
| 101 return false; | 101 return false; |
| 102 } | 102 } |
| 103 | 103 |
| 104 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override { | 104 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override { |
| 105 if (always_overscroll_ && | 105 if (always_overscroll_ && |
| 106 event.type == blink::WebInputEvent::GestureScrollUpdate) { | 106 event.type() == blink::WebInputEvent::GestureScrollUpdate) { |
| 107 didOverscroll(blink::WebFloatSize(event.data.scrollUpdate.deltaX, | 107 didOverscroll(blink::WebFloatSize(event.data.scrollUpdate.deltaX, |
| 108 event.data.scrollUpdate.deltaY), | 108 event.data.scrollUpdate.deltaY), |
| 109 blink::WebFloatSize(event.data.scrollUpdate.deltaX, | 109 blink::WebFloatSize(event.data.scrollUpdate.deltaX, |
| 110 event.data.scrollUpdate.deltaY), | 110 event.data.scrollUpdate.deltaY), |
| 111 blink::WebFloatPoint(event.x, event.y), | 111 blink::WebFloatPoint(event.x, event.y), |
| 112 blink::WebFloatSize(event.data.scrollUpdate.velocityX, | 112 blink::WebFloatSize(event.data.scrollUpdate.velocityX, |
| 113 event.data.scrollUpdate.velocityY)); | 113 event.data.scrollUpdate.velocityY)); |
| 114 return true; | 114 return true; |
| 115 } | 115 } |
| 116 | 116 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 widget()->SendInputEvent(scroll); | 257 widget()->SendInputEvent(scroll); |
| 258 | 258 |
| 259 // Overscroll notifications received while handling an input event should | 259 // Overscroll notifications received while handling an input event should |
| 260 // be bundled with the event ack IPC. | 260 // be bundled with the event ack IPC. |
| 261 ASSERT_EQ(1u, widget()->sink()->message_count()); | 261 ASSERT_EQ(1u, widget()->sink()->message_count()); |
| 262 const IPC::Message* message = widget()->sink()->GetMessageAt(0); | 262 const IPC::Message* message = widget()->sink()->GetMessageAt(0); |
| 263 ASSERT_EQ(InputHostMsg_HandleInputEvent_ACK::ID, message->type()); | 263 ASSERT_EQ(InputHostMsg_HandleInputEvent_ACK::ID, message->type()); |
| 264 InputHostMsg_HandleInputEvent_ACK::Param params; | 264 InputHostMsg_HandleInputEvent_ACK::Param params; |
| 265 InputHostMsg_HandleInputEvent_ACK::Read(message, ¶ms); | 265 InputHostMsg_HandleInputEvent_ACK::Read(message, ¶ms); |
| 266 const InputEventAck& ack = std::get<0>(params); | 266 const InputEventAck& ack = std::get<0>(params); |
| 267 ASSERT_EQ(ack.type, scroll.type); | 267 ASSERT_EQ(ack.type, scroll.type()); |
| 268 ASSERT_TRUE(ack.overscroll); | 268 ASSERT_TRUE(ack.overscroll); |
| 269 EXPECT_EQ(gfx::Vector2dF(0, 10), ack.overscroll->accumulated_overscroll); | 269 EXPECT_EQ(gfx::Vector2dF(0, 10), ack.overscroll->accumulated_overscroll); |
| 270 EXPECT_EQ(gfx::Vector2dF(0, 10), ack.overscroll->latest_overscroll_delta); | 270 EXPECT_EQ(gfx::Vector2dF(0, 10), ack.overscroll->latest_overscroll_delta); |
| 271 EXPECT_EQ(gfx::Vector2dF(), ack.overscroll->current_fling_velocity); | 271 EXPECT_EQ(gfx::Vector2dF(), ack.overscroll->current_fling_velocity); |
| 272 EXPECT_EQ(gfx::PointF(-10, 0), ack.overscroll->causal_event_viewport_point); | 272 EXPECT_EQ(gfx::PointF(-10, 0), ack.overscroll->causal_event_viewport_point); |
| 273 widget()->sink()->ClearMessages(); | 273 widget()->sink()->ClearMessages(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 TEST_F(RenderWidgetUnittest, FlingOverscroll) { | 276 TEST_F(RenderWidgetUnittest, FlingOverscroll) { |
| 277 // Overscroll notifications received outside of handling an input event should | 277 // Overscroll notifications received outside of handling an input event should |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 blink::WebRect popup_emulated_rect(130, 170, 100, 400); | 522 blink::WebRect popup_emulated_rect(130, 170, 100, 400); |
| 523 widget()->setWindowRect(popup_emulated_rect); | 523 widget()->setWindowRect(popup_emulated_rect); |
| 524 | 524 |
| 525 EXPECT_EQ(popup_emulated_rect.x, widget()->windowRect().x); | 525 EXPECT_EQ(popup_emulated_rect.x, widget()->windowRect().x); |
| 526 EXPECT_EQ(popup_emulated_rect.y, widget()->windowRect().y); | 526 EXPECT_EQ(popup_emulated_rect.y, widget()->windowRect().y); |
| 527 EXPECT_EQ(popup_emulated_rect.x, widget()->viewRect().x); | 527 EXPECT_EQ(popup_emulated_rect.x, widget()->viewRect().x); |
| 528 EXPECT_EQ(popup_emulated_rect.y, widget()->viewRect().y); | 528 EXPECT_EQ(popup_emulated_rect.y, widget()->viewRect().y); |
| 529 } | 529 } |
| 530 | 530 |
| 531 } // namespace content | 531 } // namespace content |
| OLD | NEW |