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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 ASSERT(m_hasBeenDisposed); | 229 ASSERT(m_hasBeenDisposed); |
230 } | 230 } |
231 | 231 |
232 DEFINE_TRACE(FrameView) { | 232 DEFINE_TRACE(FrameView) { |
233 visitor->trace(m_frame); | 233 visitor->trace(m_frame); |
234 visitor->trace(m_fragmentAnchor); | 234 visitor->trace(m_fragmentAnchor); |
235 visitor->trace(m_scrollableAreas); | 235 visitor->trace(m_scrollableAreas); |
236 visitor->trace(m_animatingScrollableAreas); | 236 visitor->trace(m_animatingScrollableAreas); |
237 visitor->trace(m_autoSizeInfo); | 237 visitor->trace(m_autoSizeInfo); |
238 visitor->trace(m_children); | 238 visitor->trace(m_children); |
| 239 visitor->trace(m_plugins); |
239 visitor->trace(m_viewportScrollableArea); | 240 visitor->trace(m_viewportScrollableArea); |
240 visitor->trace(m_visibilityObserver); | 241 visitor->trace(m_visibilityObserver); |
241 visitor->trace(m_scrollAnchor); | 242 visitor->trace(m_scrollAnchor); |
242 visitor->trace(m_anchoringAdjustmentQueue); | 243 visitor->trace(m_anchoringAdjustmentQueue); |
243 visitor->trace(m_scrollbarManager); | 244 visitor->trace(m_scrollbarManager); |
244 visitor->trace(m_printContext); | 245 visitor->trace(m_printContext); |
245 FrameViewBase::trace(visitor); | 246 FrameViewBase::trace(visitor); |
246 ScrollableArea::trace(visitor); | 247 ScrollableArea::trace(visitor); |
247 } | 248 } |
248 | 249 |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1476 void FrameView::updateGeometries() { | 1477 void FrameView::updateGeometries() { |
1477 Vector<RefPtr<LayoutPart>> parts; | 1478 Vector<RefPtr<LayoutPart>> parts; |
1478 copyToVector(m_parts, parts); | 1479 copyToVector(m_parts, parts); |
1479 | 1480 |
1480 for (auto part : parts) { | 1481 for (auto part : parts) { |
1481 // 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 |
1482 // happens. | 1483 // happens. |
1483 if (layoutViewItem().isNull()) | 1484 if (layoutViewItem().isNull()) |
1484 break; | 1485 break; |
1485 | 1486 |
1486 if (FrameViewBase* frameViewBase = part->frameViewBase()) { | 1487 if (FrameViewBase* frameViewBase = part->pluginOrFrame()) { |
1487 if (frameViewBase->isFrameView()) { | 1488 if (frameViewBase->isFrameView()) { |
1488 FrameView* frameView = toFrameView(frameViewBase); | 1489 FrameView* frameView = toFrameView(frameViewBase); |
1489 bool didNeedLayout = frameView->needsLayout(); | 1490 bool didNeedLayout = frameView->needsLayout(); |
1490 part->updateGeometry(); | 1491 part->updateGeometry(); |
1491 if (!didNeedLayout && !frameView->shouldThrottleRendering()) | 1492 if (!didNeedLayout && !frameView->shouldThrottleRendering()) |
1492 frameView->checkDoesNotNeedLayout(); | 1493 frameView->checkDoesNotNeedLayout(); |
1493 } else { | 1494 } else { |
1494 part->updateGeometry(); | 1495 part->updateGeometry(); |
1495 } | 1496 } |
1496 } | 1497 } |
(...skipping 1795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3292 if (needsLayout()) | 3293 if (needsLayout()) |
3293 layout(); | 3294 layout(); |
3294 | 3295 |
3295 checkDoesNotNeedLayout(); | 3296 checkDoesNotNeedLayout(); |
3296 | 3297 |
3297 // WebView plugins need to update regardless of whether the | 3298 // WebView plugins need to update regardless of whether the |
3298 // LayoutEmbeddedObject that owns them needed layout. | 3299 // LayoutEmbeddedObject that owns them needed layout. |
3299 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews. | 3300 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews. |
3300 // We should have a way to only run these other Documents to the same | 3301 // We should have a way to only run these other Documents to the same |
3301 // lifecycle stage as this frame. | 3302 // lifecycle stage as this frame. |
3302 const ChildrenSet* viewChildren = children(); | 3303 for (const Member<PluginView>& plugin : *plugins()) { |
3303 for (const Member<FrameViewBase>& child : *viewChildren) { | 3304 plugin->updateAllLifecyclePhases(); |
3304 if ((*child).isPluginContainer()) | |
3305 toPluginView(child.get())->updateAllLifecyclePhases(); | |
3306 } | 3305 } |
3307 checkDoesNotNeedLayout(); | 3306 checkDoesNotNeedLayout(); |
3308 | 3307 |
3309 // FIXME: Calling layout() shouldn't trigger script execution or have any | 3308 // FIXME: Calling layout() shouldn't trigger script execution or have any |
3310 // observable effects on the frame tree but we're not quite there yet. | 3309 // observable effects on the frame tree but we're not quite there yet. |
3311 HeapVector<Member<FrameView>> frameViews; | 3310 HeapVector<Member<FrameView>> frameViews; |
3312 for (Frame* child = m_frame->tree().firstChild(); child; | 3311 for (Frame* child = m_frame->tree().firstChild(); child; |
3313 child = child->tree().nextSibling()) { | 3312 child = child->tree().nextSibling()) { |
3314 if (!child->isLocalFrame()) | 3313 if (!child->isLocalFrame()) |
3315 continue; | 3314 continue; |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3748 FrameViewBase::setParent(parentView); | 3747 FrameViewBase::setParent(parentView); |
3749 | 3748 |
3750 updateParentScrollableAreaSet(); | 3749 updateParentScrollableAreaSet(); |
3751 setupRenderThrottling(); | 3750 setupRenderThrottling(); |
3752 | 3751 |
3753 if (parentFrameView()) | 3752 if (parentFrameView()) |
3754 m_subtreeThrottled = parentFrameView()->canThrottleRendering(); | 3753 m_subtreeThrottled = parentFrameView()->canThrottleRendering(); |
3755 } | 3754 } |
3756 | 3755 |
3757 void FrameView::removeChild(FrameViewBase* child) { | 3756 void FrameView::removeChild(FrameViewBase* child) { |
3758 ASSERT(child->parent() == this); | 3757 DCHECK(child->parent() == this); |
3759 | 3758 |
3760 if (child->isFrameView() && | 3759 if (child->isFrameView() && |
3761 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) | 3760 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) |
3762 removeScrollableArea(toFrameView(child)); | 3761 removeScrollableArea(toFrameView(child)); |
3763 | 3762 |
3764 child->setParent(0); | 3763 child->setParent(nullptr); |
3765 m_children.erase(child); | 3764 m_children.erase(child); |
3766 } | 3765 } |
3767 | 3766 |
| 3767 void FrameView::removePlugin(PluginView* plugin) { |
| 3768 DCHECK(plugin->parent() == this); |
| 3769 DCHECK(m_plugins.contains(plugin)); |
| 3770 plugin->setParent(nullptr); |
| 3771 m_plugins.erase(plugin); |
| 3772 } |
| 3773 |
| 3774 void FrameView::addPlugin(PluginView* plugin) { |
| 3775 DCHECK(!plugin->parent()); |
| 3776 DCHECK(!m_plugins.contains(plugin)); |
| 3777 plugin->setParent(this); |
| 3778 m_plugins.insert(plugin); |
| 3779 } |
| 3780 |
3768 bool FrameView::visualViewportSuppliesScrollbars() { | 3781 bool FrameView::visualViewportSuppliesScrollbars() { |
3769 // On desktop, we always use the layout viewport's scrollbars. | 3782 // On desktop, we always use the layout viewport's scrollbars. |
3770 if (!m_frame->settings() || !m_frame->settings()->getViewportEnabled() || | 3783 if (!m_frame->settings() || !m_frame->settings()->getViewportEnabled() || |
3771 !m_frame->document() || !m_frame->page()) | 3784 !m_frame->document() || !m_frame->page()) |
3772 return false; | 3785 return false; |
3773 | 3786 |
3774 const TopDocumentRootScrollerController& controller = | 3787 const TopDocumentRootScrollerController& controller = |
3775 m_frame->page()->globalRootScrollerController(); | 3788 m_frame->page()->globalRootScrollerController(); |
3776 | 3789 |
3777 if (!layoutViewportScrollableArea()) | 3790 if (!layoutViewportScrollableArea()) |
(...skipping 16 matching lines...) Expand all Loading... |
3794 page->chromeClient().setCursor(cursor, m_frame); | 3807 page->chromeClient().setCursor(cursor, m_frame); |
3795 } | 3808 } |
3796 | 3809 |
3797 void FrameView::frameRectsChanged() { | 3810 void FrameView::frameRectsChanged() { |
3798 TRACE_EVENT0("blink", "FrameView::frameRectsChanged"); | 3811 TRACE_EVENT0("blink", "FrameView::frameRectsChanged"); |
3799 if (layoutSizeFixedToFrameSize()) | 3812 if (layoutSizeFixedToFrameSize()) |
3800 setLayoutSizeInternal(frameRect().size()); | 3813 setLayoutSizeInternal(frameRect().size()); |
3801 | 3814 |
3802 for (const auto& child : m_children) | 3815 for (const auto& child : m_children) |
3803 child->frameRectsChanged(); | 3816 child->frameRectsChanged(); |
| 3817 |
| 3818 for (const auto& plugin : m_plugins) |
| 3819 plugin->frameRectsChanged(); |
3804 } | 3820 } |
3805 | 3821 |
3806 void FrameView::setLayoutSizeInternal(const IntSize& size) { | 3822 void FrameView::setLayoutSizeInternal(const IntSize& size) { |
3807 if (m_layoutSize == size) | 3823 if (m_layoutSize == size) |
3808 return; | 3824 return; |
3809 | 3825 |
3810 m_layoutSize = size; | 3826 m_layoutSize = size; |
3811 contentsResized(); | 3827 contentsResized(); |
3812 } | 3828 } |
3813 | 3829 |
(...skipping 30 matching lines...) Expand all Loading... |
3844 page->globalRootScrollerController(); | 3860 page->globalRootScrollerController(); |
3845 if (layoutViewport == controller.rootScrollerArea()) | 3861 if (layoutViewport == controller.rootScrollerArea()) |
3846 visibleSize = controller.rootScrollerVisibleArea(); | 3862 visibleSize = controller.rootScrollerVisibleArea(); |
3847 | 3863 |
3848 IntSize maximumOffset = | 3864 IntSize maximumOffset = |
3849 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); | 3865 toIntSize(-scrollOrigin() + (contentBounds - visibleSize)); |
3850 return maximumOffset.expandedTo(minimumScrollOffsetInt()); | 3866 return maximumOffset.expandedTo(minimumScrollOffsetInt()); |
3851 } | 3867 } |
3852 | 3868 |
3853 void FrameView::addChild(FrameViewBase* child) { | 3869 void FrameView::addChild(FrameViewBase* child) { |
3854 ASSERT(child != this && !child->parent()); | 3870 DCHECK(child != this && !child->parent()); |
| 3871 DCHECK(!child->isPluginView()); |
3855 child->setParent(this); | 3872 child->setParent(this); |
3856 m_children.insert(child); | 3873 m_children.insert(child); |
3857 } | 3874 } |
3858 | 3875 |
3859 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, | 3876 void FrameView::setScrollbarModes(ScrollbarMode horizontalMode, |
3860 ScrollbarMode verticalMode, | 3877 ScrollbarMode verticalMode, |
3861 bool horizontalLock, | 3878 bool horizontalLock, |
3862 bool verticalLock) { | 3879 bool verticalLock) { |
3863 bool needsUpdate = false; | 3880 bool needsUpdate = false; |
3864 | 3881 |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4640 // and potentially child frame views. | 4657 // and potentially child frame views. |
4641 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); | 4658 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); |
4642 | 4659 |
4643 FrameViewBase::setParentVisible(visible); | 4660 FrameViewBase::setParentVisible(visible); |
4644 | 4661 |
4645 if (!isSelfVisible()) | 4662 if (!isSelfVisible()) |
4646 return; | 4663 return; |
4647 | 4664 |
4648 for (const auto& child : m_children) | 4665 for (const auto& child : m_children) |
4649 child->setParentVisible(visible); | 4666 child->setParentVisible(visible); |
| 4667 |
| 4668 for (const auto& plugin : m_plugins) |
| 4669 plugin->setParentVisible(visible); |
4650 } | 4670 } |
4651 | 4671 |
4652 void FrameView::show() { | 4672 void FrameView::show() { |
4653 if (!isSelfVisible()) { | 4673 if (!isSelfVisible()) { |
4654 setSelfVisible(true); | 4674 setSelfVisible(true); |
4655 if (ScrollingCoordinator* scrollingCoordinator = | 4675 if (ScrollingCoordinator* scrollingCoordinator = |
4656 this->scrollingCoordinator()) | 4676 this->scrollingCoordinator()) |
4657 scrollingCoordinator->frameViewVisibilityDidChange(); | 4677 scrollingCoordinator->frameViewVisibilityDidChange(); |
4658 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); | 4678 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); |
4659 updateParentScrollableAreaSet(); | 4679 updateParentScrollableAreaSet(); |
4660 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && | 4680 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && |
4661 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 4681 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
4662 // The existance of scrolling properties depends on visibility through | 4682 // The existance of scrolling properties depends on visibility through |
4663 // isScrollable() so ensure properties are updated if visibility changes. | 4683 // isScrollable() so ensure properties are updated if visibility changes. |
4664 setNeedsPaintPropertyUpdate(); | 4684 setNeedsPaintPropertyUpdate(); |
4665 } | 4685 } |
4666 if (isParentVisible()) { | 4686 if (isParentVisible()) { |
4667 for (const auto& child : m_children) | 4687 for (const auto& child : m_children) |
4668 child->setParentVisible(true); | 4688 child->setParentVisible(true); |
| 4689 |
| 4690 for (const auto& plugin : m_plugins) |
| 4691 plugin->setParentVisible(true); |
4669 } | 4692 } |
4670 } | 4693 } |
4671 | 4694 |
4672 FrameViewBase::show(); | 4695 FrameViewBase::show(); |
4673 } | 4696 } |
4674 | 4697 |
4675 void FrameView::hide() { | 4698 void FrameView::hide() { |
4676 if (isSelfVisible()) { | 4699 if (isSelfVisible()) { |
4677 if (isParentVisible()) { | 4700 if (isParentVisible()) { |
4678 for (const auto& child : m_children) | 4701 for (const auto& child : m_children) |
4679 child->setParentVisible(false); | 4702 child->setParentVisible(false); |
| 4703 |
| 4704 for (const auto& plugin : m_plugins) |
| 4705 plugin->setParentVisible(false); |
4680 } | 4706 } |
4681 setSelfVisible(false); | 4707 setSelfVisible(false); |
4682 if (ScrollingCoordinator* scrollingCoordinator = | 4708 if (ScrollingCoordinator* scrollingCoordinator = |
4683 this->scrollingCoordinator()) | 4709 this->scrollingCoordinator()) |
4684 scrollingCoordinator->frameViewVisibilityDidChange(); | 4710 scrollingCoordinator->frameViewVisibilityDidChange(); |
4685 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); | 4711 setNeedsCompositingUpdate(layoutViewItem(), CompositingUpdateRebuildTree); |
4686 updateParentScrollableAreaSet(); | 4712 updateParentScrollableAreaSet(); |
4687 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && | 4713 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled() && |
4688 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 4714 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
4689 // The existance of scrolling properties depends on visibility through | 4715 // The existance of scrolling properties depends on visibility through |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5241 void FrameView::setAnimationHost( | 5267 void FrameView::setAnimationHost( |
5242 std::unique_ptr<CompositorAnimationHost> host) { | 5268 std::unique_ptr<CompositorAnimationHost> host) { |
5243 m_animationHost = std::move(host); | 5269 m_animationHost = std::move(host); |
5244 } | 5270 } |
5245 | 5271 |
5246 LayoutUnit FrameView::caretWidth() const { | 5272 LayoutUnit FrameView::caretWidth() const { |
5247 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); | 5273 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); |
5248 } | 5274 } |
5249 | 5275 |
5250 } // namespace blink | 5276 } // namespace blink |
OLD | NEW |