void MediaQueryParser::readFeatureEnd(MediaQueryTokenType type, const MediaQueryToken& token) { if (type == RightParenthesisToken || type == EOFToken) { if (m_mediaQueryData.addExpression()) m_state = ReadAnd; else m_state = SkipUntilComma; } else if (type == DelimiterToken && token.delimiter() == '/') { m_mediaQueryData.addParserValue(type, token); m_state = ReadFeatureValue; } else { m_state = SkipUntilBlockEnd; } }
void MediaQueryData::addParserValue(MediaQueryTokenType type, const MediaQueryToken& token) { CSSParserValue value; if (type == NumberToken || type == PercentageToken || type == DimensionToken) { value.setFromNumber(token.numericValue(), token.unitType()); value.isInt = (token.numericValueType() == IntegerValueType); } else if (type == DelimiterToken) { value.unit = CSSParserValue::Operator; value.iValue = token.delimiter(); } else { CSSParserFunction* function = new CSSParserFunction; function->name.init(token.value()); value.setFromFunction(function); CSSParserString tokenValue; tokenValue.init(token.value()); value.id = cssValueKeywordID(tokenValue); } m_valueList.addValue(value); }
void MediaQueryData::addParserValue(MediaQueryTokenType type, const MediaQueryToken& token) { CSSParserValue value; if (type == NumberToken || type == PercentageToken || type == DimensionToken) { value.setFromNumber(token.numericValue(), token.unitType()); value.isInt = (token.numericValueType() == IntegerValueType); } else if (type == DelimiterToken) { value.unit = CSSParserValue::Operator; value.iValue = token.delimiter(); value.id = CSSValueInvalid; value.isInt = false; } else { CSSParserString tokenValue; tokenValue.init(token.value()); value.unit = CSSPrimitiveValue::CSS_IDENT; value.string = tokenValue; value.id = cssValueKeywordID(tokenValue); value.isInt = false; } m_valueList.addValue(value); }