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

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

Issue 2650343008: Implement Element.scrollIntoView for scroll-behavior: smooth. (Closed)
Patch Set: Created 3 years, 10 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 namespace blink { 42 namespace blink {
43 43
44 class CompositorAnimationHost; 44 class CompositorAnimationHost;
45 class CompositorAnimationTimeline; 45 class CompositorAnimationTimeline;
46 class GraphicsLayer; 46 class GraphicsLayer;
47 class HostWindow; 47 class HostWindow;
48 class LayoutBox; 48 class LayoutBox;
49 class LayoutObject; 49 class LayoutObject;
50 class PaintLayer; 50 class PaintLayer;
51 class ProgrammaticScrollAnimator; 51 class ProgrammaticScrollAnimator;
52 class ProgrammaticScrollCoordinator;
52 struct ScrollAlignment; 53 struct ScrollAlignment;
53 class ScrollAnchor; 54 class ScrollAnchor;
54 class ScrollAnimatorBase; 55 class ScrollAnimatorBase;
55 class CompositorAnimationTimeline; 56 class CompositorAnimationTimeline;
56 57
57 enum IncludeScrollbarsInRect { 58 enum IncludeScrollbarsInRect {
58 ExcludeScrollbars, 59 ExcludeScrollbars,
59 IncludeScrollbars, 60 IncludeScrollbars,
60 }; 61 };
61 62
62 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin { 63 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
63 WTF_MAKE_NONCOPYABLE(ScrollableArea); 64 WTF_MAKE_NONCOPYABLE(ScrollableArea);
64 65
65 public: 66 public:
66 static int pixelsPerLineStep(HostWindow*); 67 static int pixelsPerLineStep(HostWindow*);
67 static float minFractionToStepWhenPaging(); 68 static float minFractionToStepWhenPaging();
68 static int maxOverlapBetweenPages(); 69 static int maxOverlapBetweenPages();
69 70
70 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as 71 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as
71 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. 72 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values.
72 static float normalizeNonFiniteScroll(float value) { 73 static float normalizeNonFiniteScroll(float value) {
73 return std::isfinite(value) ? value : 0.0; 74 return std::isfinite(value) ? value : 0.0;
74 } 75 }
75 76
76 // The window that hosts the ScrollableArea. The ScrollableArea will 77 // The window that hosts the ScrollableArea. The ScrollableArea will
77 // communicate scrolls and repaints to the host window in the window's 78 // communicate scrolls and repaints to the host window in the window's
78 // coordinate space. 79 // coordinate space.
79 virtual HostWindow* getHostWindow() const { return 0; } 80 virtual HostWindow* getHostWindow() const { return 0; }
80 81
82 virtual ProgrammaticScrollCoordinator* getProgrammaticScrollCoordinator()
83 const {
84 return 0;
85 }
86
81 virtual ScrollResult userScroll(ScrollGranularity, const ScrollOffset&); 87 virtual ScrollResult userScroll(ScrollGranularity, const ScrollOffset&);
82 88
83 virtual void setScrollOffset(const ScrollOffset&, 89 virtual void setScrollOffset(const ScrollOffset&,
84 ScrollType, 90 ScrollType,
85 ScrollBehavior = ScrollBehaviorInstant); 91 ScrollBehavior = ScrollBehaviorInstant);
86 virtual void scrollBy(const ScrollOffset&, 92 virtual void scrollBy(const ScrollOffset&,
87 ScrollType, 93 ScrollType,
88 ScrollBehavior = ScrollBehaviorInstant); 94 ScrollBehavior = ScrollBehaviorInstant);
89 void setScrollOffsetSingleAxis(ScrollbarOrientation, 95 void setScrollOffsetSingleAxis(ScrollbarOrientation,
90 float, 96 float,
91 ScrollType, 97 ScrollType,
92 ScrollBehavior = ScrollBehaviorInstant); 98 ScrollBehavior = ScrollBehaviorInstant);
93 99
94 // Scrolls the area so that the given rect, given in the document's content 100 // Scrolls the area so that the given rect, given in the document's content
95 // coordinates, such that it's visible in the area. Returns the new location 101 // coordinates, such that it's visible in the area. Returns the new location
96 // of the input rect relative once again to the document. 102 // of the input rect relative once again to the document.
97 // Note, in the case of a Document container, such as FrameView, the output 103 // Note, in the case of a Document container, such as FrameView, the output
98 // will always be the input rect since scrolling it can't change the location 104 // will always be the input rect since scrolling it can't change the location
99 // of content relative to the document, unlike an overflowing element. 105 // of content relative to the document, unlike an overflowing element.
100 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent, 106 virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent,
101 const ScrollAlignment& alignX, 107 const ScrollAlignment& alignX,
102 const ScrollAlignment& alignY, 108 const ScrollAlignment& alignY,
103 ScrollType = ProgrammaticScroll); 109 ScrollType = ProgrammaticScroll,
110 ScrollBehavior = ScrollBehaviorAuto);
104 111
105 // Returns a rect, in the space of the area's backing graphics layer, that 112 // Returns a rect, in the space of the area's backing graphics layer, that
106 // contains the visual region of all scrollbar parts. 113 // contains the visual region of all scrollbar parts.
107 virtual LayoutRect visualRectForScrollbarParts() const = 0; 114 virtual LayoutRect visualRectForScrollbarParts() const = 0;
108 115
109 static bool scrollBehaviorFromString(const String&, ScrollBehavior&); 116 static bool scrollBehaviorFromString(const String&, ScrollBehavior&);
110 117
111 void contentAreaWillPaint() const; 118 void contentAreaWillPaint() const;
112 void mouseEnteredContentArea() const; 119 void mouseEnteredContentArea() const;
113 void mouseExitedContentArea() const; 120 void mouseExitedContentArea() const;
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 // vertical-lr / ltr NO NO 453 // vertical-lr / ltr NO NO
447 // vertical-lr / rtl NO YES 454 // vertical-lr / rtl NO YES
448 // vertical-rl / ltr YES NO 455 // vertical-rl / ltr YES NO
449 // vertical-rl / rtl YES YES 456 // vertical-rl / rtl YES YES
450 IntPoint m_scrollOrigin; 457 IntPoint m_scrollOrigin;
451 }; 458 };
452 459
453 } // namespace blink 460 } // namespace blink
454 461
455 #endif // ScrollableArea_h 462 #endif // ScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698