OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/frame/Framelet.h" |
| 6 |
| 7 #include "core/frame/FrameletClient.h" |
| 8 #include "core/frame/FrameletView.h" |
| 9 #include "core/html/HTMLFrameOwnerElement.h" |
| 10 #include "core/html/HTMLFrameletElement.h" |
| 11 #include "core/layout/LayoutPart.h" |
| 12 #include "platform/graphics/GraphicsLayer.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 inline Framelet::Framelet(FrameletClient* client, FrameOwner* owner) |
| 17 : m_client(client) |
| 18 , m_owner(owner) |
| 19 , m_view(nullptr) |
| 20 { |
| 21 static_cast<HTMLFrameletElement*>(owner)->setFramelet(this); |
| 22 } |
| 23 |
| 24 PassRefPtrWillBeRawPtr<Framelet> Framelet::create(FrameletClient* client, FrameO
wner* owner) |
| 25 { |
| 26 return adoptRefWillBeNoop(new Framelet(client, owner)); |
| 27 } |
| 28 |
| 29 Framelet::~Framelet() |
| 30 { |
| 31 ASSERT(!m_owner); |
| 32 ASSERT(!m_view); |
| 33 } |
| 34 |
| 35 DEFINE_TRACE(Framelet) |
| 36 { |
| 37 // visitor->trace(m_client); |
| 38 visitor->trace(m_owner); |
| 39 visitor->trace(m_view); |
| 40 } |
| 41 |
| 42 void Framelet::didAttach() |
| 43 { |
| 44 client()->didAttach(); |
| 45 } |
| 46 |
| 47 void Framelet::didDetach() |
| 48 { |
| 49 client()->didDetach(); |
| 50 } |
| 51 |
| 52 void Framelet::forwardInputEvent(Event* event) |
| 53 { |
| 54 client()->forwardInputEvent(event); |
| 55 } |
| 56 |
| 57 void Framelet::frameRectsChanged(const IntRect& frameRect) |
| 58 { |
| 59 client()->frameRectsChanged(frameRect); |
| 60 } |
| 61 |
| 62 void Framelet::setView(PassRefPtrWillBeRawPtr<FrameletView> view) |
| 63 { |
| 64 // Oilpan: as FrameletView performs no finalization actions, |
| 65 // no explicit dispose() of it needed here. (cf. FrameView::dispose().) |
| 66 m_view = view; |
| 67 } |
| 68 |
| 69 void Framelet::createView() |
| 70 { |
| 71 ASSERT(!toHTMLFrameOwnerElement(m_owner)->ownedWidget()); |
| 72 |
| 73 setView(FrameletView::create(this)); |
| 74 |
| 75 toHTMLFrameOwnerElement(m_owner)->setWidget(m_view); |
| 76 } |
| 77 |
| 78 LayoutPart* Framelet::ownerLayoutObject() const |
| 79 { |
| 80 if (!m_owner) |
| 81 return nullptr; |
| 82 |
| 83 LayoutObject* object = toHTMLFrameOwnerElement(m_owner)->layoutObject(); |
| 84 if (!object) |
| 85 return nullptr; |
| 86 |
| 87 ASSERT(object->isLayoutPart()); |
| 88 return toLayoutPart(object); |
| 89 } |
| 90 |
| 91 void Framelet::setRemotePlatformLayer(WebLayer* layer) |
| 92 { |
| 93 ASSERT(owner()); |
| 94 static_cast<HTMLFrameletElement*>(owner())->setWebLayer(layer); |
| 95 } |
| 96 |
| 97 WebLayer* Framelet::remotePlatformLayer() const |
| 98 { |
| 99 ASSERT(owner()); |
| 100 return static_cast<HTMLFrameletElement*>(owner())->webLayer(); |
| 101 } |
| 102 |
| 103 void Framelet::updateFocus(bool focused, WebFocusType type) |
| 104 { |
| 105 client()->updateFocus(focused, type); |
| 106 } |
| 107 |
| 108 void Framelet::updateVisibility(bool visible) |
| 109 { |
| 110 client()->updateVisibility(visible); |
| 111 } |
| 112 |
| 113 } // namespace blink |
OLD | NEW |