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

Side by Side Diff: Source/core/platform/Scrollbar.cpp

Issue 16982005: Allow objects without scrollbars to be scrollable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: CR Fixes Created 7 years, 6 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) 2004, 2006, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2008 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #define THUMB_POSITION_AFFECTS_BUTTONS 48 #define THUMB_POSITION_AFFECTS_BUTTONS
49 #endif 49 #endif
50 50
51 namespace WebCore { 51 namespace WebCore {
52 52
53 PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea* scrollabl eArea, ScrollbarOrientation orientation, ScrollbarControlSize size) 53 PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea* scrollabl eArea, ScrollbarOrientation orientation, ScrollbarControlSize size)
54 { 54 {
55 return adoptRef(new Scrollbar(scrollableArea, orientation, size)); 55 return adoptRef(new Scrollbar(scrollableArea, orientation, size));
56 } 56 }
57 57
58 int Scrollbar::maxOverlapBetweenPages()
59 {
60 static int maxOverlapBetweenPages = ScrollbarTheme::theme()->maxOverlapBetwe enPages();
61 return maxOverlapBetweenPages;
62 }
63
64 Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orient ation, ScrollbarControlSize controlSize, 58 Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orient ation, ScrollbarControlSize controlSize,
65 ScrollbarTheme* theme) 59 ScrollbarTheme* theme)
66 : m_scrollableArea(scrollableArea) 60 : m_scrollableArea(scrollableArea)
67 , m_orientation(orientation) 61 , m_orientation(orientation)
68 , m_controlSize(controlSize) 62 , m_controlSize(controlSize)
69 , m_theme(theme) 63 , m_theme(theme)
70 , m_visibleSize(0) 64 , m_visibleSize(0)
71 , m_totalSize(0) 65 , m_totalSize(0)
72 , m_currentPos(0) 66 , m_currentPos(0)
73 , m_dragOrigin(0) 67 , m_dragOrigin(0)
74 , m_lineStep(0)
75 , m_pageStep(0)
76 , m_pixelStep(1)
77 , m_hoveredPart(NoPart) 68 , m_hoveredPart(NoPart)
78 , m_pressedPart(NoPart) 69 , m_pressedPart(NoPart)
79 , m_pressedPos(0) 70 , m_pressedPos(0)
80 , m_scrollPos(0) 71 , m_scrollPos(0)
81 , m_draggingDocument(false) 72 , m_draggingDocument(false)
82 , m_documentDragPos(0) 73 , m_documentDragPos(0)
83 , m_enabled(true) 74 , m_enabled(true)
84 , m_scrollTimer(this, &Scrollbar::autoscrollTimerFired) 75 , m_scrollTimer(this, &Scrollbar::autoscrollTimerFired)
85 , m_overlapsResizer(false) 76 , m_overlapsResizer(false)
86 , m_suppressInvalidation(false) 77 , m_suppressInvalidation(false)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 { 142 {
152 if (visibleSize == m_visibleSize && totalSize == m_totalSize) 143 if (visibleSize == m_visibleSize && totalSize == m_totalSize)
153 return; 144 return;
154 145
155 m_visibleSize = visibleSize; 146 m_visibleSize = visibleSize;
156 m_totalSize = totalSize; 147 m_totalSize = totalSize;
157 148
158 updateThumbProportion(); 149 updateThumbProportion();
159 } 150 }
160 151
161 void Scrollbar::setSteps(int lineStep, int pageStep, int pixelsPerStep)
162 {
163 m_lineStep = lineStep;
164 m_pageStep = pageStep;
165 m_pixelStep = 1.0f / pixelsPerStep;
166 }
167
168 void Scrollbar::updateThumb() 152 void Scrollbar::updateThumb()
169 { 153 {
170 #ifdef THUMB_POSITION_AFFECTS_BUTTONS 154 #ifdef THUMB_POSITION_AFFECTS_BUTTONS
171 invalidate(); 155 invalidate();
172 #else 156 #else
173 theme()->invalidateParts(this, ForwardTrackPart | BackTrackPart | ThumbPart) ; 157 theme()->invalidateParts(this, ForwardTrackPart | BackTrackPart | ThumbPart) ;
174 #endif 158 #endif
175 } 159 }
176 160
177 void Scrollbar::updateThumbPosition() 161 void Scrollbar::updateThumbPosition()
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 579
596 IntPoint Scrollbar::convertFromContainingView(const IntPoint& parentPoint) const 580 IntPoint Scrollbar::convertFromContainingView(const IntPoint& parentPoint) const
597 { 581 {
598 if (m_scrollableArea) 582 if (m_scrollableArea)
599 return m_scrollableArea->convertFromContainingViewToScrollbar(this, pare ntPoint); 583 return m_scrollableArea->convertFromContainingViewToScrollbar(this, pare ntPoint);
600 584
601 return Widget::convertFromContainingView(parentPoint); 585 return Widget::convertFromContainingView(parentPoint);
602 } 586 }
603 587
604 } // namespace WebCore 588 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698