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

Side by Side Diff: third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp

Issue 2546993002: [css-grid] Fix crash clamping grid lines (Closed)
Patch Set: Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/parser/CSSPropertyParser.h" 5 #include "core/css/parser/CSSPropertyParser.h"
6 6
7 #include "core/StylePropertyShorthand.h" 7 #include "core/StylePropertyShorthand.h"
8 #include "core/css/CSSBasicShapeValues.h" 8 #include "core/css/CSSBasicShapeValues.h"
9 #include "core/css/CSSBorderImage.h" 9 #include "core/css/CSSBorderImage.h"
10 #include "core/css/CSSContentDistributionValue.h" 10 #include "core/css/CSSContentDistributionValue.h"
(...skipping 3003 matching lines...) Expand 10 before | Expand all | Expand 10 after
3014 } 3014 }
3015 3015
3016 if (spanValue && !numericValue && !gridLineName) 3016 if (spanValue && !numericValue && !gridLineName)
3017 return nullptr; // "span" keyword alone is invalid. 3017 return nullptr; // "span" keyword alone is invalid.
3018 if (spanValue && numericValue && numericValue->getIntValue() < 0) 3018 if (spanValue && numericValue && numericValue->getIntValue() < 0)
3019 return nullptr; // Negative numbers are not allowed for span. 3019 return nullptr; // Negative numbers are not allowed for span.
3020 if (numericValue && numericValue->getIntValue() == 0) 3020 if (numericValue && numericValue->getIntValue() == 0)
3021 return nullptr; // An <integer> value of zero makes the declaration 3021 return nullptr; // An <integer> value of zero makes the declaration
3022 // invalid. 3022 // invalid.
3023 3023
3024 if (numericValue) {
jfernandez 2016/12/02 12:28:03 Wouldn't be better to define new CSSPrimitiveValue
Manuel Rego 2016/12/15 16:51:22 Uploaded new version following this approach.
3025 if (numericValue->getIntValue() > kGridMaxTracks) {
3026 numericValue = CSSPrimitiveValue::create(
3027 kGridMaxTracks, CSSPrimitiveValue::UnitType::Integer);
3028 } else if (numericValue->getIntValue() < -kGridMaxTracks) {
3029 numericValue = CSSPrimitiveValue::create(
3030 -kGridMaxTracks, CSSPrimitiveValue::UnitType::Integer);
3031 }
3032 }
3033
3024 CSSValueList* values = CSSValueList::createSpaceSeparated(); 3034 CSSValueList* values = CSSValueList::createSpaceSeparated();
3025 if (spanValue) 3035 if (spanValue)
3026 values->append(*spanValue); 3036 values->append(*spanValue);
3027 if (numericValue) 3037 if (numericValue)
3028 values->append(*numericValue); 3038 values->append(*numericValue);
3029 if (gridLineName) 3039 if (gridLineName)
3030 values->append(*gridLineName); 3040 values->append(*gridLineName);
3031 ASSERT(values->length()); 3041 ASSERT(values->length());
3032 return values; 3042 return values;
3033 } 3043 }
(...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after
5328 case CSSPropertyGridTemplate: 5338 case CSSPropertyGridTemplate:
5329 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); 5339 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important);
5330 case CSSPropertyGrid: 5340 case CSSPropertyGrid:
5331 return consumeGridShorthand(important); 5341 return consumeGridShorthand(important);
5332 default: 5342 default:
5333 return false; 5343 return false;
5334 } 5344 }
5335 } 5345 }
5336 5346
5337 } // namespace blink 5347 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/parser/CSSPropertyParserTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698