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

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

Issue 2658063002: FrameView: Don't throttle display:none frames (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4624 matching lines...) Expand 10 before | Expand all | Expand 10 after
4635 return; 4635 return;
4636 4636
4637 // Notify javascript IntersectionObservers 4637 // Notify javascript IntersectionObservers
4638 if (targetState == DocumentLifecycle::PaintClean && 4638 if (targetState == DocumentLifecycle::PaintClean &&
4639 frame().document()->intersectionObserverController()) 4639 frame().document()->intersectionObserverController())
4640 frame() 4640 frame()
4641 .document() 4641 .document()
4642 ->intersectionObserverController() 4642 ->intersectionObserverController()
4643 ->computeTrackedIntersectionObservations(); 4643 ->computeTrackedIntersectionObservations();
4644 4644
4645 // Don't throttle display:none frames (see updateRenderThrottlingStatus).
4646 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
4647 if (m_hiddenForThrottling && ownerElement && !ownerElement->layoutObject()) {
4648 updateRenderThrottlingStatus(m_hiddenForThrottling, m_subtreeThrottled);
esprehn 2017/02/14 00:05:21 This introduces an entire frame tree walk down her
Sami 2017/02/21 12:34:03 Well spotted -- fix here: https://codereview.chrom
4649 DCHECK(!canThrottleRendering());
4650 }
4651
4645 for (Frame* child = m_frame->tree().firstChild(); child; 4652 for (Frame* child = m_frame->tree().firstChild(); child;
4646 child = child->tree().nextSibling()) { 4653 child = child->tree().nextSibling()) {
4647 if (!child->isLocalFrame()) 4654 if (!child->isLocalFrame())
4648 continue; 4655 continue;
4649 if (FrameView* view = toLocalFrame(child)->view()) 4656 if (FrameView* view = toLocalFrame(child)->view())
4650 view->updateViewportIntersectionsForSubtree(targetState); 4657 view->updateViewportIntersectionsForSubtree(targetState);
4651 } 4658 }
4652 } 4659 }
4653 4660
4654 void FrameView::updateRenderThrottlingStatusForTesting() { 4661 void FrameView::updateRenderThrottlingStatusForTesting() {
4655 m_visibilityObserver->deliverObservationsForTesting(); 4662 m_visibilityObserver->deliverObservationsForTesting();
4656 } 4663 }
4657 4664
4658 void FrameView::updateRenderThrottlingStatus(bool hidden, 4665 void FrameView::updateRenderThrottlingStatus(bool hidden,
4659 bool subtreeThrottled) { 4666 bool subtreeThrottled) {
4660 TRACE_EVENT0("blink", "FrameView::updateRenderThrottlingStatus"); 4667 TRACE_EVENT0("blink", "FrameView::updateRenderThrottlingStatus");
4661 DCHECK(!isInPerformLayout()); 4668 DCHECK(!isInPerformLayout());
4662 DCHECK(!m_frame->document() || !m_frame->document()->inStyleRecalc()); 4669 DCHECK(!m_frame->document() || !m_frame->document()->inStyleRecalc());
4663 bool wasThrottled = canThrottleRendering(); 4670 bool wasThrottled = canThrottleRendering();
4664 4671
4665 // Note that we disallow throttling of 0x0 frames because some sites use 4672 // Note that we disallow throttling of 0x0 and display:none frames because
4666 // them to drive UI logic. 4673 // some sites use them to drive UI logic.
4667 m_hiddenForThrottling = hidden && !frameRect().isEmpty(); 4674 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
4675 m_hiddenForThrottling = hidden && !frameRect().isEmpty() &&
4676 (ownerElement && ownerElement->layoutObject());
4668 m_subtreeThrottled = subtreeThrottled; 4677 m_subtreeThrottled = subtreeThrottled;
4669 4678
4670 bool isThrottled = canThrottleRendering(); 4679 bool isThrottled = canThrottleRendering();
4671 bool becameUnthrottled = wasThrottled && !isThrottled; 4680 bool becameUnthrottled = wasThrottled && !isThrottled;
4672 4681
4673 // If this FrameView became unthrottled or throttled, we must make sure all 4682 // If this FrameView became unthrottled or throttled, we must make sure all
4674 // its children are notified synchronously. Otherwise we 1) might attempt to 4683 // its children are notified synchronously. Otherwise we 1) might attempt to
4675 // paint one of the children with an out-of-date layout before 4684 // paint one of the children with an out-of-date layout before
4676 // |updateRenderThrottlingStatus| has made it throttled or 2) fail to 4685 // |updateRenderThrottlingStatus| has made it throttled or 2) fail to
4677 // unthrottle a child whose parent is unthrottled by a later notification. 4686 // unthrottle a child whose parent is unthrottled by a later notification.
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
5061 std::unique_ptr<CompositorAnimationTimeline> timeline) { 5070 std::unique_ptr<CompositorAnimationTimeline> timeline) {
5062 m_animationTimeline = std::move(timeline); 5071 m_animationTimeline = std::move(timeline);
5063 } 5072 }
5064 5073
5065 void FrameView::setAnimationHost( 5074 void FrameView::setAnimationHost(
5066 std::unique_ptr<CompositorAnimationHost> host) { 5075 std::unique_ptr<CompositorAnimationHost> host) {
5067 m_animationHost = std::move(host); 5076 m_animationHost = std::move(host);
5068 } 5077 }
5069 5078
5070 } // namespace blink 5079 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698