<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[54306] trunk/src: Fix: Revert [54305].</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/54306">54306</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/54306","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>jorgefilipecosta</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-09-26 10:15:17 +0000 (Mon, 26 Sep 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Fix: Revert <a href="https://core.trac.wordpress.org/changeset/54305">[54305]</a>.
This commit caused an incompatibility with the latest released Gutenberg version.
Props bernhard-reiter.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesclasswpthemejsonphp">trunk/src/wp-includes/class-wp-theme-json.php</a></li>
<li><a href="#trunksrcwpsettingsphp">trunk/src/wp-settings.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesblocksupportssettingsphp">trunk/src/wp-includes/block-supports/settings.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesblocksupportssettingsphp"></a>
<div class="delfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Deleted: trunk/src/wp-includes/block-supports/settings.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/settings.php 2022-09-26 09:06:02 UTC (rev 54305)
+++ trunk/src/wp-includes/block-supports/settings.php 2022-09-26 10:15:17 UTC (rev 54306)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,152 +0,0 @@
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-<?php
-/**
- * Block level presets support.
- *
- * @package WordPress
- * @since 6.1.0
- */
-
-/**
- * Get the class name used on block level presets.
- *
- * @access private
- *
- * @param array $block Block object.
- * @return string The unique class name.
- */
-function _wp_get_presets_class_name( $block ) {
- return 'wp-settings-' . md5( serialize( $block ) );
-}
-
-/**
- * Update the block content with block level presets class name.
- *
- * @access private
- *
- * @param string $block_content Rendered block content.
- * @param array $block Block object.
- * @return string Filtered block content.
- */
-function _wp_add_block_level_presets_class( $block_content, $block ) {
- if ( ! $block_content ) {
- return $block_content;
- }
-
- // return early if the block doesn't have support for settings.
- $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
- if ( ! block_has_support( $block_type, array( '__experimentalSettings' ), false ) ) {
- return $block_content;
- }
-
- // return early if no settings are found on the block attributes.
- $block_settings = _wp_array_get( $block, array( 'attrs', 'settings' ), null );
- if ( empty( $block_settings ) ) {
- return $block_content;
- }
-
- $class_name = _wp_get_presets_class_name( $block );
-
- // Like the layout hook this assumes the hook only applies to blocks with a single wrapper.
- // Retrieve the opening tag of the first HTML element.
- $html_element_matches = array();
- preg_match( '/<[^>]+>/', $block_content, $html_element_matches, PREG_OFFSET_CAPTURE );
- $first_element = $html_element_matches[0][0];
- // If the first HTML element has a class attribute just add the new class
- // as we do on layout and duotone.
- if ( strpos( $first_element, 'class="' ) !== false ) {
- $content = preg_replace(
- '/' . preg_quote( 'class="', '/' ) . '/',
- 'class="' . $class_name . ' ',
- $block_content,
- 1
- );
- } else {
- // If the first HTML element has no class attribute we should inject the attribute before the attribute at the end.
- $first_element_offset = $html_element_matches[0][1];
- $content = substr_replace( $block_content, ' class="' . $class_name . '"', $first_element_offset + strlen( $first_element ) - 1, 0 );
- }
-
- return $content;
-}
-
-/**
- * Render the block level presets stylesheet.
- *
- * @access private
- *
- * @param string|null $pre_render The pre-rendered content. Default null.
- * @param array $block The block being rendered.
- *
- * @return null
- */
-function _wp_add_block_level_preset_styles( $pre_render, $block ) {
- // Return early if the block has not support for descendent block styles.
- $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
- if ( ! block_has_support( $block_type, array( '__experimentalSettings' ), false ) ) {
- return null;
- }
-
- // return early if no settings are found on the block attributes.
- $block_settings = _wp_array_get( $block, array( 'attrs', 'settings' ), null );
- if ( empty( $block_settings ) ) {
- return null;
- }
-
- $class_name = '.' . _wp_get_presets_class_name( $block );
-
- // the root selector for preset variables needs to target every possible block selector
- // in order for the general setting to override any bock specific setting of a parent block or
- // the site root.
- $variables_root_selector = '*,[class*="wp-block"]';
- $registry = WP_Block_Type_Registry::get_instance();
- $blocks = $registry->get_all_registered();
- foreach ( $blocks as $block_type ) {
- if (
- isset( $block_type->supports['__experimentalSelector'] ) &&
- is_string( $block_type->supports['__experimentalSelector'] )
- ) {
- $variables_root_selector .= ',' . $block_type->supports['__experimentalSelector'];
- }
- }
- $variables_root_selector = WP_Theme_JSON::scope_selector( $class_name, $variables_root_selector );
-
- // Remove any potentially unsafe styles.
- $theme_json_shape = WP_Theme_JSON::remove_insecure_properties(
- array(
- 'version' => WP_Theme_JSON::LATEST_SCHEMA,
- 'settings' => $block_settings,
- )
- );
- $theme_json_object = new WP_Theme_JSON( $theme_json_shape );
-
- $styles = '';
-
- // include preset css variables declaration on the stylesheet.
- $styles .= $theme_json_object->get_stylesheet(
- array( 'variables' ),
- null,
- array(
- 'root_selector' => $variables_root_selector,
- 'scope' => $class_name,
- )
- );
-
- // include preset css classes on the the stylesheet.
- $styles .= $theme_json_object->get_stylesheet(
- array( 'presets' ),
- null,
- array(
- 'root_selector' => $class_name . ',' . $class_name . ' *',
- 'scope' => $class_name,
- )
- );
-
- if ( ! empty( $styles ) ) {
- wp_enqueue_block_support_styles( $styles );
- }
-
- return null;
-}
-
-add_filter( 'render_block', '_wp_add_block_level_presets_class', 10, 2 );
-add_filter( 'pre_render_block', '_wp_add_block_level_preset_styles', 10, 2 );
</del></span></pre></div>
<a id="trunksrcwpincludesclasswpthemejsonphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-theme-json.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-theme-json.php 2022-09-26 09:06:02 UTC (rev 54305)
+++ trunk/src/wp-includes/class-wp-theme-json.php 2022-09-26 10:15:17 UTC (rev 54306)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -773,7 +773,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> static::$blocks_metadata[ $block_name ]['features'] = $features;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Assign defaults, then override those that the block sets by itself.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Assign defaults, then overwrite those that the block sets by itself.
</ins><span class="cx" style="display: block; padding: 0 10px"> // If the block selector is compounded, will append the element to each
</span><span class="cx" style="display: block; padding: 0 10px"> // individual block selector.
</span><span class="cx" style="display: block; padding: 0 10px"> $block_selectors = explode( ',', static::$blocks_metadata[ $block_name ]['selector'] );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -866,13 +866,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param array $types Types of styles to load. Will load all by default. It accepts:
</span><span class="cx" style="display: block; padding: 0 10px"> * - `variables`: only the CSS Custom Properties for presets & custom ones.
</span><span class="cx" style="display: block; padding: 0 10px"> * - `styles`: only the styles section in theme.json.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * - `presets`: only the classes for the presets. @param array $origins A list of origins to include. By default it includes VALID_ORIGINS.
- * @param array $options An array of options for now used for internal purposes only (may change without notice).
- * The options currently supported are 'scope' that makes sure all style are scoped to a given selector,
- * and root_selector which overwrites and forces a given selector to be used on the root node.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * - `presets`: only the classes for the presets.
+ * @param array $origins A list of origins to include. By default it includes VALID_ORIGINS.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @return string Stylesheet.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public function get_stylesheet( $types = array( 'variables', 'styles', 'presets' ), $origins = null, $options = array() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ public function get_stylesheet( $types = array( 'variables', 'styles', 'presets' ), $origins = null ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> if ( null === $origins ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $origins = static::VALID_ORIGINS;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -893,27 +891,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $style_nodes = static::get_style_nodes( $this->theme_json, $blocks_metadata );
</span><span class="cx" style="display: block; padding: 0 10px"> $setting_nodes = static::get_setting_nodes( $this->theme_json, $blocks_metadata );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $root_style_key = array_search( static::ROOT_BLOCK_SELECTOR, array_column( $style_nodes, 'selector' ), true );
- $root_settings_key = array_search( static::ROOT_BLOCK_SELECTOR, array_column( $setting_nodes, 'selector' ), true );
-
- if ( ! empty( $options['scope'] ) ) {
- foreach ( $setting_nodes as &$node ) {
- $node['selector'] = static::scope_selector( $options['scope'], $node['selector'] );
- }
- foreach ( $style_nodes as &$node ) {
- $node['selector'] = static::scope_selector( $options['scope'], $node['selector'] );
- }
- }
-
- if ( ! empty( $options['root_selector'] ) ) {
- if ( false !== $root_settings_key ) {
- $setting_nodes[ $root_settings_key ]['selector'] = $options['root_selector'];
- }
- if ( false !== $root_style_key ) {
- $setting_nodes[ $root_style_key ]['selector'] = $options['root_selector'];
- }
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> $stylesheet = '';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( 'variables', $types, true ) ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -921,30 +898,23 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( in_array( 'styles', $types, true ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( false !== $root_style_key ) {
- $stylesheet .= $this->get_root_layout_rules( $style_nodes[ $root_style_key ]['selector'], $style_nodes[ $root_style_key ] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $root_block_key = array_search( static::ROOT_BLOCK_SELECTOR, array_column( $style_nodes, 'selector' ), true );
+
+ if ( false !== $root_block_key ) {
+ $stylesheet .= $this->get_root_layout_rules( static::ROOT_BLOCK_SELECTOR, $style_nodes[ $root_block_key ] );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> $stylesheet .= $this->get_block_classes( $style_nodes );
</span><span class="cx" style="display: block; padding: 0 10px"> } elseif ( in_array( 'base-layout-styles', $types, true ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $root_selector = static::ROOT_BLOCK_SELECTOR;
- $columns_selector = '.wp-block-columns';
- if ( ! empty( $options['scope'] ) ) {
- $root_selector = static::scope_selector( $options['scope'], $root_selector );
- $columns_selector = static::scope_selector( $options['scope'], $columns_selector );
- }
- if ( ! empty( $options['root_selector'] ) ) {
- $root_selector = $options['root_selector'];
- }
</del><span class="cx" style="display: block; padding: 0 10px"> // Base layout styles are provided as part of `styles`, so only output separately if explicitly requested.
</span><span class="cx" style="display: block; padding: 0 10px"> // For backwards compatibility, the Columns block is explicitly included, to support a different default gap value.
</span><span class="cx" style="display: block; padding: 0 10px"> $base_styles_nodes = array(
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'path' => array( 'styles' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'selector' => $root_selector,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'selector' => static::ROOT_BLOCK_SELECTOR,
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'path' => array( 'styles', 'blocks', 'core/columns' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'selector' => $columns_selector,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'selector' => '.wp-block-columns',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'name' => 'core/columns',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1395,7 +1365,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string $selector Original selector.
</span><span class="cx" style="display: block; padding: 0 10px"> * @return string Scoped selector.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- public static function scope_selector( $scope, $selector ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ protected static function scope_selector( $scope, $selector ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $scopes = explode( ',', $scope );
</span><span class="cx" style="display: block; padding: 0 10px"> $selectors = explode( ',', $selector );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1402,20 +1372,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $selectors_scoped = array();
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $scopes as $outer ) {
</span><span class="cx" style="display: block; padding: 0 10px"> foreach ( $selectors as $inner ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $outer = trim( $outer );
- $inner = trim( $inner );
- if ( ! empty( $outer ) && ! empty( $inner ) ) {
- $selectors_scoped[] = $outer . ' ' . $inner;
- } elseif ( empty( $outer ) ) {
- $selectors_scoped[] = $inner;
- } elseif ( empty( $inner ) ) {
- $selectors_scoped[] = $outer;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $selectors_scoped[] = trim( $outer ) . ' ' . trim( $inner );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $result = implode( ', ', $selectors_scoped );
- return $result;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return implode( ', ', $selectors_scoped );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpsettingsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-settings.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-settings.php 2022-09-26 09:06:02 UTC (rev 54305)
+++ trunk/src/wp-settings.php 2022-09-26 10:15:17 UTC (rev 54306)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -322,7 +322,6 @@
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/block-patterns.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/class-wp-block-supports.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/block-supports/utils.php';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-require ABSPATH . WPINC . '/block-supports/settings.php';
</del><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/block-supports/align.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/block-supports/border.php';
</span><span class="cx" style="display: block; padding: 0 10px"> require ABSPATH . WPINC . '/block-supports/colors.php';
</span></span></pre>
</div>
</div>
</body>
</html>