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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2935813002: "Find" scrolling should be smoothly animated. (Closed)
Patch Set: Rebase and set ScrollRectToVisibleRecursive() to private. 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc.
7 * All rights reserved. 7 * All rights reserved.
8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 8 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 return false; 644 return false;
645 } 645 }
646 646
647 void LayoutBox::ScrollRectToVisible(const LayoutRect& rect, 647 void LayoutBox::ScrollRectToVisible(const LayoutRect& rect,
648 const ScrollAlignment& align_x, 648 const ScrollAlignment& align_x,
649 const ScrollAlignment& align_y, 649 const ScrollAlignment& align_y,
650 ScrollType scroll_type, 650 ScrollType scroll_type,
651 bool make_visible_in_visual_viewport, 651 bool make_visible_in_visual_viewport,
652 ScrollBehavior scroll_behavior) { 652 ScrollBehavior scroll_behavior) {
653 SmoothScrollSequencer* sequencer =
654 GetFrame()->GetPage()->GetSmoothScrollSequencer();
655 sequencer->AbortAnimations();
656 ScrollRectToVisibleRecursive(rect, align_x, align_y, scroll_type,
657 make_visible_in_visual_viewport,
658 scroll_behavior);
659 if (scroll_behavior == kScrollBehaviorSmooth)
660 sequencer->RunQueuedAnimations();
661 }
662
663 void LayoutBox::ScrollRectToVisibleRecursive(
664 const LayoutRect& rect,
665 const ScrollAlignment& align_x,
666 const ScrollAlignment& align_y,
667 ScrollType scroll_type,
668 bool make_visible_in_visual_viewport,
669 ScrollBehavior scroll_behavior) {
653 DCHECK(scroll_type == kProgrammaticScroll || scroll_type == kUserScroll); 670 DCHECK(scroll_type == kProgrammaticScroll || scroll_type == kUserScroll);
654 // Presumably the same issue as in setScrollTop. See crbug.com/343132. 671 // Presumably the same issue as in setScrollTop. See crbug.com/343132.
655 DisableCompositingQueryAsserts disabler; 672 DisableCompositingQueryAsserts disabler;
656 673
657 LayoutRect rect_to_scroll = rect; 674 LayoutRect rect_to_scroll = rect;
658 if (rect_to_scroll.Width() <= 0) 675 if (rect_to_scroll.Width() <= 0)
659 rect_to_scroll.SetWidth(LayoutUnit(1)); 676 rect_to_scroll.SetWidth(LayoutUnit(1));
660 if (rect_to_scroll.Height() <= 0) 677 if (rect_to_scroll.Height() <= 0)
661 rect_to_scroll.SetHeight(LayoutUnit(1)); 678 rect_to_scroll.SetHeight(LayoutUnit(1));
662 679
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 // scroll the parent. 734 // scroll the parent.
718 if (Style()->GetPosition() == EPosition::kFixed && 735 if (Style()->GetPosition() == EPosition::kFixed &&
719 ContainerForFixedPosition() == View()) { 736 ContainerForFixedPosition() == View()) {
720 return; 737 return;
721 } 738 }
722 739
723 if (GetFrame()->GetPage()->GetAutoscrollController().AutoscrollInProgress()) 740 if (GetFrame()->GetPage()->GetAutoscrollController().AutoscrollInProgress())
724 parent_box = EnclosingScrollableBox(); 741 parent_box = EnclosingScrollableBox();
725 742
726 if (parent_box) { 743 if (parent_box) {
727 parent_box->ScrollRectToVisible(new_rect, align_x, align_y, scroll_type, 744 parent_box->ScrollRectToVisibleRecursive(
728 make_visible_in_visual_viewport, 745 new_rect, align_x, align_y, scroll_type,
729 scroll_behavior); 746 make_visible_in_visual_viewport, scroll_behavior);
730 } 747 }
731 } 748 }
732 749
733 void LayoutBox::AbsoluteRects(Vector<IntRect>& rects, 750 void LayoutBox::AbsoluteRects(Vector<IntRect>& rects,
734 const LayoutPoint& accumulated_offset) const { 751 const LayoutPoint& accumulated_offset) const {
735 rects.push_back(PixelSnappedIntRect(accumulated_offset, Size())); 752 rects.push_back(PixelSnappedIntRect(accumulated_offset, Size()));
736 } 753 }
737 754
738 void LayoutBox::AbsoluteQuads(Vector<FloatQuad>& quads, 755 void LayoutBox::AbsoluteQuads(Vector<FloatQuad>& quads,
739 MapCoordinatesFlags mode) const { 756 MapCoordinatesFlags mode) const {
(...skipping 5203 matching lines...) Expand 10 before | Expand all | Expand 10 after
5943 void LayoutBox::MutableForPainting:: 5960 void LayoutBox::MutableForPainting::
5944 SavePreviousContentBoxSizeAndLayoutOverflowRect() { 5961 SavePreviousContentBoxSizeAndLayoutOverflowRect() {
5945 auto& rare_data = GetLayoutBox().EnsureRareData(); 5962 auto& rare_data = GetLayoutBox().EnsureRareData();
5946 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true; 5963 rare_data.has_previous_content_box_size_and_layout_overflow_rect_ = true;
5947 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size(); 5964 rare_data.previous_content_box_size_ = GetLayoutBox().ContentBoxRect().Size();
5948 rare_data.previous_layout_overflow_rect_ = 5965 rare_data.previous_layout_overflow_rect_ =
5949 GetLayoutBox().LayoutOverflowRect(); 5966 GetLayoutBox().LayoutOverflowRect();
5950 } 5967 }
5951 5968
5952 } // namespace blink 5969 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/web/tests/SmoothScrollTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698