[webkit-changes] [WebKit/WebKit] ffe7d7: [SVG] Fixed invalid input values in lighting filters

Ahmad Saleem noreply at github.com
Sat Apr 22 11:04:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ffe7d732d4ee3424d146053a4bec67b800f48f37
      https://github.com/WebKit/WebKit/commit/ffe7d732d4ee3424d146053a4bec67b800f48f37
  Author: Ahmad Saleem <ahmad.saleem792+github at gmail.com>
  Date:   2023-04-22 (Sat, 22 Apr 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp
    M Source/WebCore/platform/graphics/filters/FELighting.cpp
    M Source/WebCore/platform/graphics/filters/FESpecularLighting.cpp
    M Source/WebCore/platform/graphics/filters/LightSource.h
    M Source/WebCore/platform/graphics/filters/SpotLightSource.cpp

  Log Message:
  -----------
  [SVG] Fixed invalid input values in lighting filters

https://bugs.webkit.org/show_bug.cgi?id=250645
rdar://problem/104527452

Reviewed by Simon Fraser.

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

This patch aligns WebKit with Web-Specs:

Spec Link: https://drafts.fxtf.org/filter-effects/#element-attrdef-fespecularlighting-specularexponent &
https://drafts.fxtf.org/filter-effects/#element-attrdef-fespotlight-specularexponent &
https://drafts.fxtf.org/filter-effects/#element-attrdef-fediffuselighting-diffuseconstant

A few values have specified ranges in the W3 spec:
- specularExponent = Range 1.0 to 128.0
- specularConstant = any non-negative number
- diffuseConstant = any non-negative number

* Source/WebCore/platform/graphics/filters/FEDiffuseLighting.cpp:
(FEDiffuseLighting::setDiffuseConstant): Restrict to non-negative
* Source/WebCore/platform/graphics/filters/FELighting.cpp:
(FELighting::FELighting): Update values for 'diffuseConstant', 'specularConstant' and 'specularExponent'
* Source/WebCore/platform/graphics/filters/FESpecularLighting.cpp:
(FESpecularLighting::setSpecularConstant): Restrict 'specularConstant' to non-negative
(FESpecularLighting::setSpecularExponent): Restrict 'specularExponent' from 1.0f to 128.0f
* Source/WebCore/platform/graphics/filters/LightSource.h: Remove 'int' specularExponent
* Source/WebCore/platform/graphics/filters/SpotLightSource.cpp:
(SpotLightSource::SpotLightSource): clamp value for 'specularExponent'
(SpotLightSource::initPaintingData): Remove optimizations for common value and also update switch case for color of the pixel
(SpotLightSource::setSpecularExponent): clamp value for 'specularExponent'

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




More information about the webkit-changes mailing list