Remove concept of child Widgets.
FrameView doesn't really need to know about the child widgets,
which are just Scrollbars now.
I also deleted some dead code from Widget and removed FrameWidget
since we don't need that abstraction now.
R=ojan@chromium.org
Review URL: https://codereview.chromium.org/685593005
diff --git a/sky/engine/core/dom/Document.cpp b/sky/engine/core/dom/Document.cpp
index 465edcc..3ca8aba 100644
--- a/sky/engine/core/dom/Document.cpp
+++ b/sky/engine/core/dom/Document.cpp
@@ -2075,9 +2075,6 @@
newFocusedElement = nullptr;
}
}
-
- if (view())
- view()->setFocus(false);
}
if (newFocusedElement && newFocusedElement->isFocusable()) {
@@ -2124,9 +2121,6 @@
if (m_focusedElement->isRootEditableElement())
frame()->spellChecker().didBeginEditing(m_focusedElement.get());
-
- if (view())
- view()->setFocus(true);
}
if (!focusChangeBlocked && frameHost())
diff --git a/sky/engine/core/frame/FrameView.cpp b/sky/engine/core/frame/FrameView.cpp
index 92d5ced..a688b25 100644
--- a/sky/engine/core/frame/FrameView.cpp
+++ b/sky/engine/core/frame/FrameView.cpp
@@ -98,7 +98,6 @@
PassRefPtr<FrameView> FrameView::create(LocalFrame* frame)
{
RefPtr<FrameView> view = adoptRef(new FrameView(frame));
- view->show();
return view.release();
}
@@ -107,8 +106,6 @@
RefPtr<FrameView> view = adoptRef(new FrameView(frame));
view->Widget::setFrameRect(IntRect(view->location(), initialSize));
view->setLayoutSizeInternal(initialSize);
-
- view->show();
return view.release();
}
@@ -1430,21 +1427,6 @@
m_scrollableAreas->remove(scrollableArea);
}
-void FrameView::addChild(PassRefPtr<Widget> prpChild)
-{
- Widget* child = prpChild.get();
- ASSERT(child != this && !child->parent());
- child->setParent(this);
- m_children.add(prpChild);
-}
-
-void FrameView::removeChild(Widget* widget)
-{
- ASSERT(widget->parent() == this);
- widget->setParent(0);
- m_children.remove(widget);
-}
-
bool FrameView::wheelEvent(const PlatformWheelEvent& wheelEvent)
{
// FIXME(sky): Remove
@@ -1477,16 +1459,6 @@
page->chrome().setCursor(cursor);
}
-void FrameView::frameRectsChanged()
-{
- if (layoutSizeFixedToFrameSize())
- setLayoutSizeInternal(frameRect().size());
-
- for (const auto& widget : m_children) {
- widget->frameRectsChanged();
- }
-}
-
void FrameView::setLayoutSizeInternal(const IntSize& size)
{
if (m_layoutSize == size)
diff --git a/sky/engine/core/frame/FrameView.h b/sky/engine/core/frame/FrameView.h
index 6cef375..ecb10d4 100644
--- a/sky/engine/core/frame/FrameView.h
+++ b/sky/engine/core/frame/FrameView.h
@@ -26,11 +26,9 @@
#define FrameView_h
#include "core/rendering/PaintPhase.h"
-#include "platform/FrameWidget.h"
#include "platform/HostWindow.h"
#include "platform/RuntimeEnabledFeatures.h"
#include "platform/Widget.h"
-#include "platform/Widget.h"
#include "platform/geometry/LayoutRect.h"
#include "platform/graphics/Color.h"
#include "platform/scroll/ScrollableArea.h"
@@ -56,7 +54,7 @@
typedef unsigned long long DOMTimeStamp;
-class FrameView final : public FrameWidget {
+class FrameView final : public Widget {
public:
friend class RenderView;
@@ -204,9 +202,6 @@
void removeResizerArea(RenderBox&);
const ResizerAreaSet* resizerAreas() const { return m_resizerAreas.get(); }
- void addChild(PassRefPtr<Widget>);
- void removeChild(Widget*) final;
-
// This function exists for ports that need to handle wheel events manually.
// On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
// we need this function in order to do the scroll ourselves.
@@ -278,7 +273,6 @@
void reset();
void init();
- virtual void frameRectsChanged() override;
virtual bool isFrameView() const override { return true; }
bool contentsInCompositedLayer() const;
@@ -331,7 +325,6 @@
LayoutSize m_size;
RefPtr<LocalFrame> m_frame;
- HashSet<RefPtr<Widget> > m_children;
bool m_doFullPaintInvalidation;
diff --git a/sky/engine/core/rendering/RenderLayerScrollableArea.cpp b/sky/engine/core/rendering/RenderLayerScrollableArea.cpp
index f0aa88c..a19578e 100644
--- a/sky/engine/core/rendering/RenderLayerScrollableArea.cpp
+++ b/sky/engine/core/rendering/RenderLayerScrollableArea.cpp
@@ -788,7 +788,6 @@
didAddScrollbar(widget.get(), HorizontalScrollbar);
else
didAddScrollbar(widget.get(), VerticalScrollbar);
- box().document().view()->addChild(widget.get());
return widget.release();
}
@@ -801,7 +800,6 @@
if (!scrollbar->isCustomScrollbar())
willRemoveScrollbar(scrollbar.get(), orientation);
- scrollbar->removeFromParent();
scrollbar->disconnectFromScrollableArea();
scrollbar = nullptr;
}
diff --git a/sky/engine/platform/FrameWidget.h b/sky/engine/platform/FrameWidget.h
deleted file mode 100644
index d01b0b0..0000000
--- a/sky/engine/platform/FrameWidget.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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.
-
-#ifndef FrameWidget_h
-#define FrameWidget_h
-
-#include "platform/Widget.h"
-
-namespace blink {
-
-class Widget;
-
-class FrameWidget : public Widget {
-public:
- virtual void removeChild(Widget*) = 0;
-}; // class FrameWidget
-
-DEFINE_TYPE_CASTS(FrameWidget, Widget, widget, widget->isFrameView(), widget.isFrameView());
-
-} // namespace blink
-
-#endif // FrameWidget_h
diff --git a/sky/engine/platform/Widget.h b/sky/engine/platform/Widget.h
index f441be4..4e6600a 100644
--- a/sky/engine/platform/Widget.h
+++ b/sky/engine/platform/Widget.h
@@ -73,10 +73,6 @@
void invalidate() { invalidateRect(boundsRect()); }
virtual void invalidateRect(const IntRect&) = 0;
- virtual void setFocus(bool) { }
-
- virtual void show() { }
- virtual void hide() { }
bool isSelfVisible() const { return m_selfVisible; } // Whether or not we have been explicitly marked as visible or not.
bool isParentVisible() const { return m_parentVisible; } // Whether or not our parent is visible.
bool isVisible() const { return m_selfVisible && m_parentVisible; } // Whether or not we are actually visible.
@@ -111,11 +107,6 @@
IntPoint convertFromContainingWindow(const IntPoint&) const;
FloatPoint convertFromContainingWindow(const FloatPoint&) const;
- virtual void frameRectsChanged() { }
-
- // Notifies this widget that other widgets on the page have been repositioned.
- virtual void widgetPositionsUpdated() { }
-
// Virtual methods to convert points to/from the containing ScrollView
virtual IntRect convertToContainingView(const IntRect&) const;
virtual IntRect convertFromContainingView(const IntRect&) const;
@@ -126,13 +117,6 @@
virtual IntPoint convertChildToSelf(const Widget*, const IntPoint&) const;
virtual IntPoint convertSelfToChild(const Widget*, const IntPoint&) const;
- // Notifies this widget that it will no longer be receiving events.
- virtual void eventListenersRemoved() { }
-
-#if ENABLE(OILPAN)
- virtual void detach() { }
-#endif
-
private:
Widget* m_parent;
IntRect m_frame;
diff --git a/sky/engine/platform/scroll/Scrollbar.cpp b/sky/engine/platform/scroll/Scrollbar.cpp
index 0e62bca..09b4cf2 100644
--- a/sky/engine/platform/scroll/Scrollbar.cpp
+++ b/sky/engine/platform/scroll/Scrollbar.cpp
@@ -26,11 +26,9 @@
#include "config.h"
#include "platform/scroll/Scrollbar.h"
-#include <algorithm>
#include "platform/graphics/GraphicsContext.h"
#include "platform/PlatformGestureEvent.h"
#include "platform/PlatformMouseEvent.h"
-#include "platform/FrameWidget.h"
#include "platform/scroll/ScrollableArea.h"
#include "platform/scroll/ScrollAnimator.h"
#include "platform/scroll/Scrollbar.h"
@@ -88,12 +86,6 @@
stopTimerIfNeeded();
}
-void Scrollbar::removeFromParent()
-{
- if (parent())
- toFrameWidget(parent())->removeChild(this);
-}
-
ScrollbarOverlayStyle Scrollbar::scrollbarOverlayStyle() const
{
return m_scrollableArea ? m_scrollableArea->scrollbarOverlayStyle() : ScrollbarOverlayStyleDefault;
diff --git a/sky/engine/platform/scroll/Scrollbar.h b/sky/engine/platform/scroll/Scrollbar.h
index 319e192..a4b0cd6 100644
--- a/sky/engine/platform/scroll/Scrollbar.h
+++ b/sky/engine/platform/scroll/Scrollbar.h
@@ -58,8 +58,6 @@
Widget* parent() const { return Widget::parent(); }
Widget* root() const { return Widget::root(); }
- void removeFromParent();
-
void setFrameRect(const IntRect& r) { Widget::setFrameRect(r); }
IntRect frameRect() const { return Widget::frameRect(); }