Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind CanvasFilters.filter to a string in CanvasRenderingContext2DBase::State #5528

Conversation

shallawa
Copy link
Contributor

@shallawa shallawa commented Oct 19, 2022

2159194

Bind CanvasFilters.filter to a string in CanvasRenderingContext2DBase::State
https://bugs.webkit.org/show_bug.cgi?id=246732
rdar://101323769

Reviewed by NOBODY (OOPS!).

Bind the IDL string to a string in CanvasRenderingContext2DBase::State. The actual
filter will be drawn to the canvas in a future patch.

Parsing the filter string has to happen when the API is called because unparsed
values should not change the property.

createFilterOperations() will be used for parsing the CSS filter, the <canvas>
filter and the OffscreenCanvas filter. Becasue OffscreenCanvas can render on a
worker thread, Document can't be safely used while parsing its filter.

FilterParserContext is passed to the createFilterOperations() to control resolving
the URL of the referenced SVG filter and resolving the drop-shadow color. For CSS
filter and <canvas> filter only, createFilterOperations() will use the Document
and the RenderStyle through FilterParserContext.

Specs link: https://html.spec.whatwg.org/multipage/canvas.html#canvasfilters

* LayoutTests/fast/canvas/canvas-filter-basics-expected.txt: Added.
* LayoutTests/fast/canvas/canvas-filter-basics.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.discrete-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.gamma-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.identity-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.linear-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.table-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.value-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https_exclude=(Document_Window_HTML._)-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt:
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* LayoutTests/platform/ipad/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* LayoutTests/platform/mac-bigsur-wk1/imported/w3c/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2-expected.txt:
* LayoutTests/platform/mac-bigsur-wk1/imported/w3c/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.worker-expected.txt:
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/html/canvas/CanvasFilters.idl:
* Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::createFilterOperations const):
* Source/WebCore/html/canvas/CanvasRenderingContext2D.h:
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::State::State):
(WebCore::CanvasRenderingContext2DBase::setFilterString):
(WebCore::CanvasRenderingContext2DBase::fillInternal):
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h:
(WebCore::CanvasRenderingContext2DBase::filterString const):
(WebCore::CanvasRenderingContext2DBase::createFilterOperations const):
* Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.cpp:
(WebCore::OffscreenCanvasRenderingContext2D::createFilterOperations const):
* Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.h:
* Source/WebCore/style/FilterOperationsBuilder.cpp:
(WebCore::Style::defaultFilterParserContext):
(WebCore::Style::documentFilterParserContext):
(WebCore::Style::createFilterOperations):
* Source/WebCore/style/FilterOperationsBuilder.h:
* Source/WebCore/style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::createFilterOperations):

2159194

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🛠 gtk
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🧪 gtk-wk2
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🧪 api-gtk
✅ 🛠 🧪 jsc-arm64 ✅ 🛠 tv ✅ 🧪 mac-AS-debug-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🧪 mac-wk2-stress ✅ 🧪 jsc-armv7-tests
✅ 🛠 watch ✅ 🛠 jsc-mips
✅ 🛠 watch-sim ✅ 🧪 jsc-mips-tests

@shallawa shallawa requested review from cdumez and rniwa as code owners October 19, 2022 05:25
@shallawa shallawa self-assigned this Oct 19, 2022
@shallawa shallawa added Canvas Bugs related to the canvas element. WebKit Nightly Build labels Oct 19, 2022
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 19, 2022
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Oct 19, 2022
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from eea3e97 to 97348d4 Compare October 19, 2022 22:15
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 20, 2022
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Oct 20, 2022
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from 97348d4 to 8a3f177 Compare October 20, 2022 17:47
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 20, 2022
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Oct 20, 2022
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from 8a3f177 to c95ebd9 Compare October 20, 2022 21:00
@shallawa shallawa requested review from smfr, grorg and weinig October 20, 2022 22:45
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from c95ebd9 to 3f6e6d2 Compare October 27, 2022 04:52
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from 3f6e6d2 to d993d4e Compare October 27, 2022 04:57
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 27, 2022
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Oct 27, 2022
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from d993d4e to 6fb5a4e Compare October 27, 2022 07:00
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Oct 28, 2022
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Dec 22, 2022
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from c9a3242 to 85a27dc Compare December 22, 2022 23:43
@shallawa shallawa requested review from smfr and heycam December 22, 2022 23:48
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Dec 23, 2022
@shallawa
Copy link
Contributor Author

