| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "public/web/WebPluginContainer.h" | 31 #include "public/web/WebPluginContainer.h" |
| 32 | 32 |
| 33 #include "core/dom/Element.h" | 33 #include "core/dom/Element.h" |
| 34 #include "core/events/KeyboardEvent.h" | 34 #include "core/events/KeyboardEvent.h" |
| 35 #include "core/frame/EventHandlerRegistry.h" |
| 36 #include "core/frame/FrameHost.h" |
| 35 #include "core/layout/LayoutObject.h" | 37 #include "core/layout/LayoutObject.h" |
| 38 #include "core/page/Page.h" |
| 36 #include "platform/PlatformEvent.h" | 39 #include "platform/PlatformEvent.h" |
| 37 #include "platform/PlatformKeyboardEvent.h" | 40 #include "platform/PlatformKeyboardEvent.h" |
| 38 #include "platform/graphics/GraphicsContext.h" | 41 #include "platform/graphics/GraphicsContext.h" |
| 39 #include "platform/graphics/paint/CullRect.h" | 42 #include "platform/graphics/paint/CullRect.h" |
| 40 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" | 43 #include "platform/graphics/paint/ForeignLayerDisplayItem.h" |
| 41 #include "platform/graphics/paint/PaintController.h" | 44 #include "platform/graphics/paint/PaintController.h" |
| 42 #include "platform/testing/URLTestHelpers.h" | 45 #include "platform/testing/URLTestHelpers.h" |
| 43 #include "platform/testing/UnitTestHelpers.h" | 46 #include "platform/testing/UnitTestHelpers.h" |
| 44 #include "public/platform/Platform.h" | 47 #include "public/platform/Platform.h" |
| 45 #include "public/platform/WebClipboard.h" | 48 #include "public/platform/WebClipboard.h" |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 paintController->commitNewDisplayItems(); | 626 paintController->commitNewDisplayItems(); |
| 624 | 627 |
| 625 const auto& displayItems = paintController->paintArtifact().getDisplayItemLi
st(); | 628 const auto& displayItems = paintController->paintArtifact().getDisplayItemLi
st(); |
| 626 ASSERT_EQ(1u, displayItems.size()); | 629 ASSERT_EQ(1u, displayItems.size()); |
| 627 EXPECT_EQ(element->layoutObject(), &displayItems[0].client()); | 630 EXPECT_EQ(element->layoutObject(), &displayItems[0].client()); |
| 628 ASSERT_EQ(DisplayItem::ForeignLayerPlugin, displayItems[0].getType()); | 631 ASSERT_EQ(DisplayItem::ForeignLayerPlugin, displayItems[0].getType()); |
| 629 const auto& foreignLayerDisplayItem = static_cast<const ForeignLayerDisplayI
tem&>(displayItems[0]); | 632 const auto& foreignLayerDisplayItem = static_cast<const ForeignLayerDisplayI
tem&>(displayItems[0]); |
| 630 EXPECT_EQ(plugin->getWebLayer()->ccLayer(), foreignLayerDisplayItem.layer())
; | 633 EXPECT_EQ(plugin->getWebLayer()->ccLayer(), foreignLayerDisplayItem.layer())
; |
| 631 } | 634 } |
| 632 | 635 |
| 636 TEST_F(WebPluginContainerTest, NeedsWheelEvents) |
| 637 { |
| 638 URLTestHelpers::registerMockedURLFromBaseURL( |
| 639 WebString::fromUTF8(m_baseURL.c_str()), |
| 640 WebString::fromUTF8("plugin_container.html")); |
| 641 TestPluginWebFrameClient pluginWebFrameClient; // Must outlive webViewHelper |
| 642 FrameTestHelpers::WebViewHelper webViewHelper; |
| 643 WebViewImpl* webView = webViewHelper.initializeAndLoad(m_baseURL + "plugin_c
ontainer.html", true, &pluginWebFrameClient); |
| 644 ASSERT(webView); |
| 645 webView->settings()->setPluginsEnabled(true); |
| 646 webView->resize(WebSize(300, 300)); |
| 647 webView->updateAllLifecyclePhases(); |
| 648 runPendingTasks(); |
| 649 |
| 650 WebElement pluginContainerOneElement = webView->mainFrame()->document().getE
lementById(WebString::fromUTF8("translated-plugin")); |
| 651 pluginContainerOneElement.pluginContainer()->setWantsWheelEvents(true); |
| 652 |
| 653 runPendingTasks(); |
| 654 EXPECT_TRUE(webView->page()->frameHost().eventHandlerRegistry().hasEventHand
lers(EventHandlerRegistry::WheelEventBlocking)); |
| 655 } |
| 656 |
| 633 } // namespace blink | 657 } // namespace blink |
| OLD | NEW |