| 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 "core/dom/Document.h" | 5 #include "core/dom/Document.h" |
| 6 #include "core/dom/Element.h" | 6 #include "core/dom/Element.h" |
| 7 #include "core/frame/FrameView.h" | 7 #include "core/frame/FrameView.h" |
| 8 #include "core/html/HTMLIFrameElement.h" | 8 #include "core/html/HTMLIFrameElement.h" |
| 9 #include "platform/testing/URLTestHelpers.h" | 9 #include "platform/testing/URLTestHelpers.h" |
| 10 #include "platform/testing/UnitTestHelpers.h" | 10 #include "platform/testing/UnitTestHelpers.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 EXPECT_FALSE(document().view()->shouldScrollOnMainThread()); | 432 EXPECT_FALSE(document().view()->shouldScrollOnMainThread()); |
| 433 | 433 |
| 434 // Scroll down to unthrottle the frame. | 434 // Scroll down to unthrottle the frame. |
| 435 webView().mainFrameImpl()->frameView()->setScrollPosition(DoublePoint(0, 480
), ProgrammaticScroll); | 435 webView().mainFrameImpl()->frameView()->setScrollPosition(DoublePoint(0, 480
), ProgrammaticScroll); |
| 436 document().view()->updateAllLifecyclePhases(); | 436 document().view()->updateAllLifecyclePhases(); |
| 437 testing::runPendingTasks(); | 437 testing::runPendingTasks(); |
| 438 // The fixed background in the throttled sub frame should be considered. | 438 // The fixed background in the throttled sub frame should be considered. |
| 439 EXPECT_TRUE(document().view()->shouldScrollOnMainThread()); | 439 EXPECT_TRUE(document().view()->shouldScrollOnMainThread()); |
| 440 } | 440 } |
| 441 | 441 |
| 442 TEST_F(FrameThrottlingTest, UnthrottleByTransformingWithoutLayout) |
| 443 { |
| 444 webView().settings()->setAcceleratedCompositingEnabled(true); |
| 445 |
| 446 // Create a hidden frame which is throttled. |
| 447 SimRequest mainResource("https://example.com/", "text/html"); |
| 448 SimRequest frameResource("https://example.com/iframe.html", "text/html"); |
| 449 |
| 450 loadURL("https://example.com/"); |
| 451 mainResource.complete("<iframe id=frame sandbox src=iframe.html></iframe>"); |
| 452 frameResource.complete(""); |
| 453 |
| 454 // Move the frame offscreen to throttle it. |
| 455 auto* frameElement = toHTMLIFrameElement(document().getElementById("frame"))
; |
| 456 frameElement->setAttribute(styleAttr, "transform: translateY(480px)"); |
| 457 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()
); |
| 458 compositeFrame(); |
| 459 EXPECT_TRUE(frameElement->contentDocument()->view()->canThrottleRendering())
; |
| 460 |
| 461 // Make the frame visible by changing its transform. This doesn't cause a |
| 462 // layout, but should still unthrottle the frame. |
| 463 frameElement->setAttribute(styleAttr, "transform: translateY(0px)"); |
| 464 compositeFrame(); |
| 465 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()
); |
| 466 } |
| 467 |
| 442 } // namespace blink | 468 } // namespace blink |
| OLD | NEW |