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

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: Fixed ScrollbarGroup pageStep Created 7 years, 5 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
« no previous file with comments | « Source/core/platform/Scrollbar.h ('k') | Source/core/platform/ScrollbarThemeClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/Scrollbar.cpp
diff --git a/Source/core/platform/Scrollbar.cpp b/Source/core/platform/Scrollbar.cpp
index 742c417b0c06acaf2a5dd1c9bd90e9448ad141d5..8e640cc5ff04afe7a6fb3fdde0831f1f39960c87 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->minimumScrollPosition().x();
+
+ return m_scrollableArea->scrollPosition().y() - m_scrollableArea->minimumScrollPosition().y();
+}
+
} // namespace WebCore
« no previous file with comments | « Source/core/platform/Scrollbar.h ('k') | Source/core/platform/ScrollbarThemeClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698