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

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

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Added SimTest. Created 3 years, 9 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 namespace blink { 43 namespace blink {
44 44
45 class CompositorAnimationHost; 45 class CompositorAnimationHost;
46 class CompositorAnimationTimeline; 46 class CompositorAnimationTimeline;
47 class GraphicsLayer; 47 class GraphicsLayer;
48 class HostWindow; 48 class HostWindow;
49 class LayoutBox; 49 class LayoutBox;
50 class LayoutObject; 50 class LayoutObject;
51 class PaintLayer; 51 class PaintLayer;
52 class ProgrammaticScrollAnimator; 52 class ProgrammaticScrollAnimator;
53 class ProgrammaticScrollCoordinator;
53 struct ScrollAlignment; 54 struct ScrollAlignment;
54 class ScrollAnchor; 55 class ScrollAnchor;
55 class ScrollAnimatorBase; 56 class ScrollAnimatorBase;
56 class CompositorAnimationTimeline; 57 class CompositorAnimationTimeline;
57 58
58 enum IncludeScrollbarsInRect { 59 enum IncludeScrollbarsInRect {
59 ExcludeScrollbars, 60 ExcludeScrollbars,
60 IncludeScrollbars, 61 IncludeScrollbars,
61 }; 62 };
62 63
(...skipping 10 matching lines...) Expand all
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 // The window that hosts the ScrollableArea. The ScrollableArea will 79 // The window that hosts the ScrollableArea. The ScrollableArea will
79 // communicate scrolls and repaints to the host window in the window's 80 // communicate scrolls and repaints to the host window in the window's
80 // coordinate space. 81 // coordinate space.
81 virtual HostWindow* getHostWindow() const { return 0; } 82 virtual HostWindow* getHostWindow() const { return 0; }
82 83
84 virtual ProgrammaticScrollCoordinator* getProgrammaticScrollCoordinator()
bokan 2017/03/28 16:29:53 I don't think this should be part of this class' i
sunyunjia 2017/03/31 15:42:45 When each scrollableArea finishes its scroll, Prog
bokan 2017/03/31 20:30:46 Ah, yes...ScrollableArea is in platform. It's a bi
85 const {
86 return 0;
87 }
88
83 virtual ScrollResult userScroll(ScrollGranularity, const ScrollOffset&); 89 virtual ScrollResult userScroll(ScrollGranularity, const ScrollOffset&);
84 90
85 virtual void setScrollOffset(const ScrollOffset&, 91 virtual void setScrollOffset(const ScrollOffset&,
86 ScrollType, 92 ScrollType,
87 ScrollBehavior = ScrollBehaviorInstant); 93 ScrollBehavior = ScrollBehaviorInstant);
88 virtual void scrollBy(const ScrollOffset&, 94 virtual void scrollBy(const ScrollOffset&,
89 ScrollType, 95 ScrollType,
90 ScrollBehavior = ScrollBehaviorInstant); 96 ScrollBehavior = ScrollBehaviorInstant);
91 void setScrollOffsetSingleAxis(ScrollbarOrientation, 97 void setScrollOffsetSingleAxis(ScrollbarOrientation,
92 float, 98 float,
93 ScrollType, 99 ScrollType,
94 ScrollBehavior = ScrollBehaviorInstant); 100 ScrollBehavior = ScrollBehaviorInstant);
95 101
96 // Scrolls the area so that the given rect, given in the document's content 102 // Scrolls the area so that the given rect, given in the document's content
97 // coordinates, such that it's visible in the area. Returns the new location 103 // coordinates, such that it's visible in the area. Returns the new location
98 // of the input rect relative once again to the document. 104 // of the input rect relative once again to the document.
99 // Note, in the case of a Document container, such as FrameView, the output 105 // Note, in the case of a Document container, such as FrameView, the output
100 // will always be the input rect since scrolling it can't change the location 106 // will always be the input rect since scrolling it can't change the location
101 // of content relative to the document, unlike an overflowing element. 107 // of content relative to the document, unlike an overflowing element.
102 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent, 108 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent,
103 const ScrollAlignment& alignX, 109 const ScrollAlignment& alignX,
104 const ScrollAlignment& alignY, 110 const ScrollAlignment& alignY,
105 ScrollType = ProgrammaticScroll); 111 ScrollType = ProgrammaticScroll,
112 bool isSmooth = false);
106 113
107 static bool scrollBehaviorFromString(const String&, ScrollBehavior&); 114 static bool scrollBehaviorFromString(const String&, ScrollBehavior&);
108 115
109 void contentAreaWillPaint() const; 116 void contentAreaWillPaint() const;
110 void mouseEnteredContentArea() const; 117 void mouseEnteredContentArea() const;
111 void mouseExitedContentArea() const; 118 void mouseExitedContentArea() const;
112 void mouseMovedInContentArea() const; 119 void mouseMovedInContentArea() const;
113 void mouseEnteredScrollbar(Scrollbar&); 120 void mouseEnteredScrollbar(Scrollbar&);
114 void mouseExitedScrollbar(Scrollbar&); 121 void mouseExitedScrollbar(Scrollbar&);
115 void mouseCapturedScrollbar(); 122 void mouseCapturedScrollbar();
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 // vertical-lr / ltr NO NO 456 // vertical-lr / ltr NO NO
450 // vertical-lr / rtl NO YES 457 // vertical-lr / rtl NO YES
451 // vertical-rl / ltr YES NO 458 // vertical-rl / ltr YES NO
452 // vertical-rl / rtl YES YES 459 // vertical-rl / rtl YES YES
453 IntPoint m_scrollOrigin; 460 IntPoint m_scrollOrigin;
454 }; 461 };
455 462
456 } // namespace blink 463 } // namespace blink
457 464
458 #endif // ScrollableArea_h 465 #endif // ScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698