| OLD | NEW |
| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class Widget; | 54 class Widget; |
| 55 | 55 |
| 56 enum IncludeScrollbarsInRect { | 56 enum IncludeScrollbarsInRect { |
| 57 ExcludeScrollbars, | 57 ExcludeScrollbars, |
| 58 IncludeScrollbars, | 58 IncludeScrollbars, |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin { | 61 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin { |
| 62 WTF_MAKE_NONCOPYABLE(ScrollableArea); | 62 WTF_MAKE_NONCOPYABLE(ScrollableArea); |
| 63 public: | 63 public: |
| 64 static int pixelsPerLineStep(HostWindow*); | 64 static int pixelsPerLineStep(HostWindow*, Widget*); |
| 65 static float minFractionToStepWhenPaging(); | 65 static float minFractionToStepWhenPaging(); |
| 66 static int maxOverlapBetweenPages(); | 66 static int maxOverlapBetweenPages(); |
| 67 | 67 |
| 68 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as | 68 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as |
| 69 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. | 69 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. |
| 70 static double normalizeNonFiniteScroll(double value) { return std::isfinite(
value) ? value : 0.0; } | 70 static double normalizeNonFiniteScroll(double value) { return std::isfinite(
value) ? value : 0.0; } |
| 71 | 71 |
| 72 // The window that hosts the ScrollableArea. The ScrollableArea will communi
cate scrolls and repaints to the | 72 // The window that hosts the ScrollableArea. The ScrollableArea will communi
cate scrolls and repaints to the |
| 73 // host window in the window's coordinate space. | 73 // host window in the window's coordinate space. |
| 74 virtual HostWindow* getHostWindow() const { return 0; } | 74 virtual HostWindow* getHostWindow() const { return 0; } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 DECLARE_VIRTUAL_TRACE(); | 288 DECLARE_VIRTUAL_TRACE(); |
| 289 | 289 |
| 290 virtual void clearScrollAnimators(); | 290 virtual void clearScrollAnimators(); |
| 291 | 291 |
| 292 virtual ScrollAnchor* scrollAnchor() { return nullptr; } | 292 virtual ScrollAnchor* scrollAnchor() { return nullptr; } |
| 293 | 293 |
| 294 protected: | 294 protected: |
| 295 ScrollableArea(); | 295 ScrollableArea(); |
| 296 | 296 |
| 297 ScrollbarOrientation scrollbarOrientationFromDirection(ScrollDirectionPhysic
al) const; | 297 ScrollbarOrientation scrollbarOrientationFromDirection(ScrollDirectionPhysic
al) const; |
| 298 float scrollStep(ScrollGranularity, ScrollbarOrientation) const; | 298 float scrollStep(ScrollGranularity, ScrollbarOrientation); |
| 299 | 299 |
| 300 void setScrollOrigin(const IntPoint&); | 300 void setScrollOrigin(const IntPoint&); |
| 301 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } | 301 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } |
| 302 | 302 |
| 303 // Needed to let the animators call scrollPositionChanged. | 303 // Needed to let the animators call scrollPositionChanged. |
| 304 friend class ScrollAnimatorCompositorCoordinator; | 304 friend class ScrollAnimatorCompositorCoordinator; |
| 305 void scrollPositionChanged(const DoublePoint&, ScrollType); | 305 void scrollPositionChanged(const DoublePoint&, ScrollType); |
| 306 | 306 |
| 307 bool horizontalScrollbarNeedsPaintInvalidation() const { return m_horizontal
ScrollbarNeedsPaintInvalidation; } | 307 bool horizontalScrollbarNeedsPaintInvalidation() const { return m_horizontal
ScrollbarNeedsPaintInvalidation; } |
| 308 bool verticalScrollbarNeedsPaintInvalidation() const { return m_verticalScro
llbarNeedsPaintInvalidation; } | 308 bool verticalScrollbarNeedsPaintInvalidation() const { return m_verticalScro
llbarNeedsPaintInvalidation; } |
| 309 bool scrollCornerNeedsPaintInvalidation() const { return m_scrollCornerNeeds
PaintInvalidation; } | 309 bool scrollCornerNeedsPaintInvalidation() const { return m_scrollCornerNeeds
PaintInvalidation; } |
| 310 void clearNeedsPaintInvalidationForScrollControls() | 310 void clearNeedsPaintInvalidationForScrollControls() |
| 311 { | 311 { |
| 312 m_horizontalScrollbarNeedsPaintInvalidation = false; | 312 m_horizontalScrollbarNeedsPaintInvalidation = false; |
| 313 m_verticalScrollbarNeedsPaintInvalidation = false; | 313 m_verticalScrollbarNeedsPaintInvalidation = false; |
| 314 m_scrollCornerNeedsPaintInvalidation = false; | 314 m_scrollCornerNeedsPaintInvalidation = false; |
| 315 } | 315 } |
| 316 | 316 |
| 317 private: | 317 private: |
| 318 void programmaticScrollHelper(const DoublePoint&, ScrollBehavior); | 318 void programmaticScrollHelper(const DoublePoint&, ScrollBehavior); |
| 319 void userScrollHelper(const DoublePoint&, ScrollBehavior); | 319 void userScrollHelper(const DoublePoint&, ScrollBehavior); |
| 320 | 320 |
| 321 // This function should be overriden by subclasses to perform the actual scr
oll of the content. | 321 // This function should be overriden by subclasses to perform the actual scr
oll of the content. |
| 322 virtual void setScrollOffset(const DoublePoint& offset, ScrollType) = 0; | 322 virtual void setScrollOffset(const DoublePoint& offset, ScrollType) = 0; |
| 323 | 323 |
| 324 virtual int lineStep(ScrollbarOrientation) const; | 324 virtual int lineStep(ScrollbarOrientation); |
| 325 virtual int pageStep(ScrollbarOrientation) const; | 325 virtual int pageStep(ScrollbarOrientation) const; |
| 326 virtual int documentStep(ScrollbarOrientation) const; | 326 virtual int documentStep(ScrollbarOrientation) const; |
| 327 virtual float pixelStep(ScrollbarOrientation) const; | 327 virtual float pixelStep(ScrollbarOrientation) const; |
| 328 | 328 |
| 329 mutable Member<ScrollAnimatorBase> m_scrollAnimator; | 329 mutable Member<ScrollAnimatorBase> m_scrollAnimator; |
| 330 mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator; | 330 mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator; |
| 331 | 331 |
| 332 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle | 332 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle |
| 333 | 333 |
| 334 unsigned m_scrollOriginChanged : 1; | 334 unsigned m_scrollOriginChanged : 1; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 345 // vertical-lr / ltr NO NO | 345 // vertical-lr / ltr NO NO |
| 346 // vertical-lr / rtl NO YES | 346 // vertical-lr / rtl NO YES |
| 347 // vertical-rl / ltr YES NO | 347 // vertical-rl / ltr YES NO |
| 348 // vertical-rl / rtl YES YES | 348 // vertical-rl / rtl YES YES |
| 349 IntPoint m_scrollOrigin; | 349 IntPoint m_scrollOrigin; |
| 350 }; | 350 }; |
| 351 | 351 |
| 352 } // namespace blink | 352 } // namespace blink |
| 353 | 353 |
| 354 #endif // ScrollableArea_h | 354 #endif // ScrollableArea_h |
| OLD | NEW |