本文整理汇总了C++中MediaQuery::expressions方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaQuery::expressions方法的具体用法?C++ MediaQuery::expressions怎么用?C++ MediaQuery::expressions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaQuery
的用法示例。
在下文中一共展示了MediaQuery::expressions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: eval
bool MediaQueryEvaluator::eval(const MediaQuerySet* querySet, MediaQueryResultList* viewportDependentMediaQueryResults) const
{
if (!querySet)
return true;
const WillBeHeapVector<OwnPtrWillBeMember<MediaQuery> >& queries = querySet->queryVector();
if (!queries.size())
return true; // Empty query list evaluates to true.
// Iterate over queries, stop if any of them eval to true (OR semantics).
bool result = false;
for (size_t i = 0; i < queries.size() && !result; ++i) {
MediaQuery* query = queries[i].get();
if (mediaTypeMatch(query->mediaType())) {
const ExpressionHeapVector& expressions = query->expressions();
// Iterate through expressions, stop if any of them eval to false (AND semantics).
size_t j = 0;
for (; j < expressions.size(); ++j) {
bool exprResult = eval(expressions.at(j).get());
if (viewportDependentMediaQueryResults && expressions.at(j)->isViewportDependent())
viewportDependentMediaQueryResults->append(adoptRefWillBeNoop(new MediaQueryResult(*expressions.at(j), exprResult)));
if (!exprResult)
break;
}
// Assume true if we are at the end of the list, otherwise assume false.
result = applyRestrictor(query->restrictor(), expressions.size() == j);
} else {
result = applyRestrictor(query->restrictor(), false);
}
}
return result;
}
示例2: evalCheckingViewportDependentResults
bool MediaQueryEvaluator::evalCheckingViewportDependentResults(const MediaQuerySet* querySet, Vector<std::unique_ptr<MediaQueryResult>>& results)
{
if (!querySet)
return true;
auto& queries = querySet->queryVector();
if (!queries.size())
return true;
bool result = false;
for (size_t i = 0; i < queries.size() && !result; ++i) {
MediaQuery* query = queries[i].get();
if (query->ignored())
continue;
if (mediaTypeMatch(query->mediaType())) {
auto& expressions = query->expressions();
size_t j = 0;
for (; j < expressions.size(); ++j) {
bool exprResult = eval(expressions.at(j).get());
if (expressions.at(j)->isViewportDependent())
results.append(std::make_unique<MediaQueryResult>(*expressions.at(j), exprResult));
if (!exprResult)
break;
}
result = applyRestrictor(query->restrictor(), expressions.size() == j);
} else
result = applyRestrictor(query->restrictor(), false);
}
return result;
}
示例3: eval
bool MediaQueryEvaluator::eval(const MediaListImpl* mediaList, CSSStyleSelector* styleSelector) const
{
if (!mediaList)
return true;
const QList<MediaQuery*>* queries = mediaList->mediaQueries();
if (!queries->size())
return true; // empty query list evaluates to true
// iterate over queries, stop if any of them eval to true (OR semantics)
bool result = false;
for (int i = 0; i < queries->size() && !result; ++i) {
MediaQuery* query = queries->at(i);
if (mediaTypeMatch(query->mediaType())) {
const QList<MediaQueryExp*>* exps = query->expressions();
// iterate through expressions, stop if any of them eval to false
// (AND semantics)
int j = 0;
for (; j < exps->size(); ++j) {
bool exprResult = eval(exps->at(j));
if (styleSelector && exps->at(j)->isViewportDependent())
styleSelector->addViewportDependentMediaQueryResult(exps->at(j), exprResult);
if (!exprResult)
break;
}
// assume true if we are at the end of the list,
// otherwise assume false
result = applyRestrictor(query->restrictor(), exps->size() == j);
} else
result = applyRestrictor(query->restrictor(), false);
}
return result;
}
示例4: eval
bool MediaQueryEvaluator::eval(const MediaList* mediaList) const
{
if (!mediaList)
return true;
const Vector<MediaQuery*>* queries = mediaList->mediaQueries();
if (!queries->size())
return true; // empty query list evaluates to true
// iterate over queries, stop if any of them eval to true (OR semantics)
bool result = false;
for (size_t i = 0; i < queries->size() && !result; ++i) {
MediaQuery* query = queries->at(i);
if (mediaTypeMatch(query->mediaType())) {
const Vector<MediaQueryExp*>* exps = query->expressions();
// iterate through expressions, stop if any of them eval to false
// (AND semantics)
size_t j = 0;
for (; j < exps->size() && eval(exps->at(j)); ++j) /* empty*/;
// assume true if we are at the end of the list,
// otherwise assume false
result = applyRestrictor(query->restrictor(), exps->size() == j);
} else
result = applyRestrictor(query->restrictor(), false);
}
return result;
}
示例5: eval
bool MediaQueryEvaluator::eval(const MediaQuerySet* querySet, StyleResolver* styleResolver) const
{
if (!querySet)
return true;
auto& queries = querySet->queryVector();
if (!queries.size())
return true; // empty query list evaluates to true
// iterate over queries, stop if any of them eval to true (OR semantics)
bool result = false;
for (size_t i = 0; i < queries.size() && !result; ++i) {
MediaQuery* query = queries[i].get();
if (query->ignored() || (!query->expressions().size() && query->mediaType().isEmpty()))
continue;
if (mediaTypeMatch(query->mediaType())) {
auto& expressions = query->expressions();
// iterate through expressions, stop if any of them eval to false
// (AND semantics)
size_t j = 0;
for (; j < expressions.size(); ++j) {
bool exprResult = eval(expressions.at(j).get());
if (styleResolver && expressions.at(j)->isViewportDependent())
styleResolver->addViewportDependentMediaQueryResult(expressions.at(j).get(), exprResult);
if (!exprResult)
break;
}
// assume true if we are at the end of the list,
// otherwise assume false
result = applyRestrictor(query->restrictor(), expressions.size() == j);
} else
result = applyRestrictor(query->restrictor(), false);
}
return result;
}