OLD | NEW |
---|---|
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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
230 ASSERT(m_hasBeenDisposed); | 230 ASSERT(m_hasBeenDisposed); |
231 } | 231 } |
232 | 232 |
233 DEFINE_TRACE(FrameView) { | 233 DEFINE_TRACE(FrameView) { |
234 visitor->trace(m_frame); | 234 visitor->trace(m_frame); |
235 visitor->trace(m_fragmentAnchor); | 235 visitor->trace(m_fragmentAnchor); |
236 visitor->trace(m_scrollableAreas); | 236 visitor->trace(m_scrollableAreas); |
237 visitor->trace(m_animatingScrollableAreas); | 237 visitor->trace(m_animatingScrollableAreas); |
238 visitor->trace(m_autoSizeInfo); | 238 visitor->trace(m_autoSizeInfo); |
239 visitor->trace(m_children); | 239 visitor->trace(m_children); |
240 visitor->trace(m_plugins); | |
240 visitor->trace(m_viewportScrollableArea); | 241 visitor->trace(m_viewportScrollableArea); |
241 visitor->trace(m_visibilityObserver); | 242 visitor->trace(m_visibilityObserver); |
242 visitor->trace(m_scrollAnchor); | 243 visitor->trace(m_scrollAnchor); |
243 visitor->trace(m_anchoringAdjustmentQueue); | 244 visitor->trace(m_anchoringAdjustmentQueue); |
244 visitor->trace(m_scrollbarManager); | 245 visitor->trace(m_scrollbarManager); |
245 visitor->trace(m_printContext); | 246 visitor->trace(m_printContext); |
246 FrameViewBase::trace(visitor); | 247 FrameViewBase::trace(visitor); |
247 ScrollableArea::trace(visitor); | 248 ScrollableArea::trace(visitor); |
248 } | 249 } |
249 | 250 |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1477 void FrameView::updateGeometries() { | 1478 void FrameView::updateGeometries() { |
1478 Vector<RefPtr<LayoutPart>> parts; | 1479 Vector<RefPtr<LayoutPart>> parts; |
1479 copyToVector(m_parts, parts); | 1480 copyToVector(m_parts, parts); |
1480 | 1481 |
1481 for (auto part : parts) { | 1482 for (auto part : parts) { |
1482 // Script or plugins could detach the frame so abort processing if that | 1483 // Script or plugins could detach the frame so abort processing if that |
1483 // happens. | 1484 // happens. |
1484 if (layoutViewItem().isNull()) | 1485 if (layoutViewItem().isNull()) |
1485 break; | 1486 break; |
1486 | 1487 |
1487 if (FrameViewBase* frameViewBase = part->frameViewBase()) { | 1488 if (FrameViewBase* frameViewBase = part->pluginOrFrame()) { |
1488 if (frameViewBase->isFrameView()) { | 1489 if (frameViewBase->isFrameView()) { |
1489 FrameView* frameView = toFrameView(frameViewBase); | 1490 FrameView* frameView = toFrameView(frameViewBase); |
1490 bool didNeedLayout = frameView->needsLayout(); | 1491 bool didNeedLayout = frameView->needsLayout(); |
1491 part->updateGeometry(); | 1492 part->updateGeometry(); |
1492 if (!didNeedLayout && !frameView->shouldThrottleRendering()) | 1493 if (!didNeedLayout && !frameView->shouldThrottleRendering()) |
1493 frameView->checkDoesNotNeedLayout(); | 1494 frameView->checkDoesNotNeedLayout(); |
1494 } else { | 1495 } else { |
1495 part->updateGeometry(); | 1496 part->updateGeometry(); |
1496 } | 1497 } |
1497 } | 1498 } |
(...skipping 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3318 if (needsLayout()) | 3319 if (needsLayout()) |
3319 layout(); | 3320 layout(); |
3320 | 3321 |
3321 checkDoesNotNeedLayout(); | 3322 checkDoesNotNeedLayout(); |
3322 | 3323 |
3323 // WebView plugins need to update regardless of whether the | 3324 // WebView plugins need to update regardless of whether the |
3324 // LayoutEmbeddedObject that owns them needed layout. | 3325 // LayoutEmbeddedObject that owns them needed layout. |
3325 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews. | 3326 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews. |
3326 // We should have a way to only run these other Documents to the same | 3327 // We should have a way to only run these other Documents to the same |
3327 // lifecycle stage as this frame. | 3328 // lifecycle stage as this frame. |
3328 const ChildrenSet* viewChildren = children(); | 3329 for (const Member<PluginView>& plugin : *plugins()) { |
3329 for (const Member<FrameViewBase>& child : *viewChildren) { | 3330 plugin->updateAllLifecyclePhases(); |
3330 if ((*child).isPluginContainer()) | |
3331 toPluginView(child.get())->updateAllLifecyclePhases(); | |
3332 } | 3331 } |
3333 checkDoesNotNeedLayout(); | 3332 checkDoesNotNeedLayout(); |
3334 | 3333 |
3335 // FIXME: Calling layout() shouldn't trigger script execution or have any | 3334 // FIXME: Calling layout() shouldn't trigger script execution or have any |
3336 // observable effects on the frame tree but we're not quite there yet. | 3335 // observable effects on the frame tree but we're not quite there yet. |
3337 HeapVector<Member<FrameView>> frameViews; | 3336 HeapVector<Member<FrameView>> frameViews; |
3338 for (Frame* child = m_frame->tree().firstChild(); child; | 3337 for (Frame* child = m_frame->tree().firstChild(); child; |
3339 child = child->tree().nextSibling()) { | 3338 child = child->tree().nextSibling()) { |
3340 if (!child->isLocalFrame()) | 3339 if (!child->isLocalFrame()) |
3341 continue; | 3340 continue; |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3774 FrameViewBase::setParent(parentView); | 3773 FrameViewBase::setParent(parentView); |
3775 | 3774 |
3776 updateParentScrollableAreaSet(); | 3775 updateParentScrollableAreaSet(); |
3777 setupRenderThrottling(); | 3776 setupRenderThrottling(); |
3778 | 3777 |
3779 if (parentFrameView()) | 3778 if (parentFrameView()) |
3780 m_subtreeThrottled = parentFrameView()->canThrottleRendering(); | 3779 m_subtreeThrottled = parentFrameView()->canThrottleRendering(); |
3781 } | 3780 } |
3782 | 3781 |
3783 void FrameView::removeChild(FrameViewBase* child) { | 3782 void FrameView::removeChild(FrameViewBase* child) { |
3784 ASSERT(child->parent() == this); | 3783 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
| |
3785 | 3784 |
3786 if (child->isFrameView() && | 3785 if (child->isFrameView() && |
3787 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 3786 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
3788 removeScrollableArea(toFrameView(child)); | 3787 removeScrollableArea(toFrameView(child)); |
3789 | 3788 |
3790 child->setParent(0); | 3789 child->setParent(nullptr); |
3791 m_children.erase(child); | 3790 m_children.erase(child); |
3792 } | 3791 } |
3793 | 3792 |
3793 void FrameView::removePlugin(PluginView* plugin) { | |
3794 CHECK(plugin->parent() == this); | |
3795 DCHECK(m_plugins.contains(plugin)); | |
3796 plugin->setParent(nullptr); | |
3797 m_plugins.erase(plugin); | |
3798 } | |
3799 | |
3800 void FrameView::addPlugin(PluginView* plugin) { | |
3801 DCHECK(!plugin->parent()); | |
3802 DCHECK(!m_plugins.contains(plugin)); | |
3803 plugin->setParent(this); | |
3804 m_plugins.insert(plugin); | |
3805 } | |
3806 | |
3794 bool FrameView::visualViewportSuppliesScrollbars() { | 3807 bool FrameView::visualViewportSuppliesScrollbars() { |
3795 // On desktop, we always use the layout viewport's scrollbars. | 3808 // On desktop, we always use the layout viewport's scrollbars. |
3796 if (!m_frame->settings() || !m_frame->settings()->getViewportEnabled() || | 3809 if (!m_frame->settings() || !m_frame->settings()->getViewportEnabled() || |
3797 !m_frame->document() || !m_frame->page()) | 3810 !m_frame->document() || !m_frame->page()) |
3798 return false; | 3811 return false; |
3799 | 3812 |
3800 const TopDocumentRootScrollerController& controller = | 3813 const TopDocumentRootScrollerController& controller = |
3801 m_frame->page()->globalRootScrollerController(); | 3814 m_frame->page()->globalRootScrollerController(); |
3802 | 3815 |
3803 if (!layoutViewportScrollableArea()) | 3816 if (!layoutViewportScrollableArea()) |
(...skipping 16 matching lines...) Expand all Loading... | |
3820 page->chromeClient().setCursor(cursor, m_frame); | 3833 page->chromeClient().setCursor(cursor, m_frame); |
3821 } | 3834 } |
3822 | 3835 |
3823 void FrameView::frameRectsChanged() { | 3836 void FrameView::frameRectsChanged() { |
3824 TRACE_EVENT0("blink", "FrameView::frameRectsChanged"); | 3837 TRACE_EVENT0("blink", "FrameView::frameRectsChanged"); |
3825 if (layoutSizeFixedToFrameSize()) | 3838 if (layoutSizeFixedToFrameSize()) |
3826 setLayoutSizeInternal(frameRect().size()); | 3839 setLayoutSizeInternal(frameRect().size()); |
3827 | 3840 |
3828 for (const auto& child : m_children) | 3841 for (const auto& child : m_children) |
3829 child->frameRectsChanged(); | 3842 child->frameRectsChanged(); |
3843 | |
3844 for (const auto& plugin : m_plugins) | |
3845 plugin->frameRectsChanged(); | |
3830 } | 3846 } |
3831 | 3847 |
3832 void FrameView::setLayoutSizeInternal(const IntSize& size) { | 3848 void FrameView::setLayoutSizeInternal(const IntSize& size) { |
3833 if (m_layoutSize == size) | 3849 if (m_layoutSize == size) |
3834 return; | 3850 return; |
3835 | 3851 |
3836 m_layoutSize = size; | 3852 m_layoutSize = size; |
3837 contentsResized(); | 3853 contentsResized(); |
3838 } | 3854 } |
3839 | 3855 |
(...skipping 30 matching lines...) Expand all Loading... | |
3870 page->globalRootScrollerController(); | 3886 page->globalRootScrollerController(); |
3871 if (layoutViewport == controller.rootScrollerArea()) | 3887 if (layoutViewport == controller.rootScrollerArea()) |
3872 visibleSize = controller.rootScrollerVisibleArea(); | 3888 visibleSize = controller.rootScrollerVisibleArea(); |
3873 | 3889 |
3874 IntSize maximumOffset = | 3890 IntSize maximumOffset = |
3875 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); | 3891 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); |
3876 return maximumOffset.expandedTo(minimumScrollOffsetInt()); | 3892 return maximumOffset.expandedTo(minimumScrollOffsetInt()); |
3877 } | 3893 } |
3878 | 3894 |
3879 void FrameView::addChild(FrameViewBase* child) { | 3895 void FrameView::addChild(FrameViewBase* child) { |
3880 ASSERT(child != this && !child->parent()); | 3896 DCHECK(child != this && !child->parent()); |
3897 DCHECK(!child->isPluginView()); | |
3881 child->setParent(this); | 3898 child->setParent(this); |
3882 m_children.insert(child); | 3899 m_children.insert(child); |
3883 } | 3900 } |
3884 | 3901 |
3885 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, | 3902 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, |
3886 ScrollbarMode verticalMode, | 3903 ScrollbarMode verticalMode, |
3887 bool horizontalLock, | 3904 bool horizontalLock, |
3888 bool verticalLock) { | 3905 bool verticalLock) { |
3889 bool needsUpdate = false; | 3906 bool needsUpdate = false; |
3890 | 3907 |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4666 // and potentially child frame views. | 4683 // and potentially child frame views. |
4667 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); | 4684 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); |
4668 | 4685 |
4669 FrameViewBase::setParentVisible(visible); | 4686 FrameViewBase::setParentVisible(visible); |
4670 | 4687 |
4671 if (!isSelfVisible()) | 4688 if (!isSelfVisible()) |
4672 return; | 4689 return; |
4673 | 4690 |
4674 for (const auto& child : m_children) | 4691 for (const auto& child : m_children) |
4675 child->setParentVisible(visible); | 4692 child->setParentVisible(visible); |
4693 | |
4694 for (const auto& plugin : m_plugins) | |
4695 plugin->setParentVisible(visible); | |
4676 } | 4696 } |
4677 | 4697 |
4678 void FrameView::show() { | 4698 void FrameView::show() { |
4679 if (!isSelfVisible()) { | 4699 if (!isSelfVisible()) { |
4680 setSelfVisible(true); | 4700 setSelfVisible(true); |
4681 if (ScrollingCoordinator* scrollingCoordinator = | 4701 if (ScrollingCoordinator* scrollingCoordinator = |
4682 this->scrollingCoordinator()) | 4702 this->scrollingCoordinator()) |
4683 scrollingCoordinator->frameViewVisibilityDidChange(); | 4703 scrollingCoordinator->frameViewVisibilityDidChange(); |
4684 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); | 4704 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); |
4685 updateParentScrollableAreaSet(); | 4705 updateParentScrollableAreaSet(); |
4686 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && | 4706 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && |
4687 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 4707 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
4688 // The existance of scrolling properties depends on visibility through | 4708 // The existance of scrolling properties depends on visibility through |
4689 // isScrollable() so ensure properties are updated if visibility changes. | 4709 // isScrollable() so ensure properties are updated if visibility changes. |
4690 setNeedsPaintPropertyUpdate(); | 4710 setNeedsPaintPropertyUpdate(); |
4691 } | 4711 } |
4692 if (isParentVisible()) { | 4712 if (isParentVisible()) { |
4693 for (const auto& child : m_children) | 4713 for (const auto& child : m_children) |
4694 child->setParentVisible(true); | 4714 child->setParentVisible(true); |
4715 | |
4716 for (const auto& plugin : m_plugins) | |
4717 plugin->setParentVisible(true); | |
4695 } | 4718 } |
4696 } | 4719 } |
4697 | 4720 |
4698 FrameViewBase::show(); | 4721 FrameViewBase::show(); |
4699 } | 4722 } |
4700 | 4723 |
4701 void FrameView::hide() { | 4724 void FrameView::hide() { |
4702 if (isSelfVisible()) { | 4725 if (isSelfVisible()) { |
4703 if (isParentVisible()) { | 4726 if (isParentVisible()) { |
4704 for (const auto& child : m_children) | 4727 for (const auto& child : m_children) |
4705 child->setParentVisible(false); | 4728 child->setParentVisible(false); |
4729 | |
4730 for (const auto& plugin : m_plugins) | |
4731 plugin->setParentVisible(false); | |
4706 } | 4732 } |
4707 setSelfVisible(false); | 4733 setSelfVisible(false); |
4708 if (ScrollingCoordinator* scrollingCoordinator = | 4734 if (ScrollingCoordinator* scrollingCoordinator = |
4709 this->scrollingCoordinator()) | 4735 this->scrollingCoordinator()) |
4710 scrollingCoordinator->frameViewVisibilityDidChange(); | 4736 scrollingCoordinator->frameViewVisibilityDidChange(); |
4711 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); | 4737 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); |
4712 updateParentScrollableAreaSet(); | 4738 updateParentScrollableAreaSet(); |
4713 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && | 4739 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && |
4714 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 4740 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
4715 // The existance of scrolling properties depends on visibility through | 4741 // The existance of scrolling properties depends on visibility through |
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5265 void FrameView::setAnimationHost( | 5291 void FrameView::setAnimationHost( |
5266 std::unique_ptr<CompositorAnimationHost> host) { | 5292 std::unique_ptr<CompositorAnimationHost> host) { |
5267 m_animationHost = std::move(host); | 5293 m_animationHost = std::move(host); |
5268 } | 5294 } |
5269 | 5295 |
5270 LayoutUnit FrameView::caretWidth() const { | 5296 LayoutUnit FrameView::caretWidth() const { |
5271 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); | 5297 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); |
5272 } | 5298 } |
5273 | 5299 |
5274 } // namespace blink | 5300 } // namespace blink |
OLD | NEW |