HTML API: Make "reset insertion mode appropriately" algorithm private.

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 https://github.com/wordpress/wordpress-develop/pull/7194
Discussed in https://core.trac.wordpress.org/ticket/61549

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

Built from https://develop.svn.wordpress.org/trunk@58898


git-svn-id: http://core.svn.wordpress.org/trunk@58294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell 2024-08-14 21:19:16 +00:00
parent edd34df6ea
commit 5cd8048fc2
2 changed files with 10 additions and 10 deletions

View File

@ -1501,7 +1501,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
$this->state->stack_of_open_elements->pop_until( 'TEMPLATE' ); $this->state->stack_of_open_elements->pop_until( 'TEMPLATE' );
$this->state->active_formatting_elements->clear_up_to_last_marker(); $this->state->active_formatting_elements->clear_up_to_last_marker();
array_pop( $this->state->stack_of_template_insertion_modes ); array_pop( $this->state->stack_of_template_insertion_modes );
$this->reset_insertion_mode(); $this->reset_insertion_mode_appropriately();
return true; return true;
} }
@ -2955,7 +2955,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
} }
$this->state->stack_of_open_elements->pop_until( 'TABLE' ); $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 ); return $this->step( self::REPROCESS_CURRENT_NODE );
/* /*
@ -2968,7 +2968,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
} }
$this->state->stack_of_open_elements->pop_until( 'TABLE' ); $this->state->stack_of_open_elements->pop_until( 'TABLE' );
$this->reset_insertion_mode(); $this->reset_insertion_mode_appropriately();
return true; return true;
/* /*
@ -3729,7 +3729,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
return $this->step(); return $this->step();
} }
$this->state->stack_of_open_elements->pop_until( 'SELECT' ); $this->state->stack_of_open_elements->pop_until( 'SELECT' );
$this->reset_insertion_mode(); $this->reset_insertion_mode_appropriately();
return true; return true;
/* /*
@ -3745,7 +3745,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
return $this->step(); return $this->step();
} }
$this->state->stack_of_open_elements->pop_until( 'SELECT' ); $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 ); return $this->step( self::REPROCESS_CURRENT_NODE );
/* /*
@ -3800,7 +3800,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
case '+TH': case '+TH':
// @todo Indicate a parse error once it's possible. // @todo Indicate a parse error once it's possible.
$this->state->stack_of_open_elements->pop_until( 'SELECT' ); $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 ); return $this->step( self::REPROCESS_CURRENT_NODE );
/* /*
@ -3819,7 +3819,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
return $this->step(); return $this->step();
} }
$this->state->stack_of_open_elements->pop_until( 'SELECT' ); $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 ); return $this->step( self::REPROCESS_CURRENT_NODE );
} }
@ -3954,7 +3954,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
$this->state->stack_of_open_elements->pop_until( 'TEMPLATE' ); $this->state->stack_of_open_elements->pop_until( 'TEMPLATE' );
$this->state->active_formatting_elements->clear_up_to_last_marker(); $this->state->active_formatting_elements->clear_up_to_last_marker();
array_pop( $this->state->stack_of_template_insertion_modes ); 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 ); return $this->step( self::REPROCESS_CURRENT_NODE );
} }
@ -5100,7 +5100,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
* *
* @see https://html.spec.whatwg.org/multipage/parsing.html#reset-the-insertion-mode-appropriately * @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. // Set the first node.
$first_node = null; $first_node = null;
foreach ( $this->state->stack_of_open_elements->walk_down() as $first_node ) { foreach ( $this->state->stack_of_open_elements->walk_down() as $first_node ) {

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.7-alpha-58897'; $wp_version = '6.7-alpha-58898';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.