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

Unified Diff: Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp

Issue 11017062: Merge 130549 - Deprecated flexboxes subtract scrollbar width/height twice (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1271/
Patch Set: Created 8 years, 2 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/WebCore/rendering/RenderBox.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp
===================================================================
--- Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (revision 130950)
+++ Source/WebCore/rendering/RenderDeprecatedFlexibleBox.cpp (working copy)
@@ -151,6 +151,20 @@
return child->isOutOfFlowPositioned() || child->style()->visibility() == COLLAPSE;
}
+static LayoutUnit contentWidthForChild(RenderBox* child)
+{
+ if (child->hasOverrideWidth())
+ return child->overrideLogicalContentWidth();
+ return child->logicalWidth() - child->borderAndPaddingLogicalWidth();
+}
+
+static LayoutUnit contentHeightForChild(RenderBox* child)
+{
+ if (child->hasOverrideHeight())
+ return child->overrideLogicalContentHeight();
+ return child->logicalHeight() - child->borderAndPaddingLogicalHeight();
+}
+
void RenderDeprecatedFlexibleBox::styleWillChange(StyleDifference diff, const RenderStyle* newStyle)
{
RenderStyle* oldStyle = style();
@@ -538,7 +552,7 @@
if (allowedChildFlex(child, expanding, i)) {
LayoutUnit spaceAdd = LayoutUnit(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex));
if (spaceAdd) {
- child->setOverrideLogicalContentWidth(child->overrideLogicalContentWidth() + spaceAdd);
+ child->setOverrideLogicalContentWidth(contentWidthForChild(child) + spaceAdd);
flexingChildren = true;
relayoutChildren = true;
}
@@ -555,7 +569,7 @@
LayoutUnit spaceAdd = groupRemainingSpace > 0 ? 1 : -1;
for (RenderBox* child = iterator.first(); child && groupRemainingSpace; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i)) {
- child->setOverrideLogicalContentWidth(child->overrideLogicalContentWidth() + spaceAdd);
+ child->setOverrideLogicalContentWidth(contentWidthForChild(child) + spaceAdd);
flexingChildren = true;
relayoutChildren = true;
remainingSpace -= spaceAdd;
@@ -789,7 +803,7 @@
if (allowedChildFlex(child, expanding, i)) {
LayoutUnit spaceAdd = static_cast<LayoutUnit>(spaceAvailableThisPass * (child->style()->boxFlex() / totalFlex));
if (spaceAdd) {
- child->setOverrideLogicalContentHeight(child->overrideLogicalContentHeight() + spaceAdd);
+ child->setOverrideLogicalContentHeight(contentHeightForChild(child) + spaceAdd);
flexingChildren = true;
relayoutChildren = true;
}
@@ -806,7 +820,7 @@
LayoutUnit spaceAdd = groupRemainingSpace > 0 ? 1 : -1;
for (RenderBox* child = iterator.first(); child && groupRemainingSpace; child = iterator.next()) {
if (allowedChildFlex(child, expanding, i)) {
- child->setOverrideLogicalContentHeight(child->overrideLogicalContentHeight() + spaceAdd);
+ child->setOverrideLogicalContentHeight(contentHeightForChild(child) + spaceAdd);
flexingChildren = true;
relayoutChildren = true;
remainingSpace -= spaceAdd;
@@ -1019,7 +1033,7 @@
if (isHorizontal()) {
// FIXME: For now just handle fixed values.
LayoutUnit maxWidth = MAX_LAYOUT_UNIT;
- LayoutUnit width = child->overrideLogicalContentWidth();
+ LayoutUnit width = contentWidthForChild(child);
if (!child->style()->maxWidth().isUndefined() && child->style()->maxWidth().isFixed())
maxWidth = child->style()->maxWidth().value();
else if (child->style()->maxWidth().type() == Intrinsic)
@@ -1032,7 +1046,7 @@
} else {
// FIXME: For now just handle fixed values.
LayoutUnit maxHeight = MAX_LAYOUT_UNIT;
- LayoutUnit height = child->overrideLogicalContentHeight();
+ LayoutUnit height = contentHeightForChild(child);
if (!child->style()->maxHeight().isUndefined() && child->style()->maxHeight().isFixed())
maxHeight = child->style()->maxHeight().value();
if (maxHeight == MAX_LAYOUT_UNIT)
@@ -1044,7 +1058,7 @@
// FIXME: For now just handle fixed values.
if (isHorizontal()) {
LayoutUnit minWidth = child->minPreferredLogicalWidth();
- LayoutUnit width = child->overrideLogicalContentWidth();
+ LayoutUnit width = contentWidthForChild(child);
if (child->style()->minWidth().isFixed())
minWidth = child->style()->minWidth().value();
else if (child->style()->minWidth().type() == Intrinsic)
@@ -1060,7 +1074,7 @@
Length minHeight = child->style()->minHeight();
if (minHeight.isFixed() || minHeight.isAuto()) {
LayoutUnit minHeight = child->style()->minHeight().value();
- LayoutUnit height = child->overrideLogicalContentHeight();
+ LayoutUnit height = contentHeightForChild(child);
LayoutUnit allowedShrinkage = min<LayoutUnit>(0, minHeight - height);
return allowedShrinkage;
}
« no previous file with comments | « Source/WebCore/rendering/RenderBox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698