| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 , m_viewportIntersectionValid(false) | 156 , m_viewportIntersectionValid(false) |
| 157 , m_hiddenForThrottling(false) | 157 , m_hiddenForThrottling(false) |
| 158 , m_crossOriginForThrottling(false) | 158 , m_crossOriginForThrottling(false) |
| 159 , m_isUpdatingAllLifecyclePhases(false) | 159 , m_isUpdatingAllLifecyclePhases(false) |
| 160 , m_scrollAnchor(this) | 160 , m_scrollAnchor(this) |
| 161 { | 161 { |
| 162 ASSERT(m_frame); | 162 ASSERT(m_frame); |
| 163 init(); | 163 init(); |
| 164 } | 164 } |
| 165 | 165 |
| 166 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame) | 166 RawPtr<FrameView> FrameView::create(LocalFrame* frame) |
| 167 { | 167 { |
| 168 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)
); | 168 RawPtr<FrameView> view = new FrameView(frame); |
| 169 view->show(); | 169 view->show(); |
| 170 return view.release(); | 170 return view.release(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame, const Int
Size& initialSize) | 173 RawPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initialSiz
e) |
| 174 { | 174 { |
| 175 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)
); | 175 RawPtr<FrameView> view = new FrameView(frame); |
| 176 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); | 176 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); |
| 177 view->setLayoutSizeInternal(initialSize); | 177 view->setLayoutSizeInternal(initialSize); |
| 178 | 178 |
| 179 view->show(); | 179 view->show(); |
| 180 return view.release(); | 180 return view.release(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 FrameView::~FrameView() | 183 FrameView::~FrameView() |
| 184 { | 184 { |
| 185 ASSERT(m_hasBeenDisposed); | 185 ASSERT(m_hasBeenDisposed); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 updateScrollCorner(); | 340 updateScrollCorner(); |
| 341 positionScrollbarLayers(); | 341 positionScrollbarLayers(); |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 | 344 |
| 345 void FrameView::invalidateAllCustomScrollbarsOnActiveChanged() | 345 void FrameView::invalidateAllCustomScrollbarsOnActiveChanged() |
| 346 { | 346 { |
| 347 bool usesWindowInactiveSelector = m_frame->document()->styleEngine().usesWin
dowInactiveSelector(); | 347 bool usesWindowInactiveSelector = m_frame->document()->styleEngine().usesWin
dowInactiveSelector(); |
| 348 | 348 |
| 349 const ChildrenWidgetSet* viewChildren = children(); | 349 const ChildrenWidgetSet* viewChildren = children(); |
| 350 for (const RefPtrWillBeMember<Widget>& child : *viewChildren) { | 350 for (const Member<Widget>& child : *viewChildren) { |
| 351 Widget* widget = child.get(); | 351 Widget* widget = child.get(); |
| 352 if (widget->isFrameView()) | 352 if (widget->isFrameView()) |
| 353 toFrameView(widget)->invalidateAllCustomScrollbarsOnActiveChanged(); | 353 toFrameView(widget)->invalidateAllCustomScrollbarsOnActiveChanged(); |
| 354 else if (usesWindowInactiveSelector && widget->isScrollbar() && toScroll
bar(widget)->isCustomScrollbar()) | 354 else if (usesWindowInactiveSelector && widget->isScrollbar() && toScroll
bar(widget)->isCustomScrollbar()) |
| 355 toScrollbar(widget)->styleChanged(); | 355 toScrollbar(widget)->styleChanged(); |
| 356 if (widget->isScrollbar()) | 356 if (widget->isScrollbar()) |
| 357 toScrollbar(widget)->windowActiveChangedForSnowLeopardOnly(); | 357 toScrollbar(widget)->windowActiveChangedForSnowLeopardOnly(); |
| 358 } | 358 } |
| 359 if (usesWindowInactiveSelector) | 359 if (usesWindowInactiveSelector) |
| 360 recalculateCustomScrollbarStyle(); | 360 recalculateCustomScrollbarStyle(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 // If we have an owning ipage/LocalFrame element, then it can set the custom
scrollbar also. | 489 // If we have an owning ipage/LocalFrame element, then it can set the custom
scrollbar also. |
| 490 LayoutPart* frameLayoutObject = m_frame->ownerLayoutObject(); | 490 LayoutPart* frameLayoutObject = m_frame->ownerLayoutObject(); |
| 491 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(PseudoId
Scrollbar)) { | 491 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(PseudoId
Scrollbar)) { |
| 492 customScrollbarFrame = m_frame.get(); | 492 customScrollbarFrame = m_frame.get(); |
| 493 return true; | 493 return true; |
| 494 } | 494 } |
| 495 | 495 |
| 496 return false; | 496 return false; |
| 497 } | 497 } |
| 498 | 498 |
| 499 PassRefPtrWillBeRawPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientatio
n orientation) | 499 RawPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation) |
| 500 { | 500 { |
| 501 Element* customScrollbarElement = nullptr; | 501 Element* customScrollbarElement = nullptr; |
| 502 LocalFrame* customScrollbarFrame = nullptr; | 502 LocalFrame* customScrollbarFrame = nullptr; |
| 503 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) | 503 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) |
| 504 return LayoutScrollbar::createCustomScrollbar(this, orientation, customS
crollbarElement, customScrollbarFrame); | 504 return LayoutScrollbar::createCustomScrollbar(this, orientation, customS
crollbarElement, customScrollbarFrame); |
| 505 | 505 |
| 506 // Nobody set a custom style, so we just use a native scrollbar. | 506 // Nobody set a custom style, so we just use a native scrollbar. |
| 507 return Scrollbar::create(this, orientation, RegularScrollbar, &frame().page(
)->chromeClient()); | 507 return Scrollbar::create(this, orientation, RegularScrollbar, &frame().page(
)->chromeClient()); |
| 508 } | 508 } |
| 509 | 509 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) | 750 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) |
| 751 return; | 751 return; |
| 752 | 752 |
| 753 // If the embedded SVG document appears the first time, the ownerLayoutObjec
t has already finished | 753 // If the embedded SVG document appears the first time, the ownerLayoutObjec
t has already finished |
| 754 // layout without knowing about the existence of the embedded SVG document,
because LayoutReplaced | 754 // layout without knowing about the existence of the embedded SVG document,
because LayoutReplaced |
| 755 // embeddedReplacedContent() returns 0, as long as the embedded document isn
't loaded yet. Before | 755 // embeddedReplacedContent() returns 0, as long as the embedded document isn
't loaded yet. Before |
| 756 // bothering to lay out the SVG document, mark the ownerLayoutObject needing
layout and ask its | 756 // bothering to lay out the SVG document, mark the ownerLayoutObject needing
layout and ask its |
| 757 // FrameView for a layout. After that the LayoutEmbeddedObject (ownerLayoutO
bject) carries the | 757 // FrameView for a layout. After that the LayoutEmbeddedObject (ownerLayoutO
bject) carries the |
| 758 // correct size, which LayoutSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying | 758 // correct size, which LayoutSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying |
| 759 // out for the first time, or when the LayoutSVGRoot size has changed dynami
cally (eg. via <script>). | 759 // out for the first time, or when the LayoutSVGRoot size has changed dynami
cally (eg. via <script>). |
| 760 RefPtrWillBeRawPtr<FrameView> frameView = ownerLayoutObject->frame()->view()
; | 760 RawPtr<FrameView> frameView = ownerLayoutObject->frame()->view(); |
| 761 | 761 |
| 762 // Mark the owner layoutObject as needing layout. | 762 // Mark the owner layoutObject as needing layout. |
| 763 ownerLayoutObject->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation
(LayoutInvalidationReason::Unknown); | 763 ownerLayoutObject->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation
(LayoutInvalidationReason::Unknown); |
| 764 | 764 |
| 765 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. | 765 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. |
| 766 ASSERT(frameView); | 766 ASSERT(frameView); |
| 767 frameView->layout(); | 767 frameView->layout(); |
| 768 } | 768 } |
| 769 | 769 |
| 770 void FrameView::performPreLayoutTasks() | 770 void FrameView::performPreLayoutTasks() |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 920 | 920 |
| 921 ScriptForbiddenScope forbidScript; | 921 ScriptForbiddenScope forbidScript; |
| 922 | 922 |
| 923 if (isInPerformLayout() || !m_frame->document()->isActive() || shouldThrottl
eRendering()) | 923 if (isInPerformLayout() || !m_frame->document()->isActive() || shouldThrottl
eRendering()) |
| 924 return; | 924 return; |
| 925 | 925 |
| 926 TRACE_EVENT0("blink,benchmark", "FrameView::layout"); | 926 TRACE_EVENT0("blink,benchmark", "FrameView::layout"); |
| 927 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); | 927 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); |
| 928 | 928 |
| 929 // Protect the view from being deleted during layout (in recalcStyle) | 929 // Protect the view from being deleted during layout (in recalcStyle) |
| 930 RefPtrWillBeRawPtr<FrameView> protector(this); | 930 RawPtr<FrameView> protector(this); |
| 931 | 931 |
| 932 if (m_autoSizeInfo) | 932 if (m_autoSizeInfo) |
| 933 m_autoSizeInfo->autoSizeIfNeeded(); | 933 m_autoSizeInfo->autoSizeIfNeeded(); |
| 934 | 934 |
| 935 m_hasPendingLayout = false; | 935 m_hasPendingLayout = false; |
| 936 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); | 936 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); |
| 937 | 937 |
| 938 RELEASE_ASSERT(!isPainting()); | 938 RELEASE_ASSERT(!isPainting()); |
| 939 | 939 |
| 940 TRACE_EVENT_BEGIN1("devtools.timeline", "Layout", "beginData", InspectorLayo
utEvent::beginData(this)); | 940 TRACE_EVENT_BEGIN1("devtools.timeline", "Layout", "beginData", InspectorLayo
utEvent::beginData(this)); |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 if (m_frame->document() && m_frame->document()->layoutView()) | 1604 if (m_frame->document() && m_frame->document()->layoutView()) |
| 1605 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); | 1605 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() | 1608 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() |
| 1609 { | 1609 { |
| 1610 // Nothing to do after scrolling if there are no fixed position elements. | 1610 // Nothing to do after scrolling if there are no fixed position elements. |
| 1611 if (!hasViewportConstrainedObjects()) | 1611 if (!hasViewportConstrainedObjects()) |
| 1612 return; | 1612 return; |
| 1613 | 1613 |
| 1614 RefPtrWillBeRawPtr<FrameView> protect(this); | 1614 RawPtr<FrameView> protect(this); |
| 1615 | 1615 |
| 1616 // If there fixed position elements, scrolling may cause compositing layers
to change. | 1616 // If there fixed position elements, scrolling may cause compositing layers
to change. |
| 1617 // Update widget and layer positions after scrolling, but only if we're not
inside of | 1617 // Update widget and layer positions after scrolling, but only if we're not
inside of |
| 1618 // layout. | 1618 // layout. |
| 1619 if (!m_nestedLayoutCount) { | 1619 if (!m_nestedLayoutCount) { |
| 1620 updateWidgetGeometries(); | 1620 updateWidgetGeometries(); |
| 1621 if (LayoutView* layoutView = this->layoutView()) | 1621 if (LayoutView* layoutView = this->layoutView()) |
| 1622 layoutView->layer()->setNeedsCompositingInputsUpdate(); | 1622 layoutView->layer()->setNeedsCompositingInputsUpdate(); |
| 1623 } | 1623 } |
| 1624 } | 1624 } |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t
ransparent) | 1900 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t
ransparent) |
| 1901 { | 1901 { |
| 1902 forAllNonThrottledFrameViews([backgroundColor, transparent](FrameView& frame
View) { | 1902 forAllNonThrottledFrameViews([backgroundColor, transparent](FrameView& frame
View) { |
| 1903 frameView.setTransparent(transparent); | 1903 frameView.setTransparent(transparent); |
| 1904 frameView.setBaseBackgroundColor(backgroundColor); | 1904 frameView.setBaseBackgroundColor(backgroundColor); |
| 1905 }); | 1905 }); |
| 1906 } | 1906 } |
| 1907 | 1907 |
| 1908 void FrameView::scrollToFragmentAnchor() | 1908 void FrameView::scrollToFragmentAnchor() |
| 1909 { | 1909 { |
| 1910 RefPtrWillBeRawPtr<Node> anchorNode = m_fragmentAnchor; | 1910 RawPtr<Node> anchorNode = m_fragmentAnchor; |
| 1911 if (!anchorNode) | 1911 if (!anchorNode) |
| 1912 return; | 1912 return; |
| 1913 | 1913 |
| 1914 // Scrolling is disabled during updateScrollbars (see isProgrammaticallyScro
llable). | 1914 // Scrolling is disabled during updateScrollbars (see isProgrammaticallyScro
llable). |
| 1915 // Bail now to avoid clearing m_fragmentAnchor before we actually have a cha
nce to scroll. | 1915 // Bail now to avoid clearing m_fragmentAnchor before we actually have a cha
nce to scroll. |
| 1916 if (m_inUpdateScrollbars) | 1916 if (m_inUpdateScrollbars) |
| 1917 return; | 1917 return; |
| 1918 | 1918 |
| 1919 if (anchorNode->layoutObject()) { | 1919 if (anchorNode->layoutObject()) { |
| 1920 LayoutRect rect; | 1920 LayoutRect rect; |
| 1921 if (anchorNode != m_frame->document()) { | 1921 if (anchorNode != m_frame->document()) { |
| 1922 rect = anchorNode->boundingBox(); | 1922 rect = anchorNode->boundingBox(); |
| 1923 } else if (m_frame->settings() && m_frame->settings()->rootLayerScrolls(
)) { | 1923 } else if (m_frame->settings() && m_frame->settings()->rootLayerScrolls(
)) { |
| 1924 if (Element* documentElement = m_frame->document()->documentElement(
)) | 1924 if (Element* documentElement = m_frame->document()->documentElement(
)) |
| 1925 rect = documentElement->boundingBox(); | 1925 rect = documentElement->boundingBox(); |
| 1926 } | 1926 } |
| 1927 | 1927 |
| 1928 RefPtrWillBeRawPtr<Frame> boundaryFrame = m_frame->findUnsafeParentScrol
lPropagationBoundary(); | 1928 RawPtr<Frame> boundaryFrame = m_frame->findUnsafeParentScrollPropagation
Boundary(); |
| 1929 | 1929 |
| 1930 // FIXME: Handle RemoteFrames | 1930 // FIXME: Handle RemoteFrames |
| 1931 if (boundaryFrame && boundaryFrame->isLocalFrame()) | 1931 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
| 1932 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollT
oParent(false); | 1932 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollT
oParent(false); |
| 1933 | 1933 |
| 1934 // Scroll nested layers and frames to reveal the anchor. | 1934 // Scroll nested layers and frames to reveal the anchor. |
| 1935 // Align to the top and to the closest side (this matches other browsers
). | 1935 // Align to the top and to the closest side (this matches other browsers
). |
| 1936 anchorNode->layoutObject()->scrollRectToVisible(rect, ScrollAlignment::a
lignToEdgeIfNeeded, ScrollAlignment::alignTopAlways); | 1936 anchorNode->layoutObject()->scrollRectToVisible(rect, ScrollAlignment::a
lignToEdgeIfNeeded, ScrollAlignment::alignTopAlways); |
| 1937 | 1937 |
| 1938 if (boundaryFrame && boundaryFrame->isLocalFrame()) | 1938 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 // FIXME: Do we really need to prevent this? | 1982 // FIXME: Do we really need to prevent this? |
| 1983 m_partUpdateSet.remove(&object); | 1983 m_partUpdateSet.remove(&object); |
| 1984 } | 1984 } |
| 1985 | 1985 |
| 1986 return m_partUpdateSet.isEmpty(); | 1986 return m_partUpdateSet.isEmpty(); |
| 1987 } | 1987 } |
| 1988 | 1988 |
| 1989 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) | 1989 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) |
| 1990 { | 1990 { |
| 1991 ASSERT(!isInPerformLayout()); | 1991 ASSERT(!isInPerformLayout()); |
| 1992 RefPtrWillBeRawPtr<FrameView> protect(this); | 1992 RawPtr<FrameView> protect(this); |
| 1993 m_updateWidgetsTimer.stop(); | 1993 m_updateWidgetsTimer.stop(); |
| 1994 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { | 1994 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { |
| 1995 if (updateWidgets()) | 1995 if (updateWidgets()) |
| 1996 return; | 1996 return; |
| 1997 } | 1997 } |
| 1998 } | 1998 } |
| 1999 | 1999 |
| 2000 void FrameView::flushAnyPendingPostLayoutTasks() | 2000 void FrameView::flushAnyPendingPostLayoutTasks() |
| 2001 { | 2001 { |
| 2002 ASSERT(!isInPerformLayout()); | 2002 ASSERT(!isInPerformLayout()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2015 } | 2015 } |
| 2016 | 2016 |
| 2017 void FrameView::performPostLayoutTasks() | 2017 void FrameView::performPostLayoutTasks() |
| 2018 { | 2018 { |
| 2019 // FIXME: We can reach here, even when the page is not active! | 2019 // FIXME: We can reach here, even when the page is not active! |
| 2020 // http/tests/inspector/elements/html-link-import.html and many other | 2020 // http/tests/inspector/elements/html-link-import.html and many other |
| 2021 // tests hit that case. | 2021 // tests hit that case. |
| 2022 // We should ASSERT(isActive()); or at least return early if we can! | 2022 // We should ASSERT(isActive()); or at least return early if we can! |
| 2023 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par
t of the highest-level layout() call. | 2023 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par
t of the highest-level layout() call. |
| 2024 TRACE_EVENT0("blink,benchmark", "FrameView::performPostLayoutTasks"); | 2024 TRACE_EVENT0("blink,benchmark", "FrameView::performPostLayoutTasks"); |
| 2025 RefPtrWillBeRawPtr<FrameView> protect(this); | 2025 RawPtr<FrameView> protect(this); |
| 2026 | 2026 |
| 2027 m_postLayoutTasksTimer.stop(); | 2027 m_postLayoutTasksTimer.stop(); |
| 2028 | 2028 |
| 2029 m_frame->selection().setCaretRectNeedsUpdate(); | 2029 m_frame->selection().setCaretRectNeedsUpdate(); |
| 2030 m_frame->selection().updateAppearance(); | 2030 m_frame->selection().updateAppearance(); |
| 2031 | 2031 |
| 2032 ASSERT(m_frame->document()); | 2032 ASSERT(m_frame->document()); |
| 2033 | 2033 |
| 2034 FontFaceSet::didLayout(*m_frame->document()); | 2034 FontFaceSet::didLayout(*m_frame->document()); |
| 2035 // Cursor update scheduling is done by the local root, which is the main fra
me if there | 2035 // Cursor update scheduling is done by the local root, which is the main fra
me if there |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2408 { | 2408 { |
| 2409 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope; | 2409 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope; |
| 2410 if (phases == AllPhases) | 2410 if (phases == AllPhases) |
| 2411 isUpdatingAllLifecyclePhasesScope.emplace(m_isUpdatingAllLifecyclePhases
, true); | 2411 isUpdatingAllLifecyclePhasesScope.emplace(m_isUpdatingAllLifecyclePhases
, true); |
| 2412 | 2412 |
| 2413 // This must be called from the root frame, since it recurses down, not up. | 2413 // This must be called from the root frame, since it recurses down, not up. |
| 2414 // Otherwise the lifecycles of the frames might be out of sync. | 2414 // Otherwise the lifecycles of the frames might be out of sync. |
| 2415 ASSERT(m_frame->isLocalRoot()); | 2415 ASSERT(m_frame->isLocalRoot()); |
| 2416 | 2416 |
| 2417 // Updating layout can run script, which can tear down the FrameView. | 2417 // Updating layout can run script, which can tear down the FrameView. |
| 2418 RefPtrWillBeRawPtr<FrameView> protector(this); | 2418 RawPtr<FrameView> protector(this); |
| 2419 | 2419 |
| 2420 if (shouldThrottleRendering()) { | 2420 if (shouldThrottleRendering()) { |
| 2421 updateViewportIntersectionsForSubtree(std::min(phases, OnlyUpToCompositi
ngCleanPlusScrolling)); | 2421 updateViewportIntersectionsForSubtree(std::min(phases, OnlyUpToCompositi
ngCleanPlusScrolling)); |
| 2422 return; | 2422 return; |
| 2423 } | 2423 } |
| 2424 | 2424 |
| 2425 updateStyleAndLayoutIfNeededRecursive(); | 2425 updateStyleAndLayoutIfNeededRecursive(); |
| 2426 ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); | 2426 ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); |
| 2427 | 2427 |
| 2428 if (phases == OnlyUpToLayoutClean) { | 2428 if (phases == OnlyUpToLayoutClean) { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2592 layout(); | 2592 layout(); |
| 2593 | 2593 |
| 2594 RELEASE_ASSERT(!needsLayout()); | 2594 RELEASE_ASSERT(!needsLayout()); |
| 2595 | 2595 |
| 2596 // WebView plugins need to update regardless of whether the LayoutEmbeddedOb
ject | 2596 // WebView plugins need to update regardless of whether the LayoutEmbeddedOb
ject |
| 2597 // that owns them needed layout. | 2597 // that owns them needed layout. |
| 2598 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews.
We | 2598 // TODO(leviw): This currently runs the entire lifecycle on plugin WebViews.
We |
| 2599 // should have a way to only run these other Documents to the same lifecycle
stage | 2599 // should have a way to only run these other Documents to the same lifecycle
stage |
| 2600 // as this frame. | 2600 // as this frame. |
| 2601 const ChildrenWidgetSet* viewChildren = children(); | 2601 const ChildrenWidgetSet* viewChildren = children(); |
| 2602 for (const RefPtrWillBeMember<Widget>& child : *viewChildren) { | 2602 for (const Member<Widget>& child : *viewChildren) { |
| 2603 if ((*child).isPluginContainer()) | 2603 if ((*child).isPluginContainer()) |
| 2604 toPluginView(child.get())->updateAllLifecyclePhases(); | 2604 toPluginView(child.get())->updateAllLifecyclePhases(); |
| 2605 } | 2605 } |
| 2606 | 2606 |
| 2607 RELEASE_ASSERT(!needsLayout()); | 2607 RELEASE_ASSERT(!needsLayout()); |
| 2608 | 2608 |
| 2609 // FIXME: Calling layout() shouldn't trigger script execution or have any | 2609 // FIXME: Calling layout() shouldn't trigger script execution or have any |
| 2610 // observable effects on the frame tree but we're not quite there yet. | 2610 // observable effects on the frame tree but we're not quite there yet. |
| 2611 WillBeHeapVector<RefPtrWillBeMember<FrameView>> frameViews; | 2611 HeapVector<Member<FrameView>> frameViews; |
| 2612 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { | 2612 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { |
| 2613 if (!child->isLocalFrame()) | 2613 if (!child->isLocalFrame()) |
| 2614 continue; | 2614 continue; |
| 2615 if (FrameView* view = toLocalFrame(child)->view()) | 2615 if (FrameView* view = toLocalFrame(child)->view()) |
| 2616 frameViews.append(view); | 2616 frameViews.append(view); |
| 2617 } | 2617 } |
| 2618 | 2618 |
| 2619 for (const auto& frameView : frameViews) | 2619 for (const auto& frameView : frameViews) |
| 2620 frameView->updateStyleAndLayoutIfNeededRecursive(); | 2620 frameView->updateStyleAndLayoutIfNeededRecursive(); |
| 2621 | 2621 |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3046 IntPoint FrameView::maximumScrollPosition() const | 3046 IntPoint FrameView::maximumScrollPosition() const |
| 3047 { | 3047 { |
| 3048 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() | 3048 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() |
| 3049 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/
422331. | 3049 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/
422331. |
| 3050 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz
e(); | 3050 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz
e(); |
| 3051 IntSize contentBounds = contentsSize(); | 3051 IntSize contentBounds = contentsSize(); |
| 3052 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); | 3052 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); |
| 3053 return maximumPosition.expandedTo(minimumScrollPosition()); | 3053 return maximumPosition.expandedTo(minimumScrollPosition()); |
| 3054 } | 3054 } |
| 3055 | 3055 |
| 3056 void FrameView::addChild(PassRefPtrWillBeRawPtr<Widget> prpChild) | 3056 void FrameView::addChild(RawPtr<Widget> prpChild) |
| 3057 { | 3057 { |
| 3058 Widget* child = prpChild.get(); | 3058 Widget* child = prpChild.get(); |
| 3059 ASSERT(child != this && !child->parent()); | 3059 ASSERT(child != this && !child->parent()); |
| 3060 child->setParent(this); | 3060 child->setParent(this); |
| 3061 m_children.add(prpChild); | 3061 m_children.add(prpChild); |
| 3062 } | 3062 } |
| 3063 | 3063 |
| 3064 void FrameView::setHasHorizontalScrollbar(bool hasBar) | 3064 void FrameView::setHasHorizontalScrollbar(bool hasBar) |
| 3065 { | 3065 { |
| 3066 if (hasBar == !!m_horizontalScrollbar) | 3066 if (hasBar == !!m_horizontalScrollbar) |
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4092 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4092 return m_hiddenForThrottling && m_crossOriginForThrottling; |
| 4093 } | 4093 } |
| 4094 | 4094 |
| 4095 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4095 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
| 4096 { | 4096 { |
| 4097 ASSERT(layoutView()); | 4097 ASSERT(layoutView()); |
| 4098 return *layoutView(); | 4098 return *layoutView(); |
| 4099 } | 4099 } |
| 4100 | 4100 |
| 4101 } // namespace blink | 4101 } // namespace blink |
| OLD | NEW |