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

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

Issue 815833005: [css-grid] Handle min-content/max-content with orthogonal flows (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: New approach (Step3) - Assumed row track's breadth for intrinsic size computation. Created 5 years 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
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 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after
2033 2033
2034 if (isInline() && !isInlineBlockOrInlineTable()) { 2034 if (isInline() && !isInlineBlockOrInlineTable()) {
2035 // just calculate margins 2035 // just calculate margins
2036 computedValues.m_margins.m_start = minimumValueForLength(styleToUse.marg inStart(), containerLogicalWidth); 2036 computedValues.m_margins.m_start = minimumValueForLength(styleToUse.marg inStart(), containerLogicalWidth);
2037 computedValues.m_margins.m_end = minimumValueForLength(styleToUse.margin End(), containerLogicalWidth); 2037 computedValues.m_margins.m_end = minimumValueForLength(styleToUse.margin End(), containerLogicalWidth);
2038 if (treatAsReplaced) 2038 if (treatAsReplaced)
2039 computedValues.m_extent = std::max<LayoutUnit>(floatValueForLength(l ogicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth ()); 2039 computedValues.m_extent = std::max<LayoutUnit>(floatValueForLength(l ogicalWidthLength, 0) + borderAndPaddingLogicalWidth(), minPreferredLogicalWidth ());
2040 return; 2040 return;
2041 } 2041 }
2042 2042
2043 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth;
2044 if (hasPerpendicularContainingBlock)
2045 containerWidthInInlineDirection = perpendicularContainingBlockLogicalHei ght();
2046
2043 // Width calculations 2047 // Width calculations
2044 if (treatAsReplaced) { 2048 if (treatAsReplaced) {
2045 computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingL ogicalWidth(); 2049 computedValues.m_extent = logicalWidthLength.value() + borderAndPaddingL ogicalWidth();
2046 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && s tyle()->logicalMinWidth().isAuto() && style()->overflowX() == OVISIBLE && contai nerLogicalWidth < minPreferredLogicalWidth()) { 2050 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() && s tyle()->logicalMinWidth().isAuto() && style()->overflowX() == OVISIBLE && contai nerWidthInInlineDirection < minPreferredLogicalWidth()) {
2047 // TODO (lajava) Move this logic to the LayoutGrid class. 2051 // TODO (lajava) Move this logic to the LayoutGrid class.
2048 // Implied minimum size of Grid items. 2052 // Implied minimum size of Grid items.
2049 computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogi calWidth(), containerLogicalWidth, cb); 2053 computedValues.m_extent = constrainLogicalWidthByMinMax(minPreferredLogi calWidth(), containerWidthInInlineDirection, cb);
2050 } else { 2054 } else {
2051 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth;
2052 if (hasPerpendicularContainingBlock)
2053 containerWidthInInlineDirection = perpendicularContainingBlockLogica lHeight();
2054 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize , styleToUse.logicalWidth(), containerWidthInInlineDirection, cb); 2055 LayoutUnit preferredWidth = computeLogicalWidthUsing(MainOrPreferredSize , styleToUse.logicalWidth(), containerWidthInInlineDirection, cb);
2055 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb); 2056 computedValues.m_extent = constrainLogicalWidthByMinMax(preferredWidth, containerWidthInInlineDirection, cb);
2056 } 2057 }
2057 2058
2058 // Margin calculations. 2059 // Margin calculations.
2059 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu tedValues.m_extent, computedValues.m_margins.m_start, 2060 computeMarginsForDirection(InlineDirection, cb, containerLogicalWidth, compu tedValues.m_extent, computedValues.m_margins.m_start,
2060 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE nd()); 2061 computedValues.m_margins.m_end, style()->marginStart(), style()->marginE nd());
2061 2062
2062 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp utedValues.m_margins.m_end) 2063 if (!hasPerpendicularContainingBlock && containerLogicalWidth && containerLo gicalWidth != (computedValues.m_extent + computedValues.m_margins.m_start + comp utedValues.m_margins.m_end)
2063 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated () && !cb->isLayoutGrid()) { 2064 && !isFloating() && !isInline() && !cb->isFlexibleBoxIncludingDeprecated () && !cb->isLayoutGrid()) {
(...skipping 2775 matching lines...) Expand 10 before | Expand all | Expand 10 after
4839 StyleImage* borderImage = style()->borderImage().image(); 4840 StyleImage* borderImage = style()->borderImage().image();
4840 return borderImage && borderImage->canRender() && borderImage->isLoaded(); 4841 return borderImage && borderImage->canRender() && borderImage->isLoaded();
4841 } 4842 }
4842 4843
4843 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4844 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4844 { 4845 {
4845 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4846 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4846 } 4847 }
4847 4848
4848 } // namespace blink 4849 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698