Skip to content

Commit

Permalink
HTML API: Make "reset insertion mode appropriately" algorithm private.
Browse files Browse the repository at this point in the history
The algorithm is described and referred to in the specification as
"reset the insertion mode appropriately." This patch renames it to
more accurately reflect the specification, and it turns the public
method private. As an internal algorithm from the HTML specification
it should not be open to extension.

Developed in WordPress#7194
Discussed in https://core.trac.wordpress.org/ticket/61549

Follow-up to [28656].
Props jonsurrell.
See #61549.


git-svn-id: https://develop.svn.wordpress.org/trunk@58898 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
dmsnell committed Aug 14, 2024
1 parent 064f75e commit 1b48ae6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/wp-includes/html-api/class-wp-html-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -1501,7 +1501,7 @@ private function step_in_head(): bool {
$this->state->stack_of_open_elements->pop_until( 'TEMPLATE' );
$this->state->active_formatting_elements->clear_up_to_last_marker();
array_pop( $this->state->stack_of_template_insertion_modes );
$this->reset_insertion_mode();
$this->reset_insertion_mode_appropriately();
return true;
}

Expand Down Expand Up @@ -2955,7 +2955,7 @@ private function step_in_table(): bool {
}

$this->state->stack_of_open_elements->pop_until( 'TABLE' );
$this->reset_insertion_mode();
$this->reset_insertion_mode_appropriately();
return $this->step( self::REPROCESS_CURRENT_NODE );

/*
Expand All @@ -2968,7 +2968,7 @@ private function step_in_table(): bool {
}

$this->state->stack_of_open_elements->pop_until( 'TABLE' );
$this->reset_insertion_mode();
$this->reset_insertion_mode_appropriately();
return true;

/*
Expand Down Expand Up @@ -3729,7 +3729,7 @@ private function step_in_select(): bool {
return $this->step();
}
$this->state->stack_of_open_elements->pop_until( 'SELECT' );
$this->reset_insertion_mode();
$this->reset_insertion_mode_appropriately();
return true;

/*
Expand All @@ -3745,7 +3745,7 @@ private function step_in_select(): bool {
return $this->step();
}
$this->state->stack_of_open_elements->pop_until( 'SELECT' );
$this->reset_insertion_mode();
$this->reset_insertion_mode_appropriately();
return $this->step( self::REPROCESS_CURRENT_NODE );

/*
Expand Down Expand Up @@ -3800,7 +3800,7 @@ private function step_in_select_in_table(): bool {
case '+TH':
// @todo Indicate a parse error once it's possible.
$this->state->stack_of_open_elements->pop_until( 'SELECT' );
$this->reset_insertion_mode();
$this->reset_insertion_mode_appropriately();
return $this->step( self::REPROCESS_CURRENT_NODE );

/*
Expand All @@ -3819,7 +3819,7 @@ private function step_in_select_in_table(): bool {
return $this->step();
}
$this->state->stack_of_open_elements->pop_until( 'SELECT' );
$this->reset_insertion_mode();
$this->reset_insertion_mode_appropriately();
return $this->step( self::REPROCESS_CURRENT_NODE );
}

Expand Down Expand Up @@ -3954,7 +3954,7 @@ private function step_in_template(): bool {
$this->state->stack_of_open_elements->pop_until( 'TEMPLATE' );
$this->state->active_formatting_elements->clear_up_to_last_marker();
array_pop( $this->state->stack_of_template_insertion_modes );
$this->reset_insertion_mode();
$this->reset_insertion_mode_appropriately();
return $this->step( self::REPROCESS_CURRENT_NODE );
}

Expand Down Expand Up @@ -5100,7 +5100,7 @@ private function reconstruct_active_formatting_elements(): bool {
*
* @see https://html.spec.whatwg.org/multipage/parsing.html#reset-the-insertion-mode-appropriately
*/
public function reset_insertion_mode(): void {
private function reset_insertion_mode_appropriately(): void {
// Set the first node.
$first_node = null;
foreach ( $this->state->stack_of_open_elements->walk_down() as $first_node ) {
Expand Down

0 comments on commit 1b48ae6

Please sign in to comment.