[webkit-changes] [WebKit/WebKit] e7825a: Update handling of negative radius for feMorphology

Ahmad Saleem noreply at github.com
Thu Jun 8 20:20:06 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e7825a0cbca5b51b5fd45c8be7a9a07802cffa98
      https://github.com/WebKit/WebKit/commit/e7825a0cbca5b51b5fd45c8be7a9a07802cffa98
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2023-06-08 (Thu, 08 Jun 2023)

  Changed paths:
    A LayoutTests/svg/filters/feMorphology-negative-radius-expected.html
    A LayoutTests/svg/filters/feMorphology-negative-radius.html
    M LayoutTests/svg/filters/feMorphology-radius-cases.svg
    M Source/WebCore/platform/graphics/filters/FEMorphology.cpp
    M Source/WebCore/svg/SVGFEMorphologyElement.cpp

  Log Message:
  -----------
  Update handling of negative radius for feMorphology

https://bugs.webkit.org/show_bug.cgi?id=257838

Reviewed by Simon Fraser.

This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.

Merge: https://src.chromium.org/viewvc/blink?view=revision&revision=202644

Spec[1] states:

"A negative or zero value disables the effect of the given filter
  primitive (i.e., the result is the filter input image)."

So this changes FEMorphology to clamp radii to non-negative and stop treating
as an error in SVGFEMorphologyElement::createFilterEffect.

[1] https://drafts.fxtf.org/filters/#element-attrdef-femorphology-radius

* Source/WebCore/platform/graphics/filters/FEMorphology.cpp:
(FEMorphology::FEMorphology): clamp 'm_radiusX' and 'm_radiusY'
(FEMorphology::setRadiusX): clamp 'radiusX'
(FEMorphology::setRadiusY): clamp 'radiusY'
* Source/WebCore/svg/SVGFEMorphologyElement.cpp:
(SVGFEMorphologyElement::isIdentity): clamp return as per commit
(SVGFEMorphologyElement::createFilterEffect): Remove condition to return 'nullptr' on negative radius
* LayoutTests/svg/filters/feMorphology-negative-radius.html: Add Test Case
* LayoutTests/svg/filters/feMorphology-negative-radius-expected.html: Add Test Case Expectation
* LayoutTests/svg/filters/feMorphology-radius-cases.svg: Rebaselined

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




More information about the webkit-changes mailing list