/[suikacvs]/markup/html/whatpm/Whatpm/HTML.pm.src
Suika

Diff of /markup/html/whatpm/Whatpm/HTML.pm.src

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.95 by wakaba, Sat Mar 8 05:09:25 2008 UTC revision 1.96 by wakaba, Sat Mar 8 13:26:45 2008 UTC
# Line 2903  sub _tree_construction_main ($) { Line 2903  sub _tree_construction_main ($) {
2903      !!!cp ('t39');      !!!cp ('t39');
2904    }; # $clear_up_to_marker    }; # $clear_up_to_marker
2905    
2906    my $parse_rcdata = sub ($$) {    my $insert;
2907      my ($content_model_flag, $insert) = @_;  
2908      my $parse_rcdata = sub ($) {
2909        my ($content_model_flag) = @_;
2910    
2911      ## Step 1      ## Step 1
2912      my $start_tag_name = $token->{tag_name};      my $start_tag_name = $token->{tag_name};
# Line 2912  sub _tree_construction_main ($) { Line 2914  sub _tree_construction_main ($) {
2914      !!!create-element ($el, $start_tag_name, $token->{attributes});      !!!create-element ($el, $start_tag_name, $token->{attributes});
2915    
2916      ## Step 2      ## Step 2
2917      $insert->($el); # /context node/->append_child ($el)      $insert->($el);
2918    
2919      ## Step 3      ## Step 3
2920      $self->{content_model} = $content_model_flag; # CDATA or RCDATA      $self->{content_model} = $content_model_flag; # CDATA or RCDATA
# Line 2942  sub _tree_construction_main ($) { Line 2944  sub _tree_construction_main ($) {
2944          $token->{tag_name} eq $start_tag_name) {          $token->{tag_name} eq $start_tag_name) {
2945        !!!cp ('t42');        !!!cp ('t42');
2946        ## Ignore the token        ## Ignore the token
     } elsif ($content_model_flag == CDATA_CONTENT_MODEL) {  
       !!!cp ('t43');  
       !!!parse-error (type => 'in CDATA:#'.$token->{type});  
     } elsif ($content_model_flag == RCDATA_CONTENT_MODEL) {  
       !!!cp ('t44');  
       !!!parse-error (type => 'in RCDATA:#'.$token->{type});  
2947      } else {      } else {
2948        die "$0: $content_model_flag in parse_rcdata";        ## NOTE: An end-of-file token.
2949          if ($content_model_flag == CDATA_CONTENT_MODEL) {
2950            !!!cp ('t43');
2951            !!!parse-error (type => 'in CDATA:#'.$token->{type});
2952          } elsif ($content_model_flag == RCDATA_CONTENT_MODEL) {
2953            !!!cp ('t44');
2954            !!!parse-error (type => 'in RCDATA:#'.$token->{type});
2955          } else {
2956            die "$0: $content_model_flag in parse_rcdata";
2957          }
2958      }      }
2959      !!!next-token;      !!!next-token;
2960    }; # $parse_rcdata    }; # $parse_rcdata
2961    
2962    my $script_start_tag = sub ($) {    my $script_start_tag = sub () {
     my $insert = $_[0];  
2963      my $script_el;      my $script_el;
2964      !!!create-element ($script_el, 'script', $token->{attributes});      !!!create-element ($script_el, 'script', $token->{attributes});
2965      ## TODO: mark as "parser-inserted"      ## TODO: mark as "parser-inserted"
# Line 3212  sub _tree_construction_main ($) { Line 3216  sub _tree_construction_main ($) {
3216    ## NOTE: $open_tables->[-1]->[1] is the "tainted" flag.    ## NOTE: $open_tables->[-1]->[1] is the "tainted" flag.
3217    my $open_tables = [[$self->{open_elements}->[0]->[0]]];    my $open_tables = [[$self->{open_elements}->[0]->[0]]];
3218    
3219    my $insert_to_current = sub {    $insert = my $insert_to_current = sub {
3220      $self->{open_elements}->[-1]->[0]->append_child ($_[0]);      $self->{open_elements}->[-1]->[0]->append_child ($_[0]);
3221    }; # $insert_to_current    }; # $insert_to_current
3222    
# Line 3250  sub _tree_construction_main ($) { Line 3254  sub _tree_construction_main ($) {
3254      }      }
3255    }; # $insert_to_foster    }; # $insert_to_foster
3256    
   my $insert;  
   
