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 2531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2542 return false; | 2542 return false; |
2543 return parseGridTrackList(propId, important); | 2543 return parseGridTrackList(propId, important); |
2544 | 2544 |
2545 case CSSPropertyWebkitGridStart: | 2545 case CSSPropertyWebkitGridStart: |
2546 case CSSPropertyWebkitGridEnd: | 2546 case CSSPropertyWebkitGridEnd: |
2547 case CSSPropertyWebkitGridBefore: | 2547 case CSSPropertyWebkitGridBefore: |
2548 case CSSPropertyWebkitGridAfter: | 2548 case CSSPropertyWebkitGridAfter: |
2549 if (!cssGridLayoutEnabled()) | 2549 if (!cssGridLayoutEnabled()) |
2550 return false; | 2550 return false; |
2551 | 2551 |
2552 validPrimitive = id == CSSValueAuto || (validUnit(value, FInteger) && va
lue->fValue); | 2552 parsedValue = parseGridPosition(); |
2553 break; | 2553 break; |
2554 | 2554 |
2555 case CSSPropertyWebkitGridColumn: | 2555 case CSSPropertyWebkitGridColumn: |
2556 case CSSPropertyWebkitGridRow: { | 2556 case CSSPropertyWebkitGridRow: { |
2557 if (!cssGridLayoutEnabled()) | 2557 if (!cssGridLayoutEnabled()) |
2558 return false; | 2558 return false; |
2559 | 2559 |
2560 return parseGridItemPositionShorthand(propId, important); | 2560 return parseGridItemPositionShorthand(propId, important); |
2561 } | 2561 } |
2562 | 2562 |
(...skipping 2039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4602 result = values.release(); | 4602 result = values.release(); |
4603 return true; | 4603 return true; |
4604 } | 4604 } |
4605 if (value) { | 4605 if (value) { |
4606 result = value.release(); | 4606 result = value.release(); |
4607 return true; | 4607 return true; |
4608 } | 4608 } |
4609 return false; | 4609 return false; |
4610 } | 4610 } |
4611 | 4611 |
| 4612 PassRefPtr<CSSValue> CSSParser::parseGridPosition() |
| 4613 { |
| 4614 CSSParserValue* value = m_valueList->current(); |
| 4615 if (value->id == CSSValueAuto) { |
| 4616 m_valueList->next(); |
| 4617 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 4618 } |
| 4619 |
| 4620 RefPtr<CSSPrimitiveValue> numericValue; |
| 4621 bool hasSeenSpanKeyword = false; |
| 4622 |
| 4623 if (validUnit(value, FInteger) && value->fValue) { |
| 4624 numericValue = createPrimitiveNumericValue(value); |
| 4625 value = m_valueList->next(); |
| 4626 if (value && value->id == CSSValueSpan) { |
| 4627 hasSeenSpanKeyword = true; |
| 4628 m_valueList->next(); |
| 4629 } |
| 4630 } else if (value->id == CSSValueSpan) { |
| 4631 hasSeenSpanKeyword = true; |
| 4632 value = m_valueList->next(); |
| 4633 if (value && (validUnit(value, FInteger) && value->fValue)) { |
| 4634 numericValue = createPrimitiveNumericValue(value); |
| 4635 m_valueList->next(); |
| 4636 } |
| 4637 } |
| 4638 |
| 4639 if (!hasSeenSpanKeyword) |
| 4640 return numericValue.release(); |
| 4641 |
| 4642 if (!numericValue && hasSeenSpanKeyword) |
| 4643 return cssValuePool().createIdentifierValue(CSSValueSpan); |
| 4644 |
| 4645 // Negative numbers are not allowed for span (but are for <integer>). |
| 4646 if (numericValue && numericValue->getIntValue() < 0) |
| 4647 return 0; |
| 4648 |
| 4649 RefPtr<CSSValueList> values = CSSValueList::createSpaceSeparated(); |
| 4650 values->append(cssValuePool().createIdentifierValue(CSSValueSpan)); |
| 4651 if (numericValue) |
| 4652 values->append(numericValue.release()); |
| 4653 return values.release(); |
| 4654 } |
| 4655 |
4612 bool CSSParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId, bool i
mportant) | 4656 bool CSSParser::parseGridItemPositionShorthand(CSSPropertyID shorthandId, bool i
mportant) |
4613 { | 4657 { |
4614 ShorthandScope scope(this, shorthandId); | 4658 ShorthandScope scope(this, shorthandId); |
4615 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); | 4659 const StylePropertyShorthand& shorthand = shorthandForProperty(shorthandId); |
4616 ASSERT(shorthand.length() == 2); | 4660 ASSERT(shorthand.length() == 2); |
4617 if (!parseValue(shorthand.properties()[0], important)) | 4661 if (!parseValue(shorthand.properties()[0], important)) |
4618 return false; | 4662 return false; |
4619 | 4663 |
4620 if (!m_valueList->current()) { | 4664 if (!m_valueList->current()) { |
4621 // Only one value was specified, the opposite value should be set to 'au
to'. | 4665 // Only one value was specified, the opposite value should be set to 'au
to'. |
(...skipping 7094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11716 { | 11760 { |
11717 // The tokenizer checks for the construct of an+b. | 11761 // The tokenizer checks for the construct of an+b. |
11718 // However, since the {ident} rule precedes the {nth} rule, some of those | 11762 // However, since the {ident} rule precedes the {nth} rule, some of those |
11719 // tokens are identified as string literal. Furthermore we need to accept | 11763 // tokens are identified as string literal. Furthermore we need to accept |
11720 // "odd" and "even" which does not match to an+b. | 11764 // "odd" and "even" which does not match to an+b. |
11721 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") | 11765 return equalIgnoringCase(token, "odd") || equalIgnoringCase(token, "even") |
11722 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); | 11766 || equalIgnoringCase(token, "n") || equalIgnoringCase(token, "-n"); |
11723 } | 11767 } |
11724 | 11768 |
11725 } | 11769 } |
OLD | NEW |