[webkit-changes] [WebKit/WebKit] 4abefb: Update FEComponentTransfer filter effect when a ch...

Cameron McCormack noreply at github.com
Sat Oct 22 02:34:07 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4abefb791c7642bbf2f32d92d246010370c8183d
      https://github.com/WebKit/WebKit/commit/4abefb791c7642bbf2f32d92d246010370c8183d
  Author: Cameron McCormack <heycam at apple.com>
  Date:   2022-10-22 (Sat, 22 Oct 2022)

  Changed paths:
    M LayoutTests/svg/resource-invalidation/filter-resource-invalidation-expected.html
    M LayoutTests/svg/resource-invalidation/filter-resource-invalidation.html
    M Source/WTF/wtf/EnumeratedArray.h
    M Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp
    M Source/WebCore/platform/graphics/filters/FEComponentTransfer.h
    M Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp
    M Source/WebCore/svg/SVGComponentTransferFunctionElement.h
    A Source/WebCore/svg/SVGComponentTransferFunctionElementInlines.h
    M Source/WebCore/svg/SVGFEComponentTransferElement.cpp
    M Source/WebCore/svg/SVGFEComponentTransferElement.h
    M Source/WebCore/svg/SVGFEFuncAElement.h
    M Source/WebCore/svg/SVGFEFuncBElement.h
    M Source/WebCore/svg/SVGFEFuncGElement.h
    M Source/WebCore/svg/SVGFEFuncRElement.h
    M Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp
    M Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h

  Log Message:
  -----------
  Update FEComponentTransfer filter effect when a child transfer function attribute changes
https://bugs.webkit.org/show_bug.cgi?id=246602
<rdar://problem/101232007>

Reviewed by Said Abou-Hallawa.

Nothing currently causes the FEComponentTransfer effect to get updated
when an attribute on a child feFunc[RGBA] element changes.

Because we there are multiple child elements, we can't call
primitiveAttributeChanged on the parent SVGFEComponentTransferElement
and go through the normal setFilterEffectAttribute path like the
SVGFELightElement classes do. So instead we add a new function,
primitiveAttributeOnChildChanged, which takes the element as well.

* LayoutTests/svg/resource-invalidation/filter-resource-invalidation-expected.html:
* LayoutTests/svg/resource-invalidation/filter-resource-invalidation.html:

Add a sub-test for changing one of the feFuncX attributes.

* Source/WTF/wtf/EnumeratedArray.h:
(WTF::EnumeratedArray::index const):
(WTF::EnumeratedArray::index): Deleted.

This function needs to be const for `EnumeratedArray::operator[] const` to
work.

* Source/WebCore/platform/graphics/filters/FEComponentTransfer.cpp:
(WebCore::FEComponentTransfer::create):
(WebCore::FEComponentTransfer::FEComponentTransfer):

(WebCore::FEComponentTransfer::setType):
(WebCore::FEComponentTransfer::setSlope):
(WebCore::FEComponentTransfer::setIntercept):
(WebCore::FEComponentTransfer::setAmplitude):
(WebCore::FEComponentTransfer::setExponent):
(WebCore::FEComponentTransfer::setOffset):
(WebCore::FEComponentTransfer::setTableValues):

Setters for individual attributes of a transfer function.

(WebCore::FEComponentTransfer::externalRepresentation const):

* Source/WebCore/platform/graphics/filters/FEComponentTransfer.h:
(WebCore::FEComponentTransfer::redFunction const):
(WebCore::FEComponentTransfer::greenFunction const):
(WebCore::FEComponentTransfer::blueFunction const):
(WebCore::FEComponentTransfer::alphaFunction const):
(WebCore::FEComponentTransfer::encode const):

Store the four transfer functions in an EnumeratedArray to make access
from the new setter functions above more convenient.

* Source/WebCore/svg/SVGComponentTransferFunctionElementInlines.h: Added.

* Source/WebCore/svg/SVGComponentTransferFunctionElement.cpp:
(WebCore::SVGComponentTransferFunctionElement::svgAttributeChanged):

* Source/WebCore/svg/SVGComponentTransferFunctionElement.h:
(WebCore::SVGComponentTransferFunctionElement::channel const):
(isType):

Add type specialization support for SVGComponentTransferFunctionElement,
to avoid code that checks for each of the four feFuncX element types
explicitly.

* Source/WebCore/svg/SVGFEComponentTransferElement.cpp:
(WebCore::SVGFEComponentTransferElement::createFilterEffect const):

(WebCore::isRelevantTransferFunctionElement):

Used to ensure we only update the effect if it's the last transfer
function element of a given name that's being modified.

(WebCore::SVGFEComponentTransferElement::setFilterEffectAttributeFromChild):

Update the FEComponentTransfer effect when an attribute's changed.

(WebCore::SVGFEComponentTransferElement::transferFunctionAttributeChanged):

* Source/WebCore/svg/SVGFEComponentTransferElement.h:
* Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.cpp:
(WebCore::SVGFilterPrimitiveStandardAttributes::primitiveAttributeOnChildChanged):
* Source/WebCore/svg/SVGFilterPrimitiveStandardAttributes.h:
(WebCore::SVGFilterPrimitiveStandardAttributes::setFilterEffectAttributeFromChild):

* Source/WebCore/svg/SVGFEFuncAElement.h:
* Source/WebCore/svg/SVGFEFuncBElement.h:
* Source/WebCore/svg/SVGFEFuncGElement.h:
* Source/WebCore/svg/SVGFEFuncRElement.h:

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




More information about the webkit-changes mailing list