OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 2003 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 3 * Copyright (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 6 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. | 8 * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved. |
9 * Copyright (C) 2012 Intel Corporation. All rights reserved. | 9 * Copyright (C) 2012 Intel Corporation. All rights reserved. |
10 * | 10 * |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 || id == CSSValueRepeatingRadialGradient | 302 || id == CSSValueRepeatingRadialGradient |
303 || id == CSSValueWebkitLinearGradient | 303 || id == CSSValueWebkitLinearGradient |
304 || id == CSSValueWebkitRadialGradient | 304 || id == CSSValueWebkitRadialGradient |
305 || id == CSSValueWebkitRepeatingLinearGradient | 305 || id == CSSValueWebkitRepeatingLinearGradient |
306 || id == CSSValueWebkitRepeatingRadialGradient | 306 || id == CSSValueWebkitRepeatingRadialGradient |
307 || id == CSSValueWebkitGradient | 307 || id == CSSValueWebkitGradient |
308 || id == CSSValueWebkitCanvas | 308 || id == CSSValueWebkitCanvas |
309 || id == CSSValueWebkitCrossFade; | 309 || id == CSSValueWebkitCrossFade; |
310 } | 310 } |
311 | 311 |
312 bool CSSPropertyParser::validWidthOrHeight(CSSParserValue* value, Units unitless
) | |
313 { | |
314 int id = value->id; | |
315 if (id == CSSValueIntrinsic || id == CSSValueMinIntrinsic | |
316 || id == CSSValueWebkitMinContent || id == CSSValueWebkitMaxContent || i
d == CSSValueWebkitFillAvailable || id == CSSValueWebkitFitContent | |
317 || id == CSSValueMinContent || id == CSSValueMaxContent || id == CSSValu
eFitContent) { | |
318 if (m_context.useCounter()) { | |
319 switch (value->id) { | |
320 case CSSValueIntrinsic: | |
321 case CSSValueMinIntrinsic: | |
322 // These two will be counted in StyleAdjuster because they emit
a deprecation | |
323 // message, and we don't have access to a Document/LocalFrame he
re. | |
324 break; | |
325 case CSSValueWebkitMinContent: | |
326 m_context.useCounter()->count(UseCounter::CSSValuePrefixedMinCon
tent); | |
327 break; | |
328 case CSSValueWebkitMaxContent: | |
329 m_context.useCounter()->count(UseCounter::CSSValuePrefixedMaxCon
tent); | |
330 break; | |
331 case CSSValueWebkitFillAvailable: | |
332 m_context.useCounter()->count(UseCounter::CSSValuePrefixedFillAv
ailable); | |
333 break; | |
334 case CSSValueWebkitFitContent: | |
335 m_context.useCounter()->count(UseCounter::CSSValuePrefixedFitCon
tent); | |
336 break; | |
337 default: | |
338 break; | |
339 } | |
340 } | |
341 return true; | |
342 } | |
343 return validUnit(value, FLength | FPercent | FNonNeg | unitless); | |
344 } | |
345 | |
346 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseValidPr
imitive(CSSValueID identifier, CSSParserValue* value) | 312 inline PassRefPtrWillBeRawPtr<CSSPrimitiveValue> CSSPropertyParser::parseValidPr
imitive(CSSValueID identifier, CSSParserValue* value) |
347 { | 313 { |
348 if (identifier) | 314 if (identifier) |
349 return cssValuePool().createIdentifierValue(identifier); | 315 return cssValuePool().createIdentifierValue(identifier); |
350 if (value->unit() >= CSSPrimitiveValue::UnitType::Number && value->unit() <=
CSSPrimitiveValue::UnitType::Kilohertz) | 316 if (value->unit() >= CSSPrimitiveValue::UnitType::Number && value->unit() <=
CSSPrimitiveValue::UnitType::Kilohertz) |
351 return createPrimitiveNumericValue(value); | 317 return createPrimitiveNumericValue(value); |
352 if (value->unit() >= CSSPrimitiveValue::UnitType::Turns && value->unit() <=
CSSPrimitiveValue::UnitType::Chs) | 318 if (value->unit() >= CSSPrimitiveValue::UnitType::Turns && value->unit() <=
CSSPrimitiveValue::UnitType::Chs) |
353 return createPrimitiveNumericValue(value); | 319 return createPrimitiveNumericValue(value); |
354 if (value->unit() >= CSSPrimitiveValue::UnitType::ViewportWidth && value->un
it() <= CSSPrimitiveValue::UnitType::ViewportMax) | 320 if (value->unit() >= CSSPrimitiveValue::UnitType::ViewportWidth && value->un
it() <= CSSPrimitiveValue::UnitType::ViewportMax) |
355 return createPrimitiveNumericValue(value); | 321 return createPrimitiveNumericValue(value); |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 case CSSPropertyPaddingLeft: //// | 632 case CSSPropertyPaddingLeft: //// |
667 unitless = FUnitlessQuirk; | 633 unitless = FUnitlessQuirk; |
668 // fall through | 634 // fall through |
669 case CSSPropertyWebkitPaddingStart: | 635 case CSSPropertyWebkitPaddingStart: |
670 case CSSPropertyWebkitPaddingEnd: | 636 case CSSPropertyWebkitPaddingEnd: |
671 case CSSPropertyWebkitPaddingBefore: | 637 case CSSPropertyWebkitPaddingBefore: |
672 case CSSPropertyWebkitPaddingAfter: | 638 case CSSPropertyWebkitPaddingAfter: |
673 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg | unitles
s); | 639 validPrimitive = validUnit(value, FLength | FPercent | FNonNeg | unitles
s); |
674 break; | 640 break; |
675 | 641 |
676 case CSSPropertyMaxWidth: | |
677 case CSSPropertyMaxHeight: | |
678 unitless = FUnitlessQuirk; | |
679 // fall through | |
680 case CSSPropertyWebkitMaxLogicalWidth: | |
681 case CSSPropertyWebkitMaxLogicalHeight: | |
682 validPrimitive = (id == CSSValueNone || validWidthOrHeight(value, unitle
ss)); | |
683 break; | |
684 | |
685 case CSSPropertyMinWidth: | |
686 case CSSPropertyMinHeight: | |
687 case CSSPropertyWidth: | |
688 case CSSPropertyHeight: | |
689 unitless = FUnitlessQuirk; | |
690 // fall through | |
691 case CSSPropertyWebkitMinLogicalWidth: | |
692 case CSSPropertyWebkitMinLogicalHeight: | |
693 case CSSPropertyWebkitLogicalWidth: | |
694 case CSSPropertyWebkitLogicalHeight: | |
695 validPrimitive = (id == CSSValueAuto || validWidthOrHeight(value, unitle
ss)); | |
696 break; | |
697 | |
698 case CSSPropertyVerticalAlign: | 642 case CSSPropertyVerticalAlign: |
699 // baseline | sub | super | top | text-top | middle | bottom | text-bott
om | | 643 // baseline | sub | super | top | text-top | middle | bottom | text-bott
om | |
700 // <percentage> | <length> | inherit | 644 // <percentage> | <length> | inherit |
701 | 645 |
702 if (id >= CSSValueBaseline && id <= CSSValueWebkitBaselineMiddle) | 646 if (id >= CSSValueBaseline && id <= CSSValueWebkitBaselineMiddle) |
703 validPrimitive = true; | 647 validPrimitive = true; |
704 else | 648 else |
705 validPrimitive = validUnit(value, FLength | FPercent | FUnitlessQuir
k); | 649 validPrimitive = validUnit(value, FLength | FPercent | FUnitlessQuir
k); |
706 break; | 650 break; |
707 | 651 |
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 case CSSPropertyLineHeight: | 1288 case CSSPropertyLineHeight: |
1345 case CSSPropertyRotate: | 1289 case CSSPropertyRotate: |
1346 case CSSPropertyFont: | 1290 case CSSPropertyFont: |
1347 case CSSPropertyWebkitBorderHorizontalSpacing: | 1291 case CSSPropertyWebkitBorderHorizontalSpacing: |
1348 case CSSPropertyWebkitBorderVerticalSpacing: | 1292 case CSSPropertyWebkitBorderVerticalSpacing: |
1349 case CSSPropertyBorderSpacing: | 1293 case CSSPropertyBorderSpacing: |
1350 case CSSPropertyCounterIncrement: | 1294 case CSSPropertyCounterIncrement: |
1351 case CSSPropertyCounterReset: | 1295 case CSSPropertyCounterReset: |
1352 case CSSPropertySize: | 1296 case CSSPropertySize: |
1353 case CSSPropertyTextIndent: | 1297 case CSSPropertyTextIndent: |
| 1298 case CSSPropertyMaxWidth: |
| 1299 case CSSPropertyMaxHeight: |
| 1300 case CSSPropertyWebkitMaxLogicalWidth: |
| 1301 case CSSPropertyWebkitMaxLogicalHeight: |
| 1302 case CSSPropertyMinWidth: |
| 1303 case CSSPropertyMinHeight: |
| 1304 case CSSPropertyWidth: |
| 1305 case CSSPropertyHeight: |
| 1306 case CSSPropertyWebkitMinLogicalWidth: |
| 1307 case CSSPropertyWebkitMinLogicalHeight: |
| 1308 case CSSPropertyWebkitLogicalWidth: |
| 1309 case CSSPropertyWebkitLogicalHeight: |
1354 validPrimitive = false; | 1310 validPrimitive = false; |
1355 break; | 1311 break; |
1356 | 1312 |
1357 case CSSPropertyScrollSnapPointsX: | 1313 case CSSPropertyScrollSnapPointsX: |
1358 case CSSPropertyScrollSnapPointsY: | 1314 case CSSPropertyScrollSnapPointsY: |
1359 parsedValue = parseScrollSnapPoints(); | 1315 parsedValue = parseScrollSnapPoints(); |
1360 break; | 1316 break; |
1361 case CSSPropertyScrollSnapCoordinate: | 1317 case CSSPropertyScrollSnapCoordinate: |
1362 parsedValue = parseScrollSnapCoordinate(); | 1318 parsedValue = parseScrollSnapCoordinate(); |
1363 break; | 1319 break; |
(...skipping 5585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6949 } | 6905 } |
6950 } | 6906 } |
6951 | 6907 |
6952 if (!list->length()) | 6908 if (!list->length()) |
6953 return nullptr; | 6909 return nullptr; |
6954 | 6910 |
6955 return list.release(); | 6911 return list.release(); |
6956 } | 6912 } |
6957 | 6913 |
6958 } // namespace blink | 6914 } // namespace blink |
OLD | NEW |