Index: Source/core/rendering/RenderLayer.cpp |
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp |
index 70f6a3e44e358bdcd4586651d1ec5fb1fe8afff1..b6f927e2f52bcd89fe37e1bbcf574ff4411a82b4 100644 |
--- a/Source/core/rendering/RenderLayer.cpp |
+++ b/Source/core/rendering/RenderLayer.cpp |
@@ -1329,6 +1329,29 @@ IntRect RenderLayer::scrollableAreaBoundingBox() const |
return renderer()->absoluteBoundingBoxRect(); |
} |
+bool RenderLayer::userInputScrollable(ScrollbarOrientation orientation) const |
+{ |
+ RenderBox* box = renderBox(); |
+ ASSERT(box); |
+ |
+ EOverflow overflowStyle = (orientation == HorizontalScrollbar) ? |
+ renderer()->style()->overflowX() : renderer()->style()->overflowY(); |
+ return (overflowStyle == OSCROLL || overflowStyle == OAUTO); |
+} |
+ |
+int RenderLayer::pageStep(ScrollbarOrientation orientation) const |
+{ |
+ RenderBox* box = renderBox(); |
+ ASSERT(box); |
+ |
+ int length = (orientation == HorizontalScrollbar) ? |
+ box->pixelSnappedClientWidth() : box->pixelSnappedClientHeight(); |
+ int minPageStep = static_cast<float>(length) * ScrollableArea::minFractionToStepWhenPaging(); |
+ int pageStep = max(minPageStep, length - ScrollableArea::maxOverlapBetweenPages()); |
+ |
+ return max(pageStep, 1); |
+} |
+ |
RenderLayer* RenderLayer::enclosingTransformedAncestor() const |
{ |
RenderLayer* curr = parent(); |
@@ -2489,17 +2512,13 @@ void RenderLayer::resize(const PlatformEvent& evt, const LayoutSize& oldOffset) |
int RenderLayer::scrollSize(ScrollbarOrientation orientation) const |
{ |
- Scrollbar* scrollbar = ((orientation == HorizontalScrollbar) ? m_hBar : m_vBar).get(); |
- return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0; |
-} |
+ RenderBox* box = renderBox(); |
+ ASSERT(box); |
-int RenderLayer::scrollPosition(Scrollbar* scrollbar) const |
-{ |
- if (scrollbar->orientation() == HorizontalScrollbar) |
- return scrollXOffset(); |
- if (scrollbar->orientation() == VerticalScrollbar) |
- return scrollYOffset(); |
- return 0; |
+ if (orientation == HorizontalScrollbar) |
+ return m_scrollSize.width() - box->pixelSnappedClientWidth(); |
+ |
+ return m_scrollSize.height() - box->pixelSnappedClientHeight(); |
trchen
2013/06/20 01:46:43
Whoa. scrollSize() looks like an accessor to m_scr
bokan
2013/06/20 19:00:16
Done.
|
} |
IntPoint RenderLayer::scrollPosition() const |
@@ -2860,14 +2879,6 @@ void RenderLayer::destroyScrollbar(ScrollbarOrientation orientation) |
scrollbar = 0; |
} |
-bool RenderLayer::scrollsOverflow() const |
-{ |
- if (!renderer()->isBox()) |
- return false; |
- |
- return toRenderBox(renderer())->scrollsOverflow(); |
-} |
- |
void RenderLayer::setHasHorizontalScrollbar(bool hasScrollbar) |
{ |
if (hasScrollbar == hasHorizontalScrollbar()) |
@@ -3126,14 +3137,10 @@ void RenderLayer::updateScrollbarsAfterLayout() |
// Set up the range (and page step/line step). |
if (m_hBar) { |
int clientWidth = box->pixelSnappedClientWidth(); |
- int pageStep = max(max<int>(clientWidth * Scrollbar::minFractionToStepWhenPaging(), clientWidth - Scrollbar::maxOverlapBetweenPages()), 1); |
- m_hBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); |
m_hBar->setProportion(clientWidth, m_scrollSize.width()); |
} |
if (m_vBar) { |
int clientHeight = box->pixelSnappedClientHeight(); |
- int pageStep = max(max<int>(clientHeight * Scrollbar::minFractionToStepWhenPaging(), clientHeight - Scrollbar::maxOverlapBetweenPages()), 1); |
- m_vBar->setSteps(Scrollbar::pixelsPerLineStep(), pageStep); |
m_vBar->setProportion(clientHeight, m_scrollSize.height()); |
} |