[webkit-changes] [WebKit/WebKit] 759576: Don't apply aspect ratio scaling to gradient backg...

mattwoodrow noreply at github.com
Wed Nov 2 16:30:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 759576401a3d3175f5f17ea8756f36423b147a51
      https://github.com/WebKit/WebKit/commit/759576401a3d3175f5f17ea8756f36423b147a51
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2022-11-02 (Wed, 02 Nov 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/css3/masking/mask-luminance-gradient-expected.html
    M LayoutTests/css3/masking/mask-luminance-gradient.html
    M Source/WebCore/display/css/DisplayFillLayerImageGeometry.cpp
    M Source/WebCore/rendering/BackgroundPainter.cpp
    M Source/WebCore/rendering/RenderBoxModelObject.cpp
    M Source/WebCore/rendering/style/StyleGeneratedImage.h
    M Source/WebCore/rendering/style/StyleImage.h

  Log Message:
  -----------
  Don't apply aspect ratio scaling to gradient background images that don't have a natural aspect ratio
https://bugs.webkit.org/show_bug.cgi?id=247298
<rdar://101661731>

Reviewed by Simon Fraser.

If we use a gradient as a background image, and set one of the background size dimension to auto, we currently scale that dimension by the same amount as the other axis to preserve the aspect ratio.

Gradients have no natural dimensions (and thus no natural aspect ratio) - https://w3c.github.io/csswg-drafts/css-images/#gradients.

Background sizing should fall back to using 100% (for the case where we have one size, and auto), if there's no natural aspect ratio or dimensions - https://w3c.github.io/csswg-drafts/css-backgrounds/#background-size

* LayoutTests/TestExpectations:
* Source/WebCore/display/css/DisplayFillLayerImageGeometry.cpp:
(WebCore::Display::calculateImageIntrinsicDimensions):
(WebCore::Display::calculateFillTileSize):
* Source/WebCore/rendering/BackgroundPainter.cpp:
(WebCore::BackgroundPainter::calculateFillTileSize):
* Source/WebCore/rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::calculateImageIntrinsicDimensions const):
* Source/WebCore/rendering/style/StyleGeneratedImage.h:
* Source/WebCore/rendering/style/StyleImage.h:
(WebCore::StyleImage::imageHasNaturalDimensions const):

Canonical link: https://commits.webkit.org/256256@main




More information about the webkit-changes mailing list