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

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

Issue 2942673002: Revert of "Find" scrolling should be smoothly animated. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/ScrollIntoViewOptionsOrBoolean.h" 5 #include "bindings/core/v8/ScrollIntoViewOptionsOrBoolean.h"
6 #include "core/dom/Range.h"
7 #include "core/editing/Editor.h"
8 #include "core/editing/TextFinder.h"
9 #include "core/frame/ScrollIntoViewOptions.h" 6 #include "core/frame/ScrollIntoViewOptions.h"
10 #include "core/frame/ScrollToOptions.h" 7 #include "core/frame/ScrollToOptions.h"
11 #include "public/web/WebScriptSource.h" 8 #include "public/web/WebScriptSource.h"
12 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
13 #include "web/WebLocalFrameImpl.h" 10 #include "web/WebLocalFrameImpl.h"
14 #include "web/tests/sim/SimCompositor.h" 11 #include "web/tests/sim/SimCompositor.h"
15 #include "web/tests/sim/SimDisplayItemList.h" 12 #include "web/tests/sim/SimDisplayItemList.h"
16 #include "web/tests/sim/SimRequest.h" 13 #include "web/tests/sim/SimRequest.h"
17 #include "web/tests/sim/SimTest.h" 14 #include "web/tests/sim/SimTest.h"
18 15
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 options.setBlock("end"); 276 options.setBlock("end");
280 options.setInlinePosition("end"); 277 options.setInlinePosition("end");
281 arg4.setScrollIntoViewOptions(options); 278 arg4.setScrollIntoViewOptions(options);
282 content->scrollIntoView(arg4); 279 content->scrollIntoView(arg4);
283 ASSERT_EQ(Window().scrollX(), 280 ASSERT_EQ(Window().scrollX(),
284 content->OffsetLeft() + content_width - window_width); 281 content->OffsetLeft() + content_width - window_width);
285 ASSERT_EQ(Window().scrollY(), 282 ASSERT_EQ(Window().scrollY(),
286 content->OffsetTop() + content_height - window_height); 283 content->OffsetTop() + content_height - window_height);
287 } 284 }
288 285
289 TEST_F(SmoothScrollTest, FindTriggersSmoothScroll) {
290 v8::HandleScope HandleScope(v8::Isolate::GetCurrent());
291 WebView().Resize(WebSize(800, 600));
292 SimRequest request("https://example.com/test.html", "text/html");
293 LoadURL("https://example.com/test.html");
294 request.Complete(
295 "<div id='space' style='height: 2000px'></div>"
296 "<div id='content' style='height: 2000px'>text</div>");
297
298 Range* range = GetDocument().createRange();
299 MainFrame().GetFrame()->GetEditor().FindStringAndScrollToVisible(
300 "text", range, kCaseInsensitive);
301
302 // Scrolling the container
303 Compositor().BeginFrame(); // update run_state_.
304 Compositor().BeginFrame(); // Set start_time = now.
305 Compositor().BeginFrame(0.2);
306 ASSERT_EQ(Window().scrollY(), 299);
307
308 // Finish scrolling the container
309 Compositor().BeginFrame(1);
310 ASSERT_EQ(Window().scrollY(), 1708);
311 }
312
313 } // namespace 286 } // namespace
314 287
315 } // namespace blink 288 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698