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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1190 return true; | 1190 return true; |
1191 } | 1191 } |
1192 return false; | 1192 return false; |
1193 } | 1193 } |
1194 | 1194 |
1195 case CSSPropertyJustifySelf: | 1195 case CSSPropertyJustifySelf: |
1196 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 1196 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
1197 return false; | 1197 return false; |
1198 | 1198 |
1199 return parseItemPositionOverflowPosition(propId, important); | 1199 return parseItemPositionOverflowPosition(propId, important); |
1200 case CSSPropertyGridAutoFlow: | |
1201 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | |
1202 return false; | |
1203 parsedValue = parseGridAutoFlow(*m_valueList); | |
1204 break; | |
1200 case CSSPropertyGridAutoColumns: | 1205 case CSSPropertyGridAutoColumns: |
1201 case CSSPropertyGridAutoRows: | 1206 case CSSPropertyGridAutoRows: |
1202 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 1207 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
1203 return false; | 1208 return false; |
1204 parsedValue = parseGridTrackSize(*m_valueList); | 1209 parsedValue = parseGridTrackSize(*m_valueList); |
1205 break; | 1210 break; |
1206 | 1211 |
1207 case CSSPropertyGridTemplateColumns: | 1212 case CSSPropertyGridTemplateColumns: |
1208 case CSSPropertyGridTemplateRows: | 1213 case CSSPropertyGridTemplateRows: |
1209 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) | 1214 if (!RuntimeEnabledFeatures::cssGridLayoutEnabled()) |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1563 case CSSPropertyWebkitColumnBreakBefore: | 1568 case CSSPropertyWebkitColumnBreakBefore: |
1564 case CSSPropertyWebkitColumnBreakInside: | 1569 case CSSPropertyWebkitColumnBreakInside: |
1565 case CSSPropertyColumnFill: | 1570 case CSSPropertyColumnFill: |
1566 case CSSPropertyWebkitColumnRuleStyle: | 1571 case CSSPropertyWebkitColumnRuleStyle: |
1567 case CSSPropertyAlignContent: | 1572 case CSSPropertyAlignContent: |
1568 case CSSPropertyFlexDirection: | 1573 case CSSPropertyFlexDirection: |
1569 case CSSPropertyFlexWrap: | 1574 case CSSPropertyFlexWrap: |
1570 case CSSPropertyJustifyContent: | 1575 case CSSPropertyJustifyContent: |
1571 case CSSPropertyFontKerning: | 1576 case CSSPropertyFontKerning: |
1572 case CSSPropertyWebkitFontSmoothing: | 1577 case CSSPropertyWebkitFontSmoothing: |
1573 case CSSPropertyGridAutoFlow: | |
1574 case CSSPropertyWebkitLineBreak: | 1578 case CSSPropertyWebkitLineBreak: |
1575 case CSSPropertyWebkitMarginAfterCollapse: | 1579 case CSSPropertyWebkitMarginAfterCollapse: |
1576 case CSSPropertyWebkitMarginBeforeCollapse: | 1580 case CSSPropertyWebkitMarginBeforeCollapse: |
1577 case CSSPropertyWebkitMarginBottomCollapse: | 1581 case CSSPropertyWebkitMarginBottomCollapse: |
1578 case CSSPropertyWebkitMarginTopCollapse: | 1582 case CSSPropertyWebkitMarginTopCollapse: |
1579 case CSSPropertyInternalMarqueeDirection: | 1583 case CSSPropertyInternalMarqueeDirection: |
1580 case CSSPropertyInternalMarqueeStyle: | 1584 case CSSPropertyInternalMarqueeStyle: |
1581 case CSSPropertyWebkitPrintColorAdjust: | 1585 case CSSPropertyWebkitPrintColorAdjust: |
1582 case CSSPropertyWebkitRtlOrdering: | 1586 case CSSPropertyWebkitRtlOrdering: |
1583 case CSSPropertyWebkitRubyPosition: | 1587 case CSSPropertyWebkitRubyPosition: |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1620 default: | 1624 default: |
1621 return parseSVGValue(propId, important); | 1625 return parseSVGValue(propId, important); |
1622 } | 1626 } |
1623 | 1627 |
1624 if (validPrimitive) { | 1628 if (validPrimitive) { |
1625 parsedValue = parseValidPrimitive(id, value); | 1629 parsedValue = parseValidPrimitive(id, value); |
1626 m_valueList->next(); | 1630 m_valueList->next(); |
1627 } | 1631 } |
1628 ASSERT(!m_parsedCalculation); | 1632 ASSERT(!m_parsedCalculation); |
1629 if (parsedValue) { | 1633 if (parsedValue) { |
1630 if (!m_valueList->current() || inShorthand()) { | 1634 if (!m_valueList->current() || inShorthand()) { |
Manuel Rego
2014/06/27 22:43:51
This line makes that things like "column foo" are
| |
1631 addProperty(propId, parsedValue.release(), important); | 1635 addProperty(propId, parsedValue.release(), important); |
1632 return true; | 1636 return true; |
1633 } | 1637 } |
1634 } | 1638 } |
1635 return false; | 1639 return false; |
1636 } | 1640 } |
1637 | 1641 |
1638 void CSSPropertyParser::addFillValue(RefPtrWillBeRawPtr<CSSValue>& lval, PassRef PtrWillBeRawPtr<CSSValue> rval) | 1642 void CSSPropertyParser::addFillValue(RefPtrWillBeRawPtr<CSSValue>& lval, PassRef PtrWillBeRawPtr<CSSValue> rval) |
1639 { | 1643 { |
1640 if (lval) { | 1644 if (lval) { |
(...skipping 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3546 addProperty(CSSPropertyGridAutoFlow, cssValuePool().createImplicitInitia lValue(), important); | 3550 addProperty(CSSPropertyGridAutoFlow, cssValuePool().createImplicitInitia lValue(), important); |
3547 addProperty(CSSPropertyGridAutoColumns, cssValuePool().createImplicitIni tialValue(), important); | 3551 addProperty(CSSPropertyGridAutoColumns, cssValuePool().createImplicitIni tialValue(), important); |
3548 addProperty(CSSPropertyGridAutoRows, cssValuePool().createImplicitInitia lValue(), important); | 3552 addProperty(CSSPropertyGridAutoRows, cssValuePool().createImplicitInitia lValue(), important); |
3549 return true; | 3553 return true; |
3550 } | 3554 } |
3551 | 3555 |
3552 // Need to rewind parsing to explore the alternative syntax of this shorthan d. | 3556 // Need to rewind parsing to explore the alternative syntax of this shorthan d. |
3553 m_valueList->setCurrentIndex(0); | 3557 m_valueList->setCurrentIndex(0); |
3554 | 3558 |
3555 // 2- <grid-auto-flow> [ <grid-auto-columns> [ / <grid-auto-rows> ]? ] | 3559 // 2- <grid-auto-flow> [ <grid-auto-columns> [ / <grid-auto-rows> ]? ] |
3556 CSSValueID id = m_valueList->current()->id; | 3560 if (!parseValue(CSSPropertyGridAutoFlow, important)) |
3557 if (id != CSSValueRow && id != CSSValueColumn && id != CSSValueNone) | |
3558 return false; | 3561 return false; |
3559 | 3562 |
3560 RefPtrWillBeRawPtr<CSSValue> autoFlowValue = cssValuePool().createIdentifier Value(id); | |
3561 RefPtrWillBeRawPtr<CSSValue> autoColumnsValue = nullptr; | 3563 RefPtrWillBeRawPtr<CSSValue> autoColumnsValue = nullptr; |
3562 RefPtrWillBeRawPtr<CSSValue> autoRowsValue = nullptr; | 3564 RefPtrWillBeRawPtr<CSSValue> autoRowsValue = nullptr; |
3563 | 3565 |
3564 if (m_valueList->next()) { | 3566 if (m_valueList->current()) { |
3565 autoColumnsValue = parseGridTrackSize(*m_valueList); | 3567 autoColumnsValue = parseGridTrackSize(*m_valueList); |
3566 if (!autoColumnsValue) | 3568 if (!autoColumnsValue) |
3567 return false; | 3569 return false; |
3568 if (m_valueList->current()) { | 3570 if (m_valueList->current()) { |
3569 if (!isForwardSlashOperator(m_valueList->current()) || !m_valueList- >next()) | 3571 if (!isForwardSlashOperator(m_valueList->current()) || !m_valueList- >next()) |
3570 return false; | 3572 return false; |
3571 autoRowsValue = parseGridTrackSize(*m_valueList); | 3573 autoRowsValue = parseGridTrackSize(*m_valueList); |
3572 if (!autoRowsValue) | 3574 if (!autoRowsValue) |
3573 return false; | 3575 return false; |
3574 } | 3576 } |
3575 if (m_valueList->current()) | 3577 if (m_valueList->current()) |
3576 return false; | 3578 return false; |
3577 } else { | 3579 } else { |
3578 // Other omitted values are set to their initial values. | 3580 // Other omitted values are set to their initial values. |
3579 autoColumnsValue = cssValuePool().createImplicitInitialValue(); | 3581 autoColumnsValue = cssValuePool().createImplicitInitialValue(); |
3580 autoRowsValue = cssValuePool().createImplicitInitialValue(); | 3582 autoRowsValue = cssValuePool().createImplicitInitialValue(); |
3581 } | 3583 } |
3582 | 3584 |
3583 // if <grid-auto-rows> value is omitted, it is set to the value specified fo r grid-auto-columns. | 3585 // if <grid-auto-rows> value is omitted, it is set to the value specified fo r grid-auto-columns. |
3584 if (!autoRowsValue) | 3586 if (!autoRowsValue) |
3585 autoRowsValue = autoColumnsValue; | 3587 autoRowsValue = autoColumnsValue; |
3586 | 3588 |
3587 addProperty(CSSPropertyGridAutoFlow, autoFlowValue, important); | |
3588 addProperty(CSSPropertyGridAutoColumns, autoColumnsValue, important); | 3589 addProperty(CSSPropertyGridAutoColumns, autoColumnsValue, important); |
3589 addProperty(CSSPropertyGridAutoRows, autoRowsValue, important); | 3590 addProperty(CSSPropertyGridAutoRows, autoRowsValue, important); |
3590 | 3591 |
3591 // It can only be specified the explicit or the implicit grid properties in a single grid declaration. | 3592 // It can only be specified the explicit or the implicit grid properties in a single grid declaration. |
3592 // The sub-properties not specified are set to their initial value, as norma l for shorthands. | 3593 // The sub-properties not specified are set to their initial value, as norma l for shorthands. |
3593 addProperty(CSSPropertyGridTemplateColumns, cssValuePool().createImplicitIni tialValue(), important); | 3594 addProperty(CSSPropertyGridTemplateColumns, cssValuePool().createImplicitIni tialValue(), important); |
3594 addProperty(CSSPropertyGridTemplateRows, cssValuePool().createImplicitInitia lValue(), important); | 3595 addProperty(CSSPropertyGridTemplateRows, cssValuePool().createImplicitInitia lValue(), important); |
3595 addProperty(CSSPropertyGridTemplateAreas, cssValuePool().createImplicitIniti alValue(), important); | 3596 addProperty(CSSPropertyGridTemplateAreas, cssValuePool().createImplicitIniti alValue(), important); |
3596 | 3597 |
3597 return true; | 3598 return true; |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3897 return nullptr; | 3898 return nullptr; |
3898 ++rowCount; | 3899 ++rowCount; |
3899 } | 3900 } |
3900 | 3901 |
3901 if (!rowCount || !columnCount) | 3902 if (!rowCount || !columnCount) |
3902 return nullptr; | 3903 return nullptr; |
3903 | 3904 |
3904 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount) ; | 3905 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount) ; |
3905 } | 3906 } |
3906 | 3907 |
3908 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridAutoFlow(CSSParserV alueList& list) | |
3909 { | |
3910 // [ row | column ] && dense? | stack && [ row | column ]? | |
3911 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled()); | |
3912 | |
3913 CSSParserValue* value = list.current(); | |
3914 if (!value) | |
3915 return nullptr; | |
3916 | |
3917 RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSep arated(); | |
3918 | |
3919 // First parameter. | |
3920 CSSValueID firstId = value->id; | |
3921 if (value->id != CSSValueRow && value->id != CSSValueColumn && value->id != CSSValueDense && value->id != CSSValueStack) | |
Julien - ping for review
2014/06/27 17:44:53
Nit: firstId->id !=
Manuel Rego
2014/06/27 22:43:51
Yeah, I changed value->id by firstId.
| |
3922 return nullptr; | |
3923 parsedValues->append(cssValuePool().createIdentifierValue(value->id)); | |
3924 | |
3925 // Second parameter, if any. | |
3926 value = list.next(); | |
3927 if (!value && firstId == CSSValueDense) | |
3928 return nullptr; | |
3929 | |
3930 if (value) { | |
3931 switch (firstId) { | |
3932 case CSSValueRow: | |
3933 case CSSValueColumn: | |
3934 if (value->id != CSSValueDense && value->id != CSSValueStack) | |
3935 return parsedValues; | |
Julien - ping for review
2014/06/27 17:44:53
I assume this is needed for the 'grid' shorthand b
Manuel Rego
2014/06/27 22:43:51
I had one "column column" that was an invalid valu
| |
3936 break; | |
3937 case CSSValueDense: | |
3938 case CSSValueStack: | |
3939 if (value->id != CSSValueRow && value->id != CSSValueColumn) | |
3940 return parsedValues; | |
Julien - ping for review
2014/06/27 17:44:53
Same comment.
| |
3941 break; | |
3942 default: | |
3943 return parsedValues; | |
3944 } | |
3945 parsedValues->append(cssValuePool().createIdentifierValue(value->id)); | |
3946 list.next(); | |
3947 } | |
3948 | |
3949 return parsedValues; | |
3950 } | |
3951 | |
3907 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounterContent(CSSParse rValueList* args, bool counters) | 3952 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounterContent(CSSParse rValueList* args, bool counters) |
3908 { | 3953 { |
3909 unsigned numArgs = args->size(); | 3954 unsigned numArgs = args->size(); |
3910 if (counters && numArgs != 3 && numArgs != 5) | 3955 if (counters && numArgs != 3 && numArgs != 5) |
3911 return nullptr; | 3956 return nullptr; |
3912 if (!counters && numArgs != 1 && numArgs != 3) | 3957 if (!counters && numArgs != 1 && numArgs != 3) |
3913 return nullptr; | 3958 return nullptr; |
3914 | 3959 |
3915 CSSParserValue* i = args->current(); | 3960 CSSParserValue* i = args->current(); |
3916 if (i->unit != CSSPrimitiveValue::CSS_IDENT) | 3961 if (i->unit != CSSPrimitiveValue::CSS_IDENT) |
(...skipping 4514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8431 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); | 8476 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); |
8432 if (!seenStroke) | 8477 if (!seenStroke) |
8433 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); | 8478 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); |
8434 if (!seenMarkers) | 8479 if (!seenMarkers) |
8435 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); | 8480 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); |
8436 | 8481 |
8437 return parsedValues.release(); | 8482 return parsedValues.release(); |
8438 } | 8483 } |
8439 | 8484 |
8440 } // namespace WebCore | 8485 } // namespace WebCore |
OLD | NEW |