Yo

@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Dec 23, 2022
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from 85a27dc to 06d2f6f Compare December 23, 2022 08:30
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Dec 23, 2022
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Dec 23, 2022
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from 06d2f6f to 9d10c05 Compare December 23, 2022 17:32
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Dec 23, 2022
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Dec 23, 2022
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from 9d10c05 to 1c555d2 Compare December 23, 2022 19:56
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from 1c555d2 to 49aeb3f Compare June 30, 2023 19:04
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 30, 2023
…::State

https://bugs.webkit.org/show_bug.cgi?id=246732
rdar://101323769

Reviewed by NOBODY (OOPS!).

Bind the IDL string to a string in CanvasRenderingContext2DBase::State. The actual
filter will be drawn to the canvas in a future patch.

Parsing the filter string has to happen when the API is called because unparsed
values should not change the property.

createFilterOperations() will be used for parsing the CSS filter, the <canvas>
filter and the OffscreenCanvas filter. Becasue OffscreenCanvas can render on a
worker thread, Document can't be safely used while parsing its filter.

FilterParserContext is passed to the createFilterOperations() to control resolving
the URL of the referenced SVG filter and resolving the drop-shadow color. For CSS
filter and <canvas> filter only, createFilterOperations() will use the Document
and the RenderStyle through FilterParserContext.

Specs link: https://html.spec.whatwg.org/multipage/canvas.html#canvasfilters

* LayoutTests/fast/canvas/canvas-filter-basics-expected.txt: Added.
* LayoutTests/fast/canvas/canvas-filter-basics.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.discrete-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.gamma-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.identity-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.linear-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.componentTransfer.table-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.canvasFilterObject.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/filters/2d.filter.value-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.canvasFilterObject.tentative.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/filters/2d.filter.value.worker-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.https_exclude=(Document_Window_HTML._)-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt:
* LayoutTests/platform/glib/imported/w3c/web-platform-tests/html/dom/idlharness.worker-expected.txt:
* LayoutTests/platform/gtk/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* LayoutTests/platform/ipad/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* LayoutTests/platform/mac-bigsur-wk1/imported/w3c/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2-expected.txt:
* LayoutTests/platform/mac-bigsur-wk1/imported/w3c/web-platform-tests/html/canvas/offscreen/path-objects/2d.path.stroke.scale2.worker-expected.txt:
* LayoutTests/platform/wpe/imported/w3c/web-platform-tests/html/dom/idlharness.https-expected.txt:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/html/canvas/CanvasFilters.idl:
* Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::createFilterOperations const):
* Source/WebCore/html/canvas/CanvasRenderingContext2D.h:
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::State::State):
(WebCore::CanvasRenderingContext2DBase::setFilterString):
(WebCore::CanvasRenderingContext2DBase::fillInternal):
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.h:
(WebCore::CanvasRenderingContext2DBase::filterString const):
(WebCore::CanvasRenderingContext2DBase::createFilterOperations const):
* Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.cpp:
(WebCore::OffscreenCanvasRenderingContext2D::createFilterOperations const):
* Source/WebCore/html/canvas/OffscreenCanvasRenderingContext2D.h:
* Source/WebCore/style/FilterOperationsBuilder.cpp:
(WebCore::Style::defaultFilterParserContext):
(WebCore::Style::documentFilterParserContext):
(WebCore::Style::createFilterOperations):
* Source/WebCore/style/FilterOperationsBuilder.h:
* Source/WebCore/style/StyleBuilderState.cpp:
(WebCore::Style::BuilderState::createFilterOperations):
@shallawa shallawa removed the merging-blocked Applied to prevent a change from being merged label Jun 30, 2023
@shallawa shallawa force-pushed the eng/Bind-CanvasFilters-filter-to-a-string-in-CanvasRenderingContext2DBaseState branch from 49aeb3f to 2159194 Compare June 30, 2023 22:25
@shallawa
Copy link
Contributor Author

This is done by #3793.

@shallawa shallawa closed this Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Canvas Bugs related to the canvas element.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants