Diff
Modified: trunk/LayoutTests/ChangeLog (285935 => 285936)
--- trunk/LayoutTests/ChangeLog 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/LayoutTests/ChangeLog 2021-11-17 18:46:04 UTC (rev 285936)
@@ -1,3 +1,19 @@
+2021-11-17 Dean Jackson <[email protected]>
+
+ Add ModelDocument for directly showing content that can be handled by <model>
+ https://bugs.webkit.org/show_bug.cgi?id=233057
+ rdar://85265880
+
+ Reviewed by Darin Adler.
+
+ New test for ModelDocument.
+
+ * http/conf/mime.types: Configure the testing Apache server to serve USDZ files
+ with the correct MIME type.
+ * http/tests/model/UnitBox.usdz: Sample file.
+ * http/tests/model/model-document-expected.txt: Added.
+ * http/tests/model/model-document.html: New test for a ModelDocument.
+
2021-11-17 Youenn Fablet <[email protected]>
Safari 15.1 H264 FullHD video encode/decode fails
Modified: trunk/LayoutTests/http/conf/mime.types (285935 => 285936)
--- trunk/LayoutTests/http/conf/mime.types 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/LayoutTests/http/conf/mime.types 2021-11-17 18:46:04 UTC (rev 285936)
@@ -515,6 +515,7 @@
model/vnd.mts
model/vnd.parasolid.transmit.binary
model/vnd.parasolid.transmit.text
+model/vnd.usdz+zip usdz
model/vnd.vtu
model/vrml wrl vrml
multipart/alternative
Added: trunk/LayoutTests/http/tests/model/UnitBox.usdz (0 => 285936)
--- trunk/LayoutTests/http/tests/model/UnitBox.usdz (rev 0)
+++ trunk/LayoutTests/http/tests/model/UnitBox.usdz 2021-11-17 18:46:04 UTC (rev 285936)
@@ -0,0 +1,16 @@
+PK
+����������\xFB\x92\x8CRVb =\xF8����\xF8��������tempOutput.usdc\x86��������������������������������PXR-USDC��������������0��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
+@��������������������������������������������
+@���������������������������������������������������������������������������������������������������������������������������������������������������� ������������!��������������������"������#��������������������%��������������������&��������������������(������&������)������*������+��������������������'��������������������(������&��������������������������������������������������������������������������������������������$��������������0����������������\xF0������UEUUQUUPU+\xED\xF3\xFC+\xF7 \xFE\xFD\xFA \xF7\xF3\xF9+\xEF\xFD\xFD\xFC\xF3\xEFcA\xB5<\x8D\x8ER>\xCE\xCCL?��������������������������������������������������������������������������������������\x80\xBF������������\x80?������\x80����\x80?��������������\x80������������\x80\xBF������\x80��������������������\x80\xBF����\x80?��������������\x80��������������������\x80?������������\x80?������\x80����\x80?��������������\x80������������\x80\xBF������\x80����
����������������\x80?����\x80?��������������\x80����\x80\xBF��������������\x80��������������������\x80\xBF������������\x80?������\x80����\x80\xBF��������������\x80������������\x80\xBF������\x80��������������������\x80\xBF����\x80\xBF��������������\x80��������������������\x80?������������\x80?������\x80����\x80\xBF��������������\x80������������\x80\xBF������\x80��������������������\x80?������������������������������������������������������������������������?����\x80?������\xBF������?����\x80?������\xBF������?����\x80?��
����\xBF������?��������������\xBF������?��������������\xBF������?��������������\xBF������?����\x80?������?������?����\x80?������?������?����\x80?������?������?��������������?������?��������������?������?��������������?������\xBF����\x80?������\xBF������\xBF����\x80?������\xBF������\xBF����\x80?������\xBF������\xBF��������������\xBF������\xBF��������������\xBF������\xBF��������������\xBF������\xBF����\x80?������?������\xBF����\x80?������?������\xBF����\x80?������?������\xBF��������������?������\xBF��������������?������\xBF��������������?������������������ ?������?���� ?������?���� ?������?����\xC0>������?����\xC0>������?����\xC0>������?���� ?����@?���� ?����@?���� ?����@?����\xC0>����@?����\xC0>����@?����\xC0>����@?���� ?����\x80>���� ?����\x80>����`?������?����\xC0>����\x80>������>������?����\xC0>����\x80>���� ?������������ ?����\x80?����`?����@?����\xC0>��������������>����@?����\xC0>����\x80? \x92\xF7>oz\xAC>f\xB6U\xBE\xB7\xCDG
?������@\x81o@��������O\xD5@������\x80\xB4@������������������������������������������������������������������������
+@@��������������\xD4������������\��������������\xF0%��upAxis��Y��primChildren��UnitBox��defaultPrim��metersPer��\xF0G��customLayerData��creator��usdzconvert preview 0.62��specifier��typeName��Xform��assetInfo��n��\xF3kind��component��Materials��Geom��properties��m��\xF0:binding��Scope��Camera��x\��\xC4Op:translate��TOrder+��A:orif��\xA1esh��points \xC0vars:st��norm|��\xF8faceVertexIndice��0Cou7��\xF4subdivisionScheme��doubleSided��Blue\xCB��VC'%er�� ��0surs��0Sha\xAD��\x83outputs:������\xA1info:id��in��\xB0diffuseColo����\x84metallic$��\xF4roughness��bool��variability\x95��\xA0��int[]��tok2sdP\xC4S\x91�� ��c^��\xF33f��float��targetPaths+@3f[]C��\xB0erpolation��\x90ex��connec��0��n/��D@ord2<��\xA3none��quatf@3\x8C��`[]��Rea\xAA�� 8X 20 (q`0.62)���������������������� ������������������?������7��������������>����������������R#������U��\xF1
+UTE\xF4\xF8\xF8\xF8\xF0��\xF0\xF8"\xDD��\xDD\xDD\xDD����\xD7��\xD3\xDD��\xDD\xDD\xDD+�������������� ����0@X��A��)����\xC0@����\x80?���� @x����a������*@��1@\x80��1����1@\x9C��3)��\xAC����1@\xB8��3)��\xC8����1@\xDC��@)�� ��0)��$��C��@�� ��'��,��H��T��, ����#��,��3@/��d��2\x80\x9C��#\xA00��1��2��\xDC ��3��3����\xC1��@\xCD\xCC\xCC>����@\xF5 ��3"��\xE8��5!��1@A3\x807�� 0 ��3"��=��9��A��@P��3\x80:��xi3\x80;��<��@p3��=��P��3��>��\x80h��������\x80m��������������w����������������\xF0e��������EUTTUUPTUEQUUAUUQUUU��\xFB\xF5\xF3\xF2 \xF0\xEF\xEC\xEA\xFB\xEC\xE8\xE5\xE3\xE2\xFB\xE0!\xDE#\xDC#\xDB\xDA+\xD9(\xD6\xD5\xE1+\xD4-\xD2/\xFB\xD0\xFB\xCF2\xCD4\xCB6\xE4\xC9����������������������������#����������������\xF0������QDT��\xEF\xE6\xEA\xF1\xF3\xF1 )����������������\xF0\xFF\xFF\xFF\xF
FUUUT��\xE8&\xD1\xDB
+\xF7\xFC1\xB8K\xB3I\xB7M\xB1#����������������\xF0��������QE��UT\xFF\xF6\xFC\xFE\xFE \xF8\xFF\xFE\xFF\xFE������������������������������@��������\xD0PU����\xFF\xFF\xFF#����������������\xF0������@UQ����\xFE����������������\xF0����������������\xFF\xFB\xF9��������������TOKENS��������������������\x94������������t������������STRINGS��������������������������������������������FIELDS��������������������$������������\x81������������FIELDSETS��������������\xA5 ������������\x87��������������PATHS����������������������,
+������������\x97��������������SPECS����������������������\xC3
+������������m��������������PK����
+����������\xFB\x92\x8CRVb =\xF8����\xF8������������������������������������tempOutput.usdc\x86��������������������������������PK������������P������8��������
\ No newline at end of file
Added: trunk/LayoutTests/http/tests/model/model-document-expected.txt (0 => 285936)
--- trunk/LayoutTests/http/tests/model/model-document-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/model/model-document-expected.txt 2021-11-17 18:46:04 UTC (rev 285936)
@@ -0,0 +1,5 @@
+Basic ModelDocument test.
+
+PASS: <model> and <source> seen in iframe.
+
+
Property changes on: trunk/LayoutTests/http/tests/model/model-document-expected.txt
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/plain
\ No newline at end of property
Added: trunk/LayoutTests/http/tests/model/model-document.html (0 => 285936)
--- trunk/LayoutTests/http/tests/model/model-document.html (rev 0)
+++ trunk/LayoutTests/http/tests/model/model-document.html 2021-11-17 18:46:04 UTC (rev 285936)
@@ -0,0 +1,38 @@
+<html>
+<head>
+<script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ }
+
+ function run()
+ {
+ const frame = document.createElement("iframe");
+ frame.addEventListener("load", function () {
+ const output = document.getElementById("output");
+ const model = frame.contentDocument.querySelector("model");
+ const source = frame.contentDocument.querySelector("model source");
+ if (!model)
+ output.textContent = "FAIL: <model> not seen in iframe.";
+ else if (!source)
+ output.textContent = "FAIL: <model> found, but no <source> child.";
+ else
+ output.textContent = "PASS: <model> and <source> seen in iframe.";
+
+ if (window.testRunner)
+ testRunner.notifyDone();
+ });
+ frame.src = ""
+ document.body.appendChild(frame);
+ }
+ window.addEventListener("load", run, false);
+</script>
+</head>
+<body>
+<p>
+Basic ModelDocument test.
+<p>
+<p id="output"></p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/http/tests/model/model-document.html
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Revision
\ No newline at end of property
Added: svn:mime-type
+text/html
\ No newline at end of property
Modified: trunk/LayoutTests/platform/mac/TestExpectations (285935 => 285936)
--- trunk/LayoutTests/platform/mac/TestExpectations 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2021-11-17 18:46:04 UTC (rev 285936)
@@ -1713,6 +1713,7 @@
[ Catalina Mojave BigSur ] webaudio/decode-audio-data-webm-opus.html [ Skip ]
[ Catalina Mojave BigSur ] webaudio/decode-audio-data-webm-opus-resample.html [ Skip ]
[ Catalina Mojave BigSur ] webaudio/decode-audio-data-webm-vorbis.html [ Skip ]
+[ Catalina Mojave BigSur ] http/tests/model/model-document.html [ Skip ]
webkit.org/b/214422 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/suspend-after-construct.html [ Pass Failure ]
Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (285935 => 285936)
--- trunk/LayoutTests/platform/mac-wk1/TestExpectations 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations 2021-11-17 18:46:04 UTC (rev 285936)
@@ -47,6 +47,7 @@
css-typedom [ Skip ]
css-dark-mode [ Skip ]
model-element [ Skip ]
+http/tests/model [ Skip ]
# Media Stream API testing is not supported for WK1 yet.
fast/mediastream
Modified: trunk/LayoutTests/platform/win/TestExpectations (285935 => 285936)
--- trunk/LayoutTests/platform/win/TestExpectations 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/LayoutTests/platform/win/TestExpectations 2021-11-17 18:46:04 UTC (rev 285936)
@@ -132,6 +132,9 @@
fast/harness/platform-layer-tree-as-text.html [ Skip ]
model-element/model-element-graphics-layers-opacity.html [ Skip ]
+# Apple Cocoa only for the moment.
+http/tests/model [ Skip ]
+
# color-filters are off by default
webkit.org/b/185076 css3/color-filters [ Skip ]
Modified: trunk/Source/WTF/ChangeLog (285935 => 285936)
--- trunk/Source/WTF/ChangeLog 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WTF/ChangeLog 2021-11-17 18:46:04 UTC (rev 285936)
@@ -1,3 +1,16 @@
+2021-11-17 Dean Jackson <[email protected]>
+
+ Add ModelDocument for directly showing content that can be handled by <model>
+ https://bugs.webkit.org/show_bug.cgi?id=233057
+ rdar://85265880
+
+ Reviewed by Darin Adler.
+
+ Add a experimental feature: ModelDocumentEnabled
+ for loading content that can be handled by <model>.
+
+ * Scripts/Preferences/WebPreferencesExperimental.yaml:
+
2021-11-16 Devin Rousso <[email protected]>
[iOS] use PhotosUIPrivate instead of PhotosUI
Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (285935 => 285936)
--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml 2021-11-17 18:46:04 UTC (rev 285936)
@@ -894,6 +894,19 @@
WebKit:
default: false
+ModelDocumentEnabled:
+ type: bool
+ humanReadableName: "HTML <model> elements for stand-alone document"
+ humanReadableDescription: "HTML <model> element for model documents"
+ condition: ENABLE(MODEL_ELEMENT)
+ webcoreBinding: RuntimeEnabledFeatures
+ defaultValue:
+ WebKitLegacy:
+ default: false
+ WebKit:
+ "ENABLE(SEPARATED_MODEL)": true
+ default: false
+
ModelElementEnabled:
type: bool
humanReadableName: "HTML <model> element"
Modified: trunk/Source/WebCore/ChangeLog (285935 => 285936)
--- trunk/Source/WebCore/ChangeLog 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WebCore/ChangeLog 2021-11-17 18:46:04 UTC (rev 285936)
@@ -1,3 +1,42 @@
+2021-11-17 Dean Jackson <[email protected]>
+
+ Add ModelDocument for directly showing content that can be handled by <model>
+ https://bugs.webkit.org/show_bug.cgi?id=233057
+ rdar://85265880
+
+ Reviewed by Darin Adler.
+
+ Add a new ModelDocument class that is created when we encounter a MIME-type that
+ can be handled by the <model> element.
+
+ Test: http/tests/model/model-document.html
+
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj: Add new files.
+
+ * dom/DOMImplementation.cpp:
+ (WebCore::DOMImplementation::createDocument): Create a ModelDocument when we
+ see a MIME-type that <model> can support.
+
+ * dom/Document.h: Add a new ModelDocumentClass which meant I also had to
+ increase the sizeof DocumentClassFlags.
+ (WebCore::Document::isModelDocument const):
+
+ * html/ModelDocument.cpp: Added.
+ (WebCore::ModelDocumentParser::createDocumentStructure):
+ (WebCore::ModelDocumentParser::appendBytes):
+ (WebCore::ModelDocumentParser::finish):
+ (WebCore::ModelDocument::ModelDocument):
+ (WebCore::ModelDocument::createParser):
+ * html/ModelDocument.h: Added.
+ (isType):
+
+ * platform/MIMETypeRegistry.cpp: Add isSupportedModelMIMEType and test for it
+ in canShowMIMEType.
+ (WebCore::MIMETypeRegistry::canShowMIMEType):
+ (WebCore::MIMETypeRegistry::isSupportedModelMIMEType):
+ * platform/MIMETypeRegistry.h:
+
2021-11-17 Commit Queue <[email protected]>
Unreviewed, reverting r285934.
Modified: trunk/Source/WebCore/Sources.txt (285935 => 285936)
--- trunk/Source/WebCore/Sources.txt 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WebCore/Sources.txt 2021-11-17 18:46:04 UTC (rev 285936)
@@ -1293,6 +1293,7 @@
html/MediaDocument.cpp
html/MediaElementSession.cpp
html/MediaFragmentURIParser.cpp
+html/ModelDocument.cpp
html/MonthInputType.cpp
html/NumberInputType.cpp
html/OffscreenCanvas.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (285935 => 285936)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-11-17 18:46:04 UTC (rev 285936)
@@ -943,6 +943,7 @@
3135910B1E7DDC7300F30630 /* RTCSignalingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 313591051E7DDC6000F30630 /* RTCSignalingState.h */; };
313BCE1C235E3BE500FC39E5 /* ElementContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 313BCE1B235E3BDB00FC39E5 /* ElementContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
313DE87023A96973008FC47B /* GraphicsContextGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 313DE86F23A96967008FC47B /* GraphicsContextGL.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 313E79EA273C86B80097F905 /* ModelDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 313E79E9273C86B80097F905 /* ModelDocument.h */; };
3140379B124BEA7F00AF40E4 /* WebCoreMotionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 31403797124BEA7F00AF40E4 /* WebCoreMotionManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
3140379D124BEA7F00AF40E4 /* DeviceOrientationClientIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 31403799124BEA7F00AF40E4 /* DeviceOrientationClientIOS.h */; };
3140C5201FDF151A00D2A873 /* OffscreenCanvasRenderingContext2D.h in Headers */ = {isa = PBXBuildFile; fileRef = 3140C51E1FDF151A00D2A873 /* OffscreenCanvasRenderingContext2D.h */; };
@@ -7902,6 +7903,8 @@
313BCE1B235E3BDB00FC39E5 /* ElementContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementContext.h; sourceTree = "<group>"; };
313DE86D23A96966008FC47B /* GraphicsContextGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextGL.cpp; sourceTree = "<group>"; };
313DE86F23A96967008FC47B /* GraphicsContextGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGL.h; sourceTree = "<group>"; };
+ 313E79E9273C86B80097F905 /* ModelDocument.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ModelDocument.h; sourceTree = "<group>"; };
+ 313E79EC273C86E80097F905 /* ModelDocument.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ModelDocument.cpp; sourceTree = "<group>"; };
31403797124BEA7F00AF40E4 /* WebCoreMotionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreMotionManager.h; sourceTree = "<group>"; };
31403798124BEA7F00AF40E4 /* WebCoreMotionManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreMotionManager.mm; sourceTree = "<group>"; };
31403799124BEA7F00AF40E4 /* DeviceOrientationClientIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationClientIOS.h; sourceTree = "<group>"; };
@@ -18954,11 +18957,11 @@
1A569CC40D7E2B60007C3983 /* bridge */ = {
isa = PBXGroup;
children = (
- 59B5977111086556007159E8 /* jsc */,
1A569CE20D7E2B82007C3983 /* objc */,
599E758F11055A1F00D904FA /* Bridge.h */,
1A71D5790F33819000F9CE4E /* IdentifierRep.cpp */,
1A71D57A0F33819000F9CE4E /* IdentifierRep.h */,
+ 59B5977111086556007159E8 /* jsc */,
1A569CEF0D7E2B82007C3983 /* runtime_array.cpp */,
1A569CF00D7E2B82007C3983 /* runtime_array.h */,
1A569CF10D7E2B82007C3983 /* runtime_method.cpp */,
@@ -24895,6 +24898,8 @@
E446139C0CD6331000FADA75 /* MediaError.idl */,
07A6D1E91491137700051D0C /* MediaFragmentURIParser.cpp */,
07A6D1EA1491137700051D0C /* MediaFragmentURIParser.h */,
+ 313E79EC273C86E80097F905 /* ModelDocument.cpp */,
+ 313E79E9273C86B80097F905 /* ModelDocument.h */,
F55B3D911251F12D003EF269 /* MonthInputType.cpp */,
F55B3D921251F12D003EF269 /* MonthInputType.h */,
F55B3D931251F12D003EF269 /* NumberInputType.cpp */,
@@ -35213,6 +35218,7 @@
CDF2B0191820540700F2B424 /* MockTracks.h in Headers */,
5715610C234C1CA1008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */,
2DC8D39825F2FE9700CFCBAB /* Model.h in Headers */,
+ 313E79EA273C86B80097F905 /* ModelDocument.h in Headers */,
BC2B41172732F41E00A2D191 /* ModelPlayer.h in Headers */,
BC2B41192732F42900A2D191 /* ModelPlayerClient.h in Headers */,
BC2B41182732F42300A2D191 /* ModelPlayerProvider.h in Headers */,
Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (285935 => 285936)
--- trunk/Source/WebCore/dom/DOMImplementation.cpp 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WebCore/dom/DOMImplementation.cpp 2021-11-17 18:46:04 UTC (rev 285936)
@@ -45,6 +45,7 @@
#include "Page.h"
#include "PluginData.h"
#include "PluginDocument.h"
+#include "RuntimeEnabledFeatures.h"
#include "SVGDocument.h"
#include "SVGNames.h"
#include "SecurityOrigin.h"
@@ -57,6 +58,10 @@
#include <wtf/IsoMallocInlines.h>
#include <wtf/StdLibExtras.h>
+#if ENABLE(MODEL_ELEMENT)
+#include "ModelDocument.h"
+#endif
+
namespace WebCore {
using namespace HTMLNames;
@@ -162,6 +167,11 @@
return MediaDocument::create(frame, settings, url);
#endif
+#if ENABLE(MODEL_ELEMENT)
+ if (MIMETypeRegistry::isUSDMIMEType(contentType) && RuntimeEnabledFeatures::sharedFeatures().modelDocumentEnabled())
+ return ModelDocument::create(frame, settings, url);
+#endif
+
#if ENABLE(FTPDIR)
if (equalLettersIgnoringASCIICase(contentType, "application/x-ftp-directory"))
return FTPDirectoryDocument::create(frame, settings, url);
Modified: trunk/Source/WebCore/dom/Document.h (285935 => 285936)
--- trunk/Source/WebCore/dom/Document.h 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WebCore/dom/Document.h 2021-11-17 18:46:04 UTC (rev 285936)
@@ -302,8 +302,11 @@
SVGDocumentClass = 1 << 5,
TextDocumentClass = 1 << 6,
XMLDocumentClass = 1 << 7,
+#if ENABLE(MODEL_ELEMENT)
+ ModelDocumentClass = 1 << 8,
+#endif
};
-using DocumentClassFlags = unsigned char;
+using DocumentClassFlags = uint16_t;
enum class DocumentCompatibilityMode : unsigned char {
NoQuirksMode = 1,
@@ -540,6 +543,9 @@
bool isPluginDocument() const { return m_documentClasses & PluginDocumentClass; }
bool isMediaDocument() const { return m_documentClasses & MediaDocumentClass; }
bool isTextDocument() const { return m_documentClasses & TextDocumentClass; }
+#if ENABLE(MODEL_ELEMENT)
+ bool isModelDocument() const { return m_documentClasses & ModelDocumentClass; }
+#endif
bool hasSVGRootNode() const;
virtual bool isFrameSet() const { return false; }
Added: trunk/Source/WebCore/html/ModelDocument.cpp (0 => 285936)
--- trunk/Source/WebCore/html/ModelDocument.cpp (rev 0)
+++ trunk/Source/WebCore/html/ModelDocument.cpp 2021-11-17 18:46:04 UTC (rev 285936)
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ModelDocument.h"
+
+#if ENABLE(MODEL_ELEMENT)
+
+#include "Document.h"
+#include "DocumentLoader.h"
+#include "EventNames.h"
+#include "FrameLoader.h"
+#include "FrameLoaderClient.h"
+#include "HTMLBodyElement.h"
+#include "HTMLHeadElement.h"
+#include "HTMLHtmlElement.h"
+#include "HTMLMetaElement.h"
+#include "HTMLModelElement.h"
+#include "HTMLNames.h"
+#include "HTMLSourceElement.h"
+#include "HTMLStyleElement.h"
+#include "RawDataDocumentParser.h"
+#include <wtf/IsoMallocInlines.h>
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(ModelDocument);
+
+using namespace HTMLNames;
+
+class ModelDocumentParser final : public RawDataDocumentParser {
+public:
+ static Ref<ModelDocumentParser> create(ModelDocument& document)
+ {
+ return adoptRef(*new ModelDocumentParser(document));
+ }
+
+private:
+ ModelDocumentParser(ModelDocument& document)
+ : RawDataDocumentParser { document }
+ , m_outgoingReferrer { document.outgoingReferrer() }
+ {
+ }
+
+ void createDocumentStructure();
+
+ void appendBytes(DocumentWriter&, const uint8_t*, size_t) final;
+ void finish() final;
+
+ HTMLModelElement* m_modelElement { nullptr };
+ String m_outgoingReferrer;
+};
+
+void ModelDocumentParser::createDocumentStructure()
+{
+ auto& document = *this->document();
+
+ auto rootElement = HTMLHtmlElement::create(document);
+ document.appendChild(rootElement);
+ document.setCSSTarget(rootElement.ptr());
+ rootElement->insertedByParser();
+
+ if (document.frame())
+ document.frame()->injectUserScripts(UserScriptInjectionTime::DocumentStart);
+
+ auto headElement = HTMLHeadElement::create(document);
+ rootElement->appendChild(headElement);
+
+ auto metaElement = HTMLMetaElement::create(document);
+ metaElement->setAttributeWithoutSynchronization(nameAttr, AtomString("viewport", AtomString::ConstructFromLiteral));
+ metaElement->setAttributeWithoutSynchronization(contentAttr, AtomString("width=device-width,initial-scale=1", AtomString::ConstructFromLiteral));
+ headElement->appendChild(metaElement);
+
+ auto styleElement = HTMLStyleElement::create(document);
+ auto styleContent = "body { background-color: white; text-align: center; }\n"
+ "@media (prefers-color-scheme: dark) { body { background-color: rgb(32, 32, 37); } }\n"
+ "model { width: 80vw; height: 80vh; }\n"_s;
+ styleElement->setTextContent(styleContent);
+ headElement->appendChild(styleElement);
+
+ auto body = HTMLBodyElement::create(document);
+ rootElement->appendChild(body);
+
+ auto modelElement = HTMLModelElement::create(HTMLNames::modelTag, document);
+ m_modelElement = modelElement.ptr();
+ modelElement->setAttributeWithoutSynchronization(controlsAttr, emptyAtom());
+
+ auto sourceElement = HTMLSourceElement::create(HTMLNames::sourceTag, document);
+ sourceElement->setAttributeWithoutSynchronization(srcAttr, document.url().string());
+ if (RefPtr loader = document.loader())
+ sourceElement->setAttributeWithoutSynchronization(typeAttr, loader->responseMIMEType());
+
+ modelElement->appendChild(sourceElement);
+
+ body->appendChild(modelElement);
+ document.setHasVisuallyNonEmptyCustomContent();
+
+ auto frame = document.frame();
+ if (!frame)
+ return;
+
+ frame->loader().activeDocumentLoader()->setMainResourceDataBufferingPolicy(DataBufferingPolicy::DoNotBufferData);
+ frame->loader().setOutgoingReferrer(document.completeURL(m_outgoingReferrer));
+}
+
+void ModelDocumentParser::appendBytes(DocumentWriter&, const uint8_t*, size_t)
+{
+ if (!m_modelElement)
+ createDocumentStructure();
+}
+
+void ModelDocumentParser::finish()
+{
+ document()->finishedParsing();
+}
+
+ModelDocument::ModelDocument(Frame* frame, const Settings& settings, const URL& url)
+ : HTMLDocument(frame, settings, url, ModelDocumentClass)
+{
+ if (frame)
+ m_outgoingReferrer = frame->loader().outgoingReferrer();
+}
+
+Ref<DocumentParser> ModelDocument::createParser()
+{
+ return ModelDocumentParser::create(*this);
+}
+
+}
+
+#endif
Property changes on: trunk/Source/WebCore/html/ModelDocument.cpp
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Author Id Revision HeadURL
\ No newline at end of property
Added: trunk/Source/WebCore/html/ModelDocument.h (0 => 285936)
--- trunk/Source/WebCore/html/ModelDocument.h (rev 0)
+++ trunk/Source/WebCore/html/ModelDocument.h 2021-11-17 18:46:04 UTC (rev 285936)
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2021 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(MODEL_ELEMENT)
+
+#include "HTMLDocument.h"
+
+namespace WebCore {
+
+class ModelDocument final : public HTMLDocument {
+ WTF_MAKE_ISO_ALLOCATED(ModelDocument);
+public:
+ static Ref<ModelDocument> create(Frame* frame, const Settings& settings, const URL& url)
+ {
+ return adoptRef(*new ModelDocument(frame, settings, url));
+ }
+
+ virtual ~ModelDocument() = default;
+
+ String outgoingReferrer() const { return m_outgoingReferrer; }
+
+private:
+ ModelDocument(Frame*, const Settings&, const URL&);
+
+ Ref<DocumentParser> createParser() override;
+
+ String m_outgoingReferrer;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ModelDocument)
+ static bool isType(const WebCore::Document& document) { return document.isModelDocument(); }
+ static bool isType(const WebCore::Node& node) { return is<WebCore::Document>(node) && isType(downcast<WebCore::Document>(node)); }
+SPECIALIZE_TYPE_TRAITS_END()
+
+#endif // ENABLE(MODEL_ELEMENT)
Property changes on: trunk/Source/WebCore/html/ModelDocument.h
___________________________________________________________________
Added: svn:eol-style
+native
\ No newline at end of property
Added: svn:keywords
+Date Author Id Revision HeadURL
\ No newline at end of property
Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (285935 => 285936)
--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h 2021-11-17 18:46:04 UTC (rev 285936)
@@ -258,6 +258,11 @@
bool builtInNotificationsEnabled() const { return m_builtInNotificationsEnabled; }
#endif
+#if ENABLE(MODEL_ELEMENT)
+ void setModelDocumentEnabled(bool isEnabled) { m_modelDocumentEnabled = isEnabled; }
+ bool modelDocumentEnabled() const { return m_modelDocumentEnabled; }
+#endif
+
private:
// Never instantiate.
RuntimeEnabledFeatures();
@@ -398,6 +403,10 @@
bool m_builtInNotificationsEnabled { false };
#endif
+#if ENABLE(MODEL_ELEMENT)
+ bool m_modelDocumentEnabled { false };
+#endif
+
friend class NeverDestroyed<RuntimeEnabledFeatures>;
};
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (285935 => 285936)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.cpp 2021-11-17 18:46:04 UTC (rev 285936)
@@ -658,6 +658,11 @@
return true;
#endif
+#if ENABLE(MODEL_ELEMENT)
+ if (isSupportedModelMIMEType(mimeType))
+ return true;
+#endif
+
if (startsWithLettersIgnoringASCIICase(mimeType, "text/"))
return !isUnsupportedTextMIMEType(mimeType);
@@ -688,6 +693,11 @@
return usdMIMETypeSet.contains(mimeType);
}
+bool MIMETypeRegistry::isSupportedModelMIMEType(const String& mimeType)
+{
+ return MIMETypeRegistry::isUSDMIMEType(mimeType);
+}
+
// FIXME: Not great that CURL needs this concept; other platforms do not.
static String normalizedImageMIMEType(const String& mimeType)
{
Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.h (285935 => 285936)
--- trunk/Source/WebCore/platform/MIMETypeRegistry.h 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WebCore/platform/MIMETypeRegistry.h 2021-11-17 18:46:04 UTC (rev 285936)
@@ -108,6 +108,8 @@
WEBCORE_EXPORT static bool isUSDMIMEType(const String& mimeType);
+ WEBCORE_EXPORT static bool isSupportedModelMIMEType(const String& mimeType);
+
// Check to see if a MIME type is suitable for being shown inside a page.
// Returns true if any of isSupportedImageMIMEType(), isSupportedNonImageMIMEType(),
// isSupportedMediaMIMEType(), isSupportedJavaScriptMIMEType(), isSupportedJSONMIMEType(),
Modified: trunk/Source/WebKit/ChangeLog (285935 => 285936)
--- trunk/Source/WebKit/ChangeLog 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WebKit/ChangeLog 2021-11-17 18:46:04 UTC (rev 285936)
@@ -1,3 +1,16 @@
+2021-11-17 Dean Jackson <[email protected]>
+
+ Add ModelDocument for directly showing content that can be handled by <model>
+ https://bugs.webkit.org/show_bug.cgi?id=233057
+ rdar://85265880
+
+ Reviewed by Darin Adler.
+
+ We don't need to use WKUSDPreviewView if we have ModelDocument.
+
+ * UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
+ (-[WKWebViewContentProviderRegistry initWithConfiguration:]):
+
2021-11-17 Antoine Quint <[email protected]>
[Model] Create iOS ModelPlayer implementation
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm (285935 => 285936)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm 2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm 2021-11-17 18:46:04 UTC (rev 285936)
@@ -54,7 +54,7 @@
[self registerProvider:[WKPDFView class] forMIMEType:@(type)];
#endif
-#if USE(SYSTEM_PREVIEW) && !HAVE(UIKIT_WEBKIT_INTERNALS)
+#if USE(SYSTEM_PREVIEW) && !HAVE(UIKIT_WEBKIT_INTERNALS) && !ENABLE(MODEL_ELEMENT)
if (configuration._systemPreviewEnabled) {
for (auto& type : WebCore::MIMETypeRegistry::usdMIMETypes())
[self registerProvider:[WKUSDPreviewView class] forMIMEType:@(type)];