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

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2764313002: Move plugins to be stored in HTMLPlugInElement. (Closed)
Patch Set: Use plugin and frame in updateGeometries Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org>
3 * 1999 Lars Knoll <knoll@kde.org> 3 * 1999 Lars Knoll <knoll@kde.org>
4 * 1999 Antti Koivisto <koivisto@kde.org> 4 * 1999 Antti Koivisto <koivisto@kde.org>
5 * 2000 Dirk Mueller <mueller@kde.org> 5 * 2000 Dirk Mueller <mueller@kde.org>
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
9 * Copyright (C) 2009 Google Inc. All rights reserved. 9 * Copyright (C) 2009 Google Inc. All rights reserved.
10 * 10 *
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 #include "core/page/Page.h" 93 #include "core/page/Page.h"
94 #include "core/page/PrintContext.h" 94 #include "core/page/PrintContext.h"
95 #include "core/page/scrolling/RootScrollerUtil.h" 95 #include "core/page/scrolling/RootScrollerUtil.h"
96 #include "core/page/scrolling/ScrollingCoordinator.h" 96 #include "core/page/scrolling/ScrollingCoordinator.h"
97 #include "core/page/scrolling/TopDocumentRootScrollerController.h" 97 #include "core/page/scrolling/TopDocumentRootScrollerController.h"
98 #include "core/paint/BlockPaintInvalidator.h" 98 #include "core/paint/BlockPaintInvalidator.h"
99 #include "core/paint/FramePainter.h" 99 #include "core/paint/FramePainter.h"
100 #include "core/paint/PaintLayer.h" 100 #include "core/paint/PaintLayer.h"
101 #include "core/paint/PaintTiming.h" 101 #include "core/paint/PaintTiming.h"
102 #include "core/paint/PrePaintTreeWalk.h" 102 #include "core/paint/PrePaintTreeWalk.h"
103 #include "core/plugins/PluginView.h"
104 #include "core/style/ComputedStyle.h" 103 #include "core/style/ComputedStyle.h"
105 #include "core/svg/SVGDocumentExtensions.h" 104 #include "core/svg/SVGDocumentExtensions.h"
106 #include "core/svg/SVGSVGElement.h" 105 #include "core/svg/SVGSVGElement.h"
107 #include "platform/Histogram.h" 106 #include "platform/Histogram.h"
108 #include "platform/HostWindow.h" 107 #include "platform/HostWindow.h"
109 #include "platform/RuntimeEnabledFeatures.h" 108 #include "platform/RuntimeEnabledFeatures.h"
110 #include "platform/ScriptForbiddenScope.h" 109 #include "platform/ScriptForbiddenScope.h"
111 #include "platform/WebFrameScheduler.h" 110 #include "platform/WebFrameScheduler.h"
112 #include "platform/fonts/FontCache.h" 111 #include "platform/fonts/FontCache.h"
113 #include "platform/geometry/DoubleRect.h" 112 #include "platform/geometry/DoubleRect.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 ASSERT(m_hasBeenDisposed); 229 ASSERT(m_hasBeenDisposed);
231 } 230 }
232 231
233 DEFINE_TRACE(FrameView) { 232 DEFINE_TRACE(FrameView) {
234 visitor->trace(m_frame); 233 visitor->trace(m_frame);
235 visitor->trace(m_fragmentAnchor); 234 visitor->trace(m_fragmentAnchor);
236 visitor->trace(m_scrollableAreas); 235 visitor->trace(m_scrollableAreas);
237 visitor->trace(m_animatingScrollableAreas); 236 visitor->trace(m_animatingScrollableAreas);
238 visitor->trace(m_autoSizeInfo); 237 visitor->trace(m_autoSizeInfo);
239 visitor->trace(m_children); 238 visitor->trace(m_children);
239 visitor->trace(m_plugins);
240 visitor->trace(m_viewportScrollableArea); 240 visitor->trace(m_viewportScrollableArea);
241 visitor->trace(m_visibilityObserver); 241 visitor->trace(m_visibilityObserver);
242 visitor->trace(m_scrollAnchor); 242 visitor->trace(m_scrollAnchor);
243 visitor->trace(m_anchoringAdjustmentQueue); 243 visitor->trace(m_anchoringAdjustmentQueue);
244 visitor->trace(m_scrollbarManager); 244 visitor->trace(m_scrollbarManager);
245 visitor->trace(m_printContext); 245 visitor->trace(m_printContext);
246 FrameViewBase::trace(visitor); 246 FrameViewBase::trace(visitor);
247 ScrollableArea::trace(visitor); 247 ScrollableArea::trace(visitor);
248 } 248 }
249 249
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 void FrameView::updateGeometries() { 1477 void FrameView::updateGeometries() {
1478 Vector<RefPtr<LayoutPart>> parts; 1478 Vector<RefPtr<LayoutPart>> parts;
1479 copyToVector(m_parts, parts); 1479 copyToVector(m_parts, parts);
1480 1480
1481 for (auto part : parts) { 1481 for (auto part : parts) {
1482 // Script or plugins could detach the frame so abort processing if that 1482 // Script or plugins could detach the frame so abort processing if that
1483 // happens. 1483 // happens.
1484 if (layoutViewItem().isNull()) 1484 if (layoutViewItem().isNull())
1485 break; 1485 break;
1486 1486
1487 if (FrameViewBase* frameViewBase = part->frameViewBase()) { 1487 if (FrameViewBase* frameViewBase = part->pluginOrFrame()) {
1488 if (frameViewBase->isFrameView()) { 1488 if (frameViewBase->isFrameView()) {
1489 FrameView* frameView = toFrameView(frameViewBase); 1489 FrameView* frameView = toFrameView(frameViewBase);
1490 bool didNeedLayout = frameView->needsLayout(); 1490 bool didNeedLayout = frameView->needsLayout();
1491 part->updateGeometry(); 1491 part->updateGeometry();
1492 if (!didNeedLayout && !frameView->shouldThrottleRendering()) 1492 if (!didNeedLayout && !frameView->shouldThrottleRendering())
1493 frameView->checkDoesNotNeedLayout(); 1493 frameView->checkDoesNotNeedLayout();
1494 } else { 1494 } else {
1495 part->updateGeometry(); 1495 part->updateGeometry();
1496 } 1496 }
1497 } 1497 }
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 if (needsLayout()) 3314 if (needsLayout())
3315 layout(); 3315 layout();
3316 3316
3317 checkDoesNotNeedLayout(); 3317 checkDoesNotNeedLayout();
3318 3318
3319 // WebView plugins need to update regardless of whether the 3319 // WebView plugins need to update regardless of whether the
3320 // LayoutEmbeddedObject that owns them needed layout. 3320 // LayoutEmbeddedObject that owns them needed layout.
3321 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews. 3321 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews.
3322 // We should have a way to only run these other Documents to the same 3322 // We should have a way to only run these other Documents to the same
3323 // lifecycle stage as this frame. 3323 // lifecycle stage as this frame.
3324 const ChildrenSet* viewChildren = children(); 3324 for (const Member<PluginView>& plugin : *plugins()) {
3325 for (const Member<FrameViewBase>& child : *viewChildren) { 3325 plugin->updateAllLifecyclePhases();
3326 if ((*child).isPluginContainer())
3327 toPluginView(child.get())->updateAllLifecyclePhases();
3328 } 3326 }
3329 checkDoesNotNeedLayout(); 3327 checkDoesNotNeedLayout();
3330 3328
3331 // FIXME: Calling layout() shouldn't trigger script execution or have any 3329 // FIXME: Calling layout() shouldn't trigger script execution or have any
3332 // observable effects on the frame tree but we're not quite there yet. 3330 // observable effects on the frame tree but we're not quite there yet.
3333 HeapVector<Member<FrameView>> frameViews; 3331 HeapVector<Member<FrameView>> frameViews;
3334 for (Frame* child = m_frame->tree().firstChild(); child; 3332 for (Frame* child = m_frame->tree().firstChild(); child;
3335 child = child->tree().nextSibling()) { 3333 child = child->tree().nextSibling()) {
3336 if (!child->isLocalFrame()) 3334 if (!child->isLocalFrame())
3337 continue; 3335 continue;
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
3778 ASSERT(child->parent() == this); 3776 ASSERT(child->parent() == this);
3779 3777
3780 if (child->isFrameView() && 3778 if (child->isFrameView() &&
3781 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) 3779 !RuntimeEnabledFeatures::rootLayerScrollingEnabled())
3782 removeScrollableArea(toFrameView(child)); 3780 removeScrollableArea(toFrameView(child));
3783 3781
3784 child->setParent(0); 3782 child->setParent(0);
3785 m_children.erase(child); 3783 m_children.erase(child);
3786 } 3784 }
3787 3785
3786 void FrameView::removePlugin(PluginView* plugin) {
3787 DCHECK(m_plugins.contains(plugin));
3788 m_plugins.erase(plugin);
3789 }
3790
3791 void FrameView::addPlugin(PluginView* plugin) {
3792 DCHECK(!m_plugins.contains(plugin));
3793 m_plugins.insert(plugin);
3794 }
3795
3788 bool FrameView::visualViewportSuppliesScrollbars() { 3796 bool FrameView::visualViewportSuppliesScrollbars() {
3789 // On desktop, we always use the layout viewport's scrollbars. 3797 // On desktop, we always use the layout viewport's scrollbars.
3790 if (!m_frame->settings() || !m_frame->settings()->getViewportEnabled() || 3798 if (!m_frame->settings() || !m_frame->settings()->getViewportEnabled() ||
3791 !m_frame->document() || !m_frame->page()) 3799 !m_frame->document() || !m_frame->page())
3792 return false; 3800 return false;
3793 3801
3794 const TopDocumentRootScrollerController& controller = 3802 const TopDocumentRootScrollerController& controller =
3795 m_frame->page()->globalRootScrollerController(); 3803 m_frame->page()->globalRootScrollerController();
3796 3804
3797 if (!layoutViewportScrollableArea()) 3805 if (!layoutViewportScrollableArea())
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3864 page->globalRootScrollerController(); 3872 page->globalRootScrollerController();
3865 if (layoutViewport == controller.rootScrollerArea()) 3873 if (layoutViewport == controller.rootScrollerArea())
3866 visibleSize = controller.rootScrollerVisibleArea(); 3874 visibleSize = controller.rootScrollerVisibleArea();
3867 3875
3868 IntSize maximumOffset = 3876 IntSize maximumOffset =
3869 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); 3877 toIntSize(-scrollOrigin() + (contentBounds - visibleSize));
3870 return maximumOffset.expandedTo(minimumScrollOffsetInt()); 3878 return maximumOffset.expandedTo(minimumScrollOffsetInt());
3871 } 3879 }
3872 3880
3873 void FrameView::addChild(FrameViewBase* child) { 3881 void FrameView::addChild(FrameViewBase* child) {
3874 ASSERT(child != this && !child->parent()); 3882 DCHECK(child != this && !child->parent());
3883 DCHECK(!child->isPluginView());
3875 child->setParent(this); 3884 child->setParent(this);
3876 m_children.insert(child); 3885 m_children.insert(child);
3877 } 3886 }
3878 3887
3879 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, 3888 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode,
3880 ScrollbarMode verticalMode, 3889 ScrollbarMode verticalMode,
3881 bool horizontalLock, 3890 bool horizontalLock,
3882 bool verticalLock) { 3891 bool verticalLock) {
3883 bool needsUpdate = false; 3892 bool needsUpdate = false;
3884 3893
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after
5260 void FrameView::setAnimationHost( 5269 void FrameView::setAnimationHost(
5261 std::unique_ptr<CompositorAnimationHost> host) { 5270 std::unique_ptr<CompositorAnimationHost> host) {
5262 m_animationHost = std::move(host); 5271 m_animationHost = std::move(host);
5263 } 5272 }
5264 5273
5265 LayoutUnit FrameView::caretWidth() const { 5274 LayoutUnit FrameView::caretWidth() const {
5266 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); 5275 return LayoutUnit(getHostWindow()->windowToViewportScalar(1));
5267 } 5276 }
5268 5277
5269 } // namespace blink 5278 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698