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

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

Issue 2692993003: Invalidate throttling-related dirty bits when changing cross-origin status. (Closed)
Patch Set: none Created 3 years, 10 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 4735 matching lines...) Expand 10 before | Expand all | Expand 10 after
4746 continue; 4746 continue;
4747 if (FrameView* view = toLocalFrame(child)->view()) 4747 if (FrameView* view = toLocalFrame(child)->view())
4748 view->updateViewportIntersectionsForSubtree(targetState); 4748 view->updateViewportIntersectionsForSubtree(targetState);
4749 } 4749 }
4750 } 4750 }
4751 4751
4752 void FrameView::updateRenderThrottlingStatusForTesting() { 4752 void FrameView::updateRenderThrottlingStatusForTesting() {
4753 m_visibilityObserver->deliverObservationsForTesting(); 4753 m_visibilityObserver->deliverObservationsForTesting();
4754 } 4754 }
4755 4755
4756 void FrameView::crossOriginStatusChanged() {
4757 // Cross-domain status is not stored as a dirty bit within FrameView,
4758 // so force-invalidate throttling status when it changes regardless of
4759 // previous or new value.
4760 updateRenderThrottlingStatus(m_hiddenForThrottling, m_subtreeThrottled, true);
4761 }
4762
4756 void FrameView::updateRenderThrottlingStatus(bool hidden, 4763 void FrameView::updateRenderThrottlingStatus(bool hidden,
4757 bool subtreeThrottled) { 4764 bool subtreeThrottled,
4765 bool forceThrottlingInvalidation) {
4758 TRACE_EVENT0("blink", "FrameView::updateRenderThrottlingStatus"); 4766 TRACE_EVENT0("blink", "FrameView::updateRenderThrottlingStatus");
4759 DCHECK(!isInPerformLayout()); 4767 DCHECK(!isInPerformLayout());
4760 DCHECK(!m_frame->document() || !m_frame->document()->inStyleRecalc()); 4768 DCHECK(!m_frame->document() || !m_frame->document()->inStyleRecalc());
4761 bool wasThrottled = canThrottleRendering(); 4769 bool wasThrottled = canThrottleRendering();
4762 4770
4763 // Note that we disallow throttling of 0x0 and display:none frames because 4771 // Note that we disallow throttling of 0x0 and display:none frames because
4764 // some sites use them to drive UI logic. 4772 // some sites use them to drive UI logic.
4765 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner(); 4773 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
4766 m_hiddenForThrottling = hidden && !frameRect().isEmpty() && 4774 m_hiddenForThrottling = hidden && !frameRect().isEmpty() &&
4767 (ownerElement && ownerElement->layoutObject()); 4775 (ownerElement && ownerElement->layoutObject());
4768 m_subtreeThrottled = subtreeThrottled; 4776 m_subtreeThrottled = subtreeThrottled;
4769 4777
4770 bool isThrottled = canThrottleRendering(); 4778 bool isThrottled = canThrottleRendering();
4771 bool becameUnthrottled = wasThrottled && !isThrottled; 4779 bool becameUnthrottled = wasThrottled && !isThrottled;
4772 4780
4773 // If this FrameView became unthrottled or throttled, we must make sure all 4781 // If this FrameView became unthrottled or throttled, we must make sure all
4774 // its children are notified synchronously. Otherwise we 1) might attempt to 4782 // its children are notified synchronously. Otherwise we 1) might attempt to
4775 // paint one of the children with an out-of-date layout before 4783 // paint one of the children with an out-of-date layout before
4776 // |updateRenderThrottlingStatus| has made it throttled or 2) fail to 4784 // |updateRenderThrottlingStatus| has made it throttled or 2) fail to
4777 // unthrottle a child whose parent is unthrottled by a later notification. 4785 // unthrottle a child whose parent is unthrottled by a later notification.
4778 if (wasThrottled != isThrottled) { 4786 if (wasThrottled != isThrottled || forceThrottlingInvalidation) {
4779 for (const Member<Widget>& child : *children()) { 4787 for (const Member<Widget>& child : *children()) {
4780 if (child->isFrameView()) { 4788 if (child->isFrameView()) {
4781 FrameView* childView = toFrameView(child); 4789 FrameView* childView = toFrameView(child);
4782 childView->updateRenderThrottlingStatus( 4790 childView->updateRenderThrottlingStatus(
4783 childView->m_hiddenForThrottling, isThrottled); 4791 childView->m_hiddenForThrottling, isThrottled);
4784 } 4792 }
4785 } 4793 }
4786 } 4794 }
4787 4795
4788 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator(); 4796 ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
4789 if (becameUnthrottled) { 4797 if (becameUnthrottled || forceThrottlingInvalidation) {
4790 // ScrollingCoordinator needs to update according to the new throttling 4798 // ScrollingCoordinator needs to update according to the new throttling
4791 // status. 4799 // status.
4792 if (scrollingCoordinator) 4800 if (scrollingCoordinator)
4793 scrollingCoordinator->notifyGeometryChanged(); 4801 scrollingCoordinator->notifyGeometryChanged();
4794 // Start ticking animation frames again if necessary. 4802 // Start ticking animation frames again if necessary.
4795 if (page()) 4803 if (page())
4796 page()->animator().scheduleVisualUpdate(m_frame.get()); 4804 page()->animator().scheduleVisualUpdate(m_frame.get());
4797 // Force a full repaint of this frame to ensure we are not left with a 4805 // Force a full repaint of this frame to ensure we are not left with a
4798 // partially painted version of this frame's contents if we skipped 4806 // partially painted version of this frame's contents if we skipped
4799 // painting them while the frame was throttled. 4807 // painting them while the frame was throttled.
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
5173 void FrameView::setAnimationHost( 5181 void FrameView::setAnimationHost(
5174 std::unique_ptr<CompositorAnimationHost> host) { 5182 std::unique_ptr<CompositorAnimationHost> host) {
5175 m_animationHost = std::move(host); 5183 m_animationHost = std::move(host);
5176 } 5184 }
5177 5185
5178 LayoutUnit FrameView::caretWidth() const { 5186 LayoutUnit FrameView::caretWidth() const {
5179 return LayoutUnit(getHostWindow()->windowToViewportScalar(1)); 5187 return LayoutUnit(getHostWindow()->windowToViewportScalar(1));
5180 } 5188 }
5181 5189
5182 } // namespace blink 5190 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/frame/FrameView.h ('k') | third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698