Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(736)

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2764313002: Move plugins to be stored in HTMLPlugInElement. (Closed)
Patch Set: Rebase and merge Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index 5f4f5758e0fa9f5d417d334b3964da60f1a4635b..47dfcc08912acb3c7c094bcc9cbe7d711a0818b9 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -237,6 +237,7 @@ DEFINE_TRACE(FrameView) {
visitor->trace(m_animatingScrollableAreas);
visitor->trace(m_autoSizeInfo);
visitor->trace(m_children);
+ visitor->trace(m_plugins);
visitor->trace(m_viewportScrollableArea);
visitor->trace(m_visibilityObserver);
visitor->trace(m_scrollAnchor);
@@ -1484,7 +1485,7 @@ void FrameView::updateGeometries() {
if (layoutViewItem().isNull())
break;
- if (FrameViewBase* frameViewBase = part->frameViewBase()) {
+ if (FrameViewBase* frameViewBase = part->pluginOrFrame()) {
if (frameViewBase->isFrameView()) {
FrameView* frameView = toFrameView(frameViewBase);
bool didNeedLayout = frameView->needsLayout();
@@ -3325,10 +3326,8 @@ void FrameView::updateStyleAndLayoutIfNeededRecursiveInternal() {
// TODO(leviw): This currently runs the entire lifecycle on plugin WebViews.
// We should have a way to only run these other Documents to the same
// lifecycle stage as this frame.
- const ChildrenSet* viewChildren = children();
- for (const Member<FrameViewBase>& child : *viewChildren) {
- if ((*child).isPluginContainer())
- toPluginView(child.get())->updateAllLifecyclePhases();
+ for (const Member<PluginView>& plugin : *plugins()) {
+ plugin->updateAllLifecyclePhases();
}
checkDoesNotNeedLayout();
@@ -3781,16 +3780,30 @@ void FrameView::setParent(FrameViewBase* parentView) {
}
void FrameView::removeChild(FrameViewBase* child) {
- ASSERT(child->parent() == this);
+ CHECK(child->parent() == this);
dcheng 2017/04/04 07:20:12 Nit: DCHECK is the equivalent of ASSERT
joelhockey 2017/04/04 23:39:05 Done, also changed CHECK below in removePlugin to
if (child->isFrameView() &&
!RuntimeEnabledFeatures::rootLayerScrollingEnabled())
removeScrollableArea(toFrameView(child));
- child->setParent(0);
+ child->setParent(nullptr);
m_children.erase(child);
}
+void FrameView::removePlugin(PluginView* plugin) {
+ CHECK(plugin->parent() == this);
+ DCHECK(m_plugins.contains(plugin));
+ plugin->setParent(nullptr);
+ m_plugins.erase(plugin);
+}
+
+void FrameView::addPlugin(PluginView* plugin) {
+ DCHECK(!plugin->parent());
+ DCHECK(!m_plugins.contains(plugin));
+ plugin->setParent(this);
+ m_plugins.insert(plugin);
+}
+
bool FrameView::visualViewportSuppliesScrollbars() {
// On desktop, we always use the layout viewport's scrollbars.
if (!m_frame->settings() || !m_frame->settings()->getViewportEnabled() ||
@@ -3827,6 +3840,9 @@ void FrameView::frameRectsChanged() {
for (const auto& child : m_children)
child->frameRectsChanged();
+
+ for (const auto& plugin : m_plugins)
+ plugin->frameRectsChanged();
}
void FrameView::setLayoutSizeInternal(const IntSize& size) {
@@ -3877,7 +3893,8 @@ IntSize FrameView::maximumScrollOffsetInt() const {
}
void FrameView::addChild(FrameViewBase* child) {
- ASSERT(child != this && !child->parent());
+ DCHECK(child != this && !child->parent());
+ DCHECK(!child->isPluginView());
child->setParent(this);
m_children.insert(child);
}
@@ -4673,6 +4690,9 @@ void FrameView::setParentVisible(bool visible) {
for (const auto& child : m_children)
child->setParentVisible(visible);
+
+ for (const auto& plugin : m_plugins)
+ plugin->setParentVisible(visible);
}
void FrameView::show() {
@@ -4692,6 +4712,9 @@ void FrameView::show() {
if (isParentVisible()) {
for (const auto& child : m_children)
child->setParentVisible(true);
+
+ for (const auto& plugin : m_plugins)
+ plugin->setParentVisible(true);
}
}
@@ -4703,6 +4726,9 @@ void FrameView::hide() {
if (isParentVisible()) {
for (const auto& child : m_children)
child->setParentVisible(false);
+
+ for (const auto& plugin : m_plugins)
+ plugin->setParentVisible(false);
}
setSelfVisible(false);
if (ScrollingCoordinator* scrollingCoordinator =

Powered by Google App Engine
This is Rietveld 408576698