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

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

Issue 2750463003: Reduce the number of ObjectPaintProperties (Closed)
Patch Set: Created 3 years, 9 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/PaintPropertyTreeBuilderTest.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 "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 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 auto* frameElement = toHTMLIFrameElement(document().getElementById("frame")); 1007 auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"));
1008 auto* frameDocument = frameElement->contentDocument(); 1008 auto* frameDocument = frameElement->contentDocument();
1009 auto* innerDiv = frameDocument->getElementById("div"); 1009 auto* innerDiv = frameDocument->getElementById("div");
1010 auto* innerDivObject = innerDiv->layoutObject(); 1010 auto* innerDivObject = innerDiv->layoutObject();
1011 EXPECT_FALSE(frameDocument->view()->shouldThrottleRendering()); 1011 EXPECT_FALSE(frameDocument->view()->shouldThrottleRendering());
1012 1012
1013 frameElement->setAttribute(HTMLNames::styleAttr, 1013 frameElement->setAttribute(HTMLNames::styleAttr,
1014 "transform: translateY(1000px)"); 1014 "transform: translateY(1000px)");
1015 compositeFrame(); 1015 compositeFrame();
1016 EXPECT_TRUE(frameDocument->view()->canThrottleRendering()); 1016 EXPECT_TRUE(frameDocument->view()->canThrottleRendering());
1017 EXPECT_FALSE(innerDivObject->paintProperties()->transform()); 1017 EXPECT_FALSE(innerDivObject->paintProperties());
1018 1018
1019 // Mutating the throttled frame should not cause paint property update. 1019 // Mutating the throttled frame should not cause paint property update.
1020 innerDiv->setAttribute(HTMLNames::styleAttr, "transform: translateY(20px)"); 1020 innerDiv->setAttribute(HTMLNames::styleAttr, "transform: translateY(20px)");
1021 EXPECT_FALSE(compositor().needsBeginFrame()); 1021 EXPECT_FALSE(compositor().needsBeginFrame());
1022 EXPECT_TRUE(frameDocument->view()->canThrottleRendering()); 1022 EXPECT_TRUE(frameDocument->view()->canThrottleRendering());
1023 { 1023 {
1024 DocumentLifecycle::AllowThrottlingScope throttlingScope( 1024 DocumentLifecycle::AllowThrottlingScope throttlingScope(
1025 document().lifecycle()); 1025 document().lifecycle());
1026 document().view()->updateAllLifecyclePhases(); 1026 document().view()->updateAllLifecyclePhases();
1027 } 1027 }
1028 EXPECT_FALSE(innerDivObject->paintProperties()->transform()); 1028 EXPECT_FALSE(innerDivObject->paintProperties());
1029 1029
1030 // Move the frame back on screen to unthrottle it. 1030 // Move the frame back on screen to unthrottle it.
1031 frameElement->setAttribute(HTMLNames::styleAttr, ""); 1031 frameElement->setAttribute(HTMLNames::styleAttr, "");
1032 // The first update unthrottles the frame, the second actually update layout 1032 // The first update unthrottles the frame, the second actually update layout
1033 // and paint properties etc. 1033 // and paint properties etc.
1034 compositeFrame(); 1034 compositeFrame();
1035 compositeFrame(); 1035 compositeFrame();
1036 EXPECT_FALSE(frameDocument->view()->canThrottleRendering()); 1036 EXPECT_FALSE(frameDocument->view()->canThrottleRendering());
1037 EXPECT_EQ(TransformationMatrix().translate(0, 20), 1037 EXPECT_EQ(TransformationMatrix().translate(0, 20),
1038 innerDiv->layoutObject()->paintProperties()->transform()->matrix()); 1038 innerDiv->layoutObject()->paintProperties()->transform()->matrix());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 // Setting display:none for the parent frame unthrottles the parent but not 1085 // Setting display:none for the parent frame unthrottles the parent but not
1086 // the child. This behavior matches Safari. 1086 // the child. This behavior matches Safari.
1087 frameElement->setAttribute(styleAttr, "display: none"); 1087 frameElement->setAttribute(styleAttr, "display: none");
1088 compositeFrame(); 1088 compositeFrame();
1089 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()); 1089 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering());
1090 EXPECT_TRUE( 1090 EXPECT_TRUE(
1091 childFrameElement->contentDocument()->view()->canThrottleRendering()); 1091 childFrameElement->contentDocument()->view()->canThrottleRendering());
1092 } 1092 }
1093 1093
1094 } // namespace blink 1094 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintPropertyTreeBuilderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698