Chromium Code Reviews| 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 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1127 TestNonCompositedReasons("transform", | 1127 TestNonCompositedReasons("transform", |
| 1128 MainThreadScrollingReason::kHasTransformAndLCDText); | 1128 MainThreadScrollingReason::kHasTransformAndLCDText); |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 TEST_P(NonCompositedMainThreadScrollingReasonTest, BackgroundNotOpaqueTest) { | 1131 TEST_P(NonCompositedMainThreadScrollingReasonTest, BackgroundNotOpaqueTest) { |
| 1132 TestNonCompositedReasons( | 1132 TestNonCompositedReasons( |
| 1133 "background-not-opaque", | 1133 "background-not-opaque", |
| 1134 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText); | 1134 MainThreadScrollingReason::kBackgroundNotOpaqueInRectAndLCDText); |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 TEST_P(NonCompositedMainThreadScrollingReasonTest, BorderRadiusTest) { | |
| 1138 TestNonCompositedReasons("border-radius", | |
| 1139 MainThreadScrollingReason::kHasBorderRadius); | |
| 1140 } | |
| 1141 | |
| 1142 TEST_P(NonCompositedMainThreadScrollingReasonTest, ClipTest) { | 1137 TEST_P(NonCompositedMainThreadScrollingReasonTest, ClipTest) { |
| 1143 TestNonCompositedReasons("clip", | 1138 TestNonCompositedReasons("clip", |
| 1144 MainThreadScrollingReason::kHasClipRelatedProperty); | 1139 MainThreadScrollingReason::kHasClipRelatedProperty); |
| 1145 } | 1140 } |
| 1146 | 1141 |
| 1147 TEST_P(NonCompositedMainThreadScrollingReasonTest, ClipPathTest) { | 1142 TEST_P(NonCompositedMainThreadScrollingReasonTest, ClipPathTest) { |
| 1148 uint32_t clip_reason = MainThreadScrollingReason::kHasClipRelatedProperty; | 1143 uint32_t clip_reason = MainThreadScrollingReason::kHasClipRelatedProperty; |
| 1149 GetWebView()->GetSettings()->SetPreferCompositingToLCDTextEnabled(false); | 1144 GetWebView()->GetSettings()->SetPreferCompositingToLCDTextEnabled(false); |
| 1150 Document* document = GetFrame()->GetDocument(); | 1145 Document* document = GetFrame()->GetDocument(); |
| 1151 // Test ancestor with ClipPath | 1146 // Test ancestor with ClipPath |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1187 | 1182 |
| 1188 // Remove clip path from descendant. | 1183 // Remove clip path from descendant. |
| 1189 element->removeAttribute(HTMLNames::styleAttr); | 1184 element->removeAttribute(HTMLNames::styleAttr); |
| 1190 ForceFullCompositingUpdate(); | 1185 ForceFullCompositingUpdate(); |
| 1191 EXPECT_FALSE(scrollable_area->GetNonCompositedMainThreadScrollingReasons() & | 1186 EXPECT_FALSE(scrollable_area->GetNonCompositedMainThreadScrollingReasons() & |
| 1192 clip_reason); | 1187 clip_reason); |
| 1193 EXPECT_FALSE(frame_view->GetMainThreadScrollingReasons() & clip_reason); | 1188 EXPECT_FALSE(frame_view->GetMainThreadScrollingReasons() & clip_reason); |
| 1194 } | 1189 } |
| 1195 | 1190 |
| 1196 TEST_P(NonCompositedMainThreadScrollingReasonTest, LCDTextEnabledTest) { | 1191 TEST_P(NonCompositedMainThreadScrollingReasonTest, LCDTextEnabledTest) { |
| 1197 TestNonCompositedReasons("transparent border-radius", | 1192 TestNonCompositedReasons("transparent", |
| 1198 MainThreadScrollingReason::kHasOpacityAndLCDText | | 1193 MainThreadScrollingReason::kHasOpacityAndLCDText); |
| 1199 MainThreadScrollingReason::kHasBorderRadius); | |
| 1200 } | 1194 } |
| 1201 | 1195 |
| 1202 TEST_P(NonCompositedMainThreadScrollingReasonTest, BoxShadowTest) { | 1196 TEST_P(NonCompositedMainThreadScrollingReasonTest, BoxShadowTest) { |
| 1203 TestNonCompositedReasons( | 1197 TestNonCompositedReasons( |
| 1204 "box-shadow", MainThreadScrollingReason::kHasBoxShadowFromNonRootLayer); | 1198 "box-shadow", MainThreadScrollingReason::kHasBoxShadowFromNonRootLayer); |
| 1205 } | 1199 } |
| 1206 | 1200 |
| 1207 TEST_P(NonCompositedMainThreadScrollingReasonTest, StackingContextTest) { | 1201 TEST_P(NonCompositedMainThreadScrollingReasonTest, StackingContextTest) { |
| 1208 GetWebView()->GetSettings()->SetPreferCompositingToLCDTextEnabled(false); | 1202 GetWebView()->GetSettings()->SetPreferCompositingToLCDTextEnabled(false); |
| 1209 | 1203 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1244 Element* container = document->getElementById("scroller1"); | 1238 Element* container = document->getElementById("scroller1"); |
| 1245 ASSERT_TRUE(container); | 1239 ASSERT_TRUE(container); |
| 1246 container->setAttribute("class", "composited transparent", | 1240 container->setAttribute("class", "composited transparent", |
| 1247 ASSERT_NO_EXCEPTION); | 1241 ASSERT_NO_EXCEPTION); |
| 1248 ForceFullCompositingUpdate(); | 1242 ForceFullCompositingUpdate(); |
| 1249 | 1243 |
| 1250 PaintLayerScrollableArea* scrollable_area = | 1244 PaintLayerScrollableArea* scrollable_area = |
| 1251 ToLayoutBoxModelObject(container->GetLayoutObject())->GetScrollableArea(); | 1245 ToLayoutBoxModelObject(container->GetLayoutObject())->GetScrollableArea(); |
| 1252 ASSERT_TRUE(scrollable_area); | 1246 ASSERT_TRUE(scrollable_area); |
| 1253 EXPECT_FALSE(scrollable_area->GetNonCompositedMainThreadScrollingReasons()); | 1247 EXPECT_FALSE(scrollable_area->GetNonCompositedMainThreadScrollingReasons()); |
| 1254 | |
| 1255 Element* container2 = document->getElementById("scroller2"); | |
|
chrishtr
2017/06/16 22:34:34
Please add a unittest here that it *does* composit
sunxd
2017/06/20 14:36:10
Done.
| |
| 1256 ASSERT_TRUE(container2); | |
| 1257 container2->setAttribute("class", "composited border-radius", | |
| 1258 ASSERT_NO_EXCEPTION); | |
| 1259 ForceFullCompositingUpdate(); | |
| 1260 PaintLayerScrollableArea* scrollable_area2 = | |
| 1261 ToLayoutBoxModelObject(container2->GetLayoutObject()) | |
| 1262 ->GetScrollableArea(); | |
| 1263 ASSERT_TRUE(scrollable_area2); | |
| 1264 EXPECT_TRUE(scrollable_area2->GetNonCompositedMainThreadScrollingReasons() & | |
| 1265 MainThreadScrollingReason::kHasBorderRadius); | |
| 1266 } | 1248 } |
| 1267 | 1249 |
| 1268 } // namespace blink | 1250 } // namespace blink |
| OLD | NEW |