示例#1
0
void LessMediaQuery::process(Stylesheet &s) {
  MediaQuery* query = s.createMediaQuery();

  query->setSelector(*getSelector());
  getContext()->processValue(query->getSelector());

  LessStylesheet::process(*query, *parent->getContext());
}
示例#2
0
void MediaQueryRuleset::process(Stylesheet &s, Selector* prefix, ProcessingContext &context) {
  MediaQuery* query;
  Ruleset* target;
  Selector selector;

#ifdef WITH_LIBGLOG
  VLOG(2) << "Processing Less Ruleset: " <<
    getSelector().toString();
#endif
  
  query = s.createMediaQuery();
  selector = getSelector();
  context.interpolate(selector);

  if (query->getSelector().size() > 0) {
    selector.pop_front();

    query->getSelector().push_back(Token(" ", Token::WHITESPACE));
    query->getSelector().push_back(Token("and", Token::IDENTIFIER));
    query->getSelector().insert(query->getSelector().end(),
                                 selector.begin(),
                                 selector.end());
  } else
    query->setSelector(selector);

  if (prefix != NULL) {
    target = query->createRuleset();
    target->setSelector(*prefix);

#ifdef WITH_LIBGLOG
    VLOG(3) << "Interpolating selector " <<
    target->getSelector().toString();
#endif
    context.interpolate(target->getSelector());
  
    insert(NULL, *target, context);
  } else
    insert(NULL, *query, context);
}