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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleBuilderConverter.cpp

Issue 2287113004: [css-grid] Implement fit-content track size (Closed)
Patch Set: Patch for landing Created 4 years, 3 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * * Redistributions of source code must retain the above copyright 4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer. 5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above 6 * * Redistributions in binary form must reproduce the above
7 * copyright notice, this list of conditions and the following disclaimer 7 * copyright notice, this list of conditions and the following disclaimer
8 * in the documentation and/or other materials provided with the 8 * in the documentation and/or other materials provided with the
9 * distribution. 9 * distribution.
10 * * Neither the name of Google Inc. nor the names of its 10 * * Neither the name of Google Inc. nor the names of its
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 position.setExplicitPosition(gridLineNumber, gridLineName); 532 position.setExplicitPosition(gridLineNumber, gridLineName);
533 533
534 return position; 534 return position;
535 } 535 }
536 536
537 GridTrackSize StyleBuilderConverter::convertGridTrackSize(StyleResolverState& st ate, const CSSValue& value) 537 GridTrackSize StyleBuilderConverter::convertGridTrackSize(StyleResolverState& st ate, const CSSValue& value)
538 { 538 {
539 if (value.isPrimitiveValue()) 539 if (value.isPrimitiveValue())
540 return GridTrackSize(convertGridTrackBreadth(state, toCSSPrimitiveValue( value))); 540 return GridTrackSize(convertGridTrackBreadth(state, toCSSPrimitiveValue( value)));
541 541
542 const CSSFunctionValue& minmaxFunction = toCSSFunctionValue(value); 542 auto& function = toCSSFunctionValue(value);
543 ASSERT_WITH_SECURITY_IMPLICATION(minmaxFunction.length() == 2); 543 if (function.functionType() == CSSValueFitContent) {
544 GridLength minTrackBreadth(convertGridTrackBreadth(state, toCSSPrimitiveValu e(minmaxFunction.item(0)))); 544 SECURITY_DCHECK(function.length() == 1);
545 GridLength maxTrackBreadth(convertGridTrackBreadth(state, toCSSPrimitiveValu e(minmaxFunction.item(1)))); 545 return GridTrackSize(convertGridTrackBreadth(state, toCSSPrimitiveValue( function.item(0))), FitContentTrackSizing);
546 }
547
548 SECURITY_DCHECK(function.length() == 2);
549 GridLength minTrackBreadth(convertGridTrackBreadth(state, toCSSPrimitiveValu e(function.item(0))));
550 GridLength maxTrackBreadth(convertGridTrackBreadth(state, toCSSPrimitiveValu e(function.item(1))));
546 return GridTrackSize(minTrackBreadth, maxTrackBreadth); 551 return GridTrackSize(minTrackBreadth, maxTrackBreadth);
547 } 552 }
548 553
549 static void convertGridLineNamesList(const CSSValue& value, size_t currentNamedG ridLine, NamedGridLinesMap& namedGridLines, OrderedNamedGridLines& orderedNamedG ridLines) 554 static void convertGridLineNamesList(const CSSValue& value, size_t currentNamedG ridLine, NamedGridLinesMap& namedGridLines, OrderedNamedGridLines& orderedNamedG ridLines)
550 { 555 {
551 ASSERT(value.isGridLineNamesValue()); 556 ASSERT(value.isGridLineNamesValue());
552 557
553 for (auto& namedGridLineValue : toCSSValueList(value)) { 558 for (auto& namedGridLineValue : toCSSValueList(value)) {
554 String namedGridLine = toCSSCustomIdentValue(*namedGridLineValue).value( ); 559 String namedGridLine = toCSSCustomIdentValue(*namedGridLineValue).value( );
555 NamedGridLinesMap::AddResult result = namedGridLines.add(namedGridLine, Vector<size_t>()); 560 NamedGridLinesMap::AddResult result = namedGridLines.add(namedGridLine, Vector<size_t>());
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 1095
1091 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value) 1096 PassRefPtr<StylePath> StyleBuilderConverter::convertPathOrNone(StyleResolverStat e& state, const CSSValue& value)
1092 { 1097 {
1093 if (value.isPathValue()) 1098 if (value.isPathValue())
1094 return toCSSPathValue(value).stylePath(); 1099 return toCSSPathValue(value).stylePath();
1095 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone); 1100 ASSERT(value.isPrimitiveValue() && toCSSPrimitiveValue(value).getValueID() = = CSSValueNone);
1096 return nullptr; 1101 return nullptr;
1097 } 1102 }
1098 1103
1099 } // namespace blink 1104 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutGrid.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698