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

Unified Diff: Source/core/rendering/RenderOverflow.h

Issue 22799017: Prevent overflow of width/height of layout overflow rectangle which can cause scroll bar to misfunc… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix expected txt Created 7 years, 4 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 | « LayoutTests/scrollbars/scrollbar-large-overflow-rectangle-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderOverflow.h
diff --git a/Source/core/rendering/RenderOverflow.h b/Source/core/rendering/RenderOverflow.h
index d01d3bae59190896538aa3546b2442e393dd8fde..81d7f40f2d96e96e7628038dc07fade28aef5366 100644
--- a/Source/core/rendering/RenderOverflow.h
+++ b/Source/core/rendering/RenderOverflow.h
@@ -87,10 +87,13 @@ inline void RenderOverflow::addLayoutOverflow(const LayoutRect& rect)
{
LayoutUnit maxX = std::max(rect.maxX(), m_layoutOverflow.maxX());
LayoutUnit maxY = std::max(rect.maxY(), m_layoutOverflow.maxY());
- m_layoutOverflow.setX(std::min(rect.x(), m_layoutOverflow.x()));
- m_layoutOverflow.setY(std::min(rect.y(), m_layoutOverflow.y()));
- m_layoutOverflow.setWidth(maxX - m_layoutOverflow.x());
- m_layoutOverflow.setHeight(maxY - m_layoutOverflow.y());
+ LayoutUnit minX = std::min(rect.x(), m_layoutOverflow.x());
+ LayoutUnit minY = std::min(rect.y(), m_layoutOverflow.y());
+ // In case the width/height is larger than LayoutUnit can represent, fix the right/bottom edge and shift the top/left ones
+ m_layoutOverflow.setWidth(maxX - minX);
+ m_layoutOverflow.setHeight(maxY - minY);
+ m_layoutOverflow.setX(maxX - m_layoutOverflow.width());
+ m_layoutOverflow.setY(maxY - m_layoutOverflow.height());
}
inline void RenderOverflow::addVisualOverflow(const LayoutRect& rect)
« no previous file with comments | « LayoutTests/scrollbars/scrollbar-large-overflow-rectangle-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698