| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 scrollLayer = layoutObject->frameView()->layerForScrolling(); | 1022 scrollLayer = layoutObject->frameView()->layerForScrolling(); |
| 1023 ASSERT_TRUE(scrollLayer); | 1023 ASSERT_TRUE(scrollLayer); |
| 1024 | 1024 |
| 1025 webScrollLayer = scrollLayer->platformLayer(); | 1025 webScrollLayer = scrollLayer->platformLayer(); |
| 1026 ASSERT_TRUE(webScrollLayer->scrollable()); | 1026 ASSERT_TRUE(webScrollLayer->scrollable()); |
| 1027 ASSERT_FALSE( | 1027 ASSERT_FALSE( |
| 1028 webScrollLayer->mainThreadScrollingReasons() & | 1028 webScrollLayer->mainThreadScrollingReasons() & |
| 1029 MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects); | 1029 MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects); |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 TEST_F(ScrollingCoordinatorTest, StyleRelatedMainThreadScrollingReason) { |
| 1033 registerMockedHttpURLLoad("two_transparent_scrollable_area.html"); |
| 1034 navigateTo(m_baseURL + "two_transparent_scrollable_area.html"); |
| 1035 webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(false); |
| 1036 forceFullCompositingUpdate(); |
| 1037 |
| 1038 FrameView* frameView = frame()->view(); |
| 1039 ASSERT_TRUE(frameView); |
| 1040 ASSERT_TRUE(frameView->mainThreadScrollingReasons() & |
| 1041 MainThreadScrollingReason::kHasOpacity); |
| 1042 |
| 1043 // Remove opacity from one of the scrollers. |
| 1044 // Still need to scroll on main thread. |
| 1045 Document* document = frame()->document(); |
| 1046 Element* container = document->getElementById("scroller1"); |
| 1047 DCHECK(container); |
| 1048 |
| 1049 container->removeAttribute("class"); |
| 1050 forceFullCompositingUpdate(); |
| 1051 |
| 1052 ASSERT_TRUE(frameView->mainThreadScrollingReasons() & |
| 1053 MainThreadScrollingReason::kHasOpacity); |
| 1054 |
| 1055 // Remove opacity from the other scroller would lead to |
| 1056 // scroll on impl. |
| 1057 container = document->getElementById("scroller2"); |
| 1058 DCHECK(container); |
| 1059 |
| 1060 container->removeAttribute("class"); |
| 1061 forceFullCompositingUpdate(); |
| 1062 |
| 1063 ASSERT_FALSE(frameView->mainThreadScrollingReasons() & |
| 1064 MainThreadScrollingReason::kHasOpacity); |
| 1065 |
| 1066 // Add opacity would again lead to scroll on main thread |
| 1067 container->setAttribute("class", "transparent", ASSERT_NO_EXCEPTION); |
| 1068 forceFullCompositingUpdate(); |
| 1069 |
| 1070 ASSERT_TRUE(frameView->mainThreadScrollingReasons() & |
| 1071 MainThreadScrollingReason::kHasOpacity); |
| 1072 |
| 1073 webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(true); |
| 1074 forceFullCompositingUpdate(); |
| 1075 |
| 1076 ASSERT_FALSE(frameView->mainThreadScrollingReasons()); |
| 1077 } |
| 1078 |
| 1032 } // namespace blink | 1079 } // namespace blink |
| OLD | NEW |