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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutBox.cpp

Issue 2022553002: [css-flexbox] logical widths are always definite. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h » ('j') | 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 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2238 containerWidthInInlineDirection = perpendicularContainingBlockLogicalHei ght(); 2238 containerWidthInInlineDirection = perpendicularContainingBlockLogicalHei ght();
2239 2239
2240 // Width calculations 2240 // Width calculations
2241 if (treatAsReplaced) { 2241 if (treatAsReplaced) {
2242 computedValues.m_extent = LayoutUnit(logicalWidthLength.value()) + borde rAndPaddingLogicalWidth(); 2242 computedValues.m_extent = LayoutUnit(logicalWidthLength.value()) + borde rAndPaddingLogicalWidth();
2243 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && s tyle()->logicalMinWidth().isAuto() && style()->overflowX() == OverflowVisible && containerWidthInInlineDirection < minPreferredLogicalWidth()) { 2243 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && s tyle()->logicalMinWidth().isAuto() && style()->overflowX() == OverflowVisible && containerWidthInInlineDirection < minPreferredLogicalWidth()) {
2244 // TODO (lajava) Move this logic to the LayoutGrid class. 2244 // TODO (lajava) Move this logic to the LayoutGrid class.
2245 // Implied minimum size of Grid items. 2245 // Implied minimum size of Grid items.
2246 computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogi calWidth(), containerWidthInInlineDirection, cb); 2246 computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogi calWidth(), containerWidthInInlineDirection, cb);
2247 } else { 2247 } else {
2248 if (!hasPerpendicularContainingBlock && cb->isFlexItem() && styleToUse.l ogicalWidth().hasPercent() && !isOutOfFlowPositioned()) {
2249 LayoutUnit stretchedWidth = toLayoutFlexibleBox(cb->parent())->child LogicalWidthForPercentageResolution(*cb);
2250 if (stretchedWidth != LayoutUnit(-1))
2251 containerWidthInInlineDirection = stretchedWidth;
2252 }
2253 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize , styleToUse.logicalWidth(), containerWidthInInlineDirection, cb); 2248 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize , styleToUse.logicalWidth(), containerWidthInInlineDirection, cb);
2254 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb); 2249 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb);
2255 } 2250 }
2256 2251
2257 // Margin calculations. 2252 // Margin calculations.
2258 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu tedValues.m_extent, computedValues.m_margins.m_start, 2253 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu tedValues.m_extent, computedValues.m_margins.m_start,
2259 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE nd()); 2254 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE nd());
2260 2255
2261 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp utedValues.m_margins.m_end) 2256 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp utedValues.m_margins.m_end)
2262 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated () && !cb->isLayoutGrid()) { 2257 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated () && !cb->isLayoutGrid()) {
(...skipping 2679 matching lines...) Expand 10 before | Expand all | Expand 10 after
4942 m_rareData->m_snapAreas->remove(&snapArea); 4937 m_rareData->m_snapAreas->remove(&snapArea);
4943 } 4938 }
4944 } 4939 }
4945 4940
4946 SnapAreaSet* LayoutBox::snapAreas() const 4941 SnapAreaSet* LayoutBox::snapAreas() const
4947 { 4942 {
4948 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr; 4943 return m_rareData ? m_rareData->m_snapAreas.get() : nullptr;
4949 } 4944 }
4950 4945
4951 } // namespace blink 4946 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/layout/LayoutFlexibleBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698