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

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

Issue 2660633002: 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 4585 matching lines...) Expand 10 before | Expand all | Expand 10 after
4596 return; 4596 return;
4597 4597
4598 // Notify javascript IntersectionObservers 4598 // Notify javascript IntersectionObservers
4599 if (targetState == DocumentLifecycle::PaintClean && 4599 if (targetState == DocumentLifecycle::PaintClean &&
4600 frame().document()->intersectionObserverController()) 4600 frame().document()->intersectionObserverController())
4601 frame() 4601 frame()
4602 .document() 4602 .document()
4603 ->intersectionObserverController() 4603 ->intersectionObserverController()
4604 ->computeTrackedIntersectionObservations(); 4604 ->computeTrackedIntersectionObservations();
4605 4605
4606 // Don't throttle display:none frames (see updateRenderThrottlingStatus).
4607 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
4608 if (m_hiddenForThrottling && ownerElement && !ownerElement->layoutObject()) {
4609 updateRenderThrottlingStatus(m_hiddenForThrottling, m_subtreeThrottled);
4610 DCHECK(!canThrottleRendering());
4611 }
4612
4606 for (Frame* child = m_frame->tree().firstChild(); child; 4613 for (Frame* child = m_frame->tree().firstChild(); child;
4607 child = child->tree().nextSibling()) { 4614 child = child->tree().nextSibling()) {
4608 if (!child->isLocalFrame()) 4615 if (!child->isLocalFrame())
4609 continue; 4616 continue;
4610 if (FrameView* view = toLocalFrame(child)->view()) 4617 if (FrameView* view = toLocalFrame(child)->view())
4611 view->updateViewportIntersectionsForSubtree(targetState); 4618 view->updateViewportIntersectionsForSubtree(targetState);
4612 } 4619 }
4613 } 4620 }
4614 4621
4615 void FrameView::updateRenderThrottlingStatusForTesting() { 4622 void FrameView::updateRenderThrottlingStatusForTesting() {
4616 m_visibilityObserver->deliverObservationsForTesting(); 4623 m_visibilityObserver->deliverObservationsForTesting();
4617 } 4624 }
4618 4625
4619 void FrameView::updateRenderThrottlingStatus(bool hidden, 4626 void FrameView::updateRenderThrottlingStatus(bool hidden,
4620 bool subtreeThrottled) { 4627 bool subtreeThrottled) {
4621 TRACE_EVENT0("blink", "FrameView::updateRenderThrottlingStatus"); 4628 TRACE_EVENT0("blink", "FrameView::updateRenderThrottlingStatus");
4622 DCHECK(!isInPerformLayout()); 4629 DCHECK(!isInPerformLayout());
4623 DCHECK(!m_frame->document() || !m_frame->document()->inStyleRecalc()); 4630 DCHECK(!m_frame->document() || !m_frame->document()->inStyleRecalc());
4624 bool wasThrottled = canThrottleRendering(); 4631 bool wasThrottled = canThrottleRendering();
4625 4632
4626 // Note that we disallow throttling of 0x0 frames because some sites use 4633 // Note that we disallow throttling of 0x0 and display:none frames because
4627 // them to drive UI logic. 4634 // some sites use them to drive UI logic.
4628 m_hiddenForThrottling = hidden && !frameRect().isEmpty(); 4635 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
4636 m_hiddenForThrottling = hidden && !frameRect().isEmpty() &&
4637 (ownerElement && ownerElement->layoutObject());
4629 m_subtreeThrottled = subtreeThrottled; 4638 m_subtreeThrottled = subtreeThrottled;
4630 4639
4631 bool isThrottled = canThrottleRendering(); 4640 bool isThrottled = canThrottleRendering();
4632 bool becameUnthrottled = wasThrottled && !isThrottled; 4641 bool becameUnthrottled = wasThrottled && !isThrottled;
4633 4642
4634 // If this FrameView became unthrottled or throttled, we must make sure all 4643 // If this FrameView became unthrottled or throttled, we must make sure all
4635 // its children are notified synchronously. Otherwise we 1) might attempt to 4644 // its children are notified synchronously. Otherwise we 1) might attempt to
4636 // paint one of the children with an out-of-date layout before 4645 // paint one of the children with an out-of-date layout before
4637 // |updateRenderThrottlingStatus| has made it throttled or 2) fail to 4646 // |updateRenderThrottlingStatus| has made it throttled or 2) fail to
4638 // unthrottle a child whose parent is unthrottled by a later notification. 4647 // unthrottle a child whose parent is unthrottled by a later notification.
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
5022 std::unique_ptr<CompositorAnimationTimeline> timeline) { 5031 std::unique_ptr<CompositorAnimationTimeline> timeline) {
5023 m_animationTimeline = std::move(timeline); 5032 m_animationTimeline = std::move(timeline);
5024 } 5033 }
5025 5034
5026 void FrameView::setAnimationHost( 5035 void FrameView::setAnimationHost(
5027 std::unique_ptr<CompositorAnimationHost> host) { 5036 std::unique_ptr<CompositorAnimationHost> host) {
5028 m_animationHost = std::move(host); 5037 m_animationHost = std::move(host);
5029 } 5038 }
5030 5039
5031 } // namespace blink 5040 } // 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