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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/platform/Scrollbar.cpp
diff --git a/Source/core/platform/Scrollbar.cpp b/Source/core/platform/Scrollbar.cpp
index 7bf8b4107a4bbcdc877580ab2b23a161e0d536a7..c3d22a66b33488c98f4d54fdb40ae884a3024142 100644
--- a/Source/core/platform/Scrollbar.cpp
+++ b/Source/core/platform/Scrollbar.cpp
@@ -55,12 +55,6 @@ PassRefPtr<Scrollbar> Scrollbar::createNativeScrollbar(ScrollableArea* scrollabl
return adoptRef(new Scrollbar(scrollableArea, orientation, size));
}
-int Scrollbar::maxOverlapBetweenPages()
-{
- static int maxOverlapBetweenPages = ScrollbarTheme::theme()->maxOverlapBetweenPages();
- return maxOverlapBetweenPages;
-}
-
Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orientation, ScrollbarControlSize controlSize,
ScrollbarTheme* theme)
: m_scrollableArea(scrollableArea)
@@ -71,9 +65,6 @@ Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orient
, m_totalSize(0)
, m_currentPos(0)
, m_dragOrigin(0)
- , m_lineStep(0)
- , m_pageStep(0)
- , m_pixelStep(1)
, m_hoveredPart(NoPart)
, m_pressedPart(NoPart)
, m_pressedPos(0)
@@ -97,8 +88,7 @@ Scrollbar::Scrollbar(ScrollableArea* scrollableArea, ScrollbarOrientation orient
int thickness = m_theme->scrollbarThickness(controlSize);
Widget::setFrameRect(IntRect(0, 0, thickness, thickness));
- if (m_scrollableArea)
- m_currentPos = static_cast<float>(m_scrollableArea->scrollPosition(this));
+ m_currentPos = scrollableAreaCurrentPos();
}
Scrollbar::~Scrollbar()
@@ -136,7 +126,7 @@ void Scrollbar::offsetDidChange()
{
ASSERT(m_scrollableArea);
- float position = static_cast<float>(m_scrollableArea->scrollPosition(this));
+ float position = scrollableAreaCurrentPos();
if (position == m_currentPos)
return;
@@ -158,13 +148,6 @@ void Scrollbar::setProportion(int visibleSize, int totalSize)
updateThumbProportion();
}
-void Scrollbar::setSteps(int lineStep, int pageStep, int pixelsPerStep)
-{
- m_lineStep = lineStep;
- m_pageStep = pageStep;
- m_pixelStep = 1.0f / pixelsPerStep;
-}
-
void Scrollbar::updateThumb()
{
#ifdef THUMB_POSITION_AFFECTS_BUTTONS
@@ -601,4 +584,15 @@ IntPoint Scrollbar::convertFromContainingView(const IntPoint& parentPoint) const
return Widget::convertFromContainingView(parentPoint);
}
+float Scrollbar::scrollableAreaCurrentPos() const
+{
+ if (!m_scrollableArea)
+ return 0;
+
+ if (m_orientation == HorizontalScrollbar)
+ return m_scrollableArea->scrollPosition().x() + m_scrollableArea->scrollOrigin().x();
trchen 2013/06/20 01:46:43 I recommend phasing out scrollOrigin(). Please use
bokan 2013/06/20 19:00:16 Done.
+
+ return m_scrollableArea->scrollPosition().y() + m_scrollableArea->scrollOrigin().y();
+}
+
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698