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 11 matching lines...) Expand all Loading... | |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #ifndef ScrollableArea_h | 26 #ifndef ScrollableArea_h |
27 #define ScrollableArea_h | 27 #define ScrollableArea_h |
28 | 28 |
29 #include "platform/PlatformExport.h" | 29 #include "platform/PlatformExport.h" |
30 #include "platform/RuntimeEnabledFeatures.h" | 30 #include "platform/RuntimeEnabledFeatures.h" |
31 #include "platform/geometry/DoublePoint.h" | 31 #include "platform/geometry/DoublePoint.h" |
32 #include "platform/heap/Handle.h" | |
32 #include "platform/scroll/ScrollAnimator.h" | 33 #include "platform/scroll/ScrollAnimator.h" |
33 #include "platform/scroll/ScrollTypes.h" | 34 #include "platform/scroll/ScrollTypes.h" |
34 #include "platform/scroll/Scrollbar.h" | 35 #include "platform/scroll/Scrollbar.h" |
35 #include "wtf/Noncopyable.h" | 36 #include "wtf/Noncopyable.h" |
36 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
37 | 38 |
38 namespace blink { | 39 namespace blink { |
39 | 40 |
40 class DoubleRect; | 41 class DoubleRect; |
41 class FloatPoint; | 42 class FloatPoint; |
42 class GraphicsLayer; | 43 class GraphicsLayer; |
43 class HostWindow; | 44 class HostWindow; |
44 class PlatformWheelEvent; | 45 class PlatformWheelEvent; |
45 class ProgrammaticScrollAnimator; | 46 class ProgrammaticScrollAnimator; |
46 struct ScrollAlignment; | 47 struct ScrollAlignment; |
47 class ScrollAnimator; | 48 class ScrollAnimator; |
48 | 49 |
49 enum ScrollBehavior { | 50 enum ScrollBehavior { |
50 ScrollBehaviorAuto, | 51 ScrollBehaviorAuto, |
51 ScrollBehaviorInstant, | 52 ScrollBehaviorInstant, |
52 ScrollBehaviorSmooth, | 53 ScrollBehaviorSmooth, |
53 }; | 54 }; |
54 | 55 |
55 enum IncludeScrollbarsInRect { | 56 enum IncludeScrollbarsInRect { |
56 ExcludeScrollbars, | 57 ExcludeScrollbars, |
57 IncludeScrollbars, | 58 IncludeScrollbars, |
58 }; | 59 }; |
59 | 60 |
61 #if ENABLE(OILPAN) | |
62 // Oilpan: Using the transition type WillBeGarbageCollectedMixin is | |
63 // problematic non-Oilpan as the type expands to DummyBase, exporting it | |
64 // also from 'platform' as a result. Bringing about duplicate DummyBases | |
65 // as core also exports same; with component build linking fails as a | |
66 // result. Hence the workaround of not using a transition type. | |
67 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin { | |
68 #else | |
60 class PLATFORM_EXPORT ScrollableArea { | 69 class PLATFORM_EXPORT ScrollableArea { |
70 #endif | |
61 WTF_MAKE_NONCOPYABLE(ScrollableArea); | 71 WTF_MAKE_NONCOPYABLE(ScrollableArea); |
62 public: | 72 public: |
63 static int pixelsPerLineStep(); | 73 static int pixelsPerLineStep(); |
64 static float minFractionToStepWhenPaging(); | 74 static float minFractionToStepWhenPaging(); |
65 static int maxOverlapBetweenPages(); | 75 static int maxOverlapBetweenPages(); |
66 | 76 |
67 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as | 77 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as |
68 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. | 78 // per http://dev.w3.org/csswg/cssom-view/#normalize-non_finite-values. |
69 static double normalizeNonFiniteScroll(double value) { return std::isfinite( value) ? value : 0.0; } | 79 static double normalizeNonFiniteScroll(double value) { return std::isfinite( value) ? value : 0.0; } |
70 | 80 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 // TODO(bokan): FrameView::setScrollPosition uses updateScrollbars to scroll | 292 // TODO(bokan): FrameView::setScrollPosition uses updateScrollbars to scroll |
283 // which bails out early if its already in updateScrollbars, the effect bein g | 293 // which bails out early if its already in updateScrollbars, the effect bein g |
284 // that programmatic scrolls (i.e. setScrollPosition) are disabled when in | 294 // that programmatic scrolls (i.e. setScrollPosition) are disabled when in |
285 // updateScrollbars. Expose this here to allow RootFrameViewport to match th e | 295 // updateScrollbars. Expose this here to allow RootFrameViewport to match th e |
286 // semantics for now but it should be cleaned up at the source. | 296 // semantics for now but it should be cleaned up at the source. |
287 virtual bool isProgrammaticallyScrollable() { return true; } | 297 virtual bool isProgrammaticallyScrollable() { return true; } |
288 | 298 |
289 // Subtracts space occupied by this ScrollableArea's scrollbars. | 299 // Subtracts space occupied by this ScrollableArea's scrollbars. |
290 // Does nothing if overlay scrollbars are enabled. | 300 // Does nothing if overlay scrollbars are enabled. |
291 IntSize excludeScrollbars(const IntSize&) const; | 301 IntSize excludeScrollbars(const IntSize&) const; |
302 | |
303 // Need to promptly let go of owned animator objects. | |
haraken
2015/06/29 15:20:22
I don't fully understand this -- why do we need to
sof
2015/06/29 15:59:41
Look at ScrollAnimatorMac and the back references
| |
304 EAGERLY_FINALIZE(); | |
305 DEFINE_INLINE_VIRTUAL_TRACE() { } | |
306 | |
292 protected: | 307 protected: |
293 ScrollableArea(); | 308 ScrollableArea(); |
294 | 309 |
295 void setScrollOrigin(const IntPoint&); | 310 void setScrollOrigin(const IntPoint&); |
296 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } | 311 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } |
297 | 312 |
298 // Needed to let the animators call scrollPositionChanged. | 313 // Needed to let the animators call scrollPositionChanged. |
299 friend class ScrollAnimator; | 314 friend class ScrollAnimator; |
300 friend class ProgrammaticScrollAnimator; | 315 friend class ProgrammaticScrollAnimator; |
301 void scrollPositionChanged(const DoublePoint&, ScrollType); | 316 void scrollPositionChanged(const DoublePoint&, ScrollType); |
(...skipping 18 matching lines...) Expand all Loading... | |
320 virtual int lineStep(ScrollbarOrientation) const; | 335 virtual int lineStep(ScrollbarOrientation) const; |
321 virtual int pageStep(ScrollbarOrientation) const; | 336 virtual int pageStep(ScrollbarOrientation) const; |
322 virtual int documentStep(ScrollbarOrientation) const; | 337 virtual int documentStep(ScrollbarOrientation) const; |
323 virtual float pixelStep(ScrollbarOrientation) const; | 338 virtual float pixelStep(ScrollbarOrientation) const; |
324 | 339 |
325 // Stores the paint invalidations for the scrollbars during layout. | 340 // Stores the paint invalidations for the scrollbars during layout. |
326 IntRect m_horizontalBarDamage; | 341 IntRect m_horizontalBarDamage; |
327 IntRect m_verticalBarDamage; | 342 IntRect m_verticalBarDamage; |
328 | 343 |
329 struct ScrollableAreaAnimators { | 344 struct ScrollableAreaAnimators { |
330 RefPtr<ScrollAnimator> scrollAnimator; | 345 OwnPtr<ScrollAnimator> scrollAnimator; |
331 OwnPtr<ProgrammaticScrollAnimator> programmaticScrollAnimator; | 346 OwnPtr<ProgrammaticScrollAnimator> programmaticScrollAnimator; |
332 }; | 347 }; |
333 | 348 |
334 mutable OwnPtr<ScrollableAreaAnimators> m_animators; | 349 mutable OwnPtr<ScrollableAreaAnimators> m_animators; |
335 | 350 |
336 unsigned m_inLiveResize : 1; | 351 unsigned m_inLiveResize : 1; |
337 | 352 |
338 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle | 353 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle |
339 | 354 |
340 unsigned m_scrollOriginChanged : 1; | 355 unsigned m_scrollOriginChanged : 1; |
341 | 356 |
342 // There are 8 possible combinations of writing mode and direction. Scroll o rigin will be non-zero in the x or y axis | 357 // There are 8 possible combinations of writing mode and direction. Scroll o rigin will be non-zero in the x or y axis |
343 // if there is any reversed direction or writing-mode. The combinations are: | 358 // if there is any reversed direction or writing-mode. The combinations are: |
344 // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set | 359 // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set |
345 // horizontal-tb / ltr NO NO | 360 // horizontal-tb / ltr NO NO |
346 // horizontal-tb / rtl YES NO | 361 // horizontal-tb / rtl YES NO |
347 // horizontal-bt / ltr NO YES | 362 // horizontal-bt / ltr NO YES |
348 // horizontal-bt / rtl YES YES | 363 // horizontal-bt / rtl YES YES |
349 // vertical-lr / ltr NO NO | 364 // vertical-lr / ltr NO NO |
350 // vertical-lr / rtl NO YES | 365 // vertical-lr / rtl NO YES |
351 // vertical-rl / ltr YES NO | 366 // vertical-rl / ltr YES NO |
352 // vertical-rl / rtl YES YES | 367 // vertical-rl / rtl YES YES |
353 IntPoint m_scrollOrigin; | 368 IntPoint m_scrollOrigin; |
354 }; | 369 }; |
355 | 370 |
356 } // namespace blink | 371 } // namespace blink |
357 | 372 |
358 #endif // ScrollableArea_h | 373 #endif // ScrollableArea_h |
OLD | NEW |