Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp

Issue 2638013002: Record box shadow as main thread scrolling reasons (Closed)
Patch Set: Add flag related test && bug fix Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 ASSERT_FALSE( 1030 ASSERT_FALSE(
1031 webScrollLayer->mainThreadScrollingReasons() & 1031 webScrollLayer->mainThreadScrollingReasons() &
1032 MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects); 1032 MainThreadScrollingReason::kHasNonLayerViewportConstrainedObjects);
1033 } 1033 }
1034 1034
1035 class StyleRelatedMainThreadScrollingReasonTest 1035 class StyleRelatedMainThreadScrollingReasonTest
1036 : public ScrollingCoordinatorTest { 1036 : public ScrollingCoordinatorTest {
1037 static const uint32_t m_LCDTextRelatedReasons = 1037 static const uint32_t m_LCDTextRelatedReasons =
1038 MainThreadScrollingReason::kHasOpacityAndLCDText | 1038 MainThreadScrollingReason::kHasOpacityAndLCDText |
1039 MainThreadScrollingReason::kHasTransformAndLCDText | 1039 MainThreadScrollingReason::kHasTransformAndLCDText |
1040 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText; 1040 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText |
1041 MainThreadScrollingReason::kHasBoxShadowAndLCDText |
1042 MainThreadScrollingReason::kHasTranslucentBorderAndLCDText;
1043 static const uint32_t m_OpaqueScrollersRelatedReasons =
1044 MainThreadScrollingReason::kHasTranslucentBorderAndLCDText;
1041 1045
1042 protected: 1046 protected:
1043 StyleRelatedMainThreadScrollingReasonTest() { 1047 StyleRelatedMainThreadScrollingReasonTest() {
1044 registerMockedHttpURLLoad("two_scrollable_area.html"); 1048 registerMockedHttpURLLoad("two_scrollable_area.html");
1045 navigateTo(m_baseURL + "two_scrollable_area.html"); 1049 navigateTo(m_baseURL + "two_scrollable_area.html");
1046 } 1050 }
1047 void testStyle(const std::string& target, const uint32_t reason) { 1051 void testStyle(const std::string& target, const uint32_t reason) {
1048 webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(false); 1052 webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(false);
1049 Document* document = frame()->document(); 1053 Document* document = frame()->document();
1050 Element* container = document->getElementById("scroller1"); 1054 Element* container = document->getElementById("scroller1");
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 forceFullCompositingUpdate(); 1086 forceFullCompositingUpdate();
1083 1087
1084 ASSERT_TRUE(frameView->mainThreadScrollingReasons() & reason); 1088 ASSERT_TRUE(frameView->mainThreadScrollingReasons() & reason);
1085 1089
1086 if ((reason & m_LCDTextRelatedReasons) && 1090 if ((reason & m_LCDTextRelatedReasons) &&
1087 !(reason & ~m_LCDTextRelatedReasons)) { 1091 !(reason & ~m_LCDTextRelatedReasons)) {
1088 webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(true); 1092 webViewImpl()->settings()->setPreferCompositingToLCDTextEnabled(true);
1089 forceFullCompositingUpdate(); 1093 forceFullCompositingUpdate();
1090 ASSERT_FALSE(frameView->mainThreadScrollingReasons()); 1094 ASSERT_FALSE(frameView->mainThreadScrollingReasons());
1091 } 1095 }
1096 if ((reason & m_OpaqueScrollersRelatedReasons) &&
1097 !(reason & ~m_OpaqueScrollersRelatedReasons)) {
1098 RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true);
1099 forceFullCompositingUpdate();
1100 ASSERT_FALSE(frameView->mainThreadScrollingReasons());
1101 }
1092 } 1102 }
1093 }; 1103 };
1094 1104
1095 TEST_F(StyleRelatedMainThreadScrollingReasonTest, TransparentTest) { 1105 TEST_F(StyleRelatedMainThreadScrollingReasonTest, TransparentTest) {
1096 testStyle("transparent", MainThreadScrollingReason::kHasOpacityAndLCDText); 1106 testStyle("transparent", MainThreadScrollingReason::kHasOpacityAndLCDText);
1097 } 1107 }
1098 1108
1099 TEST_F(StyleRelatedMainThreadScrollingReasonTest, TransformTest) { 1109 TEST_F(StyleRelatedMainThreadScrollingReasonTest, TransformTest) {
1100 testStyle("transform", MainThreadScrollingReason::kHasTransformAndLCDText); 1110 testStyle("transform", MainThreadScrollingReason::kHasTransformAndLCDText);
1101 } 1111 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 forceFullCompositingUpdate(); 1157 forceFullCompositingUpdate();
1148 ASSERT_FALSE(frameView->mainThreadScrollingReasons() & reason); 1158 ASSERT_FALSE(frameView->mainThreadScrollingReasons() & reason);
1149 } 1159 }
1150 1160
1151 TEST_F(StyleRelatedMainThreadScrollingReasonTest, LCDTextEnabledTest) { 1161 TEST_F(StyleRelatedMainThreadScrollingReasonTest, LCDTextEnabledTest) {
1152 testStyle("transparent border-radius", 1162 testStyle("transparent border-radius",
1153 MainThreadScrollingReason::kHasOpacityAndLCDText | 1163 MainThreadScrollingReason::kHasOpacityAndLCDText |
1154 MainThreadScrollingReason::kHasBorderRadius); 1164 MainThreadScrollingReason::kHasBorderRadius);
1155 } 1165 }
1156 1166
1167 TEST_F(StyleRelatedMainThreadScrollingReasonTest, BoxShadowTest) {
1168 testStyle("box-shadow", MainThreadScrollingReason::kHasBoxShadowAndLCDText);
1169 }
1170
1171 TEST_F(StyleRelatedMainThreadScrollingReasonTest, TranslucentBorderTest) {
1172 RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(false);
1173 testStyle("translucent-border",
1174 MainThreadScrollingReason::kHasTranslucentBorderAndLCDText);
1175 }
1176
1177 TEST_F(StyleRelatedMainThreadScrollingReasonTest, OpaqueScrollersEnabledTest) {
1178 testStyle("translucent-border border-radius",
1179 MainThreadScrollingReason::kHasOpacityAndLCDText |
1180 MainThreadScrollingReason::kHasBorderRadius);
1181 }
1182
1157 } // namespace blink 1183 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698