Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: Source/core/css/parser/CSSPropertyParser.cpp

Issue 333563003: [CSS Grid Layout] Update grid-auto-flow to the new syntax (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Attempt 2 to fix win_blink_rel Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after
3544 addProperty(CSSPropertyGridAutoFlow, cssValuePool().createImplicitInitia lValue(), important); 3548 addProperty(CSSPropertyGridAutoFlow, cssValuePool().createImplicitInitia lValue(), important);
3545 addProperty(CSSPropertyGridAutoColumns, cssValuePool().createImplicitIni tialValue(), important); 3549 addProperty(CSSPropertyGridAutoColumns, cssValuePool().createImplicitIni tialValue(), important);
3546 addProperty(CSSPropertyGridAutoRows, cssValuePool().createImplicitInitia lValue(), important); 3550 addProperty(CSSPropertyGridAutoRows, cssValuePool().createImplicitInitia lValue(), important);
3547 return true; 3551 return true;
3548 } 3552 }
3549 3553
3550 // Need to rewind parsing to explore the alternative syntax of this shorthan d. 3554 // Need to rewind parsing to explore the alternative syntax of this shorthan d.
3551 m_valueList->setCurrentIndex(0); 3555 m_valueList->setCurrentIndex(0);
3552 3556
3553 // 2- <grid-auto-flow> [ <grid-auto-columns> [ / <grid-auto-rows> ]? ] 3557 // 2- <grid-auto-flow> [ <grid-auto-columns> [ / <grid-auto-rows> ]? ]
3554 CSSValueID id = m_valueList->current()->id; 3558 if (!parseValue(CSSPropertyGridAutoFlow, important))
3555 if (id != CSSValueRow && id != CSSValueColumn && id != CSSValueNone)
3556 return false; 3559 return false;
3557 3560
3558 RefPtrWillBeRawPtr<CSSValue> autoFlowValue = cssValuePool().createIdentifier Value(id);
3559 RefPtrWillBeRawPtr<CSSValue> autoColumnsValue = nullptr; 3561 RefPtrWillBeRawPtr<CSSValue> autoColumnsValue = nullptr;
3560 RefPtrWillBeRawPtr<CSSValue> autoRowsValue = nullptr; 3562 RefPtrWillBeRawPtr<CSSValue> autoRowsValue = nullptr;
3561 3563
3562 if (m_valueList->next()) { 3564 if (m_valueList->current()) {
3563 autoColumnsValue = parseGridTrackSize(*m_valueList); 3565 autoColumnsValue = parseGridTrackSize(*m_valueList);
3564 if (!autoColumnsValue) 3566 if (!autoColumnsValue)
3565 return false; 3567 return false;
3566 if (m_valueList->current()) { 3568 if (m_valueList->current()) {
3567 if (!isForwardSlashOperator(m_valueList->current()) || !m_valueList- >next()) 3569 if (!isForwardSlashOperator(m_valueList->current()) || !m_valueList- >next())
3568 return false; 3570 return false;
3569 autoRowsValue = parseGridTrackSize(*m_valueList); 3571 autoRowsValue = parseGridTrackSize(*m_valueList);
3570 if (!autoRowsValue) 3572 if (!autoRowsValue)
3571 return false; 3573 return false;
3572 } 3574 }
3573 if (m_valueList->current()) 3575 if (m_valueList->current())
3574 return false; 3576 return false;
3575 } else { 3577 } else {
3576 // Other omitted values are set to their initial values. 3578 // Other omitted values are set to their initial values.
3577 autoColumnsValue = cssValuePool().createImplicitInitialValue(); 3579 autoColumnsValue = cssValuePool().createImplicitInitialValue();
3578 autoRowsValue = cssValuePool().createImplicitInitialValue(); 3580 autoRowsValue = cssValuePool().createImplicitInitialValue();
3579 } 3581 }
3580 3582
3581 // if <grid-auto-rows> value is omitted, it is set to the value specified fo r grid-auto-columns. 3583 // if <grid-auto-rows> value is omitted, it is set to the value specified fo r grid-auto-columns.
3582 if (!autoRowsValue) 3584 if (!autoRowsValue)
3583 autoRowsValue = autoColumnsValue; 3585 autoRowsValue = autoColumnsValue;
3584 3586
3585 addProperty(CSSPropertyGridAutoFlow, autoFlowValue, important);
3586 addProperty(CSSPropertyGridAutoColumns, autoColumnsValue, important); 3587 addProperty(CSSPropertyGridAutoColumns, autoColumnsValue, important);
3587 addProperty(CSSPropertyGridAutoRows, autoRowsValue, important); 3588 addProperty(CSSPropertyGridAutoRows, autoRowsValue, important);
3588 3589
3589 // It can only be specified the explicit or the implicit grid properties in a single grid declaration. 3590 // It can only be specified the explicit or the implicit grid properties in a single grid declaration.
3590 // The sub-properties not specified are set to their initial value, as norma l for shorthands. 3591 // The sub-properties not specified are set to their initial value, as norma l for shorthands.
3591 addProperty(CSSPropertyGridTemplateColumns, cssValuePool().createImplicitIni tialValue(), important); 3592 addProperty(CSSPropertyGridTemplateColumns, cssValuePool().createImplicitIni tialValue(), important);
3592 addProperty(CSSPropertyGridTemplateRows, cssValuePool().createImplicitInitia lValue(), important); 3593 addProperty(CSSPropertyGridTemplateRows, cssValuePool().createImplicitInitia lValue(), important);
3593 addProperty(CSSPropertyGridTemplateAreas, cssValuePool().createImplicitIniti alValue(), important); 3594 addProperty(CSSPropertyGridTemplateAreas, cssValuePool().createImplicitIniti alValue(), important);
3594 3595
3595 return true; 3596 return true;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
3895 return nullptr; 3896 return nullptr;
3896 ++rowCount; 3897 ++rowCount;
3897 } 3898 }
3898 3899
3899 if (!rowCount || !columnCount) 3900 if (!rowCount || !columnCount)
3900 return nullptr; 3901 return nullptr;
3901 3902
3902 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount) ; 3903 return CSSGridTemplateAreasValue::create(gridAreaMap, rowCount, columnCount) ;
3903 } 3904 }
3904 3905
3906 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseGridAutoFlow(CSSParserV alueList& list)
3907 {
3908 // [ row | column ] && dense? | stack && [ row | column ]?
3909 ASSERT(RuntimeEnabledFeatures::cssGridLayoutEnabled());
3910
3911 CSSParserValue* value = list.current();
3912 if (!value)
3913 return nullptr;
3914
3915 RefPtrWillBeRawPtr<CSSValueList> parsedValues = CSSValueList::createSpaceSep arated();
3916
3917 // First parameter.
3918 CSSValueID firstId = value->id;
3919 if (firstId != CSSValueRow && firstId != CSSValueColumn && firstId != CSSVal ueDense && firstId != CSSValueStack)
3920 return nullptr;
3921 parsedValues->append(cssValuePool().createIdentifierValue(firstId));
3922
3923 // Second parameter, if any.
3924 value = list.next();
3925 if (!value && firstId == CSSValueDense)
3926 return nullptr;
3927
3928 if (value) {
3929 switch (firstId) {
3930 case CSSValueRow:
3931 case CSSValueColumn:
3932 if (value->id != CSSValueDense && value->id != CSSValueStack)
3933 return parsedValues;
3934 break;
3935 case CSSValueDense:
3936 case CSSValueStack:
3937 if (value->id != CSSValueRow && value->id != CSSValueColumn)
3938 return parsedValues;
3939 break;
3940 default:
3941 return parsedValues;
3942 }
3943 parsedValues->append(cssValuePool().createIdentifierValue(value->id));
3944 list.next();
3945 }
3946
3947 return parsedValues;
3948 }
3949
3905 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounterContent(CSSParse rValueList* args, bool counters) 3950 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseCounterContent(CSSParse rValueList* args, bool counters)
3906 { 3951 {
3907 unsigned numArgs = args->size(); 3952 unsigned numArgs = args->size();
3908 if (counters && numArgs != 3 && numArgs != 5) 3953 if (counters && numArgs != 3 && numArgs != 5)
3909 return nullptr; 3954 return nullptr;
3910 if (!counters && numArgs != 1 && numArgs != 3) 3955 if (!counters && numArgs != 1 && numArgs != 3)
3911 return nullptr; 3956 return nullptr;
3912 3957
3913 CSSParserValue* i = args->current(); 3958 CSSParserValue* i = args->current();
3914 if (i->unit != CSSPrimitiveValue::CSS_IDENT) 3959 if (i->unit != CSSPrimitiveValue::CSS_IDENT)
(...skipping 4514 matching lines...) Expand 10 before | Expand all | Expand 10 after
8429 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill)); 8474 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
8430 if (!seenStroke) 8475 if (!seenStroke)
8431 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) ); 8476 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke) );
8432 if (!seenMarkers) 8477 if (!seenMarkers)
8433 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers )); 8478 parsedValues->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers ));
8434 8479
8435 return parsedValues.release(); 8480 return parsedValues.release();
8436 } 8481 }
8437 8482
8438 } // namespace WebCore 8483 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.h ('k') | Source/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698