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

Side by Side Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 2935813002: "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 | « no previous file | third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 1608
1609 Range* Editor::FindStringAndScrollToVisible(const String& target, 1609 Range* Editor::FindStringAndScrollToVisible(const String& target,
1610 Range* previous_match, 1610 Range* previous_match,
1611 FindOptions options) { 1611 FindOptions options) {
1612 Range* next_match = FindRangeOfString( 1612 Range* next_match = FindRangeOfString(
1613 target, EphemeralRangeInFlatTree(previous_match), options); 1613 target, EphemeralRangeInFlatTree(previous_match), options);
1614 if (!next_match) 1614 if (!next_match)
1615 return nullptr; 1615 return nullptr;
1616 1616
1617 Node* first_node = next_match->FirstNode(); 1617 Node* first_node = next_match->FirstNode();
1618 first_node->GetLayoutObject()->ScrollRectToVisible( 1618 first_node->GetDocument()
bokan 2017/06/13 01:48:08 This leaks too many details of how smooth scroll a
sunyunjia 2017/06/13 17:45:11 Done.
1619 LayoutRect(next_match->BoundingBox()), 1619 .GetPage()
1620 ScrollAlignment::kAlignCenterIfNeeded, 1620 ->GetSmoothScrollSequencer()
1621 ScrollAlignment::kAlignCenterIfNeeded, kUserScroll); 1621 ->AbortAnimations();
sunyunjia 2017/06/12 21:17:57 Not sure why this was kUserScroll. Perhaps we shou
bokan 2017/06/13 01:48:08 Acknowledged.
1622 if (RuntimeEnabledFeatures::CSSOMSmoothScrollEnabled()) {
bokan 2017/06/13 01:48:08 This has no web-facing consequences so there's no
sunyunjia 2017/06/13 17:45:11 Done.
1623 first_node->GetLayoutObject()->ScrollRectToVisible(
1624 LayoutRect(next_match->BoundingBox()),
1625 ScrollAlignment::kAlignCenterIfNeeded,
1626 ScrollAlignment::kAlignCenterIfNeeded, kProgrammaticScroll, true,
1627 kScrollBehaviorSmooth);
1628 first_node->GetDocument()
1629 .GetPage()
1630 ->GetSmoothScrollSequencer()
1631 ->RunQueuedAnimations();
1632 } else {
1633 first_node->GetLayoutObject()->ScrollRectToVisible(
1634 LayoutRect(next_match->BoundingBox()),
1635 ScrollAlignment::kAlignCenterIfNeeded,
1636 ScrollAlignment::kAlignCenterIfNeeded, kUserScroll);
1637 }
1622 first_node->GetDocument().SetSequentialFocusNavigationStartingPoint( 1638 first_node->GetDocument().SetSequentialFocusNavigationStartingPoint(
1623 first_node); 1639 first_node);
1624 1640
1625 return next_match; 1641 return next_match;
1626 } 1642 }
1627 1643
1628 // TODO(yosin) We should return |EphemeralRange| rather than |Range|. We use 1644 // TODO(yosin) We should return |EphemeralRange| rather than |Range|. We use
1629 // |Range| object for checking whether start and end position crossing shadow 1645 // |Range| object for checking whether start and end position crossing shadow
1630 // boundaries, however we can do it without |Range| object. 1646 // boundaries, however we can do it without |Range| object.
1631 template <typename Strategy> 1647 template <typename Strategy>
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 1857
1842 DEFINE_TRACE(Editor) { 1858 DEFINE_TRACE(Editor) {
1843 visitor->Trace(frame_); 1859 visitor->Trace(frame_);
1844 visitor->Trace(last_edit_command_); 1860 visitor->Trace(last_edit_command_);
1845 visitor->Trace(undo_stack_); 1861 visitor->Trace(undo_stack_);
1846 visitor->Trace(mark_); 1862 visitor->Trace(mark_);
1847 visitor->Trace(typing_style_); 1863 visitor->Trace(typing_style_);
1848 } 1864 }
1849 1865
1850 } // namespace blink 1866 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698