| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 , m_viewportIntersectionValid(false) | 152 , m_viewportIntersectionValid(false) |
| 153 , m_hiddenForThrottling(false) | 153 , m_hiddenForThrottling(false) |
| 154 , m_crossOriginForThrottling(false) | 154 , m_crossOriginForThrottling(false) |
| 155 , m_isUpdatingAllLifecyclePhases(false) | 155 , m_isUpdatingAllLifecyclePhases(false) |
| 156 , m_scrollAnchor(this) | 156 , m_scrollAnchor(this) |
| 157 { | 157 { |
| 158 ASSERT(m_frame); | 158 ASSERT(m_frame); |
| 159 init(); | 159 init(); |
| 160 } | 160 } |
| 161 | 161 |
| 162 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame) | 162 RawPtr<FrameView> FrameView::create(LocalFrame* frame) |
| 163 { | 163 { |
| 164 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)
); | 164 RawPtr<FrameView> view = (new FrameView(frame)); |
| 165 view->show(); | 165 view->show(); |
| 166 return view.release(); | 166 return view.release(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 PassRefPtrWillBeRawPtr<FrameView> FrameView::create(LocalFrame* frame, const Int
Size& initialSize) | 169 RawPtr<FrameView> FrameView::create(LocalFrame* frame, const IntSize& initialSiz
e) |
| 170 { | 170 { |
| 171 RefPtrWillBeRawPtr<FrameView> view = adoptRefWillBeNoop(new FrameView(frame)
); | 171 RawPtr<FrameView> view = (new FrameView(frame)); |
| 172 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); | 172 view->Widget::setFrameRect(IntRect(view->location(), initialSize)); |
| 173 view->setLayoutSizeInternal(initialSize); | 173 view->setLayoutSizeInternal(initialSize); |
| 174 | 174 |
| 175 view->show(); | 175 view->show(); |
| 176 return view.release(); | 176 return view.release(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 FrameView::~FrameView() | 179 FrameView::~FrameView() |
| 180 { | 180 { |
| 181 ASSERT(m_hasBeenDisposed); | 181 ASSERT(m_hasBeenDisposed); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 updateScrollCorner(); | 341 updateScrollCorner(); |
| 342 positionScrollbarLayers(); | 342 positionScrollbarLayers(); |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 | 345 |
| 346 void FrameView::invalidateAllCustomScrollbarsOnActiveChanged() | 346 void FrameView::invalidateAllCustomScrollbarsOnActiveChanged() |
| 347 { | 347 { |
| 348 bool usesWindowInactiveSelector = m_frame->document()->styleEngine().usesWin
dowInactiveSelector(); | 348 bool usesWindowInactiveSelector = m_frame->document()->styleEngine().usesWin
dowInactiveSelector(); |
| 349 | 349 |
| 350 const ChildrenWidgetSet* viewChildren = children(); | 350 const ChildrenWidgetSet* viewChildren = children(); |
| 351 for (const RefPtrWillBeMember<Widget>& child : *viewChildren) { | 351 for (const Member<Widget>& child : *viewChildren) { |
| 352 Widget* widget = child.get(); | 352 Widget* widget = child.get(); |
| 353 if (widget->isFrameView()) | 353 if (widget->isFrameView()) |
| 354 toFrameView(widget)->invalidateAllCustomScrollbarsOnActiveChanged(); | 354 toFrameView(widget)->invalidateAllCustomScrollbarsOnActiveChanged(); |
| 355 else if (usesWindowInactiveSelector && widget->isScrollbar() && toScroll
bar(widget)->isCustomScrollbar()) | 355 else if (usesWindowInactiveSelector && widget->isScrollbar() && toScroll
bar(widget)->isCustomScrollbar()) |
| 356 toScrollbar(widget)->styleChanged(); | 356 toScrollbar(widget)->styleChanged(); |
| 357 if (widget->isScrollbar()) | 357 if (widget->isScrollbar()) |
| 358 toScrollbar(widget)->windowActiveChangedForSnowLeopardOnly(); | 358 toScrollbar(widget)->windowActiveChangedForSnowLeopardOnly(); |
| 359 } | 359 } |
| 360 if (usesWindowInactiveSelector) | 360 if (usesWindowInactiveSelector) |
| 361 recalculateCustomScrollbarStyle(); | 361 recalculateCustomScrollbarStyle(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 // If we have an owning ipage/LocalFrame element, then it can set the custom
scrollbar also. | 502 // If we have an owning ipage/LocalFrame element, then it can set the custom
scrollbar also. |
| 503 LayoutPart* frameLayoutObject = m_frame->ownerLayoutObject(); | 503 LayoutPart* frameLayoutObject = m_frame->ownerLayoutObject(); |
| 504 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(SCROLLBA
R)) { | 504 if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(SCROLLBA
R)) { |
| 505 customScrollbarFrame = m_frame.get(); | 505 customScrollbarFrame = m_frame.get(); |
| 506 return true; | 506 return true; |
| 507 } | 507 } |
| 508 | 508 |
| 509 return false; | 509 return false; |
| 510 } | 510 } |
| 511 | 511 |
| 512 PassRefPtrWillBeRawPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientatio
n orientation) | 512 RawPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation) |
| 513 { | 513 { |
| 514 Element* customScrollbarElement = nullptr; | 514 Element* customScrollbarElement = nullptr; |
| 515 LocalFrame* customScrollbarFrame = nullptr; | 515 LocalFrame* customScrollbarFrame = nullptr; |
| 516 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) | 516 if (shouldUseCustomScrollbars(customScrollbarElement, customScrollbarFrame)) |
| 517 return LayoutScrollbar::createCustomScrollbar(this, orientation, customS
crollbarElement, customScrollbarFrame); | 517 return LayoutScrollbar::createCustomScrollbar(this, orientation, customS
crollbarElement, customScrollbarFrame); |
| 518 | 518 |
| 519 // Nobody set a custom style, so we just use a native scrollbar. | 519 // Nobody set a custom style, so we just use a native scrollbar. |
| 520 return Scrollbar::create(this, orientation, RegularScrollbar, &frame().page(
)->chromeClient()); | 520 return Scrollbar::create(this, orientation, RegularScrollbar, &frame().page(
)->chromeClient()); |
| 521 } | 521 } |
| 522 | 522 |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) | 747 if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) |
| 748 return; | 748 return; |
| 749 | 749 |
| 750 // If the embedded SVG document appears the first time, the ownerLayoutObjec
t has already finished | 750 // If the embedded SVG document appears the first time, the ownerLayoutObjec
t has already finished |
| 751 // layout without knowing about the existence of the embedded SVG document,
because LayoutReplaced | 751 // layout without knowing about the existence of the embedded SVG document,
because LayoutReplaced |
| 752 // embeddedContentBox() returns 0, as long as the embedded document isn't lo
aded yet. Before | 752 // embeddedContentBox() returns 0, as long as the embedded document isn't lo
aded yet. Before |
| 753 // bothering to lay out the SVG document, mark the ownerLayoutObject needing
layout and ask its | 753 // bothering to lay out the SVG document, mark the ownerLayoutObject needing
layout and ask its |
| 754 // FrameView for a layout. After that the LayoutEmbeddedObject (ownerLayoutO
bject) carries the | 754 // FrameView for a layout. After that the LayoutEmbeddedObject (ownerLayoutO
bject) carries the |
| 755 // correct size, which LayoutSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying | 755 // correct size, which LayoutSVGRoot::computeReplacedLogicalWidth/Height rel
y on, when laying |
| 756 // out for the first time, or when the LayoutSVGRoot size has changed dynami
cally (eg. via <script>). | 756 // out for the first time, or when the LayoutSVGRoot size has changed dynami
cally (eg. via <script>). |
| 757 RefPtrWillBeRawPtr<FrameView> frameView = ownerLayoutObject->frame()->view()
; | 757 RawPtr<FrameView> frameView = ownerLayoutObject->frame()->view(); |
| 758 | 758 |
| 759 // Mark the owner layoutObject as needing layout. | 759 // Mark the owner layoutObject as needing layout. |
| 760 ownerLayoutObject->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation
(LayoutInvalidationReason::Unknown); | 760 ownerLayoutObject->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation
(LayoutInvalidationReason::Unknown); |
| 761 | 761 |
| 762 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. | 762 // Synchronously enter layout, to layout the view containing the host object
/embed/iframe. |
| 763 ASSERT(frameView); | 763 ASSERT(frameView); |
| 764 frameView->layout(); | 764 frameView->layout(); |
| 765 } | 765 } |
| 766 | 766 |
| 767 void FrameView::performPreLayoutTasks() | 767 void FrameView::performPreLayoutTasks() |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 | 917 |
| 918 ScriptForbiddenScope forbidScript; | 918 ScriptForbiddenScope forbidScript; |
| 919 | 919 |
| 920 if (isInPerformLayout() || !m_frame->document()->isActive() || shouldThrottl
eRendering()) | 920 if (isInPerformLayout() || !m_frame->document()->isActive() || shouldThrottl
eRendering()) |
| 921 return; | 921 return; |
| 922 | 922 |
| 923 TRACE_EVENT0("blink,benchmark", "FrameView::layout"); | 923 TRACE_EVENT0("blink,benchmark", "FrameView::layout"); |
| 924 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); | 924 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); |
| 925 | 925 |
| 926 // Protect the view from being deleted during layout (in recalcStyle) | 926 // Protect the view from being deleted during layout (in recalcStyle) |
| 927 RefPtrWillBeRawPtr<FrameView> protector(this); | 927 RawPtr<FrameView> protector(this); |
| 928 | 928 |
| 929 if (m_autoSizeInfo) | 929 if (m_autoSizeInfo) |
| 930 m_autoSizeInfo->autoSizeIfNeeded(); | 930 m_autoSizeInfo->autoSizeIfNeeded(); |
| 931 | 931 |
| 932 m_hasPendingLayout = false; | 932 m_hasPendingLayout = false; |
| 933 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); | 933 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); |
| 934 | 934 |
| 935 RELEASE_ASSERT(!isPainting()); | 935 RELEASE_ASSERT(!isPainting()); |
| 936 | 936 |
| 937 TRACE_EVENT_BEGIN1("devtools.timeline", "Layout", "beginData", InspectorLayo
utEvent::beginData(this)); | 937 TRACE_EVENT_BEGIN1("devtools.timeline", "Layout", "beginData", InspectorLayo
utEvent::beginData(this)); |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 if (m_frame->document() && m_frame->document()->layoutView()) | 1613 if (m_frame->document() && m_frame->document()->layoutView()) |
| 1614 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); | 1614 m_frame->document()->fetcher()->updateAllImageResourcePriorities(); |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() | 1617 void FrameView::updateLayersAndCompositingAfterScrollIfNeeded() |
| 1618 { | 1618 { |
| 1619 // Nothing to do after scrolling if there are no fixed position elements. | 1619 // Nothing to do after scrolling if there are no fixed position elements. |
| 1620 if (!hasViewportConstrainedObjects()) | 1620 if (!hasViewportConstrainedObjects()) |
| 1621 return; | 1621 return; |
| 1622 | 1622 |
| 1623 RefPtrWillBeRawPtr<FrameView> protect(this); | 1623 RawPtr<FrameView> protect(this); |
| 1624 | 1624 |
| 1625 // If there fixed position elements, scrolling may cause compositing layers
to change. | 1625 // If there fixed position elements, scrolling may cause compositing layers
to change. |
| 1626 // Update widget and layer positions after scrolling, but only if we're not
inside of | 1626 // Update widget and layer positions after scrolling, but only if we're not
inside of |
| 1627 // layout. | 1627 // layout. |
| 1628 if (!m_nestedLayoutCount) { | 1628 if (!m_nestedLayoutCount) { |
| 1629 updateWidgetGeometries(); | 1629 updateWidgetGeometries(); |
| 1630 if (LayoutView* layoutView = this->layoutView()) | 1630 if (LayoutView* layoutView = this->layoutView()) |
| 1631 layoutView->layer()->setNeedsCompositingInputsUpdate(); | 1631 layoutView->layer()->setNeedsCompositingInputsUpdate(); |
| 1632 } | 1632 } |
| 1633 } | 1633 } |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1908 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t
ransparent) | 1908 void FrameView::updateBackgroundRecursively(const Color& backgroundColor, bool t
ransparent) |
| 1909 { | 1909 { |
| 1910 forAllNonThrottledFrameViews([backgroundColor, transparent](FrameView& frame
View) { | 1910 forAllNonThrottledFrameViews([backgroundColor, transparent](FrameView& frame
View) { |
| 1911 frameView.setTransparent(transparent); | 1911 frameView.setTransparent(transparent); |
| 1912 frameView.setBaseBackgroundColor(backgroundColor); | 1912 frameView.setBaseBackgroundColor(backgroundColor); |
| 1913 }); | 1913 }); |
| 1914 } | 1914 } |
| 1915 | 1915 |
| 1916 void FrameView::scrollToFragmentAnchor() | 1916 void FrameView::scrollToFragmentAnchor() |
| 1917 { | 1917 { |
| 1918 RefPtrWillBeRawPtr<Node> anchorNode = m_fragmentAnchor; | 1918 RawPtr<Node> anchorNode = m_fragmentAnchor; |
| 1919 if (!anchorNode) | 1919 if (!anchorNode) |
| 1920 return; | 1920 return; |
| 1921 | 1921 |
| 1922 // Scrolling is disabled during updateScrollbars (see isProgrammaticallyScro
llable). | 1922 // Scrolling is disabled during updateScrollbars (see isProgrammaticallyScro
llable). |
| 1923 // Bail now to avoid clearing m_fragmentAnchor before we actually have a cha
nce to scroll. | 1923 // Bail now to avoid clearing m_fragmentAnchor before we actually have a cha
nce to scroll. |
| 1924 if (m_inUpdateScrollbars) | 1924 if (m_inUpdateScrollbars) |
| 1925 return; | 1925 return; |
| 1926 | 1926 |
| 1927 if (anchorNode->layoutObject()) { | 1927 if (anchorNode->layoutObject()) { |
| 1928 LayoutRect rect; | 1928 LayoutRect rect; |
| 1929 if (anchorNode != m_frame->document()) { | 1929 if (anchorNode != m_frame->document()) { |
| 1930 rect = anchorNode->boundingBox(); | 1930 rect = anchorNode->boundingBox(); |
| 1931 } else if (m_frame->settings() && m_frame->settings()->rootLayerScrolls(
)) { | 1931 } else if (m_frame->settings() && m_frame->settings()->rootLayerScrolls(
)) { |
| 1932 if (Element* documentElement = m_frame->document()->documentElement(
)) | 1932 if (Element* documentElement = m_frame->document()->documentElement(
)) |
| 1933 rect = documentElement->boundingBox(); | 1933 rect = documentElement->boundingBox(); |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 RefPtrWillBeRawPtr<Frame> boundaryFrame = m_frame->findUnsafeParentScrol
lPropagationBoundary(); | 1936 RawPtr<Frame> boundaryFrame = m_frame->findUnsafeParentScrollPropagation
Boundary(); |
| 1937 | 1937 |
| 1938 // FIXME: Handle RemoteFrames | 1938 // FIXME: Handle RemoteFrames |
| 1939 if (boundaryFrame && boundaryFrame->isLocalFrame()) | 1939 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
| 1940 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollT
oParent(false); | 1940 toLocalFrame(boundaryFrame.get())->view()->setSafeToPropagateScrollT
oParent(false); |
| 1941 | 1941 |
| 1942 // Scroll nested layers and frames to reveal the anchor. | 1942 // Scroll nested layers and frames to reveal the anchor. |
| 1943 // Align to the top and to the closest side (this matches other browsers
). | 1943 // Align to the top and to the closest side (this matches other browsers
). |
| 1944 anchorNode->layoutObject()->scrollRectToVisible(rect, ScrollAlignment::a
lignToEdgeIfNeeded, ScrollAlignment::alignTopAlways); | 1944 anchorNode->layoutObject()->scrollRectToVisible(rect, ScrollAlignment::a
lignToEdgeIfNeeded, ScrollAlignment::alignTopAlways); |
| 1945 | 1945 |
| 1946 if (boundaryFrame && boundaryFrame->isLocalFrame()) | 1946 if (boundaryFrame && boundaryFrame->isLocalFrame()) |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 // FIXME: Do we really need to prevent this? | 1990 // FIXME: Do we really need to prevent this? |
| 1991 m_partUpdateSet.remove(&object); | 1991 m_partUpdateSet.remove(&object); |
| 1992 } | 1992 } |
| 1993 | 1993 |
| 1994 return m_partUpdateSet.isEmpty(); | 1994 return m_partUpdateSet.isEmpty(); |
| 1995 } | 1995 } |
| 1996 | 1996 |
| 1997 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) | 1997 void FrameView::updateWidgetsTimerFired(Timer<FrameView>*) |
| 1998 { | 1998 { |
| 1999 ASSERT(!isInPerformLayout()); | 1999 ASSERT(!isInPerformLayout()); |
| 2000 RefPtrWillBeRawPtr<FrameView> protect(this); | 2000 RawPtr<FrameView> protect(this); |
| 2001 m_updateWidgetsTimer.stop(); | 2001 m_updateWidgetsTimer.stop(); |
| 2002 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { | 2002 for (unsigned i = 0; i < maxUpdateWidgetsIterations; ++i) { |
| 2003 if (updateWidgets()) | 2003 if (updateWidgets()) |
| 2004 return; | 2004 return; |
| 2005 } | 2005 } |
| 2006 } | 2006 } |
| 2007 | 2007 |
| 2008 void FrameView::flushAnyPendingPostLayoutTasks() | 2008 void FrameView::flushAnyPendingPostLayoutTasks() |
| 2009 { | 2009 { |
| 2010 ASSERT(!isInPerformLayout()); | 2010 ASSERT(!isInPerformLayout()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2023 } | 2023 } |
| 2024 | 2024 |
| 2025 void FrameView::performPostLayoutTasks() | 2025 void FrameView::performPostLayoutTasks() |
| 2026 { | 2026 { |
| 2027 // FIXME: We can reach here, even when the page is not active! | 2027 // FIXME: We can reach here, even when the page is not active! |
| 2028 // http/tests/inspector/elements/html-link-import.html and many other | 2028 // http/tests/inspector/elements/html-link-import.html and many other |
| 2029 // tests hit that case. | 2029 // tests hit that case. |
| 2030 // We should ASSERT(isActive()); or at least return early if we can! | 2030 // We should ASSERT(isActive()); or at least return early if we can! |
| 2031 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par
t of the highest-level layout() call. | 2031 ASSERT(!isInPerformLayout()); // Always before or after performLayout(), par
t of the highest-level layout() call. |
| 2032 TRACE_EVENT0("blink,benchmark", "FrameView::performPostLayoutTasks"); | 2032 TRACE_EVENT0("blink,benchmark", "FrameView::performPostLayoutTasks"); |
| 2033 RefPtrWillBeRawPtr<FrameView> protect(this); | 2033 RawPtr<FrameView> protect(this); |
| 2034 | 2034 |
| 2035 m_postLayoutTasksTimer.stop(); | 2035 m_postLayoutTasksTimer.stop(); |
| 2036 | 2036 |
| 2037 m_frame->selection().setCaretRectNeedsUpdate(); | 2037 m_frame->selection().setCaretRectNeedsUpdate(); |
| 2038 m_frame->selection().updateAppearance(); | 2038 m_frame->selection().updateAppearance(); |
| 2039 | 2039 |
| 2040 ASSERT(m_frame->document()); | 2040 ASSERT(m_frame->document()); |
| 2041 | 2041 |
| 2042 FontFaceSet::didLayout(*m_frame->document()); | 2042 FontFaceSet::didLayout(*m_frame->document()); |
| 2043 // Cursor update scheduling is done by the local root, which is the main fra
me if there | 2043 // Cursor update scheduling is done by the local root, which is the main fra
me if there |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2438 { | 2438 { |
| 2439 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope; | 2439 Optional<TemporaryChange<bool>> isUpdatingAllLifecyclePhasesScope; |
| 2440 if (phases == AllPhases) | 2440 if (phases == AllPhases) |
| 2441 isUpdatingAllLifecyclePhasesScope.emplace(m_isUpdatingAllLifecyclePhases
, true); | 2441 isUpdatingAllLifecyclePhasesScope.emplace(m_isUpdatingAllLifecyclePhases
, true); |
| 2442 | 2442 |
| 2443 // This must be called from the root frame, since it recurses down, not up. | 2443 // This must be called from the root frame, since it recurses down, not up. |
| 2444 // Otherwise the lifecycles of the frames might be out of sync. | 2444 // Otherwise the lifecycles of the frames might be out of sync. |
| 2445 ASSERT(m_frame->isLocalRoot()); | 2445 ASSERT(m_frame->isLocalRoot()); |
| 2446 | 2446 |
| 2447 // Updating layout can run script, which can tear down the FrameView. | 2447 // Updating layout can run script, which can tear down the FrameView. |
| 2448 RefPtrWillBeRawPtr<FrameView> protector(this); | 2448 RawPtr<FrameView> protector(this); |
| 2449 | 2449 |
| 2450 if (shouldThrottleRendering()) { | 2450 if (shouldThrottleRendering()) { |
| 2451 updateViewportIntersectionsForSubtree(std::min(phases, OnlyUpToCompositi
ngCleanPlusScrolling)); | 2451 updateViewportIntersectionsForSubtree(std::min(phases, OnlyUpToCompositi
ngCleanPlusScrolling)); |
| 2452 return; | 2452 return; |
| 2453 } | 2453 } |
| 2454 | 2454 |
| 2455 updateStyleAndLayoutIfNeededRecursive(); | 2455 updateStyleAndLayoutIfNeededRecursive(); |
| 2456 ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); | 2456 ASSERT(lifecycle().state() >= DocumentLifecycle::LayoutClean); |
| 2457 | 2457 |
| 2458 if (phases == OnlyUpToLayoutClean) { | 2458 if (phases == OnlyUpToLayoutClean) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2616 // region but then become included later by the second frame adding rects to
the dirty region | 2616 // region but then become included later by the second frame adding rects to
the dirty region |
| 2617 // when it lays out. | 2617 // when it lays out. |
| 2618 | 2618 |
| 2619 m_frame->document()->updateLayoutTreeIfNeeded(); | 2619 m_frame->document()->updateLayoutTreeIfNeeded(); |
| 2620 | 2620 |
| 2621 if (needsLayout()) | 2621 if (needsLayout()) |
| 2622 layout(); | 2622 layout(); |
| 2623 | 2623 |
| 2624 // FIXME: Calling layout() shouldn't trigger script execution or have any | 2624 // FIXME: Calling layout() shouldn't trigger script execution or have any |
| 2625 // observable effects on the frame tree but we're not quite there yet. | 2625 // observable effects on the frame tree but we're not quite there yet. |
| 2626 WillBeHeapVector<RefPtrWillBeMember<FrameView>> frameViews; | 2626 HeapVector<Member<FrameView>> frameViews; |
| 2627 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { | 2627 for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree
().nextSibling()) { |
| 2628 if (!child->isLocalFrame()) | 2628 if (!child->isLocalFrame()) |
| 2629 continue; | 2629 continue; |
| 2630 if (FrameView* view = toLocalFrame(child)->view()) | 2630 if (FrameView* view = toLocalFrame(child)->view()) |
| 2631 frameViews.append(view); | 2631 frameViews.append(view); |
| 2632 } | 2632 } |
| 2633 | 2633 |
| 2634 for (const auto& frameView : frameViews) | 2634 for (const auto& frameView : frameViews) |
| 2635 frameView->updateStyleAndLayoutIfNeededRecursive(); | 2635 frameView->updateStyleAndLayoutIfNeededRecursive(); |
| 2636 | 2636 |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2939 | 2939 |
| 2940 ResizerAreaSet::iterator it = m_resizerAreas->find(&resizerBox); | 2940 ResizerAreaSet::iterator it = m_resizerAreas->find(&resizerBox); |
| 2941 if (it != m_resizerAreas->end()) | 2941 if (it != m_resizerAreas->end()) |
| 2942 m_resizerAreas->remove(it); | 2942 m_resizerAreas->remove(it); |
| 2943 } | 2943 } |
| 2944 | 2944 |
| 2945 void FrameView::addScrollableArea(ScrollableArea* scrollableArea) | 2945 void FrameView::addScrollableArea(ScrollableArea* scrollableArea) |
| 2946 { | 2946 { |
| 2947 ASSERT(scrollableArea); | 2947 ASSERT(scrollableArea); |
| 2948 if (!m_scrollableAreas) | 2948 if (!m_scrollableAreas) |
| 2949 m_scrollableAreas = adoptPtrWillBeNoop(new ScrollableAreaSet); | 2949 m_scrollableAreas = (new ScrollableAreaSet); |
| 2950 m_scrollableAreas->add(scrollableArea); | 2950 m_scrollableAreas->add(scrollableArea); |
| 2951 | 2951 |
| 2952 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) | 2952 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) |
| 2953 scrollingCoordinator->scrollableAreasDidChange(); | 2953 scrollingCoordinator->scrollableAreasDidChange(); |
| 2954 } | 2954 } |
| 2955 | 2955 |
| 2956 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) | 2956 void FrameView::removeScrollableArea(ScrollableArea* scrollableArea) |
| 2957 { | 2957 { |
| 2958 if (!m_scrollableAreas) | 2958 if (!m_scrollableAreas) |
| 2959 return; | 2959 return; |
| 2960 m_scrollableAreas->remove(scrollableArea); | 2960 m_scrollableAreas->remove(scrollableArea); |
| 2961 | 2961 |
| 2962 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) | 2962 if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(
)) |
| 2963 scrollingCoordinator->scrollableAreasDidChange(); | 2963 scrollingCoordinator->scrollableAreasDidChange(); |
| 2964 } | 2964 } |
| 2965 | 2965 |
| 2966 void FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea) | 2966 void FrameView::addAnimatingScrollableArea(ScrollableArea* scrollableArea) |
| 2967 { | 2967 { |
| 2968 ASSERT(scrollableArea); | 2968 ASSERT(scrollableArea); |
| 2969 if (!m_animatingScrollableAreas) | 2969 if (!m_animatingScrollableAreas) |
| 2970 m_animatingScrollableAreas = adoptPtrWillBeNoop(new ScrollableAreaSet); | 2970 m_animatingScrollableAreas = (new ScrollableAreaSet); |
| 2971 m_animatingScrollableAreas->add(scrollableArea); | 2971 m_animatingScrollableAreas->add(scrollableArea); |
| 2972 } | 2972 } |
| 2973 | 2973 |
| 2974 void FrameView::removeAnimatingScrollableArea(ScrollableArea* scrollableArea) | 2974 void FrameView::removeAnimatingScrollableArea(ScrollableArea* scrollableArea) |
| 2975 { | 2975 { |
| 2976 if (!m_animatingScrollableAreas) | 2976 if (!m_animatingScrollableAreas) |
| 2977 return; | 2977 return; |
| 2978 m_animatingScrollableAreas->remove(scrollableArea); | 2978 m_animatingScrollableAreas->remove(scrollableArea); |
| 2979 } | 2979 } |
| 2980 | 2980 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3077 IntPoint FrameView::maximumScrollPosition() const | 3077 IntPoint FrameView::maximumScrollPosition() const |
| 3078 { | 3078 { |
| 3079 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() | 3079 // Make the same calculation as in CC's LayerImpl::MaxScrollOffset() |
| 3080 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/
422331. | 3080 // FIXME: We probably shouldn't be storing the bounds in a float. crbug.com/
422331. |
| 3081 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz
e(); | 3081 IntSize visibleSize = visibleContentSize(ExcludeScrollbars) + topControlsSiz
e(); |
| 3082 IntSize contentBounds = contentsSize(); | 3082 IntSize contentBounds = contentsSize(); |
| 3083 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); | 3083 IntPoint maximumPosition = -scrollOrigin() + (contentBounds - visibleSize); |
| 3084 return maximumPosition.expandedTo(minimumScrollPosition()); | 3084 return maximumPosition.expandedTo(minimumScrollPosition()); |
| 3085 } | 3085 } |
| 3086 | 3086 |
| 3087 void FrameView::addChild(PassRefPtrWillBeRawPtr<Widget> prpChild) | 3087 void FrameView::addChild(RawPtr<Widget> prpChild) |
| 3088 { | 3088 { |
| 3089 Widget* child = prpChild.get(); | 3089 Widget* child = prpChild.get(); |
| 3090 ASSERT(child != this && !child->parent()); | 3090 ASSERT(child != this && !child->parent()); |
| 3091 child->setParent(this); | 3091 child->setParent(this); |
| 3092 m_children.add(prpChild); | 3092 m_children.add(prpChild); |
| 3093 } | 3093 } |
| 3094 | 3094 |
| 3095 void FrameView::setHasHorizontalScrollbar(bool hasBar) | 3095 void FrameView::setHasHorizontalScrollbar(bool hasBar) |
| 3096 { | 3096 { |
| 3097 if (hasBar == !!m_horizontalScrollbar) | 3097 if (hasBar == !!m_horizontalScrollbar) |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4096 return m_hiddenForThrottling && m_crossOriginForThrottling; | 4096 return m_hiddenForThrottling && m_crossOriginForThrottling; |
| 4097 } | 4097 } |
| 4098 | 4098 |
| 4099 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 4099 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
| 4100 { | 4100 { |
| 4101 ASSERT(layoutView()); | 4101 ASSERT(layoutView()); |
| 4102 return *layoutView(); | 4102 return *layoutView(); |
| 4103 } | 4103 } |
| 4104 | 4104 |
| 4105 } // namespace blink | 4105 } // namespace blink |
| OLD | NEW |