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

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp

Issue 1921553008: Fix scroll origin, overflow rects, and coordinate flipping for flexbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Split flexbox refactor into separate CL Created 4 years, 8 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: third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
index 12f489202c52d6b429840b7777bd6fb20455b4a5..06d8fea21ad6e59ffb86fbca2ff2044ae4c4a6e4 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -587,14 +587,49 @@ int PaintLayerScrollableArea::pixelSnappedScrollHeight() const
return snapSizeToPixel(scrollHeight(), box().clientTop() + box().location().y());
}
+IntSize PaintLayerScrollableArea::originAdjustmentForScrollbars() const
leviw_travelin_and_unemployed 2016/04/28 22:12:12 This deserves a big description about why it exist
+{
+ IntSize size;
+ int verticalScrollbarWidth = box().verticalScrollbarWidth();
+ int horizontalScrollbarHeight = box().horizontalScrollbarHeight();
+
+ if (box().hasFlippedBlocksWritingMode()) {
+ if (box().isFlexibleBox()) {
leviw_travelin_and_unemployed 2016/04/28 22:12:12 It seems like it may be easier/clearer to handle t
+ EFlexDirection flexDirection = box().style()->flexDirection();
+ if (flexDirection != FlowColumnReverse)
+ size.expand(verticalScrollbarWidth, 0);
+ if (flexDirection == FlowRowReverse)
+ size.expand(0, horizontalScrollbarHeight);
+ } else {
+ size.expand(verticalScrollbarWidth, 0);
+ }
+ } else if (box().isHorizontalWritingMode()) {
+ if (box().isFlexibleBox()) {
+ EFlexDirection flexDirection = box().style()->flexDirection();
+ if (flexDirection == FlowRowReverse)
+ size.expand(verticalScrollbarWidth, 0);
+ else if (flexDirection == FlowColumnReverse)
+ size.expand(0, horizontalScrollbarHeight);
+ } else if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
+ size.expand(verticalScrollbarWidth, 0);
+ }
+ } else if (box().isFlexibleBox()) {
+ EFlexDirection flexDirection = box().style()->flexDirection();
+ if (flexDirection == FlowColumnReverse)
+ size.expand(verticalScrollbarWidth, 0);
+ else if (flexDirection == FlowRowReverse)
+ size.expand(0, horizontalScrollbarHeight);
+ }
+ return size;
+}
+
void PaintLayerScrollableArea::computeScrollDimensions()
{
m_overflowRect = box().layoutOverflowRect();
box().flipForWritingMode(m_overflowRect);
- int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScrollbarWidth() : 0);
- int scrollableTopOverflow = m_overflowRect.y() - box().borderTop();
- setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow));
+ LayoutPoint scrollableOverflow = m_overflowRect.location() - LayoutSize(box().borderLeft(), box().borderTop());
+ setScrollOrigin(flooredIntPoint(-scrollableOverflow) + originAdjustmentForScrollbars());
}
void PaintLayerScrollableArea::scrollToPosition(const DoublePoint& scrollPosition, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior, ScrollType scrollType)

Powered by Google App Engine
This is Rietveld 408576698