This commit simplifies block style variation class name generation to ensure unique class names by replacing the hashing of block attributes in the block style variation class names with a call to `wp_unique_id`.
Doing so avoids potential for non-unique class names and conflicting styles when exact copies of a block are inserted via a repeated pattern.
Props aaronrobertshaw, martinkrcho, mukesh27, peterwilsoncc, ramonopoly.
Fixes#61877.
Built from https://develop.svn.wordpress.org/trunk@58951
git-svn-id: http://core.svn.wordpress.org/trunk@58347 1a063a9b-81f0-0310-95a4-ce76da25c4cd
In theme.json, individual font sizes may opt out of fluid typography if it is turned on globally.
This commit ensures that individual font size presets can also opt in to fluid typography if it is not turned on globally.
Props aaronrobertshaw, mmaattiiaass, ramonopoly, wildworks.
Fixes#61932.
Built from https://develop.svn.wordpress.org/trunk@58950
git-svn-id: http://core.svn.wordpress.org/trunk@58346 1a063a9b-81f0-0310-95a4-ce76da25c4cd
The commit syncs the following changes from Gutenberg:
- Background images: add support for theme.json ref value resolution gutenberg#64128
- Background images: ensure appropriate default values gutenberg#64192
- Background image: ensure consistency with defaults and fix reset/remove functionality gutenberg#64328
These changes brings consistency to the default background image styles WordPress applies to user uploaded images, and adds support for ref resolution to "background" style properties.
Props andrewserong, aaronrobertshaw.
Fixes #61858
Built from https://develop.svn.wordpress.org/trunk@58936
git-svn-id: http://core.svn.wordpress.org/trunk@58332 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Introduces the ability to specify a value for `background.backgroundAttachment` in theme.json styles.
The theme.json value determines the CSS value for the `background-attachment` property.
This feature was introduced into the Gutenberg plugin in version 18.9.
Props andrewserong, mukesh27, noisysocks, ramonopoly.
Fixes#61720
Built from https://develop.svn.wordpress.org/trunk@58834
git-svn-id: http://core.svn.wordpress.org/trunk@58230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
These changes involve:
- Move shared variation definitions from styles.blocks.variations to styles.variations
- Remove blockTypes from styles.variations.
- Do not register shared variations from theme style variation or primary theme.json files.
- Move the merging of theme.json data into the WP_Theme_JSON_Resolver and WP_Theme_JSON classes.
These changes improve performance and are more future-proof API wise.
See conversation at https://github.com/WordPress/gutenberg/issues/62686
Props aaronrobertshaw, oandregal, andrewserong, joemcgill, talldanwp, andrewserong, ramonopoly, richtabor, youknowriad.
See #61312, #61451.
Built from https://develop.svn.wordpress.org/trunk@58466
git-svn-id: http://core.svn.wordpress.org/trunk@57915 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Adjusts the block level global styles selectors so they have a consistent specificity of 0-1-0, and adjusts base and layout global style selectors to their minimum required specificity.
Props aaronrobertshaw, isabel_brison, andrewserong, mukesh27.
Fixes#61165.
Built from https://develop.svn.wordpress.org/trunk@58241
git-svn-id: http://core.svn.wordpress.org/trunk@57704 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Make layout support compatible with enhanced pagination by ensuring that generated class names are stable across pagination, even when the number of rendered posts is different.
With the previous implementation of enhanced pagination, the CSS corresponding to each block was not detected. Therefore, for enhanced pagination to work correctly, the CSS of the blocks present in the Post Template must be stable on all pages.
The number of posts rendered by the Query block is always the same, except in the last page, where it can be only a fraction. If any of the blocks rendered by the Post Template used the `wp_unique_id` function, the ID (which is incremental) would have been different than in the previous pages and the class names would have varied.
This is remediated by this changeset by replacing the usage of `wp_unique_id` in the layout support (which is used by the Query block) with an implementation that uses IDs that are incremental only for that block. That way, the generated class names are never affected by the number of times `wp_unique_id` runs.
Props luisherranz, andrewserong, isabel_brison, costdev, mukesh27, cbravobernal, hellofromTonya, jorbin.
Fixes#59681.
Built from https://develop.svn.wordpress.org/trunk@56994
git-svn-id: http://core.svn.wordpress.org/trunk@56505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
By skipping iterations in block supports when not necessary, this changeset improves performance of the function notably.
The performance enhancement leads to even a notable improvement for overall page load time: For example, the Twenty Twenty-Four home page loads ~2% faster with this changeset.
Props dmsnell, spacedmonkey, costdev, hellofromTonya, aaronrobertshaw.
Fixes#59544.
Built from https://develop.svn.wordpress.org/trunk@56807
git-svn-id: http://core.svn.wordpress.org/trunk@56319 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Replace calls to `property_exists` with `instanceof WP_Block_Type` in block related functions. This change not only improves type safety but also enhances performance.
Follow on from [56678] and [56677].
Props gziolo, aristath, aaronrobertshaw, spacedmonkey.
Fixes#59453
Built from https://develop.svn.wordpress.org/trunk@56742
git-svn-id: http://core.svn.wordpress.org/trunk@56254 1a063a9b-81f0-0310-95a4-ce76da25c4cd
`_wp_array_get()` is an expensive function, and it's called thousands of times on each page view on the front end. While the function performance was slightly improved in #58376, it is still called more times than it should be.
This commit aims to further optimize its usage:
* In many cases, `_wp_array_get()` can be replaced with a much simpler and faster `isset()` check.
* The `isset()` function is capable of checking nested arrays, so `isset( $foo['a']['b']['c'] )` will return false even if `$foo['a']` is unset, without throwing any errors or warnings.
* When `_wp_array_get()` cannot be directly replaced with `isset()`, it would be good practice to wrap it in an `isset()` function so that `_wp_array_get()` only runs when it needs to.
Original PR from Gutenberg repository:
* [https://github.com/WordPress/gutenberg/pull/51116#51116 Performance improvement: Reduce the use of the _wp_array_get() function]
Follow-up to [55851], [56382].
Props aristath, jrf, spacedmonkey, mukesh27, swissspidy, hellofromTonya.
Fixes#59405.
Built from https://develop.svn.wordpress.org/trunk@56709
git-svn-id: http://core.svn.wordpress.org/trunk@56221 1a063a9b-81f0-0310-95a4-ce76da25c4cd