Changeset 61620
- Timestamp:
- 02/12/2026 05:43:12 AM (7 weeks ago)
- Location:
- trunk
- Files:
-
- 5 edited
-
src/wp-includes/block-supports/dimensions.php (modified) (1 diff)
-
src/wp-includes/class-wp-theme-json.php (modified) (8 diffs)
-
src/wp-includes/style-engine/class-wp-style-engine.php (modified) (1 diff)
-
tests/phpunit/tests/block-supports/wpApplyDimensionsSupport.php (modified) (1 diff)
-
tests/phpunit/tests/theme/wpThemeJson.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-supports/dimensions.php
r61619 r61620 65 65 66 66 $dimensions_block_styles = array(); 67 $supported_features = array( 'minHeight', ' width' );67 $supported_features = array( 'minHeight', 'height', 'width' ); 68 68 69 69 foreach ( $supported_features as $feature ) { -
trunk/src/wp-includes/class-wp-theme-json.php
r61619 r61620 238 238 * @since 6.6.0 Added `background-[image|position|repeat|size]` properties. 239 239 * @since 6.7.0 Added `background-attachment` property. 240 * @since 7.0.0 Added `dimensions.width` .240 * @since 7.0.0 Added `dimensions.width` and `dimensions.height`. 241 241 * @var array 242 242 */ … … 303 303 'filter' => array( 'filter', 'duotone' ), 304 304 'box-shadow' => array( 'shadow' ), 305 'height' => array( 'dimensions', 'height' ), 305 306 'width' => array( 'dimensions', 'width' ), 306 307 'writing-mode' => array( 'typography', 'writingMode' ), … … 399 400 * @since 6.9.0 Added support for `border.radiusSizes`. 400 401 * @since 7.0.0 Added type markers to the schema for boolean values. 401 * Added support for `dimensions.width` .402 * Added support for `dimensions.width` and `dimensions.height`. 402 403 * @var array 403 404 */ … … 438 439 'aspectRatios' => null, 439 440 'defaultAspectRatios' => null, 441 'height' => null, 440 442 'minHeight' => null, 441 443 'width' => null, … … 533 535 * @since 6.5.0 Added support for `dimensions.aspectRatio`. 534 536 * @since 6.6.0 Added `background` sub properties to top-level only. 535 * @since 7.0.0 Added support for `dimensions.width` .537 * @since 7.0.0 Added support for `dimensions.width` and `dimensions.height`. 536 538 * @var array 537 539 */ … … 561 563 'dimensions' => array( 562 564 'aspectRatio' => null, 565 'height' => null, 563 566 'minHeight' => null, 564 567 'width' => null, … … 773 776 * @since 6.4.0 Added `background.backgroundImage`. 774 777 * @since 6.5.0 Added `background.backgroundSize` and `dimensions.aspectRatio`. 775 * @since 7.0.0 Added `dimensions.width` .778 * @since 7.0.0 Added `dimensions.width` and `dimensions.height`. 776 779 * @var array 777 780 */ … … 788 791 array( 'color', 'caption' ), 789 792 array( 'dimensions', 'aspectRatio' ), 793 array( 'dimensions', 'height' ), 790 794 array( 'dimensions', 'minHeight' ), 791 795 array( 'dimensions', 'width' ), -
trunk/src/wp-includes/style-engine/class-wp-style-engine.php
r61619 r61620 211 211 ), 212 212 ), 213 'height' => array( 214 'property_keys' => array( 215 'default' => 'height', 216 ), 217 'path' => array( 'dimensions', 'height' ), 218 ), 213 219 'minHeight' => array( 214 220 'property_keys' => array( -
trunk/tests/phpunit/tests/block-supports/wpApplyDimensionsSupport.php
r61619 r61620 172 172 ); 173 173 } 174 175 /** 176 * Tests that height block support works as expected. 177 * 178 * @ticket 64202 179 * 180 * @covers ::wp_apply_dimensions_support 181 * 182 * @dataProvider data_height_block_support 183 * 184 * @param string $block_name The test block name to register. 185 * @param mixed $dimensions The dimensions block support settings. 186 * @param mixed $expected The expected results. 187 */ 188 public function test_height_block_support( $block_name, $dimensions, $expected ) { 189 $this->test_block_name = $block_name; 190 register_block_type( 191 $this->test_block_name, 192 array( 193 'api_version' => 2, 194 'attributes' => array( 195 'style' => array( 196 'type' => 'object', 197 ), 198 ), 199 'supports' => array( 200 'dimensions' => $dimensions, 201 ), 202 ) 203 ); 204 $registry = WP_Block_Type_Registry::get_instance(); 205 $block_type = $registry->get_registered( $this->test_block_name ); 206 $block_attrs = array( 207 'style' => array( 208 'dimensions' => array( 209 'height' => '400px', 210 ), 211 ), 212 ); 213 214 $actual = wp_apply_dimensions_support( $block_type, $block_attrs ); 215 216 $this->assertSame( $expected, $actual ); 217 } 218 219 /** 220 * Data provider. 221 * 222 * @return array 223 */ 224 public function data_height_block_support() { 225 return array( 226 'style is applied' => array( 227 'block_name' => 'test/height-style-is-applied', 228 'dimensions' => array( 229 'height' => true, 230 ), 231 'expected' => array( 232 'style' => 'height:400px;', 233 ), 234 ), 235 'style output is skipped when individual feature serialization is skipped' => array( 236 'block_name' => 'test/height-with-individual-skipped-serialization-block-supports', 237 'dimensions' => array( 238 'height' => true, 239 '__experimentalSkipSerialization' => array( 'height' ), 240 ), 241 'expected' => array(), 242 ), 243 ); 244 } 174 245 } -
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r61619 r61620 281 281 'dimensions' => array( 282 282 'aspectRatio' => true, 283 'height' => true, 283 284 'minHeight' => true, 284 285 'width' => true, … … 321 322 'dimensions' => array( 322 323 'aspectRatio' => true, 324 'height' => true, 323 325 'minHeight' => true, 324 326 'width' => true,
Note: See TracChangeset
for help on using the changeset viewer.