Index: third_party/WebKit/Source/core/frame/FrameletView.cpp |
diff --git a/third_party/WebKit/Source/core/frame/FrameletView.cpp b/third_party/WebKit/Source/core/frame/FrameletView.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3a227c0df8e3668fbbd9805d85c04cced4355552 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/frame/FrameletView.cpp |
@@ -0,0 +1,104 @@ |
+// Copyright 2014 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/FrameletView.h" |
+ |
+#include "core/events/Event.h" |
+#include "core/frame/Framelet.h" |
+#include "core/html/HTMLFrameOwnerElement.h" |
+#include "core/layout/LayoutPart.h" |
+ |
+namespace blink { |
+ |
+FrameletView::FrameletView(Framelet* framelet) |
+ : m_framelet(framelet) |
+{ |
+ ASSERT(framelet); |
+} |
+ |
+FrameletView::~FrameletView() |
+{ |
+} |
+ |
+PassRefPtrWillBeRawPtr<FrameletView> FrameletView::create(Framelet* framelet) |
+{ |
+ RefPtrWillBeRawPtr<FrameletView> view = adoptRefWillBeNoop(new FrameletView(framelet)); |
+ view->show(); |
+ return view.release(); |
+} |
+ |
+void FrameletView::dispose() |
+{ |
+ HTMLFrameOwnerElement* ownerElement = toHTMLFrameOwnerElement(m_framelet->owner()); |
+ if (ownerElement && ownerElement->ownedWidget() == this) |
+ ownerElement->setWidget(nullptr); |
+} |
+ |
+void FrameletView::frameRectsChanged() |
+{ |
+ m_framelet->frameRectsChanged(frameRect()); |
+} |
+ |
+void FrameletView::hide() |
+{ |
+ setSelfVisible(false); |
+ m_framelet->updateVisibility(false); |
+ Widget::hide(); |
+} |
+ |
+void FrameletView::invalidateRect(const IntRect& rect) |
+{ |
+ LayoutPart* layoutObject = m_framelet->ownerLayoutObject(); |
+ if (!layoutObject) |
+ return; |
+ |
+ LayoutRect repaintRect(rect); |
+ repaintRect.move(layoutObject->borderLeft() + layoutObject->paddingLeft(), |
+ layoutObject->borderTop() + layoutObject->paddingTop()); |
+ layoutObject->invalidatePaintRectangle(repaintRect); |
+} |
+ |
+void FrameletView::setFocus(bool focused, WebFocusType focusType) |
+{ |
+ m_framelet->updateFocus(focused, focusType); |
+} |
+ |
+void FrameletView::setFrameRect(const IntRect& newRect) |
+{ |
+ IntRect oldRect = frameRect(); |
+ |
+ if (newRect == oldRect) |
+ return; |
+ |
+ Widget::setFrameRect(newRect); |
+ |
+ frameRectsChanged(); |
+} |
+ |
+void FrameletView::setParentVisible(bool parentVisible) |
+{ |
+ if (isParentVisible() == parentVisible) |
+ return; |
+ |
+ Widget::setParentVisible(parentVisible); |
+ if (!isSelfVisible()) |
+ return; |
+ |
+ m_framelet->updateVisibility(isVisible()); |
+} |
+ |
+void FrameletView::show() |
+{ |
+ setSelfVisible(true); |
+ m_framelet->updateVisibility(true); |
+ Widget::show(); |
+} |
+ |
+DEFINE_TRACE(FrameletView) |
+{ |
+ visitor->trace(m_framelet); |
+ Widget::trace(visitor); |
+} |
+ |
+} // namespace blink |