| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 : FakeWebPlugin(frame, params), | 441 : FakeWebPlugin(frame, params), |
| 442 m_lastEventType(WebInputEvent::Undefined) {} | 442 m_lastEventType(WebInputEvent::Undefined) {} |
| 443 | 443 |
| 444 WebInputEventResult handleInputEvent(const WebInputEvent& event, | 444 WebInputEventResult handleInputEvent(const WebInputEvent& event, |
| 445 WebCursorInfo&) override { | 445 WebCursorInfo&) override { |
| 446 m_lastEventType = event.type(); | 446 m_lastEventType = event.type(); |
| 447 if (WebInputEvent::isMouseEventType(event.type()) || | 447 if (WebInputEvent::isMouseEventType(event.type()) || |
| 448 event.type() == WebInputEvent::MouseWheel) { | 448 event.type() == WebInputEvent::MouseWheel) { |
| 449 const WebMouseEvent& mouseEvent = | 449 const WebMouseEvent& mouseEvent = |
| 450 static_cast<const WebMouseEvent&>(event); | 450 static_cast<const WebMouseEvent&>(event); |
| 451 m_lastMouseEventLocation = IntPoint(mouseEvent.x, mouseEvent.y); | 451 m_lastMouseEventLocation = IntPoint(mouseEvent.positionInWidget().x, |
| 452 mouseEvent.positionInWidget().y); |
| 452 } | 453 } |
| 453 | 454 |
| 454 return WebInputEventResult::HandledSystem; | 455 return WebInputEventResult::HandledSystem; |
| 455 } | 456 } |
| 456 WebInputEvent::Type getLastInputEventType() { return m_lastEventType; } | 457 WebInputEvent::Type getLastInputEventType() { return m_lastEventType; } |
| 457 | 458 |
| 458 IntPoint getLastMouseEventLocation() { return m_lastMouseEventLocation; } | 459 IntPoint getLastMouseEventLocation() { return m_lastMouseEventLocation; } |
| 459 | 460 |
| 460 private: | 461 private: |
| 461 WebInputEvent::Type m_lastEventType; | 462 WebInputEvent::Type m_lastEventType; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 WebPlugin* plugin = static_cast<WebPluginContainerImpl*>( | 531 WebPlugin* plugin = static_cast<WebPluginContainerImpl*>( |
| 531 pluginContainerOneElement.pluginContainer()) | 532 pluginContainerOneElement.pluginContainer()) |
| 532 ->plugin(); | 533 ->plugin(); |
| 533 EventTestPlugin* testPlugin = static_cast<EventTestPlugin*>(plugin); | 534 EventTestPlugin* testPlugin = static_cast<EventTestPlugin*>(plugin); |
| 534 | 535 |
| 535 WebMouseWheelEvent event(WebInputEvent::MouseWheel, | 536 WebMouseWheelEvent event(WebInputEvent::MouseWheel, |
| 536 WebInputEvent::NoModifiers, | 537 WebInputEvent::NoModifiers, |
| 537 WebInputEvent::TimeStampForTesting); | 538 WebInputEvent::TimeStampForTesting); |
| 538 | 539 |
| 539 WebRect rect = pluginContainerOneElement.boundsInViewport(); | 540 WebRect rect = pluginContainerOneElement.boundsInViewport(); |
| 540 event.x = rect.x + rect.width / 2; | 541 event.setPositionInWidget(rect.x + rect.width / 2, rect.y + rect.height / 2); |
| 541 event.y = rect.y + rect.height / 2; | |
| 542 | 542 |
| 543 webView->handleInputEvent(WebCoalescedInputEvent(event)); | 543 webView->handleInputEvent(WebCoalescedInputEvent(event)); |
| 544 runPendingTasks(); | 544 runPendingTasks(); |
| 545 | 545 |
| 546 EXPECT_EQ(WebInputEvent::MouseWheel, testPlugin->getLastInputEventType()); | 546 EXPECT_EQ(WebInputEvent::MouseWheel, testPlugin->getLastInputEventType()); |
| 547 EXPECT_EQ(rect.width / 2, testPlugin->getLastMouseEventLocation().x()); | 547 EXPECT_EQ(rect.width / 2, testPlugin->getLastMouseEventLocation().x()); |
| 548 EXPECT_EQ(rect.height / 2, testPlugin->getLastMouseEventLocation().y()); | 548 EXPECT_EQ(rect.height / 2, testPlugin->getLastMouseEventLocation().y()); |
| 549 } | 549 } |
| 550 | 550 |
| 551 // Verify that isRectTopmost returns false when the document is detached. | 551 // Verify that isRectTopmost returns false when the document is detached. |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 webView->mainFrame()->document().getElementById( | 783 webView->mainFrame()->document().getElementById( |
| 784 WebString::fromUTF8("translated-plugin")); | 784 WebString::fromUTF8("translated-plugin")); |
| 785 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); | 785 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); |
| 786 | 786 |
| 787 runPendingTasks(); | 787 runPendingTasks(); |
| 788 EXPECT_TRUE(webView->page()->eventHandlerRegistry().hasEventHandlers( | 788 EXPECT_TRUE(webView->page()->eventHandlerRegistry().hasEventHandlers( |
| 789 EventHandlerRegistry::WheelEventBlocking)); | 789 EventHandlerRegistry::WheelEventBlocking)); |
| 790 } | 790 } |
| 791 | 791 |
| 792 } // namespace blink | 792 } // namespace blink |
| OLD | NEW |