예제 #1
0
 Selector* Contextualize::operator()(Complex_Selector* s)
 {
   To_String to_string(&ctx);
   Complex_Selector* ss = new (ctx.mem) Complex_Selector(*s);
   // ss->last_block(s->last_block());
   // ss->media_block(s->media_block());
   Compound_Selector* new_head = 0;
   Complex_Selector* new_tail = 0;
   if (ss->head()) {
     new_head = static_cast<Compound_Selector*>(s->head()->perform(this));
     ss->head(new_head);
   }
   if (ss->tail()) {
     new_tail = static_cast<Complex_Selector*>(s->tail()->perform(this));
     // new_tail->last_block(s->last_block());
     // new_tail->media_block(s->media_block());
     ss->tail(new_tail);
   }
   if ((new_head && new_head->has_placeholder()) || (new_tail && new_tail->has_placeholder())) {
     ss->has_placeholder(true);
   }
   else {
     ss->has_placeholder(false);
   }
   if (!ss->head() && ss->combinator() == Complex_Selector::ANCESTOR_OF) {
     return ss->tail();
   }
   else {
     return ss;
   }
 }