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

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

Issue 2005193005: Disable fractional scroll feature by default (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@layout-test-fix
Patch Set: Fix tests Created 4 years, 6 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 // Main scrolling should be enabled with the setting override. 147 // Main scrolling should be enabled with the setting override.
148 WebLayer* rootScrollLayer = getRootScrollLayer(); 148 WebLayer* rootScrollLayer = getRootScrollLayer();
149 ASSERT_TRUE(rootScrollLayer->scrollable()); 149 ASSERT_TRUE(rootScrollLayer->scrollable());
150 ASSERT_TRUE(rootScrollLayer->shouldScrollOnMainThread()); 150 ASSERT_TRUE(rootScrollLayer->shouldScrollOnMainThread());
151 } 151 }
152 152
153 153
154 TEST_F(ScrollingCoordinatorTest, fastFractionalScrollingDiv) 154 TEST_F(ScrollingCoordinatorTest, fastFractionalScrollingDiv)
155 { 155 {
156 bool origFractionalOffsetsEnabled = RuntimeEnabledFeatures::fractionalScroll OffsetsEnabled();
157 RuntimeEnabledFeatures::setFractionalScrollOffsetsEnabled(true);
158
156 registerMockedHttpURLLoad("fractional-scroll-div.html"); 159 registerMockedHttpURLLoad("fractional-scroll-div.html");
157 navigateTo(m_baseURL + "fractional-scroll-div.html"); 160 navigateTo(m_baseURL + "fractional-scroll-div.html");
158 forceFullCompositingUpdate(); 161 forceFullCompositingUpdate();
159 162
160 Document* document = frame()->document(); 163 Document* document = frame()->document();
161 Element* scrollableElement = document->getElementById("scroller"); 164 Element* scrollableElement = document->getElementById("scroller");
162 DCHECK(scrollableElement); 165 DCHECK(scrollableElement);
163 166
164 scrollableElement->setScrollTop(1.0); 167 scrollableElement->setScrollTop(1.0);
165 scrollableElement->setScrollLeft(1.0); 168 scrollableElement->setScrollLeft(1.0);
166 forceFullCompositingUpdate(); 169 forceFullCompositingUpdate();
167 170
168 // Make sure the fractional scroll offset change 1.0 -> 1.2 gets propagated 171 // Make sure the fractional scroll offset change 1.0 -> 1.2 gets propagated
169 // to compositor. 172 // to compositor.
170 scrollableElement->setScrollTop(1.2); 173 scrollableElement->setScrollTop(1.2);
171 scrollableElement->setScrollLeft(1.2); 174 scrollableElement->setScrollLeft(1.2);
172 forceFullCompositingUpdate(); 175 forceFullCompositingUpdate();
173 176
174 LayoutObject* layoutObject = scrollableElement->layoutObject(); 177 LayoutObject* layoutObject = scrollableElement->layoutObject();
175 ASSERT_TRUE(layoutObject->isBox()); 178 ASSERT_TRUE(layoutObject->isBox());
176 LayoutBox* box = toLayoutBox(layoutObject); 179 LayoutBox* box = toLayoutBox(layoutObject);
177 ASSERT_TRUE(box->usesCompositedScrolling()); 180 ASSERT_TRUE(box->usesCompositedScrolling());
178 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping(); 181 CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLay erMapping();
179 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer()); 182 ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
180 DCHECK(compositedLayerMapping->scrollingContentsLayer()); 183 DCHECK(compositedLayerMapping->scrollingContentsLayer());
181 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()- >platformLayer(); 184 WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()- >platformLayer();
182 ASSERT_TRUE(webScrollLayer); 185 ASSERT_TRUE(webScrollLayer);
183 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().x, 0.01); 186 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().x, 0.01);
184 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01); 187 ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01);
188
189 RuntimeEnabledFeatures::setFractionalScrollOffsetsEnabled(origFractionalOffs etsEnabled);
185 } 190 }
186 191
187 static WebLayer* webLayerFromElement(Element* element) 192 static WebLayer* webLayerFromElement(Element* element)
188 { 193 {
189 if (!element) 194 if (!element)
190 return 0; 195 return 0;
191 LayoutObject* layoutObject = element->layoutObject(); 196 LayoutObject* layoutObject = element->layoutObject();
192 if (!layoutObject || !layoutObject->isBoxModelObject()) 197 if (!layoutObject || !layoutObject->isBoxModelObject())
193 return 0; 198 return 0;
194 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer(); 199 PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread()); 629 EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread());
625 630
626 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone); 631 fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone);
627 forceFullCompositingUpdate(); 632 forceFullCompositingUpdate();
628 633
629 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l ayer()->hasCompositedLayerMapping()); 634 EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->l ayer()->hasCompositedLayerMapping());
630 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread()); 635 EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread());
631 } 636 }
632 637
633 } // namespace blink 638 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698