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

Side by Side Diff: third_party/WebKit/Source/web/tests/FrameThrottlingTest.cpp

Issue 1954093003: Don't try to paint graphics layers inside throttled frames (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add tests. Created 4 years, 7 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 | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ScriptController.h" 5 #include "bindings/core/v8/ScriptController.h"
6 #include "core/dom/Document.h" 6 #include "core/dom/Document.h"
7 #include "core/dom/Element.h" 7 #include "core/dom/Element.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/LocalFrame.h" 9 #include "core/frame/LocalFrame.h"
10 #include "core/html/HTMLIFrameElement.h" 10 #include "core/html/HTMLIFrameElement.h"
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 frameElement->contentDocument()->view()->notifyRenderThrottlingObserversForT esting(); 771 frameElement->contentDocument()->view()->notifyRenderThrottlingObserversForT esting();
772 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering()) ; 772 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering()) ;
773 EXPECT_TRUE(childFrameElement->contentDocument()->view()->canThrottleRenderi ng()); 773 EXPECT_TRUE(childFrameElement->contentDocument()->view()->canThrottleRenderi ng());
774 774
775 // Both frames should still be throttled after the second notification. 775 // Both frames should still be throttled after the second notification.
776 childFrameElement->contentDocument()->view()->notifyRenderThrottlingObserver sForTesting(); 776 childFrameElement->contentDocument()->view()->notifyRenderThrottlingObserver sForTesting();
777 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering()) ; 777 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering()) ;
778 EXPECT_TRUE(childFrameElement->contentDocument()->view()->canThrottleRenderi ng()); 778 EXPECT_TRUE(childFrameElement->contentDocument()->view()->canThrottleRenderi ng());
779 } 779 }
780 780
781 TEST_F(FrameThrottlingTest, SkipPaintingLayersInThrottledFrames)
782 {
783 webView().settings()->setAcceleratedCompositingEnabled(true);
784 webView().settings()->setPreferCompositingToLCDTextEnabled(true);
785
786 SimRequest mainResource("https://example.com/", "text/html");
787 SimRequest frameResource("https://example.com/iframe.html", "text/html");
788
789 loadURL("https://example.com/");
790 mainResource.complete("<iframe id=frame sandbox src=iframe.html></iframe>");
791 frameResource.complete("<div id=div style='transform: translateZ(0); backgro und: red'>layer</div>");
792 auto displayItems = compositeFrame();
793 EXPECT_TRUE(displayItems.contains(SimCanvas::Rect, "red"));
794
795 auto* frameElement = toHTMLIFrameElement(document().getElementById("frame")) ;
796 frameElement->setAttribute(styleAttr, "transform: translateY(480px)");
797 compositeFrame();
798 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering()) ;
799
800 auto* frameDocument = frameElement->contentDocument();
801 EXPECT_EQ(DocumentLifecycle::PaintClean, frameDocument->lifecycle().state()) ;
802
803 // Simulate the paint for a graphics layer being externally invalidated
804 // (e.g., by video playback).
805 frameDocument->view()->layoutView()->invalidatePaintForViewAndCompositedLaye rs();
806
807 // The layer inside the throttled frame should not get painted.
808 auto displayItems2 = compositeFrame();
809 EXPECT_FALSE(displayItems2.contains(SimCanvas::Rect, "red"));
810 }
811
781 } // namespace blink 812 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698