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 "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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 document().lifecycle()); | 535 document().lifecycle()); |
536 // This will call ScrollingCoordinator::updateAfterCompositingChangeIfNeeded() | 536 // This will call ScrollingCoordinator::updateAfterCompositingChangeIfNeeded() |
537 // and should not cause assert failure about | 537 // and should not cause assert failure about |
538 // isAllowedToQueryCompositingState() in the throttled frame. | 538 // isAllowedToQueryCompositingState() in the throttled frame. |
539 document().view()->updateAllLifecyclePhases(); | 539 document().view()->updateAllLifecyclePhases(); |
540 testing::runPendingTasks(); | 540 testing::runPendingTasks(); |
541 EXPECT_EQ(DocumentLifecycle::VisualUpdatePending, | 541 EXPECT_EQ(DocumentLifecycle::VisualUpdatePending, |
542 frameElement->contentDocument()->lifecycle().state()); | 542 frameElement->contentDocument()->lifecycle().state()); |
543 // The fixed background in the throttled sub frame should not cause main | 543 // The fixed background in the throttled sub frame should not cause main |
544 // thread scrolling. | 544 // thread scrolling. |
545 EXPECT_FALSE(document().view()->shouldScrollOnMainThread()); | 545 EXPECT_FALSE(document() |
| 546 .view() |
| 547 ->layoutViewportScrollableArea() |
| 548 ->shouldScrollOnMainThread()); |
546 | 549 |
547 // Make the frame visible by changing its transform. This doesn't cause a | 550 // Make the frame visible by changing its transform. This doesn't cause a |
548 // layout, but should still unthrottle the frame. | 551 // layout, but should still unthrottle the frame. |
549 frameElement->setAttribute(styleAttr, "transform: translateY(0px)"); | 552 frameElement->setAttribute(styleAttr, "transform: translateY(0px)"); |
550 compositeFrame(); | 553 compositeFrame(); |
551 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()); | 554 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()); |
552 // The fixed background in the throttled sub frame should be considered. | 555 // The fixed background in the throttled sub frame should be considered. |
553 EXPECT_TRUE( | 556 EXPECT_TRUE(frameElement->contentDocument() |
554 frameElement->contentDocument()->view()->shouldScrollOnMainThread()); | 557 ->view() |
555 EXPECT_FALSE(document().view()->shouldScrollOnMainThread()); | 558 ->layoutViewportScrollableArea() |
| 559 ->shouldScrollOnMainThread()); |
| 560 EXPECT_FALSE(document() |
| 561 .view() |
| 562 ->layoutViewportScrollableArea() |
| 563 ->shouldScrollOnMainThread()); |
556 } | 564 } |
557 | 565 |
558 TEST_P(FrameThrottlingTest, ScrollingCoordinatorShouldSkipThrottledLayer) { | 566 TEST_P(FrameThrottlingTest, ScrollingCoordinatorShouldSkipThrottledLayer) { |
559 webView().settings()->setJavaScriptEnabled(true); | 567 webView().settings()->setJavaScriptEnabled(true); |
560 webView().settings()->setAcceleratedCompositingEnabled(true); | 568 webView().settings()->setAcceleratedCompositingEnabled(true); |
561 webView().settings()->setPreferCompositingToLCDTextEnabled(true); | 569 webView().settings()->setPreferCompositingToLCDTextEnabled(true); |
562 | 570 |
563 // Create a hidden frame which is throttled and has a touch handler inside a | 571 // Create a hidden frame which is throttled and has a touch handler inside a |
564 // composited layer. | 572 // composited layer. |
565 SimRequest mainResource("https://example.com/", "text/html"); | 573 SimRequest mainResource("https://example.com/", "text/html"); |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1077 // 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 |
1078 // the child. This behavior matches Safari. | 1086 // the child. This behavior matches Safari. |
1079 frameElement->setAttribute(styleAttr, "display: none"); | 1087 frameElement->setAttribute(styleAttr, "display: none"); |
1080 compositeFrame(); | 1088 compositeFrame(); |
1081 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()); | 1089 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()); |
1082 EXPECT_TRUE( | 1090 EXPECT_TRUE( |
1083 childFrameElement->contentDocument()->view()->canThrottleRendering()); | 1091 childFrameElement->contentDocument()->view()->canThrottleRendering()); |
1084 } | 1092 } |
1085 | 1093 |
1086 } // namespace blink | 1094 } // namespace blink |
OLD | NEW |