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

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

Issue 2290233007: Move convertViewportToWindow and convertWindowToViewport from (Closed)
Patch Set: Created 4 years, 3 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) 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 class Widget; 53 class Widget;
54 54
55 enum IncludeScrollbarsInRect { 55 enum IncludeScrollbarsInRect {
56 ExcludeScrollbars, 56 ExcludeScrollbars,
57 IncludeScrollbars, 57 IncludeScrollbars,
58 }; 58 };
59 59
60 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin { 60 class PLATFORM_EXPORT ScrollableArea : public GarbageCollectedMixin {
61 WTF_MAKE_NONCOPYABLE(ScrollableArea); 61 WTF_MAKE_NONCOPYABLE(ScrollableArea);
62 public: 62 public:
63 static int pixelsPerLineStep(HostWindow*); 63 static int pixelsPerLineStep(HostWindow*, Widget*);
dcheng 2016/09/08 05:25:47 Oh... I guess it's because of this. So I guess we
lfg 2016/09/08 21:40:43 Acknowledged.
64 static float minFractionToStepWhenPaging(); 64 static float minFractionToStepWhenPaging();
65 static int maxOverlapBetweenPages(); 65 static int maxOverlapBetweenPages();
66 66
67 // Convert a non-finite scroll value (Infinity, -Infinity, NaN) to 0 as 67 // 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. 68 // 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; } 69 static double normalizeNonFiniteScroll(double value) { return std::isfinite( value) ? value : 0.0; }
70 70
71 // The window that hosts the ScrollableArea. The ScrollableArea will communi cate scrolls and repaints to the 71 // The window that hosts the ScrollableArea. The ScrollableArea will communi cate scrolls and repaints to the
72 // host window in the window's coordinate space. 72 // host window in the window's coordinate space.
73 virtual HostWindow* getHostWindow() const { return 0; } 73 virtual HostWindow* getHostWindow() const { return 0; }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 // Need to promptly let go of owned animator objects. 285 // Need to promptly let go of owned animator objects.
286 EAGERLY_FINALIZE(); 286 EAGERLY_FINALIZE();
287 DECLARE_VIRTUAL_TRACE(); 287 DECLARE_VIRTUAL_TRACE();
288 288
289 virtual void clearScrollAnimators(); 289 virtual void clearScrollAnimators();
290 290
291 protected: 291 protected:
292 ScrollableArea(); 292 ScrollableArea();
293 293
294 ScrollbarOrientation scrollbarOrientationFromDirection(ScrollDirectionPhysic al) const; 294 ScrollbarOrientation scrollbarOrientationFromDirection(ScrollDirectionPhysic al) const;
295 float scrollStep(ScrollGranularity, ScrollbarOrientation) const; 295 float scrollStep(ScrollGranularity, ScrollbarOrientation);
296 296
297 void setScrollOrigin(const IntPoint&); 297 void setScrollOrigin(const IntPoint&);
298 void resetScrollOriginChanged() { m_scrollOriginChanged = false; } 298 void resetScrollOriginChanged() { m_scrollOriginChanged = false; }
299 299
300 // Needed to let the animators call scrollPositionChanged. 300 // Needed to let the animators call scrollPositionChanged.
301 friend class ScrollAnimatorCompositorCoordinator; 301 friend class ScrollAnimatorCompositorCoordinator;
302 void scrollPositionChanged(const DoublePoint&, ScrollType); 302 void scrollPositionChanged(const DoublePoint&, ScrollType);
303 303
304 bool horizontalScrollbarNeedsPaintInvalidation() const { return m_horizontal ScrollbarNeedsPaintInvalidation; } 304 bool horizontalScrollbarNeedsPaintInvalidation() const { return m_horizontal ScrollbarNeedsPaintInvalidation; }
305 bool verticalScrollbarNeedsPaintInvalidation() const { return m_verticalScro llbarNeedsPaintInvalidation; } 305 bool verticalScrollbarNeedsPaintInvalidation() const { return m_verticalScro llbarNeedsPaintInvalidation; }
306 bool scrollCornerNeedsPaintInvalidation() const { return m_scrollCornerNeeds PaintInvalidation; } 306 bool scrollCornerNeedsPaintInvalidation() const { return m_scrollCornerNeeds PaintInvalidation; }
307 void clearNeedsPaintInvalidationForScrollControls() 307 void clearNeedsPaintInvalidationForScrollControls()
308 { 308 {
309 m_horizontalScrollbarNeedsPaintInvalidation = false; 309 m_horizontalScrollbarNeedsPaintInvalidation = false;
310 m_verticalScrollbarNeedsPaintInvalidation = false; 310 m_verticalScrollbarNeedsPaintInvalidation = false;
311 m_scrollCornerNeedsPaintInvalidation = false; 311 m_scrollCornerNeedsPaintInvalidation = false;
312 } 312 }
313 313
314 private: 314 private:
315 void programmaticScrollHelper(const DoublePoint&, ScrollBehavior); 315 void programmaticScrollHelper(const DoublePoint&, ScrollBehavior);
316 void userScrollHelper(const DoublePoint&, ScrollBehavior); 316 void userScrollHelper(const DoublePoint&, ScrollBehavior);
317 317
318 // This function should be overriden by subclasses to perform the actual scr oll of the content. 318 // This function should be overriden by subclasses to perform the actual scr oll of the content.
319 virtual void setScrollOffset(const DoublePoint& offset, ScrollType) = 0; 319 virtual void setScrollOffset(const DoublePoint& offset, ScrollType) = 0;
320 320
321 virtual int lineStep(ScrollbarOrientation) const; 321 virtual int lineStep(ScrollbarOrientation);
322 virtual int pageStep(ScrollbarOrientation) const; 322 virtual int pageStep(ScrollbarOrientation) const;
323 virtual int documentStep(ScrollbarOrientation) const; 323 virtual int documentStep(ScrollbarOrientation) const;
324 virtual float pixelStep(ScrollbarOrientation) const; 324 virtual float pixelStep(ScrollbarOrientation) const;
325 325
326 mutable Member<ScrollAnimatorBase> m_scrollAnimator; 326 mutable Member<ScrollAnimatorBase> m_scrollAnimator;
327 mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator; 327 mutable Member<ProgrammaticScrollAnimator> m_programmaticScrollAnimator;
328 328
329 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle 329 unsigned m_scrollbarOverlayStyle : 2; // ScrollbarOverlayStyle
330 330
331 unsigned m_scrollOriginChanged : 1; 331 unsigned m_scrollOriginChanged : 1;
(...skipping 10 matching lines...) Expand all
342 // vertical-lr / ltr NO NO 342 // vertical-lr / ltr NO NO
343 // vertical-lr / rtl NO YES 343 // vertical-lr / rtl NO YES
344 // vertical-rl / ltr YES NO 344 // vertical-rl / ltr YES NO
345 // vertical-rl / rtl YES YES 345 // vertical-rl / rtl YES YES
346 IntPoint m_scrollOrigin; 346 IntPoint m_scrollOrigin;
347 }; 347 };
348 348
349 } // namespace blink 349 } // namespace blink
350 350
351 #endif // ScrollableArea_h 351 #endif // ScrollableArea_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698