| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 return true; | 394 return true; |
| 395 | 395 |
| 396 bool validPrimitive = false; | 396 bool validPrimitive = false; |
| 397 Units unitless = FUnknown; | 397 Units unitless = FUnknown; |
| 398 | 398 |
| 399 switch (propId) { | 399 switch (propId) { |
| 400 case CSSPropertyContent: // [ <string> | <uri> | <counter> | at
tr(X) | open-quote | | 400 case CSSPropertyContent: // [ <string> | <uri> | <counter> | at
tr(X) | open-quote | |
| 401 // close-quote | no-open-quote | no-close-quote ]+ | inherit | 401 // close-quote | no-open-quote | no-close-quote ]+ | inherit |
| 402 parsedValue = parseContent(); | 402 parsedValue = parseContent(); |
| 403 break; | 403 break; |
| 404 case CSSPropertyClip: // <shape> | auto | inherit | |
| 405 if (id == CSSValueAuto) | |
| 406 validPrimitive = true; | |
| 407 else if (value->m_unit == CSSParserValue::Function) | |
| 408 parsedValue = parseClipShape(); | |
| 409 break; | |
| 410 | 404 |
| 411 /* Start of supported CSS properties with validation. This is needed for par
seShorthand to work | 405 /* Start of supported CSS properties with validation. This is needed for par
seShorthand to work |
| 412 * correctly and allows optimization in blink::applyRule(..) | 406 * correctly and allows optimization in blink::applyRule(..) |
| 413 */ | 407 */ |
| 414 | 408 |
| 415 case CSSPropertyTextAlign: | 409 case CSSPropertyTextAlign: |
| 416 // left | right | center | justify | -webkit-left | -webkit-right | -web
kit-center | -webkit-match-parent | 410 // left | right | center | justify | -webkit-left | -webkit-right | -web
kit-center | -webkit-match-parent |
| 417 // | start | end | <string> | inherit | -webkit-auto (converted to start
) | 411 // | start | end | <string> | inherit | -webkit-auto (converted to start
) |
| 418 // FIXME: <string> not supported right now | 412 // FIXME: <string> not supported right now |
| 419 if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id
== CSSValueStart || id == CSSValueEnd) { | 413 if ((id >= CSSValueWebkitAuto && id <= CSSValueWebkitMatchParent) || id
== CSSValueStart || id == CSSValueEnd) { |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1300 case CSSPropertyWebkitMaxLogicalWidth: | 1294 case CSSPropertyWebkitMaxLogicalWidth: |
| 1301 case CSSPropertyWebkitMaxLogicalHeight: | 1295 case CSSPropertyWebkitMaxLogicalHeight: |
| 1302 case CSSPropertyMinWidth: | 1296 case CSSPropertyMinWidth: |
| 1303 case CSSPropertyMinHeight: | 1297 case CSSPropertyMinHeight: |
| 1304 case CSSPropertyWidth: | 1298 case CSSPropertyWidth: |
| 1305 case CSSPropertyHeight: | 1299 case CSSPropertyHeight: |
| 1306 case CSSPropertyWebkitMinLogicalWidth: | 1300 case CSSPropertyWebkitMinLogicalWidth: |
| 1307 case CSSPropertyWebkitMinLogicalHeight: | 1301 case CSSPropertyWebkitMinLogicalHeight: |
| 1308 case CSSPropertyWebkitLogicalWidth: | 1302 case CSSPropertyWebkitLogicalWidth: |
| 1309 case CSSPropertyWebkitLogicalHeight: | 1303 case CSSPropertyWebkitLogicalHeight: |
| 1304 case CSSPropertyClip: |
| 1310 validPrimitive = false; | 1305 validPrimitive = false; |
| 1311 break; | 1306 break; |
| 1312 | 1307 |
| 1313 case CSSPropertyScrollSnapPointsX: | 1308 case CSSPropertyScrollSnapPointsX: |
| 1314 case CSSPropertyScrollSnapPointsY: | 1309 case CSSPropertyScrollSnapPointsY: |
| 1315 parsedValue = parseScrollSnapPoints(); | 1310 parsedValue = parseScrollSnapPoints(); |
| 1316 break; | 1311 break; |
| 1317 case CSSPropertyScrollSnapCoordinate: | 1312 case CSSPropertyScrollSnapCoordinate: |
| 1318 parsedValue = parseScrollSnapCoordinate(); | 1313 parsedValue = parseScrollSnapCoordinate(); |
| 1319 break; | 1314 break; |
| (...skipping 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3674 listStyleID = i->id; | 3669 listStyleID = i->id; |
| 3675 else | 3670 else |
| 3676 return nullptr; | 3671 return nullptr; |
| 3677 | 3672 |
| 3678 listStyle = cssValuePool().createIdentifierValue(listStyleID); | 3673 listStyle = cssValuePool().createIdentifierValue(listStyleID); |
| 3679 } | 3674 } |
| 3680 | 3675 |
| 3681 return CSSCounterValue::create(identifier.release(), listStyle.release(), se
parator.release()); | 3676 return CSSCounterValue::create(identifier.release(), listStyle.release(), se
parator.release()); |
| 3682 } | 3677 } |
| 3683 | 3678 |
| 3684 PassRefPtrWillBeRawPtr<CSSQuadValue> CSSPropertyParser::parseClipShape() | |
| 3685 { | |
| 3686 CSSParserValue* value = m_valueList->current(); | |
| 3687 CSSParserValueList* args = value->function->args.get(); | |
| 3688 | |
| 3689 if (value->function->id != CSSValueRect || !args) | |
| 3690 return nullptr; | |
| 3691 | |
| 3692 // rect(t, r, b, l) || rect(t r b l) | |
| 3693 if (args->size() != 4 && args->size() != 7) | |
| 3694 return nullptr; | |
| 3695 int i = 0; | |
| 3696 CSSParserValue* a = args->current(); | |
| 3697 | |
| 3698 RefPtrWillBeRawPtr<CSSPrimitiveValue> top = nullptr; | |
| 3699 RefPtrWillBeRawPtr<CSSPrimitiveValue> right = nullptr; | |
| 3700 RefPtrWillBeRawPtr<CSSPrimitiveValue> bottom = nullptr; | |
| 3701 RefPtrWillBeRawPtr<CSSPrimitiveValue> left = nullptr; | |
| 3702 while (a) { | |
| 3703 if (a->id != CSSValueAuto && !validUnit(a, FLength | FUnitlessQuirk)) | |
| 3704 return nullptr; | |
| 3705 RefPtrWillBeRawPtr<CSSPrimitiveValue> length = a->id == CSSValueAuto ? | |
| 3706 cssValuePool().createIdentifierValue(CSSValueAuto) : | |
| 3707 createPrimitiveNumericValue(a); | |
| 3708 if (i == 0) | |
| 3709 top = length; | |
| 3710 else if (i == 1) | |
| 3711 right = length; | |
| 3712 else if (i == 2) | |
| 3713 bottom = length; | |
| 3714 else | |
| 3715 left = length; | |
| 3716 a = args->next(); | |
| 3717 if (a && args->size() == 7) { | |
| 3718 if (!consumeComma(args)) | |
| 3719 return nullptr; | |
| 3720 a = args->current(); | |
| 3721 } | |
| 3722 i++; | |
| 3723 } | |
| 3724 m_valueList->next(); | |
| 3725 return CSSQuadValue::create(top.release(), right.release(), bottom.release()
, left.release(), CSSQuadValue::SerializeAsRect); | |
| 3726 } | |
| 3727 | |
| 3728 static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4]) | 3679 static void completeBorderRadii(RefPtrWillBeRawPtr<CSSPrimitiveValue> radii[4]) |
| 3729 { | 3680 { |
| 3730 if (radii[3]) | 3681 if (radii[3]) |
| 3731 return; | 3682 return; |
| 3732 if (!radii[2]) { | 3683 if (!radii[2]) { |
| 3733 if (!radii[1]) | 3684 if (!radii[1]) |
| 3734 radii[1] = radii[0]; | 3685 radii[1] = radii[0]; |
| 3735 radii[2] = radii[0]; | 3686 radii[2] = radii[0]; |
| 3736 } | 3687 } |
| 3737 radii[3] = radii[1]; | 3688 radii[3] = radii[1]; |
| (...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6905 } | 6856 } |
| 6906 } | 6857 } |
| 6907 | 6858 |
| 6908 if (!list->length()) | 6859 if (!list->length()) |
| 6909 return nullptr; | 6860 return nullptr; |
| 6910 | 6861 |
| 6911 return list.release(); | 6862 return list.release(); |
| 6912 } | 6863 } |
| 6913 | 6864 |
| 6914 } // namespace blink | 6865 } // namespace blink |
| OLD | NEW |