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

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

Issue 2658063002: FrameView: Don't throttle display:none frames (Closed)
Patch Set: Created 3 years, 11 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 // 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 "bindings/core/v8/ScriptSourceCode.h" 6 #include "bindings/core/v8/ScriptSourceCode.h"
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/Element.h" 8 #include "core/dom/Element.h"
9 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
10 #include "core/frame/LocalFrame.h" 10 #include "core/frame/LocalFrame.h"
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 frameElement->setAttribute(HTMLNames::styleAttr, ""); 970 frameElement->setAttribute(HTMLNames::styleAttr, "");
971 // The first update unthrottles the frame, the second actually update layout 971 // The first update unthrottles the frame, the second actually update layout
972 // and paint properties etc. 972 // and paint properties etc.
973 compositeFrame(); 973 compositeFrame();
974 compositeFrame(); 974 compositeFrame();
975 EXPECT_FALSE(frameDocument->view()->canThrottleRendering()); 975 EXPECT_FALSE(frameDocument->view()->canThrottleRendering());
976 EXPECT_EQ(TransformationMatrix().translate(0, 20), 976 EXPECT_EQ(TransformationMatrix().translate(0, 20),
977 innerDiv->layoutObject()->paintProperties()->transform()->matrix()); 977 innerDiv->layoutObject()->paintProperties()->transform()->matrix());
978 } 978 }
979 979
980 TEST_F(FrameThrottlingTest, DisplayNoneNotThrottled) {
981 SimRequest mainResource("https://example.com/", "text/html");
982
983 loadURL("https://example.com/");
984 mainResource.complete(
985 "<style>iframe { transform: translateY(480px); }</style>"
986 "<iframe sandbox id=frame></iframe>");
987
988 auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"));
989 auto* frameDocument = frameElement->contentDocument();
990
991 // Initially the frame is throttled as it is offscreen.
992 compositeFrame();
993 EXPECT_TRUE(frameDocument->view()->canThrottleRendering());
994
995 // Setting display:none unthrottles the frame.
996 frameElement->setAttribute(styleAttr, "display: none");
997 compositeFrame();
998 EXPECT_FALSE(frameDocument->view()->canThrottleRendering());
999 }
1000
980 } // namespace blink 1001 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698