3257    B: {    B: {
3258      if ($token->{type} == DOCTYPE_TOKEN) {      if ($token->{type} == DOCTYPE_TOKEN) {
3259        !!!cp ('t73');        !!!cp ('t73');
# Line 3537  sub _tree_construction_main ($) { Line 3539  sub _tree_construction_main ($) {
3539                ## NOTE: There is a "as if in head" code clone.                ## NOTE: There is a "as if in head" code clone.
3540                my $parent = defined $self->{head_element} ? $self->{head_element}                my $parent = defined $self->{head_element} ? $self->{head_element}
3541                    : $self->{open_elements}->[-1]->[0];                    : $self->{open_elements}->[-1]->[0];
3542                $parse_rcdata->(RCDATA_CONTENT_MODEL,                $parse_rcdata->(RCDATA_CONTENT_MODEL);
                               sub { $parent->append_child ($_[0]) });  
3543                pop @{$self->{open_elements}}                pop @{$self->{open_elements}}
3544                    if $self->{insertion_mode} == AFTER_HEAD_IM;                    if $self->{insertion_mode} == AFTER_HEAD_IM;
3545                redo B;                redo B;
# Line 3553  sub _tree_construction_main ($) { Line 3554  sub _tree_construction_main ($) {
3554                } else {                } else {
3555                  !!!cp ('t115');                  !!!cp ('t115');
3556                }                }
3557                $parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current);                $parse_rcdata->(CDATA_CONTENT_MODEL);
3558                pop @{$self->{open_elements}}                pop @{$self->{open_elements}}
3559                    if $self->{insertion_mode} == AFTER_HEAD_IM;                    if $self->{insertion_mode} == AFTER_HEAD_IM;
3560                redo B;                redo B;
# Line 5204  sub _tree_construction_main ($) { Line 5205  sub _tree_construction_main ($) {
5205          } elsif ($token->{tag_name} eq 'noframes') {          } elsif ($token->{tag_name} eq 'noframes') {
5206            !!!cp ('t320');            !!!cp ('t320');
5207            ## NOTE: As if in body.            ## NOTE: As if in body.
5208            $parse_rcdata->(CDATA_CONTENT_MODEL, $insert_to_current);            $parse_rcdata->(CDATA_CONTENT_MODEL);
5209            redo B;            redo B;
5210          } else {          } else {
5211            if ($self->{insertion_mode} == IN_FRAMESET_IM) {            if ($self->{insertion_mode} == IN_FRAMESET_IM) {
# Line 5288  sub _tree_construction_main ($) { Line 5289  sub _tree_construction_main ($) {
5289        } elsif ($token->{tag_name} eq 'style') {        } elsif ($token->{tag_name} eq 'style') {
5290          !!!cp ('t333');          !!!cp ('t333');
5291          ## NOTE: This is an "as if in head" code clone          ## NOTE: This is an "as if in head" code clone
5292          $parse_rcdata->(CDATA_CONTENT_MODEL, $insert);          $parse_rcdata->(CDATA_CONTENT_MODEL);
5293          redo B;          redo B;
5294        } elsif ({        } elsif ({
5295                  base => 1, link => 1,                  base => 1, link => 1,
# Line 5351  sub _tree_construction_main ($) { Line 5352  sub _tree_construction_main ($) {
5352          redo B;          redo B;
5353        } elsif ($token->{tag_name} eq 'title') {        } elsif ($token->{tag_name} eq 'title') {
5354          !!!cp ('t341');          !!!cp ('t341');
         !!!parse-error (type => 'in body:title');  
5355          ## NOTE: This is an "as if in head" code clone          ## NOTE: This is an "as if in head" code clone
5356          $parse_rcdata->(RCDATA_CONTENT_MODEL, sub {          $parse_rcdata->(RCDATA_CONTENT_MODEL);
           if (defined $self->{head_element}) {  
             !!!cp ('t339');  
             $self->{head_element}->append_child ($_[0]);  
           } else {  
             !!!cp ('t340');  
             $insert->($_[0]);  
           }  
         });  
5357          redo B;          redo B;
5358        } elsif ($token->{tag_name} eq 'body') {        } elsif ($token->{tag_name} eq 'body') {
5359          !!!parse-error (type => 'in body:body');          !!!parse-error (type => 'in body:body');
# Line 5709  sub _tree_construction_main ($) { Line 5701  sub _tree_construction_main ($) {
5701        } elsif ($token->{tag_name} eq 'xmp') {        } elsif ($token->{tag_name} eq 'xmp') {
5702          !!!cp ('t381');          !!!cp ('t381');
5703          $reconstruct_active_formatting_elements->($insert_to_current);          $reconstruct_active_formatting_elements->($insert_to_current);
5704          $parse_rcdata->(CDATA_CONTENT_MODEL, $insert);          $parse_rcdata->(CDATA_CONTENT_MODEL);
5705          redo B;          redo B;
5706        } elsif ($token->{tag_name} eq 'table') {        } elsif ($token->{tag_name} eq 'table') {
5707          ## has a p element in scope          ## has a p element in scope
# Line 5885  sub _tree_construction_main ($) { Line 5877  sub _tree_construction_main ($) {
5877                 }->{$token->{tag_name}}) {                 }->{$token->{tag_name}}) {
5878          !!!cp ('t399');          !!!cp ('t399');
5879          ## NOTE: There is an "as if in body" code clone.          ## NOTE: There is an "as if in body" code clone.
5880          $parse_rcdata->(CDATA_CONTENT_MODEL, $insert);          $parse_rcdata->(CDATA_CONTENT_MODEL);
5881          redo B;          redo B;
5882        } elsif ($token->{tag_name} eq 'select') {        } elsif ($token->{tag_name} eq 'select') {
5883          !!!cp ('t400');          !!!cp ('t400');

Legend:
Removed from v.1.95  
changed lines
  Added in v.1.96

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24