From 1b48ae62d9eb3743f6ecfbfdc0cc81b9d835c394 Mon Sep 17 00:00:00 2001 From: Dennis Snell Date: Wed, 14 Aug 2024 21:17:22 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@58898 602fd350-edb4-49c9-b593-d223f7449a82 --- .../html-api/class-wp-html-processor.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/wp-includes/html-api/class-wp-html-processor.php b/src/wp-includes/html-api/class-wp-html-processor.php index 6f5da5477f922..9f3249db74f78 100644 --- a/src/wp-includes/html-api/class-wp-html-processor.php +++ b/src/wp-includes/html-api/class-wp-html-processor.php @@ -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; } @@ -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 ); /* @@ -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; /* @@ -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; /* @@ -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 ); /* @@ -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 ); /* @@ -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 ); } @@ -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 ); } @@ -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 ) {