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

Side by Side Diff: third_party/WebKit/Source/platform/scroll/ScrollableArea.h

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Rebase Created 3 years, 7 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) 2008, 2011 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008, 2011 Apple 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class CompositorAnimationTimeline; 46 class CompositorAnimationTimeline;
47 class GraphicsLayer; 47 class GraphicsLayer;
48 class LayoutBox; 48 class LayoutBox;
49 class LayoutObject; 49 class LayoutObject;
50 class PaintLayer; 50 class PaintLayer;
51 class PlatformChromeClient; 51 class PlatformChromeClient;
52 class ProgrammaticScrollAnimator; 52 class ProgrammaticScrollAnimator;
53 struct ScrollAlignment; 53 struct ScrollAlignment;
54 class ScrollAnchor; 54 class ScrollAnchor;
55 class ScrollAnimatorBase; 55 class ScrollAnimatorBase;
56 class SmoothScrollSequencer;
56 class CompositorAnimationTimeline; 57 class CompositorAnimationTimeline;
57 58
58 enum IncludeScrollbarsInRect { 59 enum IncludeScrollbarsInRect {
59 kExcludeScrollbars, 60 kExcludeScrollbars,
60 kIncludeScrollbars, 61 kIncludeScrollbars,
61 }; 62 };
62 63
63 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin, 64 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin,
64 public WebLayerScrollClient { 65 public WebLayerScrollClient {
65 WTF_MAKE_NONCOPYABLE(ScrollableArea); 66 WTF_MAKE_NONCOPYABLE(ScrollableArea);
66 67
67 public: 68 public:
68 static int PixelsPerLineStep(PlatformChromeClient*); 69 static int PixelsPerLineStep(PlatformChromeClient*);
69 static float MinFractionToStepWhenPaging(); 70 static float MinFractionToStepWhenPaging();
70 static int MaxOverlapBetweenPages(); 71 static int MaxOverlapBetweenPages();
71 72
72 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as 73 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as
73 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. 74 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values.
74 static float NormalizeNonFiniteScroll(float value) { 75 static float NormalizeNonFiniteScroll(float value) {
75 return std::isfinite(value) ? value : 0.0; 76 return std::isfinite(value) ? value : 0.0;
76 } 77 }
77 78
78 virtual PlatformChromeClient* GetChromeClient() const { return 0; } 79 virtual PlatformChromeClient* GetChromeClient() const { return 0; }
79 80
81 virtual SmoothScrollSequencer* GetSmoothScrollSequencer() const {
82 return nullptr;
83 }
84
80 virtual ScrollResult UserScroll(ScrollGranularity, const ScrollOffset&); 85 virtual ScrollResult UserScroll(ScrollGranularity, const ScrollOffset&);
81 86
82 virtual void SetScrollOffset(const ScrollOffset&, 87 virtual void SetScrollOffset(const ScrollOffset&,
83 ScrollType, 88 ScrollType,
84 ScrollBehavior = kScrollBehaviorInstant); 89 ScrollBehavior = kScrollBehaviorInstant);
85 virtual void ScrollBy(const ScrollOffset&, 90 virtual void ScrollBy(const ScrollOffset&,
86 ScrollType, 91 ScrollType,
87 ScrollBehavior = kScrollBehaviorInstant); 92 ScrollBehavior = kScrollBehaviorInstant);
88 void SetScrollOffsetSingleAxis(ScrollbarOrientation, 93 void SetScrollOffsetSingleAxis(ScrollbarOrientation,
89 float, 94 float,
90 ScrollType, 95 ScrollType,
91 ScrollBehavior = kScrollBehaviorInstant); 96 ScrollBehavior = kScrollBehaviorInstant);
92 97
93 // Scrolls the area so that the given rect, given in the document's content 98 // Scrolls the area so that the given rect, given in the document's content
94 // coordinates, such that it's visible in the area. Returns the new location 99 // coordinates, such that it's visible in the area. Returns the new location
95 // of the input rect relative once again to the document. 100 // of the input rect relative once again to the document.
96 // Note, in the case of a Document container, such as FrameView, the output 101 // Note, in the case of a Document container, such as FrameView, the output
97 // will always be the input rect since scrolling it can't change the location 102 // will always be the input rect since scrolling it can't change the location
98 // of content relative to the document, unlike an overflowing element. 103 // of content relative to the document, unlike an overflowing element.
99 virtual LayoutRect ScrollIntoView(const LayoutRect& rect_in_content, 104 virtual LayoutRect ScrollIntoView(const LayoutRect& rect_in_content,
100 const ScrollAlignment& align_x, 105 const ScrollAlignment& align_x,
101 const ScrollAlignment& align_y, 106 const ScrollAlignment& align_y,
102 ScrollType = kProgrammaticScroll); 107 ScrollType = kProgrammaticScroll,
108 bool is_smooth = false);
bokan 2017/05/15 17:15:28 This has few enough callers, and you always pass i
sunyunjia 2017/05/19 16:24:29 Done.
103 109
104 static bool ScrollBehaviorFromString(const String&, ScrollBehavior&); 110 static bool ScrollBehaviorFromString(const String&, ScrollBehavior&);
105 111
106 void ContentAreaWillPaint() const; 112 void ContentAreaWillPaint() const;
107 void MouseEnteredContentArea() const; 113 void MouseEnteredContentArea() const;
108 void MouseExitedContentArea() const; 114 void MouseExitedContentArea() const;
109 void MouseMovedInContentArea() const; 115 void MouseMovedInContentArea() const;
110 void MouseEnteredScrollbar(Scrollbar&); 116 void MouseEnteredScrollbar(Scrollbar&);
111 void MouseExitedScrollbar(Scrollbar&); 117 void MouseExitedScrollbar(Scrollbar&);
112 void MouseCapturedScrollbar(); 118 void MouseCapturedScrollbar();
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 // vertical-lr / ltr NO NO 456 // vertical-lr / ltr NO NO
451 // vertical-lr / rtl NO YES 457 // vertical-lr / rtl NO YES
452 // vertical-rl / ltr YES NO 458 // vertical-rl / ltr YES NO
453 // vertical-rl / rtl YES YES 459 // vertical-rl / rtl YES YES
454 IntPoint scroll_origin_; 460 IntPoint scroll_origin_;
455 }; 461 };
456 462
457 } // namespace blink 463 } // namespace blink
458 464
459 #endif // ScrollableArea_h 465 #endif // ScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698