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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 // The fixed background in the throttled sub frame should not cause main | 489 // The fixed background in the throttled sub frame should not cause main |
490 // thread scrolling. | 490 // thread scrolling. |
491 EXPECT_FALSE(document().view()->shouldScrollOnMainThread()); | 491 EXPECT_FALSE(document().view()->shouldScrollOnMainThread()); |
492 | 492 |
493 // Make the frame visible by changing its transform. This doesn't cause a | 493 // Make the frame visible by changing its transform. This doesn't cause a |
494 // layout, but should still unthrottle the frame. | 494 // layout, but should still unthrottle the frame. |
495 frameElement->setAttribute(styleAttr, "transform: translateY(0px)"); | 495 frameElement->setAttribute(styleAttr, "transform: translateY(0px)"); |
496 compositeFrame(); | 496 compositeFrame(); |
497 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()); | 497 EXPECT_FALSE(frameElement->contentDocument()->view()->canThrottleRendering()); |
498 // The fixed background in the throttled sub frame should be considered. | 498 // The fixed background in the throttled sub frame should be considered. |
499 EXPECT_TRUE(document().view()->shouldScrollOnMainThread()); | 499 EXPECT_TRUE( |
| 500 frameElement->contentDocument()->view()->shouldScrollOnMainThread()); |
| 501 EXPECT_FALSE(document().view()->shouldScrollOnMainThread()); |
500 } | 502 } |
501 | 503 |
502 TEST_F(FrameThrottlingTest, ScrollingCoordinatorShouldSkipThrottledLayer) { | 504 TEST_F(FrameThrottlingTest, ScrollingCoordinatorShouldSkipThrottledLayer) { |
503 webView().settings()->setJavaScriptEnabled(true); | 505 webView().settings()->setJavaScriptEnabled(true); |
504 webView().settings()->setAcceleratedCompositingEnabled(true); | 506 webView().settings()->setAcceleratedCompositingEnabled(true); |
505 webView().settings()->setPreferCompositingToLCDTextEnabled(true); | 507 webView().settings()->setPreferCompositingToLCDTextEnabled(true); |
506 | 508 |
507 // Create a hidden frame which is throttled and has a touch handler inside a | 509 // Create a hidden frame which is throttled and has a touch handler inside a |
508 // composited layer. | 510 // composited layer. |
509 SimRequest mainResource("https://example.com/", "text/html"); | 511 SimRequest mainResource("https://example.com/", "text/html"); |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 924 |
923 LocalFrame* localFrame = toLocalFrame(frameElement->contentFrame()); | 925 LocalFrame* localFrame = toLocalFrame(frameElement->contentFrame()); |
924 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 926 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
925 v8::Local<v8::Value> result = | 927 v8::Local<v8::Value> result = |
926 localFrame->script().executeScriptInMainWorldAndReturnValue( | 928 localFrame->script().executeScriptInMainWorldAndReturnValue( |
927 ScriptSourceCode("window.didRaf;")); | 929 ScriptSourceCode("window.didRaf;")); |
928 EXPECT_TRUE(result->IsTrue()); | 930 EXPECT_TRUE(result->IsTrue()); |
929 } | 931 } |
930 | 932 |
931 } // namespace blink | 933 } // namespace blink |
OLD | NEW |