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

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

Issue 2478463003: Revert of Implement overlay scrollbar fade out for non-composited scrollers. (Closed)
Patch Set: Created 4 years, 1 month 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // Returns a rect, in the space of the area's backing graphics layer, that 100 // Returns a rect, in the space of the area's backing graphics layer, that
101 // contains the visual region of all scrollbar parts. 101 // contains the visual region of all scrollbar parts.
102 virtual LayoutRect visualRectForScrollbarParts() const = 0; 102 virtual LayoutRect visualRectForScrollbarParts() const = 0;
103 103
104 static bool scrollBehaviorFromString(const String&, ScrollBehavior&); 104 static bool scrollBehaviorFromString(const String&, ScrollBehavior&);
105 105
106 void contentAreaWillPaint() const; 106 void contentAreaWillPaint() const;
107 void mouseEnteredContentArea() const; 107 void mouseEnteredContentArea() const;
108 void mouseExitedContentArea() const; 108 void mouseExitedContentArea() const;
109 void mouseMovedInContentArea() const; 109 void mouseMovedInContentArea() const;
110 void mouseEnteredScrollbar(Scrollbar&); 110 void mouseEnteredScrollbar(Scrollbar&) const;
111 void mouseExitedScrollbar(Scrollbar&); 111 void mouseExitedScrollbar(Scrollbar&) const;
112 void mouseCapturedScrollbar();
113 void mouseReleasedScrollbar();
114 void contentAreaDidShow() const; 112 void contentAreaDidShow() const;
115 void contentAreaDidHide() const; 113 void contentAreaDidHide() const;
116 114
117 void finishCurrentScrollAnimations() const; 115 void finishCurrentScrollAnimations() const;
118 116
119 virtual void didAddScrollbar(Scrollbar&, ScrollbarOrientation); 117 virtual void didAddScrollbar(Scrollbar&, ScrollbarOrientation);
120 virtual void willRemoveScrollbar(Scrollbar&, ScrollbarOrientation); 118 virtual void willRemoveScrollbar(Scrollbar&, ScrollbarOrientation);
121 119
122 virtual void contentsResized(); 120 virtual void contentsResized();
123 121
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 220
223 virtual IntRect visibleContentRect( 221 virtual IntRect visibleContentRect(
224 IncludeScrollbarsInRect = ExcludeScrollbars) const; 222 IncludeScrollbarsInRect = ExcludeScrollbars) const;
225 virtual int visibleHeight() const { return visibleContentRect().height(); } 223 virtual int visibleHeight() const { return visibleContentRect().height(); }
226 virtual int visibleWidth() const { return visibleContentRect().width(); } 224 virtual int visibleWidth() const { return visibleContentRect().width(); }
227 virtual IntSize contentsSize() const = 0; 225 virtual IntSize contentsSize() const = 0;
228 virtual IntPoint lastKnownMousePosition() const { return IntPoint(); } 226 virtual IntPoint lastKnownMousePosition() const { return IntPoint(); }
229 227
230 virtual bool shouldSuspendScrollAnimations() const { return true; } 228 virtual bool shouldSuspendScrollAnimations() const { return true; }
231 virtual void scrollbarStyleChanged() {} 229 virtual void scrollbarStyleChanged() {}
230 virtual void scrollbarVisibilityChanged() {}
232 virtual bool scrollbarsCanBeActive() const = 0; 231 virtual bool scrollbarsCanBeActive() const = 0;
233 232
234 // Returns the bounding box of this scrollable area, in the coordinate system 233 // Returns the bounding box of this scrollable area, in the coordinate system
235 // of the enclosing scroll view. 234 // of the enclosing scroll view.
236 virtual IntRect scrollableAreaBoundingBox() const = 0; 235 virtual IntRect scrollableAreaBoundingBox() const = 0;
237 236
238 virtual bool scrollAnimatorEnabled() const { return false; } 237 virtual bool scrollAnimatorEnabled() const { return false; }
239 238
240 // NOTE: Only called from Internals for testing. 239 // NOTE: Only called from Internals for testing.
241 void updateScrollOffsetFromInternals(const IntSize&); 240 void updateScrollOffsetFromInternals(const IntSize&);
242 241
243 IntSize clampScrollOffset(const IntSize&) const; 242 IntSize clampScrollOffset(const IntSize&) const;
244 ScrollOffset clampScrollOffset(const ScrollOffset&) const; 243 ScrollOffset clampScrollOffset(const ScrollOffset&) const;
245 244
246 // Let subclasses provide a way of asking for and servicing scroll 245 // Let subclasses provide a way of asking for and servicing scroll
247 // animations. 246 // animations.
248 virtual bool scheduleAnimation(); 247 virtual bool scheduleAnimation();
249 virtual void serviceScrollAnimations(double monotonicTime); 248 virtual void serviceScrollAnimations(double monotonicTime);
250 virtual void updateCompositorScrollAnimations(); 249 virtual void updateCompositorScrollAnimations();
251 virtual void registerForAnimation() {} 250 virtual void registerForAnimation() {}
252 virtual void deregisterForAnimation() {} 251 virtual void deregisterForAnimation() {}
253 252
254 virtual bool usesCompositedScrolling() const { return false; } 253 virtual bool usesCompositedScrolling() const { return false; }
255 virtual bool shouldScrollOnMainThread() const; 254 virtual bool shouldScrollOnMainThread() const;
256 255
257 // Overlay scrollbars can "fade-out" when inactive. 256 // Overlay scrollbars can "fade-out" when inactive.
258 virtual bool scrollbarsHidden() const; 257 virtual bool scrollbarsHidden() const;
259 virtual void setScrollbarsHidden(bool); 258 virtual void setScrollbarsHidden(bool);
259 virtual void didChangeScrollbarsHidden(){};
260 260
261 // Returns true if the GraphicsLayer tree needs to be rebuilt. 261 // Returns true if the GraphicsLayer tree needs to be rebuilt.
262 virtual bool updateAfterCompositingChange() { return false; } 262 virtual bool updateAfterCompositingChange() { return false; }
263 263
264 virtual bool userInputScrollable(ScrollbarOrientation) const = 0; 264 virtual bool userInputScrollable(ScrollbarOrientation) const = 0;
265 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0; 265 virtual bool shouldPlaceVerticalScrollbarOnLeft() const = 0;
266 266
267 // Convenience functions 267 // Convenience functions
268 float scrollOffset(ScrollbarOrientation orientation) { 268 float scrollOffset(ScrollbarOrientation orientation) {
269 return orientation == HorizontalScrollbar ? scrollOffsetInt().width() 269 return orientation == HorizontalScrollbar ? scrollOffsetInt().width()
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 virtual bool isRootFrameViewport() const { return false; } 340 virtual bool isRootFrameViewport() const { return false; }
341 341
342 // Returns true if the scroller adjusts the scroll offset to compensate 342 // Returns true if the scroller adjusts the scroll offset to compensate
343 // for layout movements (bit.ly/scroll-anchoring). 343 // for layout movements (bit.ly/scroll-anchoring).
344 virtual bool shouldPerformScrollAnchoring() const { return false; } 344 virtual bool shouldPerformScrollAnchoring() const { return false; }
345 345
346 // Need to promptly let go of owned animator objects. 346 // Need to promptly let go of owned animator objects.
347 EAGERLY_FINALIZE(); 347 EAGERLY_FINALIZE();
348 DECLARE_VIRTUAL_TRACE(); 348 DECLARE_VIRTUAL_TRACE();
349 349
350 virtual void clearScrollableArea(); 350 virtual void clearScrollAnimators();
351 351
352 virtual ScrollAnchor* scrollAnchor() { return nullptr; } 352 virtual ScrollAnchor* scrollAnchor() { return nullptr; }
353 353
354 protected: 354 protected:
355 ScrollableArea(); 355 ScrollableArea();
356 356
357 ScrollbarOrientation scrollbarOrientationFromDirection( 357 ScrollbarOrientation scrollbarOrientationFromDirection(
358 ScrollDirectionPhysical) const; 358 ScrollDirectionPhysical) const;
359 float scrollStep(ScrollGranularity, ScrollbarOrientation) const; 359 float scrollStep(ScrollGranularity, ScrollbarOrientation) const;
360 360
(...skipping 11 matching lines...) Expand all
372 return m_verticalScrollbarNeedsPaintInvalidation; 372 return m_verticalScrollbarNeedsPaintInvalidation;
373 } 373 }
374 bool scrollCornerNeedsPaintInvalidation() const { 374 bool scrollCornerNeedsPaintInvalidation() const {
375 return m_scrollCornerNeedsPaintInvalidation; 375 return m_scrollCornerNeedsPaintInvalidation;
376 } 376 }
377 void clearNeedsPaintInvalidationForScrollControls() { 377 void clearNeedsPaintInvalidationForScrollControls() {
378 m_horizontalScrollbarNeedsPaintInvalidation = false; 378 m_horizontalScrollbarNeedsPaintInvalidation = false;
379 m_verticalScrollbarNeedsPaintInvalidation = false; 379 m_verticalScrollbarNeedsPaintInvalidation = false;
380 m_scrollCornerNeedsPaintInvalidation = false; 380 m_scrollCornerNeedsPaintInvalidation = false;
381 } 381 }
382 void showOverlayScrollbars();
383 virtual void scrollbarVisibilityChanged() {}
384 382
385 private: 383 private:
386 void programmaticScrollHelper(const ScrollOffset&, ScrollBehavior); 384 void programmaticScrollHelper(const ScrollOffset&, ScrollBehavior);
387 void userScrollHelper(const ScrollOffset&, ScrollBehavior); 385 void userScrollHelper(const ScrollOffset&, ScrollBehavior);
388 386
389 void fadeOverlayScrollbarsTimerFired(TimerBase*);
390
391 // This function should be overriden by subclasses to perform the actual 387 // This function should be overriden by subclasses to perform the actual
392 // scroll of the content. 388 // scroll of the content.
393 virtual void updateScrollOffset(const ScrollOffset&, ScrollType) = 0; 389 virtual void updateScrollOffset(const ScrollOffset&, ScrollType) = 0;
394 390
395 virtual int lineStep(ScrollbarOrientation) const; 391 virtual int lineStep(ScrollbarOrientation) const;
396 virtual int pageStep(ScrollbarOrientation) const; 392 virtual int pageStep(ScrollbarOrientation) const;
397 virtual int documentStep(ScrollbarOrientation) const; 393 virtual int documentStep(ScrollbarOrientation) const;
398 virtual float pixelStep(ScrollbarOrientation) const; 394 virtual float pixelStep(ScrollbarOrientation) const;
399 395
400 mutable Member<ScrollAnimatorBase> m_scrollAnimator; 396 mutable Member<ScrollAnimatorBase> m_scrollAnimator;
401 mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator; 397 mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator;
402 398
403 std::unique_ptr<Timer<ScrollableArea>> m_fadeOverlayScrollbarsTimer;
404
405 unsigned m_scrollbarOverlayColorTheme : 2; 399 unsigned m_scrollbarOverlayColorTheme : 2;
406 400
407 unsigned m_scrollOriginChanged : 1; 401 unsigned m_scrollOriginChanged : 1;
408 402
409 unsigned m_horizontalScrollbarNeedsPaintInvalidation : 1; 403 unsigned m_horizontalScrollbarNeedsPaintInvalidation : 1;
410 unsigned m_verticalScrollbarNeedsPaintInvalidation : 1; 404 unsigned m_verticalScrollbarNeedsPaintInvalidation : 1;
411 unsigned m_scrollCornerNeedsPaintInvalidation : 1; 405 unsigned m_scrollCornerNeedsPaintInvalidation : 1;
412 unsigned m_scrollbarsHidden : 1; 406 unsigned m_scrollbarsHidden : 1;
413 unsigned m_scrollbarCaptured : 1;
414 407
415 // There are 6 possible combinations of writing mode and direction. Scroll 408 // There are 6 possible combinations of writing mode and direction. Scroll
416 // origin will be non-zero in the x or y axis if there is any reversed 409 // origin will be non-zero in the x or y axis if there is any reversed
417 // direction or writing-mode. The combinations are: 410 // direction or writing-mode. The combinations are:
418 // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set 411 // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set
419 // horizontal-tb / ltr NO NO 412 // horizontal-tb / ltr NO NO
420 // horizontal-tb / rtl YES NO 413 // horizontal-tb / rtl YES NO
421 // vertical-lr / ltr NO NO 414 // vertical-lr / ltr NO NO
422 // vertical-lr / rtl NO YES 415 // vertical-lr / rtl NO YES
423 // vertical-rl / ltr YES NO 416 // vertical-rl / ltr YES NO
424 // vertical-rl / rtl YES YES 417 // vertical-rl / rtl YES YES
425 IntPoint m_scrollOrigin; 418 IntPoint m_scrollOrigin;
426 }; 419 };
427 420
428 } // namespace blink 421 } // namespace blink
429 422
430 #endif // ScrollableArea_h 423 #endif // ScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698