Skip to content

Commit

Permalink
Merge branch 'WordPress:trunk' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
brobken authored Aug 15, 2024
2 parents 606a178 + efee925 commit 6317c26
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request-comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
const prBody = pr.body ?? '';
const prTitle = pr.title ?? '';
const tracTicketRegex = new RegExp( 'https?://core.trac.wordpress.org/ticket/([0-9]+)', 'g' );
const tracTicketRegex = new RegExp( '(https?://core.trac.wordpress.org/ticket/|Core-)([0-9]+)', 'g' );
const tracTicketMatches = prBody.match( tracTicketRegex ) || prTitle.match( tracTicketRegex );
if ( ! tracTicketMatches ) {
Expand Down
127 changes: 127 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# Aliases names and emails inside of commits.
# See https://git-scm.com/docs/gitmailmap
#
# Some entries appear as duplicates, but are both required to correct
# identities with just the wrong name as well as those with the wrong
# name and also the wrong email address.

# Accounts with a display name.
Aaron D. Campbell <[email protected]> <aaroncampbell@602fd350-edb4-49c9-b593-d223f7449a82>
Aaron Jorbin <[email protected]> <jorbin@602fd350-edb4-49c9-b593-d223f7449a82>
Adam Silverstein <[email protected]> <adamsilverstein@602fd350-edb4-49c9-b593-d223f7449a82>
Alex King <[email protected]> <alexkingorg@602fd350-edb4-49c9-b593-d223f7449a82>
Alex Shiels <[email protected]> <tellyworth@602fd350-edb4-49c9-b593-d223f7449a82>
André <[email protected]>
André <[email protected]> <oandregal@602fd350-edb4-49c9-b593-d223f7449a82>
Andrea Fercia <[email protected]> <afercia@602fd350-edb4-49c9-b593-d223f7449a82>
Andrew Duthie <[email protected]> <aduth@602fd350-edb4-49c9-b593-d223f7449a82>
Andrew Nacin <[email protected]> <nacin@602fd350-edb4-49c9-b593-d223f7449a82>
Andrew Ozz <[email protected]> <azaozz@602fd350-edb4-49c9-b593-d223f7449a82>
Anthony Burchell <[email protected]> <antpb@602fd350-edb4-49c9-b593-d223f7449a82>
Anton Timmermans <[email protected]> <atimmer@602fd350-edb4-49c9-b593-d223f7449a82>
Bernie Reiter <[email protected]>
Bernie Reiter <[email protected]> <bernhard-reiter@602fd350-edb4-49c9-b593-d223f7449a82>
Boone Gorges <[email protected]> <boonebgorges@602fd350-edb4-49c9-b593-d223f7449a82>
Carlos Bravo <[email protected]> <cbravobernal@602fd350-edb4-49c9-b593-d223f7449a82>
Colin Stewart <[email protected]> <costdev@602fd350-edb4-49c9-b593-d223f7449a82>
Daniel Bachhuber <[email protected]> <danielbachhuber@602fd350-edb4-49c9-b593-d223f7449a82>
Daniel Richards <[email protected]> <talldanwp@602fd350-edb4-49c9-b593-d223f7449a82>
Daryl Koopersmith <[email protected]> <koop@602fd350-edb4-49c9-b593-d223f7449a82>
David A. Kennedy <[email protected]> <davidakennedy@602fd350-edb4-49c9-b593-d223f7449a82>
David Baumwald <[email protected]> <davidbaumwald@602fd350-edb4-49c9-b593-d223f7449a82>
Dennis Snell <[email protected]> <dmsnell@602fd350-edb4-49c9-b593-d223f7449a82>
Dion Hulse <[email protected]> <dd32@602fd350-edb4-49c9-b593-d223f7449a82>
Dominik Schilling <[email protected]>
Dominik Schilling <[email protected]> <ocean90@602fd350-edb4-49c9-b593-d223f7449a82>
Donncha O Caoimh <[email protected]> <donncha@602fd350-edb4-49c9-b593-d223f7449a82>
Dougal Campbell <[email protected]> <dougal@602fd350-edb4-49c9-b593-d223f7449a82>
Drew Jaynes <[email protected]>
Drew Jaynes <[email protected]> <drewapicture@602fd350-edb4-49c9-b593-d223f7449a82>
Drew Jaynes <[email protected]> <DrewAPicture@602fd350-edb4-49c9-b593-d223f7449a82>
Ella <[email protected]>
Ella <[email protected]> <ellatrix@602fd350-edb4-49c9-b593-d223f7449a82>
Ella <[email protected]> <iseulde@602fd350-edb4-49c9-b593-d223f7449a82>
Ella <[email protected]> <[email protected]>
Eric Andrew Lewis <[email protected]> <ericlewis@602fd350-edb4-49c9-b593-d223f7449a82>
Felix Arntz <[email protected]> <flixos90@602fd350-edb4-49c9-b593-d223f7449a82>
Gary Pendergast <[email protected]> <pento@602fd350-edb4-49c9-b593-d223f7449a82>
Greg Ziółkowski <[email protected]>
Greg Ziółkowski <[email protected]> <gziolo@602fd350-edb4-49c9-b593-d223f7449a82>
Helen Hou-Sandi <[email protected]> <helen@602fd350-edb4-49c9-b593-d223f7449a82>
Ian Belanger <[email protected]> <ianbelanger@602fd350-edb4-49c9-b593-d223f7449a82>
Ian Dunn <[email protected]> <iandunn@602fd350-edb4-49c9-b593-d223f7449a82>
Ian Stewart <[email protected]> <iandstewart@602fd350-edb4-49c9-b593-d223f7449a82>
Isabel Brison <[email protected]> <isabel_brison@602fd350-edb4-49c9-b593-d223f7449a82>
Jake Spurlock <[email protected]> <whyisjake@602fd350-edb4-49c9-b593-d223f7449a82>
James Nylen <[email protected]> <jnylen0@602fd350-edb4-49c9-b593-d223f7449a82>
Jb Audras <[email protected]> <audrasjb@602fd350-edb4-49c9-b593-d223f7449a82>
Jeff Ong <[email protected]> <jffng@602fd350-edb4-49c9-b593-d223f7449a82>
Jeremy Felt <[email protected]> <jeremyfelt@602fd350-edb4-49c9-b593-d223f7449a82>
Joe Dolson <[email protected]> <joedolson@602fd350-edb4-49c9-b593-d223f7449a82>
Joe Hoyle <[email protected]> <joehoyle@602fd350-edb4-49c9-b593-d223f7449a82>
Joe McGill <[email protected]> <joemcgill@602fd350-edb4-49c9-b593-d223f7449a82>
John Blackbourn <[email protected]> <johnbillion@602fd350-edb4-49c9-b593-d223f7449a82>
John James Jacoby <[email protected]> <johnjamesjacoby@602fd350-edb4-49c9-b593-d223f7449a82>
Jon Cave <[email protected]> <duck_@602fd350-edb4-49c9-b593-d223f7449a82>
Jonathan Desrosiers <[email protected]> <desrosj@602fd350-edb4-49c9-b593-d223f7449a82>
Jonny Harris <[email protected]> <spacedmonkey@602fd350-edb4-49c9-b593-d223f7449a82>
Jorge Costa <[email protected]> <jorgefilipecosta@602fd350-edb4-49c9-b593-d223f7449a82>
Joseph Scott <[email protected]> <josephscott@602fd350-edb4-49c9-b593-d223f7449a82>
Juliette Reinders Folmer <[email protected]>
Juliette Reinders Folmer <[email protected]> <jrf@602fd350-edb4-49c9-b593-d223f7449a82>
K. Adam White <[email protected]> <kadamwhite@602fd350-edb4-49c9-b593-d223f7449a82>
Kelly Choyce-Dwan <[email protected]>
Kelly Choyce-Dwan <[email protected]> <ryelle@602fd350-edb4-49c9-b593-d223f7449a82>
Kira Schroder <[email protected]> <mikeschroder@602fd350-edb4-49c9-b593-d223f7449a82>
Kira Schroder <[email protected]> <[email protected]>
Konstantin Kovshenin <[email protected]> <kovshenin@602fd350-edb4-49c9-b593-d223f7449a82>
Konstantin Obenland <[email protected]>
Konstantin Obenland <[email protected]> <obenland@602fd350-edb4-49c9-b593-d223f7449a82>
Lance Willett <[email protected]> <lancewillett@602fd350-edb4-49c9-b593-d223f7449a82>
Marius L. J <[email protected]> <clorith@602fd350-edb4-49c9-b593-d223f7449a82>
Mark Jaquith <[email protected]> <markjaquith@602fd350-edb4-49c9-b593-d223f7449a82>
Matias Ventura <[email protected]> <matveb@602fd350-edb4-49c9-b593-d223f7449a82>
Matt Mullenweg <[email protected]> <matt@602fd350-edb4-49c9-b593-d223f7449a82>
Matt Thomas <[email protected]> <iammattthomas@602fd350-edb4-49c9-b593-d223f7449a82>
Mel Choyce <[email protected]> <melchoyce@602fd350-edb4-49c9-b593-d223f7449a82>
Michael Adams <[email protected]>
Michael Adams <[email protected]> <mdawaffe@602fd350-edb4-49c9-b593-d223f7449a82>
Michael Arestad <[email protected]> <michael-arestad@602fd350-edb4-49c9-b593-d223f7449a82>
Michal Czaplinski <[email protected]> <czapla@602fd350-edb4-49c9-b593-d223f7449a82>
Miguel Fonseca <[email protected]> <mcsf@602fd350-edb4-49c9-b593-d223f7449a82>
Mike Little <[email protected]> <mikelittle@602fd350-edb4-49c9-b593-d223f7449a82>
Nikolay Bachiyski <[email protected]> <nbachiyski@602fd350-edb4-49c9-b593-d223f7449a82>
Omar Reiss <[email protected]> <omarreiss@602fd350-edb4-49c9-b593-d223f7449a82>
Pascal Birchler <[email protected]> <swissspidy@602fd350-edb4-49c9-b593-d223f7449a82>
Pete Mall <[email protected]> <petemall@602fd350-edb4-49c9-b593-d223f7449a82>
Peter Westwood <[email protected]> <westi@602fd350-edb4-49c9-b593-d223f7449a82>
Peter Wilson <[email protected]> <peterwilsoncc@602fd350-edb4-49c9-b593-d223f7449a82>
Rachel Baker <[email protected]> <rachelbaker@602fd350-edb4-49c9-b593-d223f7449a82>
Riad Benguella <[email protected]> <youknowriad@602fd350-edb4-49c9-b593-d223f7449a82>
Robert Anderson <[email protected]> <noisysocks@602fd350-edb4-49c9-b593-d223f7449a82>
Ron Rennick <[email protected]> <wpmuguru@602fd350-edb4-49c9-b593-d223f7449a82>
Ryan Boren <[email protected]> <ryan@602fd350-edb4-49c9-b593-d223f7449a82>
Ryan McCue <[email protected]> <rmccue@602fd350-edb4-49c9-b593-d223f7449a82>
Scott Taylor <[email protected]> <wonderboymusic@602fd350-edb4-49c9-b593-d223f7449a82>
Sergey Biryukov <[email protected]> <sergeybiryukov@602fd350-edb4-49c9-b593-d223f7449a82>
Sergey Biryukov <[email protected]> <SergeyBiryukov@602fd350-edb4-49c9-b593-d223f7449a82>
Tammie Lister <[email protected]>
Tammie Lister <[email protected]> <karmatosed@602fd350-edb4-49c9-b593-d223f7449a82>
Timothy Jacobs <[email protected]> <timothyblynjacobs@602fd350-edb4-49c9-b593-d223f7449a82>
Timothy Jacobs <[email protected]> <TimothyBlynJacobs@602fd350-edb4-49c9-b593-d223f7449a82>
Tonya Mork <[email protected]> <hellofromTonya@602fd350-edb4-49c9-b593-d223f7449a82>
Tonya Mork <[email protected]> <[email protected]>
Weston Ruter <[email protected]> <westonruter@602fd350-edb4-49c9-b593-d223f7449a82>

# Accounts without a corresponding display name.
allancole <[email protected]> <allancole@602fd350-edb4-49c9-b593-d223f7449a82>
bumpbot <[email protected]> <bumpbot@602fd350-edb4-49c9-b593-d223f7449a82>
jverber <[email protected]> <jverber@602fd350-edb4-49c9-b593-d223f7449a82>
laurelfulford <[email protected]> <laurelfulford@602fd350-edb4-49c9-b593-d223f7449a82>
luisherranz <[email protected]> <luisherranz@602fd350-edb4-49c9-b593-d223f7449a82>
michelvaldrighi <[email protected]> <michelvaldrighi@602fd350-edb4-49c9-b593-d223f7449a82>
potbot <[email protected]> <potbot@602fd350-edb4-49c9-b593-d223f7449a82>
ramonopoly <[email protected]> <ramonopoly@602fd350-edb4-49c9-b593-d223f7449a82>
rob1n <[email protected]> <rob1n@602fd350-edb4-49c9-b593-d223f7449a82>
scribu <[email protected]> <scribu@602fd350-edb4-49c9-b593-d223f7449a82>
zieladam <[email protected]> <zieladam@602fd350-edb4-49c9-b593-d223f7449a82>
5 changes: 5 additions & 0 deletions src/wp-admin/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,11 @@ body #dashboard-widgets .postbox form .submit {
font-weight: 400;
}

