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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp

Issue 2342663002: [css-flexbox] Fix size comparison when scrollbars are present (Closed)
Patch Set: add test Created 4 years, 3 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 | « third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
index 6f1dab9c6b8acbd9b12fab9aeed1173dbb2ffdb4..95f3d4a5fc88c408e4ec6e29e31c3ee3c582ed14 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -521,9 +521,9 @@ LayoutUnit LayoutFlexibleBox::mainAxisExtentForChild(const LayoutBox& child) con
return isHorizontalFlow() ? child.size().width() : child.size().height();
}
-LayoutUnit LayoutFlexibleBox::mainAxisContentExtentForChild(const LayoutBox& child) const
+LayoutUnit LayoutFlexibleBox::mainAxisContentExtentForChildIncludingScrollbar(const LayoutBox& child) const
{
- return isHorizontalFlow() ? child.contentWidth() : child.contentHeight();
+ return isHorizontalFlow() ? child.contentWidth() + child.verticalScrollbarWidth() : child.contentHeight() + child.horizontalScrollbarHeight();
}
LayoutUnit LayoutFlexibleBox::crossAxisExtent() const
@@ -1662,7 +1662,10 @@ void LayoutFlexibleBox::layoutAndPlaceChildren(LayoutUnit& crossAxisOffset, cons
child->setMayNeedPaintInvalidation();
setOverrideMainAxisContentSizeForChild(*child, flexItem.flexedContentSize);
- if (flexItem.flexedContentSize != mainAxisContentExtentForChild(*child)) {
+ // The flexed content size and the override size include the scrollbar
+ // width, so we need to compare to the size including the scrollbar.
+ // TODO(cbiesinger): Should it include the scrollbar?
+ if (flexItem.flexedContentSize != mainAxisContentExtentForChildIncludingScrollbar(*child)) {
child->setChildNeedsLayout(MarkOnlyThis);
} else {
// To avoid double applying margin changes in updateAutoMarginsInCrossAxis, we reset the margins here.
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698