Make WordPress Core


Ignore:
Timestamp:
09/20/2022 03:41:44 PM (2 years ago)
Author:
hellofromTonya
Message:

Editor: Introduces fluid typography and uses Style Engine.

This commit introduces fluid typography block supports and switches to use the Style Engine for typography and colors.

The motivation for fluid typography block supports:

"Fluid typography" describes how a site's font sizes adapt to every change in screen size, for example, growing larger as the viewport width increases, or smaller as it decreases.

Font sizes can smoothly scale between minimum and maximum viewport widths.

Typography changes introduced from Gutenberg:

  • Uses the Style Engine to generate the CSS and classnames in wp_apply_typography_support().
  • Introduces wp_typography_get_preset_inline_style_value() for backwards-compatibility.
  • Introduces a private internal function called wp_get_typography_value_and_unit(), for checking and getting typography unit and value.
  • Introduces a private internal function called wp_get_computed_fluid_typography_value(), for an internal implementation of CSS clamp().
  • Deprecates wp_typography_get_css_variable_inline_style().

References:

Follow-up to [53076], [52302], [52069], [51089], [50761], [49226].

Props ramonopoly, youknowriad, aristath, oandregal, aaronrobertshaw, cbirdsong, jorgefilipecosta, ironprogrammer, hellofromTonya.
See #56467.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/blocks/supportedStyles.php

    r54211 r54260  
    380380
    381381        $expected_classes = 'foo-bar-class wp-block-example';
    382         $expected_styles  = 'test: style; font-size: 10px;';
     382        $expected_styles  = 'test: style; font-size:10px;';
    383383
    384384        $this->assert_content_and_styles_and_classes_match( $block, $expected_classes, $expected_styles );
     
    437437
    438438        $expected_classes = 'foo-bar-class wp-block-example';
    439         $expected_styles  = 'test: style; line-height: 10;';
     439        $expected_styles  = 'test: style; line-height:10;';
    440440
    441441        $this->assert_content_and_styles_and_classes_match( $block, $expected_classes, $expected_styles );
     
    564564
    565565        $expected_classes = 'foo-bar-class wp-block-example has-text-color has-background alignwide';
    566         $expected_styles  = 'test: style; color:#000; background-color:#fff; font-size: 10px; line-height: 20;';
     566        $expected_styles  = 'test: style; color:#000; background-color:#fff; font-size:10px; line-height:20;';
    567567
    568568        $this->assert_content_and_styles_and_classes_match( $block, $expected_classes, $expected_styles );
     
    607607
    608608        $expected_classes = 'foo-bar-class wp-block-example';
    609         $expected_styles  = 'test: style; font-size: 10px;';
     609        $expected_styles  = 'test: style; font-size:10px;';
    610610
    611611        $this->assert_content_and_styles_and_classes_match( $block, $expected_classes, $expected_styles );
Note: See TracChangeset for help on using the changeset viewer.