| 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 EXPECT_EQ(DocumentLifecycle::PaintClean, frameDocument->lifecycle().state())
; |
| 156 | 156 |
| 157 // Mutating the throttled frame followed by a beginFrame will not result in | 157 // Mutating the throttled frame followed by a beginFrame will not result in |
| 158 // a complete lifecycle update. | 158 // a complete lifecycle update. |
| 159 frameElement->setAttribute(widthAttr, "50"); | 159 frameElement->setAttribute(widthAttr, "50"); |
| 160 compositeFrame(); | 160 compositeFrame(); |
| 161 EXPECT_EQ(DocumentLifecycle::StyleClean, frameDocument->lifecycle().state())
; | 161 EXPECT_EQ(DocumentLifecycle::StyleClean, frameDocument->lifecycle().state())
; |
| 162 | 162 |
| 163 // A hit test will force a complete lifecycle update. | 163 // A hit test will force a complete lifecycle update. |
| 164 webView().hitTestResultAt(WebPoint(0, 0)); | 164 webView().hitTestResultAt(WebPoint(0, 0)); |
| 165 EXPECT_EQ(DocumentLifecycle::CompositingClean, frameDocument->lifecycle().st
ate()); | 165 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. | 244 // Change the size of a div in the throttled frame. |
| 245 auto* divElement = frameElement->contentDocument()->getElementById("div"); | 245 auto* divElement = frameElement->contentDocument()->getElementById("div"); |
| 246 divElement->setAttribute(styleAttr, "width: 50px"); | 246 divElement->setAttribute(styleAttr, "width: 50px"); |
| 247 | 247 |
| 248 // Querying the width of the div should do a synchronous layout update even | 248 // Querying the width of the div should do a synchronous layout update even |
| 249 // though the frame is being throttled. | 249 // though the frame is being throttled. |
| 250 EXPECT_EQ(50, divElement->clientWidth()); | 250 EXPECT_EQ(50, divElement->clientWidth()); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace blink | 253 } // namespace blink |
| OLD | NEW |