<!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>[57254] trunk: Editor: add size and repeat to background image support.</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/57254">57254</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/57254","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>isabel_brison</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2024-01-09 06:10:09 +0000 (Tue, 09 Jan 2024)</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: add size and repeat to background image support.
Adds background size and background repeat style processing to the background image block support and `WP_Style_Engine` definitions.
Props andrewserong, mukesh27.
Fixes <a href="https://core.trac.wordpress.org/ticket/60175">#60175</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpincludesblocksupportsbackgroundphp">trunk/src/wp-includes/block-supports/background.php</a></li>
<li><a href="#trunksrcwpincludesclasswpthemejsonphp">trunk/src/wp-includes/class-wp-theme-json.php</a></li>
<li><a href="#trunksrcwpincludesstyleengineclasswpstyleenginephp">trunk/src/wp-includes/style-engine/class-wp-style-engine.php</a></li>
<li><a href="#trunktestsphpunittestsblocksupportswpRenderBackgroundSupportphp">trunk/tests/phpunit/tests/block-supports/wpRenderBackgroundSupport.php</a></li>
<li><a href="#trunktestsphpunittestsstyleenginestyleEnginephp">trunk/tests/phpunit/tests/style-engine/styleEngine.php</a></li>
<li><a href="#trunktestsphpunitteststhemewpThemeJsonphp">trunk/tests/phpunit/tests/theme/wpThemeJson.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpincludesblocksupportsbackgroundphp"></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/background.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/block-supports/background.php 2024-01-09 02:43:48 UTC (rev 57253)
+++ trunk/src/wp-includes/block-supports/background.php 2024-01-09 06:10:09 UTC (rev 57254)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -40,6 +40,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * it is also applied to non-server-rendered blocks.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.4.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.5.0 Added support for `backgroundPosition` and `backgroundRepeat` output.
</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 $block_content Rendered block content.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -64,9 +65,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $background_image_url = isset( $block_attributes['style']['background']['backgroundImage']['url'] )
</span><span class="cx" style="display: block; padding: 0 10px"> ? $block_attributes['style']['background']['backgroundImage']['url']
</span><span class="cx" style="display: block; padding: 0 10px"> : null;
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+
+ if ( ! $background_image_source && ! $background_image_url ) {
+ return $block_content;
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $background_size = isset( $block_attributes['style']['background']['backgroundSize'] )
</span><span class="cx" style="display: block; padding: 0 10px"> ? $block_attributes['style']['background']['backgroundSize']
</span><span class="cx" style="display: block; padding: 0 10px"> : 'cover';
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $background_position = isset( $block_attributes['style']['background']['backgroundPosition'] )
+ ? $block_attributes['style']['background']['backgroundPosition']
+ : null;
+ $background_repeat = isset( $block_attributes['style']['background']['backgroundRepeat'] )
+ ? $block_attributes['style']['background']['backgroundRepeat']
+ : null;
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $background_block_styles = array();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -76,8 +88,15 @@
</span><span class="cx" style="display: block; padding: 0 10px"> ) {
</span><span class="cx" style="display: block; padding: 0 10px"> // Set file based background URL.
</span><span class="cx" style="display: block; padding: 0 10px"> $background_block_styles['backgroundImage']['url'] = $background_image_url;
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Only output the background size when an image url is set.
- $background_block_styles['backgroundSize'] = $background_size;
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Only output the background size and repeat when an image url is set.
+ $background_block_styles['backgroundSize'] = $background_size;
+ $background_block_styles['backgroundRepeat'] = $background_repeat;
+ $background_block_styles['backgroundPosition'] = $background_position;
+
+ // If the background size is set to `contain` and no position is set, set the position to `center`.
+ if ( 'contain' === $background_size && ! isset( $background_position ) ) {
+ $background_block_styles['backgroundPosition'] = 'center';
+ }
</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"> $styles = wp_style_engine_get_styles( array( 'background' => $background_block_styles ) );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -99,6 +118,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> $updated_style .= $styles['css'];
</span><span class="cx" style="display: block; padding: 0 10px"> $tags->set_attribute( 'style', $updated_style );
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $tags->add_class( 'has-background' );
</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 $tags->get_updated_html();
</span></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 2024-01-09 02:43:48 UTC (rev 57253)
+++ trunk/src/wp-includes/class-wp-theme-json.php 2024-01-09 06:10:09 UTC (rev 57254)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -344,7 +344,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.3.0 Added support for `typography.textColumns`, removed `layout.definitions`.
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.4.0 Added support for `layout.allowEditing`, `background.backgroundImage`,
</span><span class="cx" style="display: block; padding: 0 10px"> * `typography.writingMode`, `lightbox.enabled` and `lightbox.allowEditing`.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 6.5.0 Added support for `layout.allowCustomContentAndWideSize`.
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.5.0 Added support for `layout.allowCustomContentAndWideSize` and
+ * `background.backgroundSize`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @var array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> const VALID_SETTINGS = array(
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -352,6 +353,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'useRootPaddingAwareAlignments' => null,
</span><span class="cx" style="display: block; padding: 0 10px"> 'background' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'backgroundImage' => null,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'backgroundSize' => null,
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'border' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'color' => null,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -573,10 +575,12 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.0.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.2.0 Added `dimensions.minHeight` and `position.sticky`.
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.4.0 Added `background.backgroundImage`.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.5.0 Added `background.backgroundSize`.
</ins><span class="cx" style="display: block; padding: 0 10px"> * @var array
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> const APPEARANCE_TOOLS_OPT_INS = array(
</span><span class="cx" style="display: block; padding: 0 10px"> array( 'background', 'backgroundImage' ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ array( 'background', 'backgroundSize' ),
</ins><span class="cx" style="display: block; padding: 0 10px"> array( 'border', 'color' ),
</span><span class="cx" style="display: block; padding: 0 10px"> array( 'border', 'radius' ),
</span><span class="cx" style="display: block; padding: 0 10px"> array( 'border', 'style' ),
</span></span></pre></div>
<a id="trunksrcwpincludesstyleengineclasswpstyleenginephp"></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/style-engine/class-wp-style-engine.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/style-engine/class-wp-style-engine.php 2024-01-09 02:43:48 UTC (rev 57253)
+++ trunk/src/wp-includes/style-engine/class-wp-style-engine.php 2024-01-09 06:10:09 UTC (rev 57254)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -23,6 +23,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.1.0
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.3.0 Added support for text-columns.
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 6.4.0 Added support for background.backgroundImage.
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 6.5.0 Added support for background.backgroundPosition and background.backgroundRepeat.
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> #[AllowDynamicProperties]
</span><span class="cx" style="display: block; padding: 0 10px"> final class WP_Style_Engine {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -48,7 +49,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px"> const BLOCK_STYLE_DEFINITIONS_METADATA = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'background' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'backgroundImage' => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'backgroundImage' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'property_keys' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'default' => 'background-image',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -55,8 +56,20 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'value_func' => array( self::class, 'get_url_or_value_css_declaration' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'path' => array( 'background', 'backgroundImage' ),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'backgroundSize' => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'backgroundPosition' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'property_keys' => array(
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'default' => 'background-position',
+ ),
+ 'path' => array( 'background', 'backgroundPosition' ),
+ ),
+ 'backgroundRepeat' => array(
+ 'property_keys' => array(
+ 'default' => 'background-repeat',
+ ),
+ 'path' => array( 'background', 'backgroundRepeat' ),
+ ),
+ 'backgroundSize' => array(
+ 'property_keys' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'default' => 'background-size',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'path' => array( 'background', 'backgroundSize' ),
</span></span></pre></div>
<a id="trunktestsphpunittestsblocksupportswpRenderBackgroundSupportphp"></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/wpRenderBackgroundSupport.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/block-supports/wpRenderBackgroundSupport.php 2024-01-09 02:43:48 UTC (rev 57253)
+++ trunk/tests/phpunit/tests/block-supports/wpRenderBackgroundSupport.php 2024-01-09 06:10:09 UTC (rev 57254)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -67,6 +67,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Tests that background image block support works as expected.
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 59357
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @ticket 60175
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @covers ::wp_render_background_support
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -135,9 +136,26 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'source' => 'file',
</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_wrapper' => '<div style="background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div>',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'expected_wrapper' => '<div class="has-background" style="background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div>',
</ins><span class="cx" style="display: block; padding: 0 10px"> 'wrapper' => '<div>Content</div>',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'background image style with contain, position, and repeat is applied' => array(
+ 'theme_name' => 'block-theme-child-with-fluid-typography',
+ 'block_name' => 'test/background-rules-are-output',
+ 'background_settings' => array(
+ 'backgroundImage' => true,
+ ),
+ 'background_style' => array(
+ 'backgroundImage' => array(
+ 'url' => 'https://example.com/image.jpg',
+ 'source' => 'file',
+ ),
+ 'backgroundRepeat' => 'no-repeat',
+ 'backgroundSize' => 'contain',
+ ),
+ 'expected_wrapper' => '<div class="has-background" style="background-image:url('https://example.com/image.jpg');background-position:center;background-repeat:no-repeat;background-size:contain;">Content</div>',
+ 'wrapper' => '<div>Content</div>',
+ ),
</ins><span class="cx" style="display: block; padding: 0 10px"> 'background image style is appended if a style attribute already exists' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'theme_name' => 'block-theme-child-with-fluid-typography',
</span><span class="cx" style="display: block; padding: 0 10px"> 'block_name' => 'test/background-rules-are-output',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -150,8 +168,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'source' => 'file',
</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_wrapper' => '<div classname="wp-block-test" style="color: red;background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div>',
- 'wrapper' => '<div classname="wp-block-test" style="color: red">Content</div>',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'expected_wrapper' => '<div class="wp-block-test has-background" style="color: red;background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div>',
+ 'wrapper' => '<div class="wp-block-test" style="color: red">Content</div>',
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'background image style is appended if a style attribute containing multiple styles already exists' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'theme_name' => 'block-theme-child-with-fluid-typography',
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -165,8 +183,8 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'source' => 'file',
</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_wrapper' => '<div classname="wp-block-test" style="color: red;font-size: 15px;background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div>',
- 'wrapper' => '<div classname="wp-block-test" style="color: red;font-size: 15px;">Content</div>',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'expected_wrapper' => '<div class="wp-block-test has-background" style="color: red;font-size: 15px;background-image:url('https://example.com/image.jpg');background-size:cover;">Content</div>',
+ 'wrapper' => '<div class="wp-block-test" style="color: red;font-size: 15px;">Content</div>',
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'background image style is not applied if the block does not support background image' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'theme_name' => 'block-theme-child-with-fluid-typography',
</span></span></pre></div>
<a id="trunktestsphpunittestsstyleenginestyleEnginephp"></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/style-engine/styleEngine.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/style-engine/styleEngine.php 2024-01-09 02:43:48 UTC (rev 57253)
+++ trunk/tests/phpunit/tests/style-engine/styleEngine.php 2024-01-09 06:10:09 UTC (rev 57254)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -27,6 +27,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 56467
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 58549
</span><span class="cx" style="display: block; padding: 0 10px"> * @ticket 58590
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @ticket 60175
</ins><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @covers ::wp_style_engine_get_styles
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -520,18 +521,22 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'inline_background_image_url_with_background_size' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'block_styles' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'background' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'backgroundImage' => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'backgroundImage' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'url' => 'https://example.com/image.jpg',
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'backgroundSize' => 'cover',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'backgroundPosition' => 'center',
+ 'backgroundRepeat' => 'no-repeat',
+ 'backgroundSize' => 'cover',
</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"> 'options' => array(),
</span><span class="cx" style="display: block; padding: 0 10px"> 'expected_output' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'css' => "background-image:url('https://example.com/image.jpg');background-size:cover;",
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'css' => "background-image:url('https://example.com/image.jpg');background-position:center;background-repeat:no-repeat;background-size:cover;",
</ins><span class="cx" style="display: block; padding: 0 10px"> 'declarations' => array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'background-image' => "url('https://example.com/image.jpg')",
- 'background-size' => 'cover',
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'background-image' => "url('https://example.com/image.jpg')",
+ 'background-position' => 'center',
+ 'background-repeat' => 'no-repeat',
+ 'background-size' => 'cover',
</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="trunktestsphpunitteststhemewpThemeJsonphp"></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/theme/wpThemeJson.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/theme/wpThemeJson.php 2024-01-09 02:43:48 UTC (rev 57253)
+++ trunk/tests/phpunit/tests/theme/wpThemeJson.php 2024-01-09 06:10:09 UTC (rev 57254)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -264,6 +264,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> $expected = array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'background' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'backgroundImage' => true,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'backgroundSize' => true,
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'border' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'width' => true,
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -300,6 +301,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'core/group' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'background' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'backgroundImage' => true,
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'backgroundSize' => true,
</ins><span class="cx" style="display: block; padding: 0 10px"> ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'border' => array(
</span><span class="cx" style="display: block; padding: 0 10px"> 'width' => true,
</span></span></pre>
</div>
</div>
</body>
</html>