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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 virtual void contentsResized(); | 119 virtual void contentsResized(); |
120 | 120 |
121 bool hasOverlayScrollbars() const; | 121 bool hasOverlayScrollbars() const; |
122 void setScrollbarOverlayStyle(ScrollbarOverlayStyle); | 122 void setScrollbarOverlayStyle(ScrollbarOverlayStyle); |
123 ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<Scr
ollbarOverlayStyle>(m_scrollbarOverlayStyle); } | 123 ScrollbarOverlayStyle scrollbarOverlayStyle() const { return static_cast<Scr
ollbarOverlayStyle>(m_scrollbarOverlayStyle); } |
124 | 124 |
125 // This getter will create a ScrollAnimatorBase if it doesn't already exist. | 125 // This getter will create a ScrollAnimatorBase if it doesn't already exist. |
126 ScrollAnimatorBase* scrollAnimator() const; | 126 ScrollAnimatorBase* scrollAnimator() const; |
127 | 127 |
128 // This getter will return null if the ScrollAnimatorBase hasn't been create
d yet. | 128 // This getter will return null if the ScrollAnimatorBase hasn't been create
d yet. |
129 ScrollAnimatorBase* existingScrollAnimator() const { return m_animators ? m_
animators->scrollAnimator.get() : 0; } | 129 ScrollAnimatorBase* existingScrollAnimator() const { return m_scrollAnimator
.get(); } |
130 | 130 |
131 ProgrammaticScrollAnimator* programmaticScrollAnimator() const; | 131 ProgrammaticScrollAnimator* programmaticScrollAnimator() const; |
132 ProgrammaticScrollAnimator* existingProgrammaticScrollAnimator() const | 132 ProgrammaticScrollAnimator* existingProgrammaticScrollAnimator() const { ret
urn m_programmaticScrollAnimator.get(); } |
133 { | |
134 return m_animators ? m_animators->programmaticScrollAnimator.get() : 0; | |
135 } | |
136 | 133 |
137 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } | 134 const IntPoint& scrollOrigin() const { return m_scrollOrigin; } |
138 bool scrollOriginChanged() const { return m_scrollOriginChanged; } | 135 bool scrollOriginChanged() const { return m_scrollOriginChanged; } |
139 | 136 |
140 | 137 |
141 // This is used to determine whether the incoming fractional scroll offset s
hould | 138 // This is used to determine whether the incoming fractional scroll offset s
hould |
142 // be truncated to integer. Current rule is that if preferCompositingToLCDTe
xtEnabled() | 139 // be truncated to integer. Current rule is that if preferCompositingToLCDTe
xtEnabled() |
143 // is disabled (which is true on low-dpi device by default) we should do the
truncation. | 140 // is disabled (which is true on low-dpi device by default) we should do the
truncation. |
144 // The justification is that non-composited elements using fractional scroll
offsets | 141 // The justification is that non-composited elements using fractional scroll
offsets |
145 // is causing too much nasty bugs but does not add too benefit on low-dpi de
vices. | 142 // is causing too much nasty bugs but does not add too benefit on low-dpi de
vices. |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // updateScrollbars. Expose this here to allow RootFrameViewport to match th
e | 268 // updateScrollbars. Expose this here to allow RootFrameViewport to match th
e |
272 // semantics for now but it should be cleaned up at the source. | 269 // semantics for now but it should be cleaned up at the source. |
273 virtual bool isProgrammaticallyScrollable() { return true; } | 270 virtual bool isProgrammaticallyScrollable() { return true; } |
274 | 271 |
275 // Subtracts space occupied by this ScrollableArea's scrollbars. | 272 // Subtracts space occupied by this ScrollableArea's scrollbars. |
276 // Does nothing if overlay scrollbars are enabled. | 273 // Does nothing if overlay scrollbars are enabled. |
277 IntSize excludeScrollbars(const IntSize&) const; | 274 IntSize excludeScrollbars(const IntSize&) const; |
278 | 275 |
279 // Need to promptly let go of owned animator objects. | 276 // Need to promptly let go of owned animator objects. |
280 EAGERLY_FINALIZE(); | 277 EAGERLY_FINALIZE(); |
281 DEFINE_INLINE_VIRTUAL_TRACE() { } | 278 DECLARE_VIRTUAL_TRACE(); |
282 | 279 |
283 protected: | 280 protected: |
284 ScrollableArea(); | 281 ScrollableArea(); |
285 | 282 |
286 void setScrollOrigin(const IntPoint&); | 283 void setScrollOrigin(const IntPoint&); |
287 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } | 284 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } |
288 | 285 |
289 // Needed to let the animators call scrollPositionChanged. | 286 // Needed to let the animators call scrollPositionChanged. |
290 friend class ScrollAnimatorBase; | 287 friend class ScrollAnimatorBase; |
291 friend class ProgrammaticScrollAnimator; | 288 friend class ProgrammaticScrollAnimator; |
(...skipping 26 matching lines...) Expand all Loading... |
318 virtual void setScrollOffset(const DoublePoint& offset, ScrollType scrollTyp
e) | 315 virtual void setScrollOffset(const DoublePoint& offset, ScrollType scrollTyp
e) |
319 { | 316 { |
320 setScrollOffset(flooredIntPoint(offset), scrollType); | 317 setScrollOffset(flooredIntPoint(offset), scrollType); |
321 } | 318 } |
322 | 319 |
323 virtual int lineStep(ScrollbarOrientation) const; | 320 virtual int lineStep(ScrollbarOrientation) const; |
324 virtual int pageStep(ScrollbarOrientation) const; | 321 virtual int pageStep(ScrollbarOrientation) const; |
325 virtual int documentStep(ScrollbarOrientation) const; | 322 virtual int documentStep(ScrollbarOrientation) const; |
326 virtual float pixelStep(ScrollbarOrientation) const; | 323 virtual float pixelStep(ScrollbarOrientation) const; |
327 | 324 |
328 struct ScrollableAreaAnimators { | 325 mutable OwnPtrWillBeMember<ScrollAnimatorBase> m_scrollAnimator; |
329 OwnPtr<ScrollAnimatorBase> scrollAnimator; | 326 mutable PersistentWillBeMember<ProgrammaticScrollAnimator> m_programmaticScr
ollAnimator; |
330 OwnPtr<ProgrammaticScrollAnimator> programmaticScrollAnimator; | |
331 }; | |
332 | |
333 mutable OwnPtr<ScrollableAreaAnimators> m_animators; | |
334 | 327 |
335 unsigned m_inLiveResize : 1; | 328 unsigned m_inLiveResize : 1; |
336 | 329 |
337 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle | 330 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle |
338 | 331 |
339 unsigned m_scrollOriginChanged : 1; | 332 unsigned m_scrollOriginChanged : 1; |
340 | 333 |
341 unsigned m_horizontalScrollbarNeedsPaintInvalidation : 1; | 334 unsigned m_horizontalScrollbarNeedsPaintInvalidation : 1; |
342 unsigned m_verticalScrollbarNeedsPaintInvalidation : 1; | 335 unsigned m_verticalScrollbarNeedsPaintInvalidation : 1; |
343 unsigned m_scrollCornerNeedsPaintInvalidation : 1; | 336 unsigned m_scrollCornerNeedsPaintInvalidation : 1; |
344 | 337 |
345 // There are 8 possible combinations of writing mode and direction. Scroll o
rigin will be non-zero in the x or y axis | 338 // There are 8 possible combinations of writing mode and direction. Scroll o
rigin will be non-zero in the x or y axis |
346 // if there is any reversed direction or writing-mode. The combinations are: | 339 // if there is any reversed direction or writing-mode. The combinations are: |
347 // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set | 340 // writing-mode / direction scrollOrigin.x() set scrollOrigin.y() set |
348 // horizontal-tb / ltr NO NO | 341 // horizontal-tb / ltr NO NO |
349 // horizontal-tb / rtl YES NO | 342 // horizontal-tb / rtl YES NO |
350 // horizontal-bt / ltr NO YES | 343 // horizontal-bt / ltr NO YES |
351 // horizontal-bt / rtl YES YES | 344 // horizontal-bt / rtl YES YES |
352 // vertical-lr / ltr NO NO | 345 // vertical-lr / ltr NO NO |
353 // vertical-lr / rtl NO YES | 346 // vertical-lr / rtl NO YES |
354 // vertical-rl / ltr YES NO | 347 // vertical-rl / ltr YES NO |
355 // vertical-rl / rtl YES YES | 348 // vertical-rl / rtl YES YES |
356 IntPoint m_scrollOrigin; | 349 IntPoint m_scrollOrigin; |
357 }; | 350 }; |
358 | 351 |
359 } // namespace blink | 352 } // namespace blink |
360 | 353 |
361 #endif // ScrollableArea_h | 354 #endif // ScrollableArea_h |
OLD | NEW |