#network_dashboard_right_now p input {
margin: 2px 1px;
vertical-align: middle;
}

/* Dashboard right now - Colors */

#dashboard_right_now .sub {
Expand Down
27 changes: 24 additions & 3 deletions src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -1448,9 +1448,16 @@ public function get_stylesheet( $types = array( 'variables', 'styles', 'presets'
protected function process_blocks_custom_css( $css, $selector ) {
$processed_css = '';

if ( empty( $css ) ) {
return $processed_css;
}

// Split CSS nested rules.
$parts = explode( '&', $css );
foreach ( $parts as $part ) {
if ( empty( $part ) ) {
continue;
}
$is_root_css = ( ! str_contains( $part, '{' ) );
if ( $is_root_css ) {
// If the part doesn't contain braces, it applies to the root level.
Expand All @@ -1463,11 +1470,25 @@ protected function process_blocks_custom_css( $css, $selector ) {
}
$nested_selector = $part[0];
$css_value = $part[1];
$part_selector = str_starts_with( $nested_selector, ' ' )

/*
* Handle pseudo elements such as ::before, ::after etc. Regex will also
* capture any leading combinator such as >, +, or ~, as well as spaces.
* This allows pseudo elements as descendants e.g. `.parent ::before`.
*/
$matches = array();
$has_pseudo_element = preg_match( '/([>+~\s]*::[a-zA-Z-]+)/', $nested_selector, $matches );
$pseudo_part = $has_pseudo_element ? $matches[1] : '';
$nested_selector = $has_pseudo_element ? str_replace( $pseudo_part, '', $nested_selector ) : $nested_selector;

// Finalize selector and re-append pseudo element if required.
$part_selector = str_starts_with( $nested_selector, ' ' )
? static::scope_selector( $selector, $nested_selector )
: static::append_to_selector( $selector, $nested_selector );
$final_selector = ":root :where($part_selector)";
$processed_css .= $final_selector . '{' . trim( $css_value ) . '}';}
$final_selector = ":root :where($part_selector)$pseudo_part";

$processed_css .= $final_selector . '{' . trim( $css_value ) . '}';
}
}
return $processed_css;
}
Expand Down
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
2 changes: 1 addition & 1 deletion src/wp-includes/html-api/class-wp-html-tag-processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -3667,7 +3667,7 @@ public function set_attribute( $name, $value ): bool {
*
* @see https://html.spec.whatwg.org/#attributes-3
*/
$escaped_new_value = in_array( $comparable_name, wp_kses_uri_attributes() ) ? esc_url( $value ) : esc_attr( $value );
$escaped_new_value = in_array( $comparable_name, wp_kses_uri_attributes(), true ) ? esc_url( $value ) : esc_attr( $value );

// If the escaping functions wiped out the update, reject it and indicate it was rejected.
if ( '' === $escaped_new_value && '' !== $value ) {
Expand Down
19 changes: 17 additions & 2 deletions tests/phpunit/tests/theme/wpThemeJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -5243,6 +5243,7 @@ public function data_custom_css_for_user_caps() {

/**
* @ticket 61165
* @ticket 61769
*
* @dataProvider data_process_blocks_custom_css
*
Expand Down Expand Up @@ -5270,6 +5271,13 @@ public function test_process_blocks_custom_css( $input, $expected ) {
public function data_process_blocks_custom_css() {
return array(
// Simple CSS without any nested selectors.
'empty css' => array(
'input' => array(
'selector' => '.foo',
'css' => '',
),
'expected' => '',
),
'no nested selectors' => array(
'input' => array(
'selector' => '.foo',
Expand All @@ -5285,21 +5293,28 @@ public function data_process_blocks_custom_css() {
),
'expected' => ':root :where(.foo){color: red; margin: auto;}:root :where(.foo.one){color: blue;}:root :where(.foo .two){color: green;}',
),
'no root styles' => array(
'input' => array(
'selector' => '.foo',
'css' => '&::before{color: red;}',
),
'expected' => ':root :where(.foo)::before{color: red;}',
),
// CSS with pseudo elements.
'with pseudo elements' => array(
'input' => array(
'selector' => '.foo',
'css' => 'color: red; margin: auto; &::before{color: blue;} & ::before{color: green;} &.one::before{color: yellow;} & .two::before{color: purple;}',
),
'expected' => ':root :where(.foo){color: red; margin: auto;}:root :where(.foo::before){color: blue;}:root :where(.foo ::before){color: green;}:root :where(.foo.one::before){color: yellow;}:root :where(.foo .two::before){color: purple;}',
'expected' => ':root :where(.foo){color: red; margin: auto;}:root :where(.foo)::before{color: blue;}:root :where(.foo) ::before{color: green;}:root :where(.foo.one)::before{color: yellow;}:root :where(.foo .two)::before{color: purple;}',
),
// CSS with multiple root selectors.
'with multiple root selectors' => array(
'input' => array(
'selector' => '.foo, .bar',
'css' => 'color: red; margin: auto; &.one{color: blue;} & .two{color: green;} &::before{color: yellow;} & ::before{color: purple;} &.three::before{color: orange;} & .four::before{color: skyblue;}',
),
'expected' => ':root :where(.foo, .bar){color: red; margin: auto;}:root :where(.foo.one, .bar.one){color: blue;}:root :where(.foo .two, .bar .two){color: green;}:root :where(.foo::before, .bar::before){color: yellow;}:root :where(.foo ::before, .bar ::before){color: purple;}:root :where(.foo.three::before, .bar.three::before){color: orange;}:root :where(.foo .four::before, .bar .four::before){color: skyblue;}',
'expected' => ':root :where(.foo, .bar){color: red; margin: auto;}:root :where(.foo.one, .bar.one){color: blue;}:root :where(.foo .two, .bar .two){color: green;}:root :where(.foo, .bar)::before{color: yellow;}:root :where(.foo, .bar) ::before{color: purple;}:root :where(.foo.three, .bar.three)::before{color: orange;}:root :where(.foo .four, .bar .four)::before{color: skyblue;}',
),
);
}
Expand Down

0 comments on commit 6317c26

Please sign in to comment.