Changeset 60910 for trunk/src/wp-includes/media.php
- Timestamp:
- 10/07/2025 06:22:02 AM (2 months ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/media.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/media.php
r60780 r60910 2082 2082 2083 2083 /** 2084 * Prints a CSS rule to fix potential visual issues with images using `sizes=auto`.2084 * Enqueues a CSS rule to fix potential visual issues with images using `sizes=auto`. 2085 2085 * 2086 2086 * This rule overrides the similar rule in the default user agent stylesheet, to avoid images that use e.g. 2087 2087 * `width: auto` or `width: fit-content` to appear smaller. 2088 2088 * 2089 * @since 6.7.1 2089 * @since 6.9.0 2090 * 2090 2091 * @see https://html.spec.whatwg.org/multipage/rendering.html#img-contain-size 2091 2092 * @see https://core.trac.wordpress.org/ticket/62413 2092 */ 2093 function wp_print_auto_sizes_contain_css_fix() { 2093 * @see https://core.trac.wordpress.org/ticket/62731 2094 */ 2095 function wp_enqueue_img_auto_sizes_contain_css_fix(): void { 2096 // Back-compat for plugins that disable functionality by unhooking this action. 2097 $priority = has_action( 'wp_head', 'wp_print_auto_sizes_contain_css_fix' ); 2098 if ( false === $priority ) { 2099 return; 2100 } 2101 remove_action( 'wp_head', 'wp_print_auto_sizes_contain_css_fix', $priority ); 2102 2094 2103 /** This filter is documented in wp-includes/media.php */ 2095 2104 $add_auto_sizes = apply_filters( 'wp_img_tag_add_auto_sizes', true ); … … 2098 2107 } 2099 2108 2100 ?> 2101 <style>img:is([sizes="auto" i], [sizes^="auto," i]) { contain-intrinsic-size: 3000px 1500px }</style> 2102 <?php 2109 $handle = 'wp-img-auto-sizes-contain'; 2110 wp_register_style( $handle, false ); 2111 wp_add_inline_style( $handle, 'img:is([sizes=auto i],[sizes^="auto," i]){contain-intrinsic-size:3000px 1500px}' ); 2112 2113 // Make sure inline style is printed first since it was previously printed at wp_head priority 1 and this preserves the CSS cascade. 2114 array_unshift( wp_styles()->queue, $handle ); 2103 2115 } 2104 2116
Note: See TracChangeset
for help on using the changeset viewer.