Index: third_party/WebKit/Source/core/frame/Framelet.cpp |
diff --git a/third_party/WebKit/Source/core/frame/Framelet.cpp b/third_party/WebKit/Source/core/frame/Framelet.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c4bd856211094a09fa35664a0841c11235f65271 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/frame/Framelet.cpp |
@@ -0,0 +1,113 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/frame/Framelet.h" |
+ |
+#include "core/frame/FrameletClient.h" |
+#include "core/frame/FrameletView.h" |
+#include "core/html/HTMLFrameOwnerElement.h" |
+#include "core/html/HTMLFrameletElement.h" |
+#include "core/layout/LayoutPart.h" |
+#include "platform/graphics/GraphicsLayer.h" |
+ |
+namespace blink { |
+ |
+inline Framelet::Framelet(FrameletClient* client, FrameOwner* owner) |
+ : m_client(client) |
+ , m_owner(owner) |
+ , m_view(nullptr) |
+{ |
+ static_cast<HTMLFrameletElement*>(owner)->setFramelet(this); |
+} |
+ |
+PassRefPtrWillBeRawPtr<Framelet> Framelet::create(FrameletClient* client, FrameOwner* owner) |
+{ |
+ return adoptRefWillBeNoop(new Framelet(client, owner)); |
+} |
+ |
+Framelet::~Framelet() |
+{ |
+ ASSERT(!m_owner); |
+ ASSERT(!m_view); |
+} |
+ |
+DEFINE_TRACE(Framelet) |
+{ |
+ // visitor->trace(m_client); |
+ visitor->trace(m_owner); |
+ visitor->trace(m_view); |
+} |
+ |
+void Framelet::didAttach() |
+{ |
+ client()->didAttach(); |
+} |
+ |
+void Framelet::didDetach() |
+{ |
+ client()->didDetach(); |
+} |
+ |
+void Framelet::forwardInputEvent(Event* event) |
+{ |
+ client()->forwardInputEvent(event); |
+} |
+ |
+void Framelet::frameRectsChanged(const IntRect& frameRect) |
+{ |
+ client()->frameRectsChanged(frameRect); |
+} |
+ |
+void Framelet::setView(PassRefPtrWillBeRawPtr<FrameletView> view) |
+{ |
+ // Oilpan: as FrameletView performs no finalization actions, |
+ // no explicit dispose() of it needed here. (cf. FrameView::dispose().) |
+ m_view = view; |
+} |
+ |
+void Framelet::createView() |
+{ |
+ ASSERT(!toHTMLFrameOwnerElement(m_owner)->ownedWidget()); |
+ |
+ setView(FrameletView::create(this)); |
+ |
+ toHTMLFrameOwnerElement(m_owner)->setWidget(m_view); |
+} |
+ |
+LayoutPart* Framelet::ownerLayoutObject() const |
+{ |
+ if (!m_owner) |
+ return nullptr; |
+ |
+ LayoutObject* object = toHTMLFrameOwnerElement(m_owner)->layoutObject(); |
+ if (!object) |
+ return nullptr; |
+ |
+ ASSERT(object->isLayoutPart()); |
+ return toLayoutPart(object); |
+} |
+ |
+void Framelet::setRemotePlatformLayer(WebLayer* layer) |
+{ |
+ ASSERT(owner()); |
+ static_cast<HTMLFrameletElement*>(owner())->setWebLayer(layer); |
+} |
+ |
+WebLayer* Framelet::remotePlatformLayer() const |
+{ |
+ ASSERT(owner()); |
+ return static_cast<HTMLFrameletElement*>(owner())->webLayer(); |
+} |
+ |
+void Framelet::updateFocus(bool focused, WebFocusType type) |
+{ |
+ client()->updateFocus(focused, type); |
+} |
+ |
+void Framelet::updateVisibility(bool visible) |
+{ |
+ client()->updateVisibility(visible); |
+} |
+ |
+} // namespace blink |