[webkit-changes] [WebKit/WebKit] 7acdd2: [Filters] Calculating the CSSFilter geometry and c...

Said Abou-Hallawa noreply at github.com
Sat Mar 18 12:29:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7acdd2650a9bc80317594614894d344b16ae6a16
      https://github.com/WebKit/WebKit/commit/7acdd2650a9bc80317594614894d344b16ae6a16
  Author: Said Abou-Hallawa <said at apple.com>
  Date:   2023-03-18 (Sat, 18 Mar 2023)

  Changed paths:
    M LayoutTests/css3/filters/effect-blur-hw.html
    M LayoutTests/css3/filters/effect-blur.html
    M LayoutTests/css3/filters/effect-combined.html
    A LayoutTests/css3/filters/svg-morphology-clipped-expected.html
    A LayoutTests/css3/filters/svg-morphology-clipped.html
    M LayoutTests/fast/filter-image/filter-image-blur-expected.html
    M LayoutTests/fast/filter-image/filter-image-blur.html
    M LayoutTests/fast/filter-image/resources/svg-blur.svg
    M LayoutTests/fast/filter-image/resources/svg-noblur.svg
    A LayoutTests/fast/hidpi/filters-drop-shadow-expected.html
    A LayoutTests/fast/hidpi/filters-drop-shadow.html
    M LayoutTests/imported/w3c/web-platform-tests/css/filter-effects/filter-region-transformed-child-001-expected.html
    M Source/WebCore/platform/graphics/filters/Filter.cpp
    M Source/WebCore/platform/graphics/filters/Filter.h
    M Source/WebCore/platform/graphics/filters/FilterEffect.cpp
    M Source/WebCore/rendering/CSSFilter.cpp
    M Source/WebCore/rendering/CSSFilter.h
    M Source/WebCore/rendering/RenderLayerFilters.cpp
    M Source/WebCore/rendering/style/StyleFilterImage.cpp
    M Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp
    M Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp
    M Source/WebCore/svg/SVGFEMorphologyElement.cpp
    M Source/WebCore/svg/SVGFEMorphologyElement.h
    M Source/WebCore/svg/graphics/filters/SVGFilter.cpp
    M Source/WebCore/svg/graphics/filters/SVGFilter.h
    M Source/WebCore/svg/graphics/filters/SVGFilterGraph.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.cpp

  Log Message:
  -----------
  [Filters] Calculating the CSSFilter geometry and clipping sometimes is incorrect
https://bugs.webkit.org/show_bug.cgi?id=254062
rdar://106844401

Reviewed by Simon Fraser.

Like SVGFilter, CSSFilter should always intersect the FilterEffect imageRect with
its primitiveSubregion. This will require:

1. Filter::ClipOperation will be removed.
2. Filter::clipToMaxEffectRect() will always clip the rectangle with maxEffectRect.
3. FilterEffect::calculateImageRect() will return the maxEffectRect if number of
   input effects is zero. This was a bug which was covered by the union mode of
   Filter::clipToMaxEffectRect().
4. RenderLayerFilters::beginFilterEffect() should set its targetBoundingBox the
   sourceImageRect of FilterTargetSwitcher.
5. SVGFilterGraph::getNamedNodes() should not return an error if one of the inputs
   is builtin and there is no node for it. This happens when we build a graph of
   primitives and one of the inputs is SourceGraphic or SourceAlpha. In this case
   we just need to ignore this input since there is no built-in primitive for it.
   This fixes the calculation of the filter outsets which was covered by the union
   mode of Filter::clipToMaxEffectRect().
6. SVGFEMorphologyElement::outsets() needs to implemented. This is a bug which was
   covered by the union mode of Filter::clipToMaxEffectRect().

Note: This work is towards enabling the GraphicsContext filters. The clipping has
to fixed first since no intermidate buffers are used to apply the CSSFilter.

* LayoutTests/css3/filters/effect-blur-hw.html:
* LayoutTests/css3/filters/effect-blur.html:
* LayoutTests/css3/filters/effect-combined.html:
* LayoutTests/css3/filters/svg-morphology-clipped-expected.html: Added.
* LayoutTests/css3/filters/svg-morphology-clipped.html: Added.
* LayoutTests/fast/filter-image/filter-image-blur-expected.html:
* LayoutTests/fast/filter-image/filter-image-blur.html:
* LayoutTests/fast/filter-image/resources/svg-blur.svg:
* LayoutTests/fast/filter-image/resources/svg-noblur.svg:
* LayoutTests/fast/hidpi/filters-drop-shadow-expected.html: Added.
* LayoutTests/fast/hidpi/filters-drop-shadow.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/css/filter-effects/filter-region-transformed-child-001-expected.html:
* Source/WebCore/platform/graphics/filters/Filter.cpp:
(WebCore::Filter::Filter):
(WebCore::Filter::clipToMaxEffectRect const):
* Source/WebCore/platform/graphics/filters/Filter.h:
(WebCore::Filter::Filter):
(WebCore::Filter::clipOperation const): Deleted.
(WebCore::Filter::setClipOperation): Deleted.
* Source/WebCore/platform/graphics/filters/FilterEffect.cpp:
(WebCore::FilterEffect::calculateImageRect const):
* Source/WebCore/rendering/CSSFilter.cpp:
(WebCore::CSSFilter::create):
(WebCore::CSSFilter::CSSFilter):
(WebCore::createBlurEffect):
(WebCore::createReferenceFilter):
(WebCore::CSSFilter::buildFilterFunctions):
* Source/WebCore/rendering/CSSFilter.h:
* Source/WebCore/rendering/RenderLayerFilters.cpp:
(WebCore::RenderLayerFilters::beginFilterEffect):
* Source/WebCore/rendering/style/StyleFilterImage.cpp:
(WebCore::StyleFilterImage::image const):
* Source/WebCore/rendering/svg/RenderSVGResourceFilter.cpp:
(WebCore::RenderSVGResourceFilter::applyResource):
* Source/WebCore/rendering/svg/SVGRenderTreeAsText.cpp:
(WebCore::writeSVGResourceContainer):
* Source/WebCore/svg/SVGFEMorphologyElement.cpp:
(WebCore::SVGFEMorphologyElement::outsets const):
* Source/WebCore/svg/SVGFEMorphologyElement.h:
* Source/WebCore/svg/graphics/filters/SVGFilter.cpp:
(WebCore::SVGFilter::create):
(WebCore::SVGFilter::SVGFilter):
* Source/WebCore/svg/graphics/filters/SVGFilter.h:
* Source/WebCore/svg/graphics/filters/SVGFilterGraph.h:
(WebCore::SVGFilterGraph::SVGFilterGraph):
(WebCore::SVGFilterGraph::sourceGraphic const):
(WebCore::SVGFilterGraph::sourceAlpha const):
(WebCore::SVGFilterGraph::addNamedNode):
(WebCore::SVGFilterGraph::getNamedNode const):
(WebCore::SVGFilterGraph::getNamedNodes const):
(WebCore::SVGFilterGraph::isSourceName):
* Source/WebKit/Shared/WebCoreArgumentCoders.cpp:
(IPC::ArgumentCoder<Filter>::encode):
(IPC::ArgumentCoder<Filter>::decode):

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




More information about the webkit-changes mailing list