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

Unified Diff: Source/core/platform/ScrollView.cpp

Issue 16982005: Allow objects without scrollbars to be scrollable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Mac Build Fix 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/ScrollView.cpp
diff --git a/Source/core/platform/ScrollView.cpp b/Source/core/platform/ScrollView.cpp
index 67382df3ce5fa01bef3a3f530315221e5d5ff54f..545449e0c2c1634a9a2eed2285ed7d29fd7d9b29 100644
--- a/Source/core/platform/ScrollView.cpp
+++ b/Source/core/platform/ScrollView.cpp
@@ -43,7 +43,6 @@ ScrollView::ScrollView()
, m_verticalScrollbarMode(ScrollbarAuto)
, m_horizontalScrollbarLock(false)
, m_verticalScrollbarLock(false)
- , m_prohibitsScrolling(false)
, m_canBlitOnScroll(true)
, m_scrollbarsAvoidingResizer(0)
, m_scrollbarsSuppressed(false)
@@ -284,15 +283,16 @@ IntPoint ScrollView::adjustScrollPositionWithinRange(const IntPoint& scrollPoint
int ScrollView::scrollSize(ScrollbarOrientation orientation) const
{
+ Scrollbar* scrollbar = ((orientation == HorizontalScrollbar) ? m_horizontalScrollbar : m_verticalScrollbar).get();
+
// If no scrollbars are present, it does not indicate content is not be scrollable.
- if (!m_horizontalScrollbar && !m_verticalScrollbar && !prohibitsScrolling()) {
+ if (!scrollbar) {
IntSize scrollSize = m_contentsSize - visibleContentRect().size();
scrollSize.clampNegativeToZero();
return orientation == HorizontalScrollbar ? scrollSize.width() : scrollSize.height();
}
- Scrollbar* scrollbar = ((orientation == HorizontalScrollbar) ? m_horizontalScrollbar : m_verticalScrollbar).get();
- return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0;
+ return scrollbar->totalSize() - scrollbar->visibleSize();
}
void ScrollView::notifyPageThatContentAreaWillPaint() const
@@ -330,9 +330,6 @@ int ScrollView::scrollPosition(Scrollbar* scrollbar) const
void ScrollView::setScrollPosition(const IntPoint& scrollPoint)
{
- if (prohibitsScrolling())
- return;
-
IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint);
if (newScrollPosition == scrollPosition())
@@ -374,7 +371,7 @@ static const unsigned cMaxUpdateScrollbarsPass = 2;
void ScrollView::updateScrollbars(const IntSize& desiredOffset)
{
- if (m_inUpdateScrollbars || prohibitsScrolling())
+ if (m_inUpdateScrollbars)
return;
// If we came in here with the view already needing a layout, then go ahead and do that
@@ -822,6 +819,16 @@ void ScrollView::positionScrollbarLayers()
positionScrollCornerLayer(layerForScrollCorner(), scrollCornerRect());
}
+bool ScrollView::isHorizontallyScrollable() const
+{
+ return m_horizontalScrollbarMode == ScrollbarAuto || m_horizontalScrollbarMode == ScrollbarAlwaysOn;
+}
+
+bool ScrollView::isVerticallyScrollable() const
+{
+ return m_verticalScrollbarMode == ScrollbarAuto || m_verticalScrollbarMode == ScrollbarAlwaysOn;
+}
+
void ScrollView::repaintContentRectangle(const IntRect& rect)
{
IntRect paintRect = rect;

Powered by Google App Engine
This is Rietveld 408576698