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

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

Issue 2744593002: [css-grid] Protect against negative values in applyStretchAlignmentToChildIfNeeded() (Closed)
Patch Set: Created 3 years, 9 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) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1466 : allowedToStretchChildAlongRowAxis(child); 1466 : allowedToStretchChildAlongRowAxis(child);
1467 if (allowedToStretchChildBlockSize) { 1467 if (allowedToStretchChildBlockSize) {
1468 LayoutUnit stretchedLogicalHeight = 1468 LayoutUnit stretchedLogicalHeight =
1469 availableAlignmentSpaceForChildBeforeStretching( 1469 availableAlignmentSpaceForChildBeforeStretching(
1470 overrideContainingBlockContentSizeForChild(child, 1470 overrideContainingBlockContentSizeForChild(child,
1471 childBlockDirection), 1471 childBlockDirection),
1472 child); 1472 child);
1473 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax( 1473 LayoutUnit desiredLogicalHeight = child.constrainLogicalHeightByMinMax(
1474 stretchedLogicalHeight, LayoutUnit(-1)); 1474 stretchedLogicalHeight, LayoutUnit(-1));
1475 child.setOverrideLogicalContentHeight( 1475 child.setOverrideLogicalContentHeight(
1476 desiredLogicalHeight - child.borderAndPaddingLogicalHeight()); 1476 std::max(desiredLogicalHeight - child.borderAndPaddingLogicalHeight(),
1477 LayoutUnit()));
svillar 2017/03/09 10:29:15 clampNegativeToZero()
Manuel Rego 2017/03/09 10:59:13 Done.
1477 if (desiredLogicalHeight != child.logicalHeight()) { 1478 if (desiredLogicalHeight != child.logicalHeight()) {
1478 // TODO (lajava): Can avoid laying out here in some cases. See 1479 // TODO (lajava): Can avoid laying out here in some cases. See
1479 // https://webkit.org/b/87905. 1480 // https://webkit.org/b/87905.
1480 child.setLogicalHeight(LayoutUnit()); 1481 child.setLogicalHeight(LayoutUnit());
1481 child.setNeedsLayout(LayoutInvalidationReason::GridChanged); 1482 child.setNeedsLayout(LayoutInvalidationReason::GridChanged);
1482 } 1483 }
1483 } 1484 }
1484 } 1485 }
1485 1486
1486 // TODO(lajava): This logic is shared by LayoutFlexibleBox, so it should be 1487 // TODO(lajava): This logic is shared by LayoutFlexibleBox, so it should be
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
2095 if (direction == ForRows) 2096 if (direction == ForRows)
2096 return grid.numTracks(ForRows); 2097 return grid.numTracks(ForRows);
2097 2098
2098 return grid.numTracks(ForRows) 2099 return grid.numTracks(ForRows)
2099 ? grid.numTracks(ForColumns) 2100 ? grid.numTracks(ForColumns)
2100 : GridPositionsResolver::explicitGridColumnCount( 2101 : GridPositionsResolver::explicitGridColumnCount(
2101 styleRef(), grid.autoRepeatTracks(ForColumns)); 2102 styleRef(), grid.autoRepeatTracks(ForColumns));
2102 } 2103 }
2103 2104
2104 } // namespace blink 2105 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-crash-huge-margins-and-min-height-max-content-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698