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

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: 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 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2218 EMarqueeDirection dir = parent()->style()->marqueeDirection(); 2218 EMarqueeDirection dir = parent()->style()->marqueeDirection();
2219 if (dir == MAUTO || dir == MFORWARD || dir == MBACKWARD || dir == MLEFT || dir == MRIGHT) 2219 if (dir == MAUTO || dir == MFORWARD || dir == MBACKWARD || dir == MLEFT || dir == MRIGHT)
2220 return true; 2220 return true;
2221 } 2221 }
2222 2222
2223 // Flexible box items should shrink wrap, so we lay them out at their intrin sic widths. 2223 // Flexible box items should shrink wrap, so we lay them out at their intrin sic widths.
2224 // In the case of columns that have a stretch alignment, we go ahead and lay out at the 2224 // In the case of columns that have a stretch alignment, we go ahead and lay out at the
2225 // stretched size to avoid an extra layout when applying alignment. 2225 // stretched size to avoid an extra layout when applying alignment.
2226 if (parent()->isFlexibleBox()) { 2226 if (parent()->isFlexibleBox()) {
2227 // For multiline columns, we need to apply align-content first, so we ca n't stretch now. 2227 // For multiline columns, we need to apply align-content first, so we ca n't stretch now.
2228 if (!parent()->style()->isColumnFlexDirection() || parent()->style()->fl exWrap() != FlexNoWrap) 2228 if (!parent()->style()->isColumnFlexDirection() || parent()->style()->fl exWrap() != FlexNoWrap)
ojan 2013/05/24 01:21:57 It's not obvious to me that this new code is right
2229 return true; 2229 return true;
2230 if (!flexItemHasStretchAlignment(this)) 2230 if (!flexItemHasStretchAlignment(this))
2231 return true; 2231 return true;
2232 if (parent()->style()->isColumnFlexDirection() && (style()->marginLeft() .isAuto() || style()->marginRight().isAuto())) {
2233 // Auto margins means we want centering, not stretching, so we want to return true here
2234 return true;
2235 }
2232 } 2236 }
2233 2237
2234 // Flexible horizontal boxes lay out children at their intrinsic widths. Al so vertical boxes 2238 // Flexible horizontal boxes lay out children at their intrinsic widths. Al so vertical boxes
2235 // that don't stretch their kids lay out their children at their intrinsic w idths. 2239 // that don't stretch their kids lay out their children at their intrinsic w idths.
2236 // FIXME: Think about block-flow here. 2240 // FIXME: Think about block-flow here.
2237 // https://bugs.webkit.org/show_bug.cgi?id=46473 2241 // https://bugs.webkit.org/show_bug.cgi?id=46473
2238 if (parent()->isDeprecatedFlexibleBox() && (parent()->style()->boxOrient() = = HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH)) 2242 if (parent()->isDeprecatedFlexibleBox() && (parent()->style()->boxOrient() = = HORIZONTAL || parent()->style()->boxAlign() != BSTRETCH))
2239 return true; 2243 return true;
2240 2244
2241 // Button, input, select, textarea, and legend treat width value of 'auto' a s 'intrinsic' unless it's in a 2245 // Button, input, select, textarea, and legend treat width value of 'auto' a s 'intrinsic' unless it's in a
(...skipping 2349 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