OLD | NEW |
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 "config.h" | 5 #include "config.h" |
6 | 6 |
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/html/HTMLIFrameElement.h" | 10 #include "core/html/HTMLIFrameElement.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 loadURL("https://example.com/"); | 145 loadURL("https://example.com/"); |
146 mainResource.complete("<iframe sandbox id=frame></iframe>"); | 146 mainResource.complete("<iframe sandbox id=frame></iframe>"); |
147 | 147 |
148 auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"))
; | 148 auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"))
; |
149 auto* frameDocument = frameElement->contentDocument(); | 149 auto* frameDocument = frameElement->contentDocument(); |
150 | 150 |
151 // Enable throttling for the child frame. | 151 // Enable throttling for the child frame. |
152 frameElement->setAttribute(styleAttr, "transform: translateY(480px)"); | 152 frameElement->setAttribute(styleAttr, "transform: translateY(480px)"); |
153 compositeFrame(); | 153 compositeFrame(); |
154 EXPECT_TRUE(frameDocument->view()->canThrottleRendering()); | 154 EXPECT_TRUE(frameDocument->view()->canThrottleRendering()); |
155 EXPECT_EQ(DocumentLifecycle::PaintInvalidationClean, frameDocument->lifecycl
e().state()); | 155 if (RuntimeEnabledFeatures::slimmingPaintSynchronizedPaintingEnabled()) |
| 156 EXPECT_EQ(DocumentLifecycle::PaintClean, frameDocument->lifecycle().stat
e()); |
| 157 else |
| 158 EXPECT_EQ(DocumentLifecycle::PaintInvalidationClean, frameDocument->life
cycle().state()); |
156 | 159 |
157 // Mutating the throttled frame followed by a beginFrame will not result in | 160 // Mutating the throttled frame followed by a beginFrame will not result in |
158 // a complete lifecycle update. | 161 // a complete lifecycle update. |
159 frameElement->setAttribute(widthAttr, "50"); | 162 frameElement->setAttribute(widthAttr, "50"); |
160 compositeFrame(); | 163 compositeFrame(); |
161 EXPECT_EQ(DocumentLifecycle::StyleClean, frameDocument->lifecycle().state())
; | 164 EXPECT_EQ(DocumentLifecycle::StyleClean, frameDocument->lifecycle().state())
; |
162 | 165 |
163 // A hit test will force a complete lifecycle update. | 166 // A hit test will force a complete lifecycle update. |
164 webView().hitTestResultAt(WebPoint(0, 0)); | 167 webView().hitTestResultAt(WebPoint(0, 0)); |
165 EXPECT_EQ(DocumentLifecycle::CompositingClean, frameDocument->lifecycle().st
ate()); | 168 EXPECT_EQ(DocumentLifecycle::CompositingClean, frameDocument->lifecycle().st
ate()); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // Change the size of a div in the throttled frame. | 247 // Change the size of a div in the throttled frame. |
245 auto* divElement = frameElement->contentDocument()->getElementById("div"); | 248 auto* divElement = frameElement->contentDocument()->getElementById("div"); |
246 divElement->setAttribute(styleAttr, "width: 50px"); | 249 divElement->setAttribute(styleAttr, "width: 50px"); |
247 | 250 |
248 // Querying the width of the div should do a synchronous layout update even | 251 // Querying the width of the div should do a synchronous layout update even |
249 // though the frame is being throttled. | 252 // though the frame is being throttled. |
250 EXPECT_EQ(50, divElement->clientWidth()); | 253 EXPECT_EQ(50, divElement->clientWidth()); |
251 } | 254 } |
252 | 255 |
253 } // namespace blink | 256 } // namespace blink |
OLD | NEW |