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

Side by Side Diff: Source/core/rendering/RenderBox.cpp

Issue 15946003: Don't stretch margin: auto items in a vertical flexbox (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix vertical divs and add a test for it 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/css3/flexbox/columns-center-with-margins-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2174 logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFl oats(marginStart, marginEnd, cb, region, offsetFromLogicalTopOfFirstPage)); 2174 logicalWidthResult = min(logicalWidthResult, shrinkLogicalWidthToAvoidFl oats(marginStart, marginEnd, cb, region, offsetFromLogicalTopOfFirstPage));
2175 2175
2176 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(widthT ype)) 2176 if (widthType == MainOrPreferredSize && sizesLogicalWidthToFitContent(widthT ype))
2177 return max(minPreferredLogicalWidth(), min(maxPreferredLogicalWidth(), l ogicalWidthResult)); 2177 return max(minPreferredLogicalWidth(), min(maxPreferredLogicalWidth(), l ogicalWidthResult));
2178 return logicalWidthResult; 2178 return logicalWidthResult;
2179 } 2179 }
2180 2180
2181 static bool flexItemHasStretchAlignment(const RenderObject* flexitem) 2181 static bool flexItemHasStretchAlignment(const RenderObject* flexitem)
2182 { 2182 {
2183 RenderObject* parent = flexitem->parent(); 2183 RenderObject* parent = flexitem->parent();
2184 // auto margins mean we don't stretch. Note that this function will only be used for
2185 // widths, so we don't have to check marginBefore/marginAfter.
ojan 2013/05/24 22:39:09 Instead of adding (or maybe in addition to) the ex
2186 if (flexitem->style()->marginStart().isAuto() || flexitem->style()->marginEn d().isAuto())
2187 return false;
2184 return flexitem->style()->alignSelf() == AlignStretch || (flexitem->style()- >alignSelf() == AlignAuto && parent->style()->alignItems() == AlignStretch); 2188 return flexitem->style()->alignSelf() == AlignStretch || (flexitem->style()- >alignSelf() == AlignAuto && parent->style()->alignItems() == AlignStretch);
2185 } 2189 }
2186 2190
2187 static bool isStretchingColumnFlexItem(const RenderObject* flexitem) 2191 static bool isStretchingColumnFlexItem(const RenderObject* flexitem)
2188 { 2192 {
2189 RenderObject* parent = flexitem->parent(); 2193 RenderObject* parent = flexitem->parent();
2190 if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER TICAL && parent->style()->boxAlign() == BSTRETCH) 2194 if (parent->isDeprecatedFlexibleBox() && parent->style()->boxOrient() == VER TICAL && parent->style()->boxAlign() == BSTRETCH)
2191 return true; 2195 return true;
2192 2196
2193 // We don't stretch multiline flexboxes because they need to apply line spac ing (align-content) first. 2197 // We don't stretch multiline flexboxes because they need to apply line spac ing (align-content) first.
(...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after
4591 4595
4592 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst rumentation) 4596 void RenderBox::reportStaticMembersMemoryUsage(MemoryInstrumentation* memoryInst rumentation)
4593 { 4597 {
4594 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes: :RenderingStructures); 4598 memoryInstrumentation->addRootObject(gOverrideHeightMap, WebCoreMemoryTypes: :RenderingStructures);
4595 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes:: RenderingStructures); 4599 memoryInstrumentation->addRootObject(gOverrideWidthMap, WebCoreMemoryTypes:: RenderingStructures);
4596 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa p, WebCoreMemoryTypes::RenderingStructures); 4600 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalHeightMa p, WebCoreMemoryTypes::RenderingStructures);
4597 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap , WebCoreMemoryTypes::RenderingStructures); 4601 memoryInstrumentation->addRootObject(gOverrideContainingBlockLogicalWidthMap , WebCoreMemoryTypes::RenderingStructures);
4598 } 4602 }
4599 4603
4600 } // namespace WebCore 4604 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/css3/flexbox/columns-center-with-margins-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698