<!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>[54211] trunk: Editor: Backport block supports (border, color, elements, spacing) from Gutenberg to WP 6.1.</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/54211">54211</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/54211","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>audrasjb</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-09-19 20:12:02 +0000 (Mon, 19 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'>Editor: Backport block supports (border, color, elements, spacing) from Gutenberg to WP 6.1.
This changeset backports `border`, `color`, `elements` and `spacing` block supports changes from Gutenberg to WP 6.1.
See tracking issue on Gutenberg repository: [https://github.com/WordPress/gutenberg/pull/43440 gutenberg<a href="https://core.trac.wordpress.org/ticket/43440">#43440</a>].
Props ramonopoly, glendaviesnz, bernhard-reiter, audrasjb, costdev.
See <a href="https://core.trac.wordpress.org/ticket/56467">#56467</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesblocksupportsborderphp">trunk/src/wp-includes/block-supports/border.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportscolorsphp">trunk/src/wp-includes/block-supports/colors.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportselementsphp">trunk/src/wp-includes/block-supports/elements.php</a></li>
<li><a href="#trunksrcwpincludesblocksupportsspacingphp">trunk/src/wp-includes/block-supports/spacing.php</a></li>
<li><a href="#trunktestsphpunittestsblocksupportsborderphp">trunk/tests/phpunit/tests/block-supports/border.php</a></li>
<li><a href="#trunktestsphpunittestsblocksupportscolorsphp">trunk/tests/phpunit/tests/block-supports/colors.php</a></li>
<li><a href="#trunktestsphpunittestsblocksupportsspacingphp">trunk/tests/phpunit/tests/block-supports/spacing.php</a></li>
<li><a href="#trunktestsphpunittestsblockssupportedStylesphp">trunk/tests/phpunit/tests/blocks/supportedStyles.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesblocksupportsborderphp"></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/block-supports/border.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/border.php 2022-09-19 19:49:47 UTC (rev 54210)
+++ trunk/src/wp-includes/block-supports/border.php 2022-09-19 20:12:02 UTC (rev 54211)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -11,27 +11,24 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * types that support borders.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.8.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.1.0 Improved conditional blocks optimization.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Block_Type $block_type Block Type.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_register_border_support( $block_type ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Determine if any border related features are supported.
- $has_border_support = block_has_support( $block_type, array( '__experimentalBorder' ) );
- $has_border_color_support = wp_has_border_feature_support( $block_type, 'color' );
-
</del><span class="cx" style="display: block; padding: 0 10px"> // Setup attributes and styles within that if needed.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( ! $block_type->attributes ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $block_type->attributes = array();
</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">- if ( $has_border_support && ! array_key_exists( 'style', $block_type->attributes ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( block_has_support( $block_type, array( '__experimentalBorder' ) ) && ! array_key_exists( 'style', $block_type->attributes ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $block_type->attributes['style'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'object',
</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">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $has_border_color_support && ! array_key_exists( 'borderColor', $block_type->attributes ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( wp_has_border_feature_support( $block_type, 'color' ) && ! array_key_exists( 'borderColor', $block_type->attributes ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> $block_type->attributes['borderColor'] = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'type' => 'string',
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -43,6 +40,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * attributes array. This will be applied to the block markup in the front-end.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.8.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.1.0 Implemented the style engine to generate CSS and classnames.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Block_Type $block_type Block type.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -54,8 +52,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return array();
</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">- $classes = array();
- $styles = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $border_block_styles = array();
+ $has_border_color_support = wp_has_border_feature_support( $block_type, 'color' );
+ $has_border_width_support = wp_has_border_feature_support( $block_type, 'width' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Border radius.
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -65,21 +64,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="cx" style="display: block; padding: 0 10px"> $border_radius = $block_attributes['style']['border']['radius'];
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( is_array( $border_radius ) ) {
- // We have individual border radius corner values.
- foreach ( $border_radius as $key => $radius ) {
- // Convert CamelCase corner name to kebab-case.
- $corner = strtolower( preg_replace( '/(?<!^)[A-Z]/', '-$0', $key ) );
- $styles[] = sprintf( 'border-%s-radius: %s;', $corner, $radius );
- }
- } else {
- // This check handles original unitless implementation.
- if ( is_numeric( $border_radius ) ) {
- $border_radius .= 'px';
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( is_numeric( $border_radius ) ) {
+ $border_radius .= 'px';
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $styles[] = sprintf( 'border-radius: %s;', $border_radius );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $border_block_styles['radius'] = $border_radius;
</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"> // Border style.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -88,13 +77,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> isset( $block_attributes['style']['border']['style'] ) &&
</span><span class="cx" style="display: block; padding: 0 10px"> ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'style' )
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $border_style = $block_attributes['style']['border']['style'];
- $styles[] = sprintf( 'border-style: %s;', $border_style );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $border_block_styles['style'] = $block_attributes['style']['border']['style'];
</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"> // Border width.
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_has_border_feature_support( $block_type, 'width' ) &&
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $has_border_width_support &&
</ins><span class="cx" style="display: block; padding: 0 10px"> isset( $block_attributes['style']['border']['width'] ) &&
</span><span class="cx" style="display: block; padding: 0 10px"> ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'width' )
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -105,38 +93,42 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $border_width .= 'px';
</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">- $styles[] = sprintf( 'border-width: %s;', $border_width );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $border_block_styles['width'] = $border_width;
</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"> // Border color.
</span><span class="cx" style="display: block; padding: 0 10px"> if (
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- wp_has_border_feature_support( $block_type, 'color' ) &&
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $has_border_color_support &&
</ins><span class="cx" style="display: block; padding: 0 10px"> ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'color' )
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $has_named_border_color = array_key_exists( 'borderColor', $block_attributes );
- $has_custom_border_color = isset( $block_attributes['style']['border']['color'] );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $preset_border_color = array_key_exists( 'borderColor', $block_attributes ) ? "var:preset|color|{$block_attributes['borderColor']}" : null;
+ $custom_border_color = _wp_array_get( $block_attributes, array( 'style', 'border', 'color' ), null );
+ $border_block_styles['color'] = $preset_border_color ? $preset_border_color : $custom_border_color;
+ }
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $has_named_border_color || $has_custom_border_color ) {
- $classes[] = 'has-border-color';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Generates styles for individual border sides.
+ if ( $has_border_color_support || $has_border_width_support ) {
+ foreach ( array( 'top', 'right', 'bottom', 'left' ) as $side ) {
+ $border = _wp_array_get( $block_attributes, array( 'style', 'border', $side ), null );
+ $border_side_values = array(
+ 'width' => isset( $border['width'] ) && ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'width' ) ? $border['width'] : null,
+ 'color' => isset( $border['color'] ) && ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'color' ) ? $border['color'] : null,
+ 'style' => isset( $border['style'] ) && ! wp_should_skip_block_supports_serialization( $block_type, '__experimentalBorder', 'style' ) ? $border['style'] : null,
+ );
+ $border_block_styles[ $side ] = $border_side_values;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-
- if ( $has_named_border_color ) {
- $classes[] = sprintf( 'has-%s-border-color', $block_attributes['borderColor'] );
- } elseif ( $has_custom_border_color ) {
- $border_color = $block_attributes['style']['border']['color'];
- $styles[] = sprintf( 'border-color: %s;', $border_color );
- }
</del><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"> // Collect classes and styles.
</span><span class="cx" style="display: block; padding: 0 10px"> $attributes = array();
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $styles = wp_style_engine_get_styles( array( 'border' => $border_block_styles ) );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $classes ) ) {
- $attributes['class'] = implode( ' ', $classes );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $styles['classnames'] ) ) {
+ $attributes['class'] = $styles['classnames'];
</ins><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">- if ( ! empty( $styles ) ) {
- $attributes['style'] = implode( ' ', $styles );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! empty( $styles['css'] ) ) {
+ $attributes['style'] = $styles['css'];
</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"> return $attributes;
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportscolorsphp"></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/block-supports/colors.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/colors.php 2022-09-19 19:49:47 UTC (rev 54210)
+++ trunk/src/wp-includes/block-supports/colors.php 2022-09-19 20:12:02 UTC (rev 54211)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -10,15 +10,13 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Registers the style and colors block attributes for block types that support it.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.6.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.1.0 Improved $color_support assignment optimization.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Block_Type $block_type Block Type.
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_register_colors_support( $block_type ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $color_support = false;
- if ( property_exists( $block_type, 'supports' ) ) {
- $color_support = _wp_array_get( $block_type->supports, array( 'color' ), false );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $color_support = property_exists( $block_type, 'supports' ) ? _wp_array_get( $block_type->supports, array( 'color' ), false ) : false;
</ins><span class="cx" style="display: block; padding: 0 10px"> $has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -63,6 +61,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * This will be applied to the block markup in the front-end.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.6.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.1.0 Implemented the style engine to generate CSS and classnames.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Block_Type $block_type Block type.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -83,66 +82,38 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
</span><span class="cx" style="display: block; padding: 0 10px"> $has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $classes = array();
- $styles = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $color_block_styles = array();
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Text colors.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Check support for text colors.
</del><span class="cx" style="display: block; padding: 0 10px"> if ( $has_text_colors_support && ! wp_should_skip_block_supports_serialization( $block_type, 'color', 'text' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $has_named_text_color = array_key_exists( 'textColor', $block_attributes );
- $has_custom_text_color = isset( $block_attributes['style']['color']['text'] );
-
- // Apply required generic class.
- if ( $has_custom_text_color || $has_named_text_color ) {
- $classes[] = 'has-text-color';
- }
- // Apply color class or inline style.
- if ( $has_named_text_color ) {
- $classes[] = sprintf( 'has-%s-color', _wp_to_kebab_case( $block_attributes['textColor'] ) );
- } elseif ( $has_custom_text_color ) {
- $styles[] = sprintf( 'color: %s;', $block_attributes['style']['color']['text'] );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $preset_text_color = array_key_exists( 'textColor', $block_attributes ) ? "var:preset|color|{$block_attributes['textColor']}" : null;
+ $custom_text_color = _wp_array_get( $block_attributes, array( 'style', 'color', 'text' ), null );
+ $color_block_styles['text'] = $preset_text_color ? $preset_text_color : $custom_text_color;
</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"> // Background colors.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $has_background_colors_support && ! wp_should_skip_block_supports_serialization( $block_type, 'color', 'background' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $has_named_background_color = array_key_exists( 'backgroundColor', $block_attributes );
- $has_custom_background_color = isset( $block_attributes['style']['color']['background'] );
-
- // Apply required background class.
- if ( $has_custom_background_color || $has_named_background_color ) {
- $classes[] = 'has-background';
- }
- // Apply background color classes or styles.
- if ( $has_named_background_color ) {
- $classes[] = sprintf( 'has-%s-background-color', _wp_to_kebab_case( $block_attributes['backgroundColor'] ) );
- } elseif ( $has_custom_background_color ) {
- $styles[] = sprintf( 'background-color: %s;', $block_attributes['style']['color']['background'] );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $preset_background_color = array_key_exists( 'backgroundColor', $block_attributes ) ? "var:preset|color|{$block_attributes['backgroundColor']}" : null;
+ $custom_background_color = _wp_array_get( $block_attributes, array( 'style', 'color', 'background' ), null );
+ $color_block_styles['background'] = $preset_background_color ? $preset_background_color : $custom_background_color;
</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"> // Gradients.
</span><span class="cx" style="display: block; padding: 0 10px"> if ( $has_gradients_support && ! wp_should_skip_block_supports_serialization( $block_type, 'color', 'gradients' ) ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $has_named_gradient = array_key_exists( 'gradient', $block_attributes );
- $has_custom_gradient = isset( $block_attributes['style']['color']['gradient'] );
-
- if ( $has_named_gradient || $has_custom_gradient ) {
- $classes[] = 'has-background';
- }
- // Apply required background class.
- if ( $has_named_gradient ) {
- $classes[] = sprintf( 'has-%s-gradient-background', _wp_to_kebab_case( $block_attributes['gradient'] ) );
- } elseif ( $has_custom_gradient ) {
- $styles[] = sprintf( 'background: %s;', $block_attributes['style']['color']['gradient'] );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $preset_gradient_color = array_key_exists( 'gradient', $block_attributes ) ? "var:preset|gradient|{$block_attributes['gradient']}" : null;
+ $custom_gradient_color = _wp_array_get( $block_attributes, array( 'style', 'color', 'gradient' ), null );
+ $color_block_styles['gradient'] = $preset_gradient_color ? $preset_gradient_color : $custom_gradient_color;
</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"> $attributes = array();
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $classes ) ) {
- $attributes['class'] = implode( ' ', $classes );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $styles = wp_style_engine_get_styles( array( 'color' => $color_block_styles ), array( 'convert_vars_to_classnames' => true ) );
+
+ if ( ! empty( $styles['classnames'] ) ) {
+ $attributes['class'] = $styles['classnames'];
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( ! empty( $styles ) ) {
- $attributes['style'] = implode( ' ', $styles );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( ! empty( $styles['css'] ) ) {
+ $attributes['style'] = $styles['css'];
</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"> return $attributes;
</span></span></pre></div>
<a id="trunksrcwpincludesblocksupportselementsphp"></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/block-supports/elements.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/elements.php 2022-09-19 19:49:47 UTC (rev 54210)
+++ trunk/src/wp-includes/block-supports/elements.php 2022-09-19 20:12:02 UTC (rev 54211)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -89,6 +89,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * we want the descendant style to take priority, and this is done by loading it after, in DOM order.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.0.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.1.0 Implemented the style engine to generate CSS and classnames.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param string|null $pre_render The pre-rendered content. Default null.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -97,41 +98,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @return null
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_render_elements_support_styles( $pre_render, $block ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
- $skip_link_color_serialization = wp_should_skip_block_supports_serialization( $block_type, 'color', 'link' );
- if ( $skip_link_color_serialization ) {
- return null;
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $block_type = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
+ $element_block_styles = isset( $block['attrs']['style']['elements'] ) ? $block['attrs']['style']['elements'] : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $link_color = null;
- if ( ! empty( $block['attrs'] ) ) {
- $link_color = _wp_array_get( $block['attrs'], array( 'style', 'elements', 'link', 'color', 'text' ), null );
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> /*
</span><span class="cx" style="display: block; padding: 0 10px"> * For now we only care about link color.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * This code in the future when we have a public API
- * should take advantage of WP_Theme_JSON::compute_style_properties
- * and work for any element and style.
</del><span class="cx" style="display: block; padding: 0 10px"> */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( null === $link_color ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $skip_link_color_serialization = wp_should_skip_block_supports_serialization( $block_type, 'color', 'link' );
+
+ if ( $skip_link_color_serialization ) {
</ins><span class="cx" style="display: block; padding: 0 10px"> return null;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $class_name = wp_get_elements_class_name( $block );
+ $link_block_styles = isset( $element_block_styles['link'] ) ? $element_block_styles['link'] : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $class_name = wp_get_elements_class_name( $block );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ wp_style_engine_get_styles(
+ $link_block_styles,
+ array(
+ 'selector' => ".$class_name a",
+ 'context' => 'block-supports',
+ )
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( strpos( $link_color, 'var:preset|color|' ) !== false ) {
- // Get the name from the string and add proper styles.
- $index_to_splice = strrpos( $link_color, '|' ) + 1;
- $link_color_name = substr( $link_color, $index_to_splice );
- $link_color = "var(--wp--preset--color--$link_color_name)";
- }
- $link_color_declaration = esc_html( safecss_filter_attr( "color: $link_color" ) );
-
- $style = ".$class_name a{" . $link_color_declaration . ';}';
-
- wp_enqueue_block_support_styles( $style );
-
</del><span class="cx" style="display: block; padding: 0 10px"> return null;
</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="trunksrcwpincludesblocksupportsspacingphp"></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/block-supports/spacing.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/spacing.php 2022-09-19 19:49:47 UTC (rev 54210)
+++ trunk/src/wp-includes/block-supports/spacing.php 2022-09-19 20:12:02 UTC (rev 54211)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -37,6 +37,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * This will be applied to the block markup in the front-end.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 5.8.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.1.0 Implemented the style engine to generate CSS and classnames.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @access private
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @param WP_Block_Type $block_type Block Type.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -48,35 +49,27 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return array();
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $attributes = array();
</ins><span class="cx" style="display: block; padding: 0 10px"> $has_padding_support = block_has_support( $block_type, array( 'spacing', 'padding' ), false );
</span><span class="cx" style="display: block; padding: 0 10px"> $has_margin_support = block_has_support( $block_type, array( 'spacing', 'margin' ), false );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $skip_padding = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'padding' );
- $skip_margin = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'margin' );
- $styles = array();
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $block_styles = isset( $block_attributes['style'] ) ? $block_attributes['style'] : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- if ( $has_padding_support && ! $skip_padding ) {
- $padding_value = _wp_array_get( $block_attributes, array( 'style', 'spacing', 'padding' ), null );
- if ( is_array( $padding_value ) ) {
- foreach ( $padding_value as $key => $value ) {
- $styles[] = sprintf( 'padding-%s: %s;', $key, $value );
- }
- } elseif ( null !== $padding_value ) {
- $styles[] = sprintf( 'padding: %s;', $padding_value );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( ! $block_styles ) {
+ return $attributes;
</ins><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">- if ( $has_margin_support && ! $skip_margin ) {
- $margin_value = _wp_array_get( $block_attributes, array( 'style', 'spacing', 'margin' ), null );
- if ( is_array( $margin_value ) ) {
- foreach ( $margin_value as $key => $value ) {
- $styles[] = sprintf( 'margin-%s: %s;', $key, $value );
- }
- } elseif ( null !== $margin_value ) {
- $styles[] = sprintf( 'margin: %s;', $margin_value );
- }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $skip_padding = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'padding' );
+ $skip_margin = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'margin' );
+ $spacing_block_styles = array();
+ $spacing_block_styles['padding'] = $has_padding_support && ! $skip_padding ? _wp_array_get( $block_styles, array( 'spacing', 'padding' ), null ) : null;
+ $spacing_block_styles['margin'] = $has_margin_support && ! $skip_margin ? _wp_array_get( $block_styles, array( 'spacing', 'margin' ), null ) : null;
+ $styles = wp_style_engine_get_styles( array( 'spacing' => $spacing_block_styles ) );
+
+ if ( ! empty( $styles['css'] ) ) {
+ $attributes['style'] = $styles['css'];
</ins><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">- return empty( $styles ) ? array() : array( 'style' => implode( ' ', $styles ) );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return $attributes;
</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"> // Register the block support.
</span></span></pre></div>
<a id="trunktestsphpunittestsblocksupportsborderphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/block-supports/border.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/block-supports/border.php 2022-09-19 19:49:47 UTC (rev 54210)
+++ trunk/tests/phpunit/tests/block-supports/border.php 2022-09-19 20:12:02 UTC (rev 54211)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,7 +64,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $actual = wp_apply_border_support( $block_type, $block_atts );
</span><span class="cx" style="display: block; padding: 0 10px"> $expected = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'class' => 'has-border-color has-red-border-color',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'style' => 'border-radius: 10px; border-style: dashed; border-width: 1px;',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'style' => 'border-radius:10px;border-style:dashed;border-width:1px;',
</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"> $this->assertSame( $expected, $actual );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -154,7 +154,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $actual = wp_apply_border_support( $block_type, $block_atts );
</span><span class="cx" style="display: block; padding: 0 10px"> $expected = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'style' => 'border-style: dotted; border-width: 1px;',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'style' => 'border-style:dotted;border-width:1px;',
</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"> $this->assertSame( $expected, $actual );
</span></span></pre></div>
<a id="trunktestsphpunittestsblocksupportscolorsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/block-supports/colors.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/block-supports/colors.php 2022-09-19 19:49:47 UTC (rev 54210)
+++ trunk/tests/phpunit/tests/block-supports/colors.php 2022-09-19 20:12:02 UTC (rev 54211)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -60,7 +60,7 @@
</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"> $actual = wp_apply_colors_support( $block_type, $block_atts );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $expected = array( 'class' => 'has-text-color has-fg-1-color has-background has-bg-2-background-color has-background has-gr-3-gradient-background' );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $expected = array( 'class' => 'has-text-color has-fg-1-color has-background has-bg-2-background-color has-gr-3-gradient-background' );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assertSame( $expected, $actual );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -143,7 +143,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $actual = wp_apply_colors_support( $block_type, $block_atts );
</span><span class="cx" style="display: block; padding: 0 10px"> $expected = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'class' => 'has-text-color',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'style' => 'color: #d92828;',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'style' => 'color:#d92828;',
</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"> $this->assertSame( $expected, $actual );
</span></span></pre></div>
<a id="trunktestsphpunittestsblocksupportsspacingphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/block-supports/spacing.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/block-supports/spacing.php 2022-09-19 19:49:47 UTC (rev 54210)
+++ trunk/tests/phpunit/tests/block-supports/spacing.php 2022-09-19 20:12:02 UTC (rev 54211)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -63,7 +63,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $actual = wp_apply_spacing_support( $block_type, $block_atts );
</span><span class="cx" style="display: block; padding: 0 10px"> $expected = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'style' => 'padding: 111px; margin-top: 1px; margin-right: 2px; margin-bottom: 3px; margin-left: 4px;',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'style' => 'padding:111px;margin-top:1px;margin-right:2px;margin-bottom:3px;margin-left:4px;',
</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"> $this->assertSame( $expected, $actual );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -159,7 +159,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $actual = wp_apply_spacing_support( $block_type, $block_atts );
</span><span class="cx" style="display: block; padding: 0 10px"> $expected = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'style' => 'padding-top: 1px; padding-right: 2px; padding-bottom: 3px; padding-left: 4px;',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'style' => 'padding-top:1px;padding-right:2px;padding-bottom:3px;padding-left:4px;',
</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"> $this->assertSame( $expected, $actual );
</span></span></pre></div>
<a id="trunktestsphpunittestsblockssupportedStylesphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/blocks/supportedStyles.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/blocks/supportedStyles.php 2022-09-19 19:49:47 UTC (rev 54210)
+++ trunk/tests/phpunit/tests/blocks/supportedStyles.php 2022-09-19 20:12:02 UTC (rev 54211)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -220,7 +220,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'innerHTML' => array(),
</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">- $expected_styles = 'test: style; color: #000; background-color: #fff;';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $expected_styles = 'test: style;color:#000;background-color:#fff;';
</ins><span class="cx" style="display: block; padding: 0 10px"> $expected_classes = 'foo-bar-class wp-block-example has-text-color has-background';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assert_content_and_styles_and_classes_match( $block, $expected_classes, $expected_styles );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -283,7 +283,7 @@
</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"> $expected_classes = 'foo-bar-class wp-block-example has-background';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $expected_styles = 'test: style; background: some-gradient-style;';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $expected_styles = 'test: style; background:some-gradient-style;';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assert_content_and_styles_and_classes_match( $block, $expected_classes, $expected_styles );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -563,7 +563,7 @@
</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"> $expected_classes = 'foo-bar-class wp-block-example has-text-color has-background alignwide';
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- $expected_styles = 'test: style; color: #000; background-color: #fff; font-size: 10px; line-height: 20;';
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $expected_styles = 'test: style; color:#000; background-color:#fff; font-size: 10px; line-height: 20;';
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $this->assert_content_and_styles_and_classes_match( $block, $expected_classes, $expected_styles );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span></span></pre>
</div>
</div>
</body>
</html>