| 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 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 namespace { | 560 namespace { |
| 561 | 561 |
| 562 class CompositedPlugin : public FakeWebPlugin { | 562 class CompositedPlugin : public FakeWebPlugin { |
| 563 public: | 563 public: |
| 564 CompositedPlugin(WebLocalFrame* frame, const WebPluginParams& params) | 564 CompositedPlugin(WebLocalFrame* frame, const WebPluginParams& params) |
| 565 : FakeWebPlugin(frame, params) | 565 : FakeWebPlugin(frame, params) |
| 566 , m_layer(adoptPtr(Platform::current()->compositorSupport()->createLayer
())) | 566 , m_layer(adoptPtr(Platform::current()->compositorSupport()->createLayer
())) |
| 567 { | 567 { |
| 568 } | 568 } |
| 569 | 569 |
| 570 WebLayer* webLayer() const { return m_layer.get(); } | 570 WebLayer* getWebLayer() const { return m_layer.get(); } |
| 571 | 571 |
| 572 // WebPlugin | 572 // WebPlugin |
| 573 | 573 |
| 574 bool initialize(WebPluginContainer* container) override | 574 bool initialize(WebPluginContainer* container) override |
| 575 { | 575 { |
| 576 if (!FakeWebPlugin::initialize(container)) | 576 if (!FakeWebPlugin::initialize(container)) |
| 577 return false; | 577 return false; |
| 578 container->setWebLayer(m_layer.get()); | 578 container->setWebLayer(m_layer.get()); |
| 579 return true; | 579 return true; |
| 580 } | 580 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 WebPluginContainerImpl* container = static_cast<WebPluginContainerImpl*>(get
WebPluginContainer(webView, WebString::fromUTF8("plugin"))); | 615 WebPluginContainerImpl* container = static_cast<WebPluginContainerImpl*>(get
WebPluginContainer(webView, WebString::fromUTF8("plugin"))); |
| 616 ASSERT_TRUE(container); | 616 ASSERT_TRUE(container); |
| 617 RefPtrWillBeRawPtr<Element> element = static_cast<PassRefPtrWillBeRawPtr<Ele
ment>>(container->element()); | 617 RefPtrWillBeRawPtr<Element> element = static_cast<PassRefPtrWillBeRawPtr<Ele
ment>>(container->element()); |
| 618 const auto* plugin = static_cast<const CompositedPlugin*>(container->plugin(
)); | 618 const auto* plugin = static_cast<const CompositedPlugin*>(container->plugin(
)); |
| 619 | 619 |
| 620 OwnPtr<PaintController> paintController = PaintController::create(); | 620 OwnPtr<PaintController> paintController = PaintController::create(); |
| 621 GraphicsContext graphicsContext(*paintController); | 621 GraphicsContext graphicsContext(*paintController); |
| 622 container->paint(graphicsContext, CullRect(IntRect(10, 10, 400, 300))); | 622 container->paint(graphicsContext, CullRect(IntRect(10, 10, 400, 300))); |
| 623 paintController->commitNewDisplayItems(); | 623 paintController->commitNewDisplayItems(); |
| 624 | 624 |
| 625 const auto& displayItems = paintController->paintArtifact().displayItemList(
); | 625 const auto& displayItems = paintController->paintArtifact().getDisplayItemLi
st(); |
| 626 ASSERT_EQ(1u, displayItems.size()); | 626 ASSERT_EQ(1u, displayItems.size()); |
| 627 EXPECT_EQ(element->layoutObject(), &displayItems[0].client()); | 627 EXPECT_EQ(element->layoutObject(), &displayItems[0].client()); |
| 628 ASSERT_EQ(DisplayItem::ForeignLayerPlugin, displayItems[0].getType()); | 628 ASSERT_EQ(DisplayItem::ForeignLayerPlugin, displayItems[0].getType()); |
| 629 const auto& foreignLayerDisplayItem = static_cast<const ForeignLayerDisplayI
tem&>(displayItems[0]); | 629 const auto& foreignLayerDisplayItem = static_cast<const ForeignLayerDisplayI
tem&>(displayItems[0]); |
| 630 EXPECT_EQ(plugin->webLayer()->ccLayer(), foreignLayerDisplayItem.layer()); | 630 EXPECT_EQ(plugin->getWebLayer()->ccLayer(), foreignLayerDisplayItem.layer())
; |
| 631 } | 631 } |
| 632 | 632 |
| 633 } // namespace blink | 633 } // namespace blink |
| OLD | NEW |