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

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

Issue 2398043002: [css-grid] Stretch should grow and shrink items to fit its grid area (Closed)
Patch Set: Created 4 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 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 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after
2478 2478
2479 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth; 2479 LayoutUnit containerWidthInInlineDirection = containerLogicalWidth;
2480 if (hasPerpendicularContainingBlock) 2480 if (hasPerpendicularContainingBlock)
2481 containerWidthInInlineDirection = 2481 containerWidthInInlineDirection =
2482 perpendicularContainingBlockLogicalHeight(); 2482 perpendicularContainingBlockLogicalHeight();
2483 2483
2484 // Width calculations 2484 // Width calculations
2485 if (treatAsReplaced) { 2485 if (treatAsReplaced) {
2486 computedValues.m_extent = 2486 computedValues.m_extent =
2487 LayoutUnit(logicalWidthLength.value()) + borderAndPaddingLogicalWidth(); 2487 LayoutUnit(logicalWidthLength.value()) + borderAndPaddingLogicalWidth();
2488 } else if (parent()->isLayoutGrid() && style()->logicalWidth().isAuto() &&
2489 style()->logicalMinWidth().isAuto() &&
2490 style()->overflowInlineDirection() == OverflowVisible &&
2491 containerWidthInInlineDirection < minPreferredLogicalWidth()) {
2492 // TODO (lajava) Move this logic to the LayoutGrid class.
2493 // Implied minimum size of Grid items.
2494 computedValues.m_extent = constrainLogicalWidthByMinMax(
2495 minPreferredLogicalWidth(), containerWidthInInlineDirection, cb);
2496 } else { 2488 } else {
2497 LayoutUnit preferredWidth = 2489 LayoutUnit preferredWidth =
2498 computeLogicalWidthUsing(MainOrPreferredSize, styleToUse.logicalWidth(), 2490 computeLogicalWidthUsing(MainOrPreferredSize, styleToUse.logicalWidth(),
2499 containerWidthInInlineDirection, cb); 2491 containerWidthInInlineDirection, cb);
2500 computedValues.m_extent = constrainLogicalWidthByMinMax( 2492 computedValues.m_extent = constrainLogicalWidthByMinMax(
2501 preferredWidth, containerWidthInInlineDirection, cb); 2493 preferredWidth, containerWidthInInlineDirection, cb);
2502 } 2494 }
2503 2495
2504 // Margin calculations. 2496 // Margin calculations.
2505 computeMarginsForDirection( 2497 computeMarginsForDirection(
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
2899 bool stretching = parent()->style()->boxAlign() == BSTRETCH; 2891 bool stretching = parent()->style()->boxAlign() == BSTRETCH;
2900 bool treatAsReplaced = 2892 bool treatAsReplaced =
2901 shouldComputeSizeAsReplaced() && (!inHorizontalBox || !stretching); 2893 shouldComputeSizeAsReplaced() && (!inHorizontalBox || !stretching);
2902 bool checkMinMaxHeight = false; 2894 bool checkMinMaxHeight = false;
2903 2895
2904 // The parent box is flexing us, so it has increased or decreased our height . We have to 2896 // The parent box is flexing us, so it has increased or decreased our height . We have to
2905 // grab our cached flexible height. 2897 // grab our cached flexible height.
2906 // FIXME: Account for writing-mode in flexible boxes. 2898 // FIXME: Account for writing-mode in flexible boxes.
2907 // https://bugs.webkit.org/show_bug.cgi?id=46418 2899 // https://bugs.webkit.org/show_bug.cgi?id=46418
2908 if (hasOverrideLogicalContentHeight()) { 2900 if (hasOverrideLogicalContentHeight()) {
2909 LayoutUnit contentHeight = overrideLogicalContentHeight(); 2901 h = Length(overrideLogicalContentHeight(), Fixed);
2910 if (parent()->isLayoutGrid() && style()->logicalMinHeight().isAuto() &&
2911 style()->overflowY() == OverflowVisible) {
2912 ASSERT(style()->logicalHeight().isAuto());
2913 LayoutUnit minContentHeight = computeContentLogicalHeight(
2914 MinSize, Length(MinContent),
2915 computedValues.m_extent - borderAndPaddingLogicalHeight());
2916 contentHeight = std::max(
2917 contentHeight,
2918 constrainContentBoxLogicalHeightByMinMax(
2919 minContentHeight,
2920 computedValues.m_extent - borderAndPaddingLogicalHeight()));
2921 }
2922 h = Length(contentHeight, Fixed);
2923 } else if (treatAsReplaced) { 2902 } else if (treatAsReplaced) {
2924 h = Length(computeReplacedLogicalHeight(), Fixed); 2903 h = Length(computeReplacedLogicalHeight(), Fixed);
2925 } else { 2904 } else {
2926 h = style()->logicalHeight(); 2905 h = style()->logicalHeight();
2927 checkMinMaxHeight = true; 2906 checkMinMaxHeight = true;
2928 } 2907 }
2929 2908
2930 // Block children of horizontal flexible boxes fill the height of the box. 2909 // Block children of horizontal flexible boxes fill the height of the box.
2931 // FIXME: Account for writing-mode in flexible boxes. 2910 // FIXME: Account for writing-mode in flexible boxes.
2932 // https://bugs.webkit.org/show_bug.cgi?id=46418 2911 // https://bugs.webkit.org/show_bug.cgi?id=46418
(...skipping 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after
5464 LayoutRect rect = frameRect(); 5443 LayoutRect rect = frameRect();
5465 5444
5466 LayoutBlock* block = containingBlock(); 5445 LayoutBlock* block = containingBlock();
5467 if (block) 5446 if (block)
5468 block->adjustChildDebugRect(rect); 5447 block->adjustChildDebugRect(rect);
5469 5448
5470 return rect; 5449 return rect;
5471 } 5450 }
5472 5451
5473 } // namespace blink 5452 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698