本文整理汇总了C++中MediaQueryToken类的典型用法代码示例。如果您正苦于以下问题:C++ MediaQueryToken类的具体用法?C++ MediaQueryToken怎么用?C++ MediaQueryToken使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MediaQueryToken类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: consumeNumber
// http://www.w3.org/TR/css3-syntax/#consume-a-numeric-token
MediaQueryToken MediaQueryTokenizer::consumeNumericToken()
{
MediaQueryToken token = consumeNumber();
if (nextCharsAreIdentifier())
token.convertToDimensionWithUnit(consumeName());
else if (consumeIfNext('%'))
token.convertToPercentage();
return token;
}
示例2: if
void MediaQueryBlockWatcher::handleToken(const MediaQueryToken& token)
{
if (token.blockType() == MediaQueryToken::BlockStart) {
++m_blockLevel;
} else if (token.blockType() == MediaQueryToken::BlockEnd) {
ASSERT(m_blockLevel);
--m_blockLevel;
}
}
示例3: readFeatureValue
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;
}
}
示例4: readFeature
void MediaQueryParser::readFeature(MediaQueryTokenType type, const MediaQueryToken& token)
{
if (type == IdentToken) {
m_mediaQueryData.setMediaFeature(token.value());
m_state = ReadFeatureColon;
} else {
m_state = SkipUntilComma;
}
}
示例5: processToken
void MediaQueryParser::processToken(const MediaQueryToken& token)
{
MediaQueryTokenType type = token.type();
handleBlocks(token);
m_blockWatcher.handleToken(token);
// Call the function that handles current state
if (type != WhitespaceToken && type != CommentToken)
((this)->*(m_state))(type, token);
}
示例6: readMediaType
void MediaQueryParser::readMediaType(MediaQueryTokenType type, const MediaQueryToken& token)
{
if (type == LeftParenthesisToken) {
m_state = ReadFeature;
} else if (type == IdentToken) {
if (m_state == ReadRestrictor && equalIgnoringCase(token.value(), "not")) {
setStateAndRestrict(ReadMediaType, MediaQuery::Not);
} else if (m_state == ReadRestrictor && equalIgnoringCase(token.value(), "only")) {
setStateAndRestrict(ReadMediaType, MediaQuery::Only);
} else {
m_mediaQueryData.setMediaType(token.value());
m_state = ReadAnd;
}
} else if (type == EOFToken && (!m_querySet->queryVector().size() || m_state != ReadRestrictor)) {
m_state = Done;
} else {
m_state = SkipUntilComma;
if (type == CommaToken)
skipUntilComma(type, token);
}
}
示例7: addParserValue
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);
}
示例8: input
void MediaQueryTokenizer::tokenize(String string, Vector<MediaQueryToken>& outTokens)
{
// According to the spec, we should perform preprocessing here.
// See: http://dev.w3.org/csswg/css-syntax/#input-preprocessing
//
// However, we can skip this step since:
// * We're using HTML spaces (which accept \r and \f as a valid white space)
// * Do not count white spaces
// * consumeEscape replaces NULLs for replacement characters
if (string.isEmpty())
return;
MediaQueryInputStream input(string);
MediaQueryTokenizer tokenizer(input);
while (true) {
MediaQueryToken token = tokenizer.nextToken();
outTokens.append(token);
if (token.type() == EOFToken)
return;
}
}
示例9: readAnd
void MediaQueryParser::readAnd(MediaQueryTokenType type, const MediaQueryToken& token)
{
if (type == IdentToken && equalIgnoringCase(token.value(), "and")) {
m_state = ReadFeatureStart;
} else if (type == CommaToken) {
m_querySet->addMediaQuery(m_mediaQueryData.takeMediaQuery());
m_state = ReadRestrictor;
} else if (type == EOFToken) {
m_state = Done;
} else {
m_state = SkipUntilComma;
}
}
示例10: readFeatureEnd
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;
}
}
示例11: addParserValue
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);
}
示例12: handleBlocks
void MediaQueryParser::handleBlocks(const MediaQueryToken& token)
{
if (token.blockType() == MediaQueryToken::BlockStart
&& (token.type() != LeftParenthesisToken || m_blockWatcher.blockLevel()))
m_state = SkipUntilBlockEnd;
}
示例13: skipUntilBlockEnd
void MediaQueryParser::skipUntilBlockEnd(MediaQueryTokenType type, const MediaQueryToken& token)
{
if (token.blockType() == MediaQueryToken::BlockEnd && !m_blockWatcher.blockLevel())
m_state = SkipUntilComma;
}