Bug 1240956 part 3 - [css-grid] Add a ParseGridTrackList convenience method. r=dholbert

This commit is contained in:
Mats Palmgren 2016-01-27 17:02:13 +01:00
Родитель a4647712fa
Коммит 94dd6e702f
1 изменённых файлов: 18 добавлений и 14 удалений

Просмотреть файл

@ -962,6 +962,8 @@ protected:
// and alternating between that and <track-size>.
bool ParseGridTrackListWithFirstLineNames(nsCSSValue& aValue,
const nsCSSValue& aFirstLineNames);
bool ParseGridTrackList(nsCSSProperty aPropID);
bool ParseGridTemplateColumnsRows(nsCSSProperty aPropID);
// |aAreaIndices| is a lookup table to help us parse faster,
@ -8935,6 +8937,19 @@ CSSParserImpl::ParseGridTrackListRepeat(nsCSSValueList** aTailPtr)
return true;
}
bool
CSSParserImpl::ParseGridTrackList(nsCSSProperty aPropID)
{
nsCSSValue value;
nsCSSValue firstLineNames;
if (ParseGridLineNames(firstLineNames) == CSSParseResult::Error ||
!ParseGridTrackListWithFirstLineNames(value, firstLineNames)) {
return false;
}
AppendValue(aPropID, value);
return true;
}
bool
CSSParserImpl::ParseGridTemplateColumnsRows(nsCSSProperty aPropID)
{
@ -8960,13 +8975,7 @@ CSSParserImpl::ParseGridTemplateColumnsRows(nsCSSProperty aPropID)
UngetToken();
}
nsCSSValue firstLineNames;
if (ParseGridLineNames(firstLineNames) == CSSParseResult::Error ||
!ParseGridTrackListWithFirstLineNames(value, firstLineNames)) {
return false;
}
AppendValue(aPropID, value);
return true;
return ParseGridTrackList(aPropID);
}
bool
@ -9160,14 +9169,9 @@ CSSParserImpl::ParseGridTemplate()
}
// Parse an optional [ / <track-list> ] as the columns value.
if (ExpectSymbol('/', true)) {
nsCSSValue lineNames;
if (ParseGridLineNames(lineNames) == CSSParseResult::Error ||
!ParseGridTrackListWithFirstLineNames(value, lineNames)) {
return false;
}
} else {
value.SetNoneValue(); // absent means 'none'
return ParseGridTrackList(eCSSProperty_grid_template_columns);
}
value.SetNoneValue(); // absent means 'none'
AppendValue(eCSSProperty_grid_template_columns, value);
return true;
}