Skip to content

Implement support for STL formats for the model element - #80652

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
jeanhbr:eng/Implement-support-for-STL-formats-for-the-model-element
Nov 13, 2026
Merged

webkit-commit-queue merged 1 commit into
WebKit:mainfrom
jeanhbr:eng/Implement-support-for-STL-formats-for-the-model-element

Conversation

@jeanhbr

@jeanhbr jeanhbr commented Nov 12, 2026 •

Copy link
Copy Markdown

2de44da

Implement support for STL formats for the model element
https://bugs.webkit.org/show_bug.cgi?id=331262
rdar://185985318

Reviewed by Mike Wyrzykowski.

Load STL models in the <model> element, behind the a temporary flag, off by default.

STL has no signature, so WebCore recognizes it by its structure, with the same checks as USDLib's
STL importer: binary STL is exactly 84 bytes plus 50 bytes per triangle, per the triangle count at
offset 80, and ASCII STL starts with "solid". WebCore gives STL models the model/stl MIME type,
which selects USDLib's STL file format when the stage is opened. Data that matches no format keeps
its Content-Type, so a server can also send model/stl. With STL disabled, an STL model fails to
load with a NotSupportedError.

Test: Tools/TestWebKitAPI/Tests/WebCore/MIMESniffer.cpp
Layout tests will be added in this follow-up: rdar://192563700

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::selectModelSource const):
(WebCore::modelMIMEType):
(WebCore::HTMLModelElement::modelResourceFinished):
* Source/WebCore/platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::isSTLMIMEType):
(WebCore::MIMETypeRegistry::isSupportedModelMIMEType):
* Source/WebCore/platform/MIMETypeRegistry.h:
* Source/WebKit/GPUProcess/graphics/Model/USDModel.swift:
(usdStageType(forMIMEType:)):
* Source/WebKit/ModelProcess/cocoa/WKUSDStageConverter.swift:
(os.usdStageType(forMIMEType:)):
* Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.cpp:
(WebKit::ModelProcessModelPlayer::load):
* Source/WebCore/platform/graphics/MIMESniffer.cpp:
(WebCore::MIMESniffer::isBinarySTL):
(WebCore::MIMESniffer::getModelMIMETypeFromContent):
* Tools/TestWebKitAPI/Tests/WebCore/MIMESniffer.cpp:
(TestWebKitAPI::TEST(MIMESniffer, ModelMIMETypes)):

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

3015ea2

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac   🛠 wpe   🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim-cmake ✅ 🛠 mac-cmake-debug   🧪 wpe-wk2   🧪 win-tests
✅ 🧪 webkitperl   🧪 ios-cmake-wk2   🧪 api-mac   🧪 api-wpe
  🧪 ios-cmake-wk2-wpt ✅ 🧪 api-mac-cmake-debug   🧪 jsc-wpe
✅ 🧪 jsc-x86-64   🧪 api-ios-cmake   🧪 mac-wk2 ✅ 🛠 gtk3-gcc
✅ 🛠 🧪 jsc-debug-arm64 ✅ 🛠 ios-safer-cpp   🧪 mac-cmake-debug-wk2 ✅ 🛠 gtk
✅ 🛠 vision   🧪 gtk-wk2
✅ 🛠 🧪 merge ✅ 🛠 vision-sim   🧪 mac-intel-wk2 ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🛠 mac-safer-cpp   🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@jeanhbr jeanhbr added the WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). label Nov 12, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need a runtime feature flag?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or should the runtime check be in isSupportedModelType instead of here? Or that is not possible, because we don't have a document in isSupportedModelType?

@jeanhbr
jeanhbr force-pushed the eng/Implement-support-for-STL-formats-for-the-model-element branch from eaf19e8 to 3015ea2 Compare November 13, 2026 13:28
@jeanhbr jeanhbr added the merge-queue Applied to send a pull request to merge-queue label Nov 13, 2026
https://bugs.webkit.org/show_bug.cgi?id=331262
rdar://185985318

Reviewed by Mike Wyrzykowski.

Load STL models in the <model> element, behind the a temporary flag, off by default.

STL has no signature, so WebCore recognizes it by its structure, with the same checks as USDLib's
STL importer: binary STL is exactly 84 bytes plus 50 bytes per triangle, per the triangle count at
offset 80, and ASCII STL starts with "solid". WebCore gives STL models the model/stl MIME type,
which selects USDLib's STL file format when the stage is opened. Data that matches no format keeps
its Content-Type, so a server can also send model/stl. With STL disabled, an STL model fails to
load with a NotSupportedError.

Test: Tools/TestWebKitAPI/Tests/WebCore/MIMESniffer.cpp
Layout tests will be added in this follow-up: rdar://192563700

* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* Source/WebCore/Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::selectModelSource const):
(WebCore::modelMIMEType):
(WebCore::HTMLModelElement::modelResourceFinished):
* Source/WebCore/platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::isSTLMIMEType):
(WebCore::MIMETypeRegistry::isSupportedModelMIMEType):
* Source/WebCore/platform/MIMETypeRegistry.h:
* Source/WebKit/GPUProcess/graphics/Model/USDModel.swift:
(usdStageType(forMIMEType:)):
* Source/WebKit/ModelProcess/cocoa/WKUSDStageConverter.swift:
(os.usdStageType(forMIMEType:)):
* Source/WebKit/WebProcess/Model/ModelProcessModelPlayer.cpp:
(WebKit::ModelProcessModelPlayer::load):
* Source/WebCore/platform/graphics/MIMESniffer.cpp:
(WebCore::MIMESniffer::isBinarySTL):
(WebCore::MIMESniffer::getModelMIMETypeFromContent):
* Tools/TestWebKitAPI/Tests/WebCore/MIMESniffer.cpp:
(TestWebKitAPI::TEST(MIMESniffer, ModelMIMETypes)):

Canonical link: https://commits.webkit.org/326648@main
@webkit-commit-queue
webkit-commit-queue force-pushed the eng/Implement-support-for-STL-formats-for-the-model-element branch from 3015ea2 to 2de44da Compare November 13, 2026 15:50
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 326648@main (2de44da): https://commits.webkit.org/326648@main

Reviewed commits have been landed. Closing PR #80652 and removing active labels.

@webkit-commit-queue
webkit-commit-queue merged commit 2de44da into WebKit:main Nov 13, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Nov 13, 2026
@jeanhbr
jeanhbr deleted the eng/Implement-support-for-STL-formats-for-the-model-element branch November 13, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants