Example #1
0
void MediaQueryParser::readFeatureValue(MediaQueryTokenType type, const MediaQueryToken& token)
{
    if (type == DimensionToken && token.unitType() == CSSPrimitiveValue::CSS_UNKNOWN) {
        m_state = SkipUntilComma;
    } else {
        m_mediaQueryData.addParserValue(type, token);
        m_state = ReadFeatureEnd;
    }
}
Example #2
0
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);
}
Example #3
0
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);
}