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 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2585 return false; | 2585 return false; |
2586 return parseGridTrackList(propId, important); | 2586 return parseGridTrackList(propId, important); |
2587 | 2587 |
2588 case CSSPropertyWebkitGridStart: | 2588 case CSSPropertyWebkitGridStart: |
2589 case CSSPropertyWebkitGridEnd: | 2589 case CSSPropertyWebkitGridEnd: |
2590 case CSSPropertyWebkitGridBefore: | 2590 case CSSPropertyWebkitGridBefore: |
2591 case CSSPropertyWebkitGridAfter: | 2591 case CSSPropertyWebkitGridAfter: |
2592 if (!cssGridLayoutEnabled()) | 2592 if (!cssGridLayoutEnabled()) |
2593 return false; | 2593 return false; |
2594 | 2594 |
2595 validPrimitive = id == CSSValueAuto || (validUnit(value, FInteger) && va
lue->fValue); | 2595 parsedValue = parseGridPosition(); |
2596 break; | 2596 break; |
2597 | 2597 |
2598 case CSSPropertyWebkitGridColumn: | 2598 case CSSPropertyWebkitGridColumn: |
2599 case CSSPropertyWebkitGridRow: { | 2599 case CSSPropertyWebkitGridRow: { |
2600 if (!cssGridLayoutEnabled()) | 2600 if (!cssGridLayoutEnabled()) |
2601 return false; | 2601 return false; |
2602 | 2602 |
2603 return parseGridItemPositionShorthand(propId, important); | 2603 return parseGridItemPositionShorthand(propId, important); |
2604 } | 2604 } |
2605 | 2605 |
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4654 result = values.release(); | 4654 result = values.release(); |
4655 return true; | 4655 return true; |
4656 } | 4656 } |
4657 if (value) { | 4657 if (value) { |
4658 result = value.release(); | 4658 result = value.release(); |
4659 return true; | 4659 return true; |
4660 } | 4660 } |
4661 return false; | 4661 return false; |
4662 } | 4662 } |
4663 | 4663 |
| 4664 PassRefPtr<CSSValue> CSSParser::parseGridPosition() |
| 4665 { |
| 4666 CSSParserValue* value = m_valueList->current(); |
| 4667 if (value->id == CSSValueAuto) { |
| 4668 m_valueList->next(); |
| 4669 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 4670 } |
| 4671 |
| 4672 RefPtr<CSSPrimitiveValue> numericValue; |
| 4673 bool hasSeenSpanKeyword = false; |
| 4674 |
| 4675 if (validUnit(value, FInteger) && value->fValue) { |
| 4676 numericValue = createPrimitiveNumericValue(value); |
| 4677 value = m_valueList->next(); |
| 4678 if (value && value->id == CSSValueSpan) { |
| 4679 hasSeenSpanKeyword = true; |
| 4680 m_valueList->next(); |
| 4681 } |
| 4682 } else if (value->id == CSSValueSpan) { |
| 4683 hasSeenSpanKeyword = true; |
| 4684 value = m_valueList->next(); |
| 4685 if (value && (validUnit(value, FInteger) && value->fValue)) { |
| 4686 numericValue = createPrimitiveNumericValue(value); |
| 4687 m_valueList->next(); |
| 4688 } |
| 4689 } |
| 4690 |
| 4691 if (!hasSeenSpanKeyword) |
| 4692 return numericValue.release(); |
| 4693 |
| 4694 if (!numericValue && hasSeenSpanKeyword) |
| 4695 return cssValuePool().createIdentifierValue(CSSValueSpan); |
| 4696 |
| 4697 // Negative numbers are not allowed for span (but are for <integer>). |
| 4698 if (numericValue && numericValue->getIntValue() < 0) |
| 4699 return 0; |
| 4700 |
| 4701 RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); |
| 4702 values->append(cssValuePool().createIdentifierValue(CSSValueSpan)); |
| 4703 if (numericValue) |
| 4704 values->append(numericValue.release()); |
| 4705 return values.release(); |
| 4706 } |
| 4707 |
4664 bool CSSParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId, bool i
mportant) | 4708 bool CSSParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId, bool i
mportant) |
4665 { | 4709 { |
4666 ShorthandScope scope(this, shorthandId); | 4710 ShorthandScope scope(this, shorthandId); |
4667 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); | 4711 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); |
4668 ASSERT(shorthand.length() == 2); | 4712 ASSERT(shorthand.length() == 2); |
4669 if (!parseValue(shorthand.properties()[0], important)) | 4713 if (!parseValue(shorthand.properties()[0], important)) |
4670 return false; | 4714 return false; |
4671 | 4715 |
4672 if (!m_valueList->current()) { | 4716 if (!m_valueList->current()) { |
4673 // Only one value was specified, the opposite value should be set to 'au
to'. | 4717 // Only one value was specified, the opposite value should be set to 'au
to'. |
(...skipping 7272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11946 { | 11990 { |
11947 // The tokenizer checks for the construct of an+b. | 11991 // The tokenizer checks for the construct of an+b. |
11948 // However, since the {ident} rule precedes the {nth} rule, some of those | 11992 // However, since the {ident} rule precedes the {nth} rule, some of those |
11949 // tokens are identified as string literal. Furthermore we need to accept | 11993 // tokens are identified as string literal. Furthermore we need to accept |
11950 // "odd" and "even" which does not match to an+b. | 11994 // "odd" and "even" which does not match to an+b. |
11951 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11995 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
11952 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11996 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
11953 } | 11997 } |
11954 | 11998 |
11955 } | 11999 } |
OLD | NEW |