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

Unified Diff: Source/core/rendering/RenderLayer.cpp

Issue 14703004: Reland "Unifies ScrollView and RenderLayer to use non-shi..." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 7 years, 7 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/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerBacking.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderLayer.cpp
diff --git a/Source/core/rendering/RenderLayer.cpp b/Source/core/rendering/RenderLayer.cpp
index 1fa7e9a28017efe08f6930bd7f70768475d379bd..b8d95604b2f9de2f46442a8ac8140a6510c85fb6 100644
--- a/Source/core/rendering/RenderLayer.cpp
+++ b/Source/core/rendering/RenderLayer.cpp
@@ -2202,10 +2202,10 @@ void RenderLayer::scrollToOffset(const IntSize& scrollOffset, ScrollOffsetClampi
{
IntSize newScrollOffset = clamp == ScrollOffsetClamped ? clampScrollOffset(scrollOffset) : scrollOffset;
if (newScrollOffset != adjustedScrollOffset())
- scrollToOffsetWithoutAnimation(IntPoint(newScrollOffset));
+ scrollToOffsetWithoutAnimation(-scrollOrigin() + newScrollOffset);
}
-void RenderLayer::scrollTo(int x, int y)
+void RenderLayer::setScrollOffset(const IntPoint& newScrollOffset)
{
RenderBox* box = renderBox();
if (!box)
@@ -2217,15 +2217,9 @@ void RenderLayer::scrollTo(int x, int y)
computeScrollDimensions();
}
- // FIXME: Eventually, we will want to perform a blit. For now never
- // blit, since the check for blitting is going to be very
- // complicated (since it will involve testing whether our layer
- // is either occluded by another layer or clipped by an enclosing
- // layer or contains fixed backgrounds, etc.).
- IntSize newScrollOffset = IntSize(x - scrollOrigin().x(), y - scrollOrigin().y());
- if (m_scrollOffset == newScrollOffset)
+ if (m_scrollOffset == toIntSize(newScrollOffset))
return;
- m_scrollOffset = newScrollOffset;
+ m_scrollOffset = toIntSize(newScrollOffset);
Frame* frame = renderer()->frame();
InspectorInstrumentation::willScrollLayer(frame);
@@ -2581,11 +2575,6 @@ int RenderLayer::scrollSize(ScrollbarOrientation orientation) const
return scrollbar ? (scrollbar->totalSize() - scrollbar->visibleSize()) : 0;
}
-void RenderLayer::setScrollOffset(const IntPoint& offset)
-{
- scrollTo(offset.x(), offset.y());
-}
-
int RenderLayer::scrollPosition(Scrollbar* scrollbar) const
{
if (scrollbar->orientation() == HorizontalScrollbar)
@@ -2607,8 +2596,13 @@ IntPoint RenderLayer::minimumScrollPosition() const
IntPoint RenderLayer::maximumScrollPosition() const
{
- // FIXME: m_scrollSize may not be up-to-date if m_scrollDimensionsDirty is true.
- return -scrollOrigin() + roundedIntSize(m_scrollSize) - visibleContentRect(IncludeScrollbars).size();
+ RenderBox* box = renderBox();
+ if (!box)
+ return -scrollOrigin();
+
+ LayoutRect overflowRect(box->layoutOverflowRect());
+ box->flipForWritingMode(overflowRect);
+ return -scrollOrigin() + enclosingIntRect(overflowRect).size() - enclosingIntRect(box->clientBoxRect()).size();
}
IntRect RenderLayer::visibleContentRect(VisibleContentRectIncludesScrollbars scrollbarInclusion) const
@@ -3250,7 +3244,7 @@ void RenderLayer::updateScrollInfoAfterLayout()
updateScrollbarsAfterLayout();
if (originalScrollOffset != adjustedScrollOffset())
- scrollToOffsetWithoutAnimation(IntPoint(adjustedScrollOffset()));
+ scrollToOffsetWithoutAnimation(-scrollOrigin() + adjustedScrollOffset());
// Composited scrolling may need to be enabled or disabled if the amount of overflow changed.
if (renderer()->view() && compositor()->updateLayerCompositingState(this))
« no previous file with comments | « Source/core/rendering/RenderLayer.h ('k') | Source/core/rendering/RenderLayerBacking.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698