OLD | NEW |
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 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 } else if (filterType == CSSValueHueRotate) { | 1448 } else if (filterType == CSSValueHueRotate) { |
1449 parsedValue = consumeAngle(args); | 1449 parsedValue = consumeAngle(args); |
1450 } else if (filterType == CSSValueBlur) { | 1450 } else if (filterType == CSSValueBlur) { |
1451 parsedValue = consumeLength(args, HTMLStandardMode, ValueRangeNonNeg
ative); | 1451 parsedValue = consumeLength(args, HTMLStandardMode, ValueRangeNonNeg
ative); |
1452 } else { | 1452 } else { |
1453 // FIXME (crbug.com/397061): Support calc expressions like calc(10%
+ 0.5) | 1453 // FIXME (crbug.com/397061): Support calc expressions like calc(10%
+ 0.5) |
1454 parsedValue = consumePercent(args, ValueRangeNonNegative); | 1454 parsedValue = consumePercent(args, ValueRangeNonNegative); |
1455 if (!parsedValue) | 1455 if (!parsedValue) |
1456 parsedValue = consumeNumber(args, ValueRangeNonNegative); | 1456 parsedValue = consumeNumber(args, ValueRangeNonNegative); |
1457 if (parsedValue && filterType != CSSValueSaturate && filterType != C
SSValueContrast) { | 1457 if (parsedValue && filterType != CSSValueSaturate && filterType != C
SSValueContrast) { |
1458 double maxAllowed = toCSSPrimitiveValue(parsedValue)->isPercenta
ge() ? 100.0 : 1.0; | 1458 bool isPercentage = toCSSPrimitiveValue(parsedValue)->isPercenta
ge(); |
1459 if (toCSSPrimitiveValue(parsedValue)->getDoubleValue() > maxAllo
wed) | 1459 double maxAllowed = isPercentage ? 100.0 : 1.0; |
1460 return nullptr; | 1460 if (toCSSPrimitiveValue(parsedValue)->getDoubleValue() > maxAllo
wed) { |
| 1461 parsedValue = CSSPrimitiveValue::create( |
| 1462 maxAllowed, |
| 1463 isPercentage ? CSSPrimitiveValue::UnitType::Percentage :
CSSPrimitiveValue::UnitType::Number); |
| 1464 } |
1461 } | 1465 } |
1462 } | 1466 } |
1463 } | 1467 } |
1464 if (!parsedValue || !args.atEnd()) | 1468 if (!parsedValue || !args.atEnd()) |
1465 return nullptr; | 1469 return nullptr; |
1466 filterValue->append(parsedValue); | 1470 filterValue->append(parsedValue); |
1467 return filterValue; | 1471 return filterValue; |
1468 } | 1472 } |
1469 | 1473 |
1470 static CSSValue* consumeFilter(CSSParserTokenRange& range, CSSParserMode cssPars
erMode) | 1474 static CSSValue* consumeFilter(CSSParserTokenRange& range, CSSParserMode cssPars
erMode) |
(...skipping 3720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5191 case CSSPropertyGridTemplate: | 5195 case CSSPropertyGridTemplate: |
5192 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); | 5196 return consumeGridTemplateShorthand(CSSPropertyGridTemplate, important); |
5193 case CSSPropertyGrid: | 5197 case CSSPropertyGrid: |
5194 return consumeGridShorthand(important); | 5198 return consumeGridShorthand(important); |
5195 default: | 5199 default: |
5196 return false; | 5200 return false; |
5197 } | 5201 } |
5198 } | 5202 } |
5199 | 5203 |
5200 } // namespace blink | 5204 } // namespace blink |
OLD | NEW |