[webkit-changes] [WebKit/WebKit] 56e5d7: [image-set] Pick first choice when identical resol...

Ryan Reno noreply at github.com
Wed May 24 11:13:36 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 56e5d7cb43e7069afcda466873b4fd9ac13ce646
      https://github.com/WebKit/WebKit/commit/56e5d7cb43e7069afcda466873b4fd9ac13ce646
  Author: Ryan Reno <rreno at apple.com>
  Date:   2023-05-24 (Wed, 24 May 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/rendering/style/StyleImageSet.cpp

  Log Message:
  -----------
  [image-set] Pick first choice when identical resolutions are found
https://bugs.webkit.org/show_bug.cgi?id=257100
rdar://109619779

Reviewed by Tim Nguyen.

Step 2 of the image-set selection algorithm [0] specifies that we should
drop any <image-set-option> whose resolution we have already seen. This
can be acheived by comparing the resolution against the `result` that we
have selected in the loop. This works because the Vector is sorted by
resolution and we bail out of the loop the first time we find an image
whose resolution is greater or equal to device resolution.

While here, also fix up a bug where we were checking if the
ImageWithScale object had a non-null pointer to an image rather than
checking if the pointer was to a StyleInvalidImage object. The
ImageWithScale defaults to having a StyleInvalidImage rather than a null
pointer.

[0] https://drafts.csswg.org/css-images-4/#image-set-notation

* LayoutTests/TestExpectations:
* LayoutTests/platform/ios/TestExpectations:
* Source/WebCore/rendering/style/StyleImageSet.cpp:
(WebCore::StyleImageSet::bestImageForScaleFactor):

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




More information about the webkit-changes mailing list