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

Unified Diff: Source/core/rendering/RenderLayer.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/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 70f6a3e44e358bdcd4586651d1ec5fb1fe8afff1..f7572bb0c96460e148ce88c074ea0095a6543e6e 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -1329,6 +1329,24 @@ IntRect RenderLayer::scrollableAreaBoundingBox() const
return renderer()->absoluteBoundingBoxRect();
}
+bool RenderLayer::isHorizontallyScrollable() const
+{
+ RenderBox* box = renderBox();
+ ASSERT(box);
+
+ EOverflow overflowStyle = renderer()->style()->overflowX();
+ return (overflowStyle == OSCROLL || overflowStyle == OAUTO);
+}
+
+bool RenderLayer::isVerticallyScrollable() const
+{
+ RenderBox* box = renderBox();
+ ASSERT(box);
+
+ EOverflow overflowStyle = renderer()->style()->overflowY();
+ return (overflowStyle == OSCROLL || overflowStyle == OAUTO);
+}
+
RenderLayer* RenderLayer::enclosingTransformedAncestor() const
{
RenderLayer* curr = parent();
@@ -2489,8 +2507,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);
+
+ if (orientation == HorizontalScrollbar)
+ return m_scrollSize.width() - box->pixelSnappedClientWidth();
+
+ return m_scrollSize.height() - box->pixelSnappedClientHeight();
}
int RenderLayer::scrollPosition(Scrollbar* scrollbar) const
@@ -2860,14 +2883,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())

Powered by Google App Engine
This is Rietveld 408576698