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

Side by Side Diff: Source/core/rendering/RenderLayerScrollableArea.h

Issue 610423004: Preserve fractional scroll offset for JS scrolling API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 6 years, 2 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) 2003, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE; 84 virtual void invalidateScrollCornerRect(const IntRect&) OVERRIDE;
85 virtual bool isActive() const OVERRIDE; 85 virtual bool isActive() const OVERRIDE;
86 virtual bool isScrollCornerVisible() const OVERRIDE; 86 virtual bool isScrollCornerVisible() const OVERRIDE;
87 virtual IntRect scrollCornerRect() const OVERRIDE; 87 virtual IntRect scrollCornerRect() const OVERRIDE;
88 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const OVERRIDE; 88 virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const OVERRIDE;
89 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const OVERRIDE; 89 virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const OVERRIDE;
90 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons t IntPoint&) const OVERRIDE; 90 virtual IntPoint convertFromScrollbarToContainingView(const Scrollbar*, cons t IntPoint&) const OVERRIDE;
91 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons t IntPoint&) const OVERRIDE; 91 virtual IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, cons t IntPoint&) const OVERRIDE;
92 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE; 92 virtual int scrollSize(ScrollbarOrientation) const OVERRIDE;
93 virtual void setScrollOffset(const IntPoint&) OVERRIDE; 93 virtual void setScrollOffset(const IntPoint&) OVERRIDE;
94 virtual void setScrollOffset(const DoublePoint&) OVERRIDE;
94 virtual IntPoint scrollPosition() const OVERRIDE; 95 virtual IntPoint scrollPosition() const OVERRIDE;
96 virtual DoublePoint scrollPositionDouble() const OVERRIDE;
95 virtual IntPoint minimumScrollPosition() const OVERRIDE; 97 virtual IntPoint minimumScrollPosition() const OVERRIDE;
96 virtual IntPoint maximumScrollPosition() const OVERRIDE; 98 virtual IntPoint maximumScrollPosition() const OVERRIDE;
97 virtual IntRect visibleContentRect(IncludeScrollbarsInRect) const OVERRIDE; 99 virtual IntRect visibleContentRect(IncludeScrollbarsInRect) const OVERRIDE;
98 virtual int visibleHeight() const OVERRIDE; 100 virtual int visibleHeight() const OVERRIDE;
99 virtual int visibleWidth() const OVERRIDE; 101 virtual int visibleWidth() const OVERRIDE;
100 virtual IntSize contentsSize() const OVERRIDE; 102 virtual IntSize contentsSize() const OVERRIDE;
101 virtual IntSize overhangAmount() const OVERRIDE; 103 virtual IntSize overhangAmount() const OVERRIDE;
102 virtual IntPoint lastKnownMousePosition() const OVERRIDE; 104 virtual IntPoint lastKnownMousePosition() const OVERRIDE;
103 virtual bool shouldSuspendScrollAnimations() const OVERRIDE; 105 virtual bool shouldSuspendScrollAnimations() const OVERRIDE;
104 virtual bool scrollbarsCanBeActive() const OVERRIDE; 106 virtual bool scrollbarsCanBeActive() const OVERRIDE;
105 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE; 107 virtual IntRect scrollableAreaBoundingBox() const OVERRIDE;
106 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE; 108 virtual bool userInputScrollable(ScrollbarOrientation) const OVERRIDE;
107 virtual bool shouldPlaceVerticalScrollbarOnLeft() const OVERRIDE; 109 virtual bool shouldPlaceVerticalScrollbarOnLeft() const OVERRIDE;
108 virtual int pageStep(ScrollbarOrientation) const OVERRIDE; 110 virtual int pageStep(ScrollbarOrientation) const OVERRIDE;
109 111
110 int scrollXOffset() const { return m_scrollOffset.width() + scrollOrigin().x (); } 112 double scrollXOffset() const { return m_scrollOffset.width() + scrollOrigin( ).x(); }
111 int scrollYOffset() const { return m_scrollOffset.height() + scrollOrigin(). y(); } 113 double scrollYOffset() const { return m_scrollOffset.height() + scrollOrigin ().y(); }
112 114
113 IntSize scrollOffset() const { return m_scrollOffset; } 115 DoubleSize scrollOffset() const { return m_scrollOffset; }
114 116
115 // FIXME: We shouldn't allow access to m_overflowRect outside this class. 117 // FIXME: We shouldn't allow access to m_overflowRect outside this class.
116 LayoutRect overflowRect() const { return m_overflowRect; } 118 LayoutRect overflowRect() const { return m_overflowRect; }
117 119
118 void scrollToOffset(const IntSize& scrollOffset, ScrollOffsetClamping = Scro llOffsetUnclamped); 120 void scrollToOffset(const DoubleSize& scrollOffset, ScrollOffsetClamping = S crollOffsetUnclamped);
119 void scrollToXOffset(int x, ScrollOffsetClamping clamp = ScrollOffsetUnclamp ed) { scrollToOffset(IntSize(x, scrollYOffset()), clamp); } 121 void scrollToXOffset(double x, ScrollOffsetClamping clamp = ScrollOffsetUncl amped) { scrollToOffset(DoubleSize(x, scrollYOffset()), clamp); }
120 void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamp ed) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); } 122 void scrollToYOffset(double y, ScrollOffsetClamping clamp = ScrollOffsetUncl amped) { scrollToOffset(DoubleSize(scrollXOffset(), y), clamp); }
121 123
122 void updateAfterLayout(); 124 void updateAfterLayout();
123 void updateAfterStyleChange(const RenderStyle*); 125 void updateAfterStyleChange(const RenderStyle*);
124 void updateAfterOverflowRecalc(); 126 void updateAfterOverflowRecalc();
125 127
126 virtual bool updateAfterCompositingChange() OVERRIDE; 128 virtual bool updateAfterCompositingChange() OVERRIDE;
127 129
128 bool hasScrollbar() const { return m_hBar || m_vBar; } 130 bool hasScrollbar() const { return m_hBar || m_vBar; }
129 131
130 // FIXME: This should be removed. 132 // FIXME: This should be removed.
(...skipping 11 matching lines...) Expand all
142 } 144 }
143 145
144 LayoutUnit scrollWidth() const; 146 LayoutUnit scrollWidth() const;
145 LayoutUnit scrollHeight() const; 147 LayoutUnit scrollHeight() const;
146 int pixelSnappedScrollWidth() const; 148 int pixelSnappedScrollWidth() const;
147 int pixelSnappedScrollHeight() const; 149 int pixelSnappedScrollHeight() const;
148 150
149 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro llbarSize) const; 151 int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScro llbarSize) const;
150 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS crollbarSize) const; 152 int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayS crollbarSize) const;
151 153
152 IntSize adjustedScrollOffset() const { return IntSize(scrollXOffset(), scrol lYOffset()); } 154 DoubleSize adjustedScrollOffset() const { return DoubleSize(scrollXOffset(), scrollYOffset()); }
153 155
154 void paintResizer(GraphicsContext*, const IntPoint& paintOffset, const IntRe ct& damageRect); 156 void paintResizer(GraphicsContext*, const IntPoint& paintOffset, const IntRe ct& damageRect);
155 void paintOverflowControls(GraphicsContext*, const IntPoint& paintOffset, co nst IntRect& damageRect, bool paintingOverlayControls); 157 void paintOverflowControls(GraphicsContext*, const IntPoint& paintOffset, co nst IntRect& damageRect, bool paintingOverlayControls);
156 void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& dam ageRect); 158 void paintScrollCorner(GraphicsContext*, const IntPoint&, const IntRect& dam ageRect);
157 159
158 void positionOverflowControls(const IntSize& offsetFromRoot); 160 void positionOverflowControls(const IntSize& offsetFromRoot);
159 161
160 // isPointInResizeControl() is used for testing if a pointer/touch position is in the resize control 162 // isPointInResizeControl() is used for testing if a pointer/touch position is in the resize control
161 // area. 163 // area.
162 bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestTyp e) const; 164 bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestTyp e) const;
(...skipping 20 matching lines...) Expand all
183 RenderLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild); return m_topmostScrollChild; } 185 RenderLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild); return m_topmostScrollChild; }
184 186
185 private: 187 private:
186 bool hasHorizontalOverflow() const; 188 bool hasHorizontalOverflow() const;
187 bool hasVerticalOverflow() const; 189 bool hasVerticalOverflow() const;
188 bool hasScrollableHorizontalOverflow() const; 190 bool hasScrollableHorizontalOverflow() const;
189 bool hasScrollableVerticalOverflow() const; 191 bool hasScrollableVerticalOverflow() const;
190 192
191 void computeScrollDimensions(); 193 void computeScrollDimensions();
192 194
193 IntSize clampScrollOffset(const IntSize&) const; 195 DoubleSize clampScrollOffset(const DoubleSize&) const;
194 196
195 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const; 197 IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const;
196 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const; 198 IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const;
197 LayoutUnit verticalScrollbarStart(int minX, int maxX) const; 199 LayoutUnit verticalScrollbarStart(int minX, int maxX) const;
198 LayoutUnit horizontalScrollbarStart(int minX) const; 200 LayoutUnit horizontalScrollbarStart(int minX) const;
199 IntSize scrollbarOffset(const Scrollbar*) const; 201 IntSize scrollbarOffset(const Scrollbar*) const;
200 202
201 PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation); 203 PassRefPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
202 void destroyScrollbar(ScrollbarOrientation); 204 void destroyScrollbar(ScrollbarOrientation);
203 205
(...skipping 29 matching lines...) Expand all
233 RenderLayer* m_topmostScrollChild; 235 RenderLayer* m_topmostScrollChild;
234 236
235 // FIXME: once cc can handle composited scrolling with clip paths, we will 237 // FIXME: once cc can handle composited scrolling with clip paths, we will
236 // no longer need this bit. 238 // no longer need this bit.
237 unsigned m_needsCompositedScrolling : 1; 239 unsigned m_needsCompositedScrolling : 1;
238 240
239 // The width/height of our scrolled area. 241 // The width/height of our scrolled area.
240 LayoutRect m_overflowRect; 242 LayoutRect m_overflowRect;
241 243
242 // This is the (scroll) offset from scrollOrigin(). 244 // This is the (scroll) offset from scrollOrigin().
243 IntSize m_scrollOffset; 245 DoubleSize m_scrollOffset;
244 246
245 IntPoint m_cachedOverlayScrollbarOffset; 247 IntPoint m_cachedOverlayScrollbarOffset;
246 248
247 // For areas with overflow, we have a pair of scrollbars. 249 // For areas with overflow, we have a pair of scrollbars.
248 RefPtr<Scrollbar> m_hBar; 250 RefPtr<Scrollbar> m_hBar;
249 RefPtr<Scrollbar> m_vBar; 251 RefPtr<Scrollbar> m_vBar;
250 252
251 // Renderers to hold our custom scroll corner. 253 // Renderers to hold our custom scroll corner.
252 RawPtrWillBePersistent<RenderScrollbarPart> m_scrollCorner; 254 RawPtrWillBePersistent<RenderScrollbarPart> m_scrollCorner;
253 255
254 // Renderers to hold our custom resizer. 256 // Renderers to hold our custom resizer.
255 RawPtrWillBePersistent<RenderScrollbarPart> m_resizer; 257 RawPtrWillBePersistent<RenderScrollbarPart> m_resizer;
256 }; 258 };
257 259
258 } // namespace blink 260 } // namespace blink
259 261
260 #endif // RenderLayerScrollableArea_h 262 #endif // RenderLayerScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698