<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[285936] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/285936">285936</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2021-11-17 10:46:04 -0800 (Wed, 17 Nov 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>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.

Source/WebCore:

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:

Source/WebKit:

We don't need to use WKUSDPreviewView if we have ModelDocument.

* UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm:
(-[WKWebViewContentProviderRegistry initWithConfiguration:]):

Source/WTF:

Add a experimental feature: ModelDocumentEnabled
for loading content that can be handled by <model>.

* Scripts/Preferences/WebPreferencesExperimental.yaml:

LayoutTests:

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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestshttpconfmimetypes">trunk/LayoutTests/http/conf/mime.types</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1TestExpectations">trunk/LayoutTests/platform/mac-wk1/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformwinTestExpectations">trunk/LayoutTests/platform/win/TestExpectations</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFScriptsPreferencesWebPreferencesExperimentalyaml">trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreSourcestxt">trunk/Source/WebCore/Sources.txt</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCoredomDOMImplementationcpp">trunk/Source/WebCore/dom/DOMImplementation.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
<li><a href="#trunkSourceWebCorepageRuntimeEnabledFeaturesh">trunk/Source/WebCore/page/RuntimeEnabledFeatures.h</a></li>
<li><a href="#trunkSourceWebCoreplatformMIMETypeRegistrycpp">trunk/Source/WebCore/platform/MIMETypeRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformMIMETypeRegistryh">trunk/Source/WebCore/platform/MIMETypeRegistry.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessCocoaWKWebViewContentProviderRegistrymm">trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/http/tests/model/</li>
<li><a href="#trunkLayoutTestshttptestsmodelUnitBoxusdz">trunk/LayoutTests/http/tests/model/UnitBox.usdz</a></li>
<li><a href="#trunkLayoutTestshttptestsmodelmodeldocumentexpectedtxt">trunk/LayoutTests/http/tests/model/model-document-expected.txt</a></li>
<li><a href="#trunkLayoutTestshttptestsmodelmodeldocumenthtml">trunk/LayoutTests/http/tests/model/model-document.html</a></li>
<li><a href="#trunkSourceWebCorehtmlModelDocumentcpp">trunk/Source/WebCore/html/ModelDocument.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlModelDocumenth">trunk/Source/WebCore/html/ModelDocument.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-11-17 18:44:12 UTC (rev 285935)
+++ trunk/LayoutTests/ChangeLog 2021-11-17 18:46:04 UTC (rev 285936)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2021-11-17  Dean Jackson  <dino@apple.com>
+
+        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.
+
</ins><span class="cx"> 2021-11-17  Youenn Fablet  <youenn@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Safari 15.1 H264 FullHD video encode/decode fails
</span></span></pre></div>
<a id="trunkLayoutTestshttpconfmimetypes"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/http/conf/mime.types (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -515,6 +515,7 @@
</span><span class="cx"> model/vnd.mts
</span><span class="cx"> model/vnd.parasolid.transmit.binary
</span><span class="cx"> model/vnd.parasolid.transmit.text
</span><ins>+model/vnd.usdz+zip usdz
</ins><span class="cx"> model/vnd.vtu
</span><span class="cx"> model/vrml                       wrl vrml
</span><span class="cx"> multipart/alternative
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsmodelUnitBoxusdz"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/model/UnitBox.usdz (0 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+PK
+\xFB\x92\x8CRVb      =\xF8 \xF8 tempOutput.usdc\x86PXR-USDC0 
+@
+@ !"#%&(&)*+'(& $0\xF0UEUUQUUPU+\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%upAxisYprimChildrenUnitBoxdefaultPrimmetersPer\xF0GcustomLayerDatacreatorusdzconvert preview 0.62specifiertypeNameXformassetInfon\xF3kindcomponentMaterialsGeompropertiesm\xF0:bindingScopeCamerax\\xC4Op:translateTOrder+A:orif\xA1eshpoints  \xC0vars:stnorm|\xF8faceVertexIndice0Cou7\xF4subdivisionSchemedoubleSidedBlue\xCBVC'%er       0surs0Sha\xAD\x83outputs:\xA1info:idin\xB0diffuseColo\x84metallic$\xF4 roughnessboolvariability\x95\xA0int[]tok2sdP\xC4S\x91 c^\xF33ffloattargetPaths+@3f[]C\xB0erpolation \x90exconnec0n/D@ord2<\xA3nonequatf@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 @XA)\xC0 @\x80?   @xa*@ 1 @\x8011 @\x9C3)\xAC1 @\xB83)\xC81 @\xDC@)  0)$C @ ',HT, #,3@/d2\x80\x9C#\xA0012\xDC 33\xC1@\xCD\xCC\xCC>@\xF5 3"\xE85!1 @A3\x807 0       3"=9A @P3\x80:xi3\x80;<@p3=P3>\x80h \x80mw\xF0eEUTTUUPTUEQUUAUUQUUU\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#\xF0QDT\xEF\xE6\xEA\xF1\xF3\xF1     )\xF0\xFF\xFF\xFF\xF
 FUUUT\xE8&\xD1\xDB
+\xF7\xFC1\xB8K\xB3I\xB7M\xB1#\xF0QEUT\xFF\xF6\xFC\xFE\xFE       \xF8\xFF\xFE\xFF\xFE@\xD0PU\xFF\xFF\xFF#\xF0@UQ\xFE\xF0\xFF\xFB\xF9TOKENS\x94tSTRINGSFIELDS$\x81FIELDSETS\xA5 \x87PATHS,
+\x97SPECS\xC3
+mPK
+\xFB\x92\x8CRVb      =\xF8 \xF8 tempOutput.usdc\x86PKP8
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestshttptestsmodelmodeldocumentexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/model/model-document-expected.txt (0 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,5 @@
</span><ins>+Basic ModelDocument test.
+
+PASS: <model> and <source> seen in iframe.
+
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/http/tests/model/model-document-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<ins>+Date Revision
</ins><span class="cx">\ No newline at end of property
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+text/plain
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestshttptestsmodelmodeldocumenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/http/tests/model/model-document.html (0 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -0,0 +1,38 @@
</span><ins>+<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 = "UnitBox.usdz";
+        document.body.appendChild(frame);
+    }
+    window.addEventListener("load", run, false);
+</script>
+</head>
+<body>
+<p>
+Basic ModelDocument test.
+<p>
+<p id="output"></p>
+</body>
+</html>
</ins><span class="cx">Property changes on: trunk/LayoutTests/http/tests/model/model-document.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<ins>+Date Revision
</ins><span class="cx">\ No newline at end of property
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<ins>+text/html
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1713,6 +1713,7 @@
</span><span class="cx"> [ Catalina Mojave BigSur ] webaudio/decode-audio-data-webm-opus.html [ Skip ]
</span><span class="cx"> [ Catalina Mojave BigSur ] webaudio/decode-audio-data-webm-opus-resample.html [ Skip ]
</span><span class="cx"> [ Catalina Mojave BigSur ] webaudio/decode-audio-data-webm-vorbis.html [ Skip ]
</span><ins>+[ Catalina Mojave BigSur ] http/tests/model/model-document.html [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> webkit.org/b/214422 imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/suspend-after-construct.html [ Pass Failure ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx"> css-typedom [ Skip ]
</span><span class="cx"> css-dark-mode [ Skip ]
</span><span class="cx"> model-element [ Skip ]
</span><ins>+http/tests/model [ Skip ]
</ins><span class="cx"> 
</span><span class="cx"> # Media Stream API testing is not supported for WK1 yet.
</span><span class="cx"> fast/mediastream
</span></span></pre></div>
<a id="trunkLayoutTestsplatformwinTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/win/TestExpectations (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -132,6 +132,9 @@
</span><span class="cx"> fast/harness/platform-layer-tree-as-text.html [ Skip ]
</span><span class="cx"> model-element/model-element-graphics-layers-opacity.html [ Skip ]
</span><span class="cx"> 
</span><ins>+# Apple Cocoa only for the moment.
+http/tests/model [ Skip ]
+
</ins><span class="cx"> # color-filters are off by default
</span><span class="cx"> webkit.org/b/185076 css3/color-filters [ Skip ]
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2021-11-17  Dean Jackson  <dino@apple.com>
+
+        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:
+
</ins><span class="cx"> 2021-11-16  Devin Rousso  <drousso@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [iOS] use PhotosUIPrivate instead of PhotosUI
</span></span></pre></div>
<a id="trunkSourceWTFScriptsPreferencesWebPreferencesExperimentalyaml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -894,6 +894,19 @@
</span><span class="cx">     WebKit:
</span><span class="cx">       default: false
</span><span class="cx"> 
</span><ins>+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
+
</ins><span class="cx"> ModelElementEnabled:
</span><span class="cx">   type: bool
</span><span class="cx">   humanReadableName: "HTML <model> element"
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,42 @@
</span><ins>+2021-11-17  Dean Jackson  <dino@apple.com>
+
+        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:
+
</ins><span class="cx"> 2021-11-17  Commit Queue  <commit-queue@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, reverting r285934.
</span></span></pre></div>
<a id="trunkSourceWebCoreSourcestxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Sources.txt (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1293,6 +1293,7 @@
</span><span class="cx"> html/MediaDocument.cpp
</span><span class="cx"> html/MediaElementSession.cpp
</span><span class="cx"> html/MediaFragmentURIParser.cpp
</span><ins>+html/ModelDocument.cpp
</ins><span class="cx"> html/MonthInputType.cpp
</span><span class="cx"> html/NumberInputType.cpp
</span><span class="cx"> html/OffscreenCanvas.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -943,6 +943,7 @@
</span><span class="cx">          3135910B1E7DDC7300F30630 /* RTCSignalingState.h in Headers */ = {isa = PBXBuildFile; fileRef = 313591051E7DDC6000F30630 /* RTCSignalingState.h */; };
</span><span class="cx">          313BCE1C235E3BE500FC39E5 /* ElementContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 313BCE1B235E3BDB00FC39E5 /* ElementContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          313DE87023A96973008FC47B /* GraphicsContextGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 313DE86F23A96967008FC47B /* GraphicsContextGL.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+               313E79EA273C86B80097F905 /* ModelDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 313E79E9273C86B80097F905 /* ModelDocument.h */; };
</ins><span class="cx">           3140379B124BEA7F00AF40E4 /* WebCoreMotionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 31403797124BEA7F00AF40E4 /* WebCoreMotionManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">          3140379D124BEA7F00AF40E4 /* DeviceOrientationClientIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 31403799124BEA7F00AF40E4 /* DeviceOrientationClientIOS.h */; };
</span><span class="cx">          3140C5201FDF151A00D2A873 /* OffscreenCanvasRenderingContext2D.h in Headers */ = {isa = PBXBuildFile; fileRef = 3140C51E1FDF151A00D2A873 /* OffscreenCanvasRenderingContext2D.h */; };
</span><span class="lines">@@ -7902,6 +7903,8 @@
</span><span class="cx">          313BCE1B235E3BDB00FC39E5 /* ElementContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementContext.h; sourceTree = "<group>"; };
</span><span class="cx">          313DE86D23A96966008FC47B /* GraphicsContextGL.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContextGL.cpp; sourceTree = "<group>"; };
</span><span class="cx">          313DE86F23A96967008FC47B /* GraphicsContextGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextGL.h; sourceTree = "<group>"; };
</span><ins>+               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>"; };
</ins><span class="cx">           31403797124BEA7F00AF40E4 /* WebCoreMotionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreMotionManager.h; sourceTree = "<group>"; };
</span><span class="cx">          31403798124BEA7F00AF40E4 /* WebCoreMotionManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreMotionManager.mm; sourceTree = "<group>"; };
</span><span class="cx">          31403799124BEA7F00AF40E4 /* DeviceOrientationClientIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DeviceOrientationClientIOS.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -18954,11 +18957,11 @@
</span><span class="cx">          1A569CC40D7E2B60007C3983 /* bridge */ = {
</span><span class="cx">                  isa = PBXGroup;
</span><span class="cx">                  children = (
</span><del>-                               59B5977111086556007159E8 /* jsc */,
</del><span class="cx">                           1A569CE20D7E2B82007C3983 /* objc */,
</span><span class="cx">                          599E758F11055A1F00D904FA /* Bridge.h */,
</span><span class="cx">                          1A71D5790F33819000F9CE4E /* IdentifierRep.cpp */,
</span><span class="cx">                          1A71D57A0F33819000F9CE4E /* IdentifierRep.h */,
</span><ins>+                               59B5977111086556007159E8 /* jsc */,
</ins><span class="cx">                           1A569CEF0D7E2B82007C3983 /* runtime_array.cpp */,
</span><span class="cx">                          1A569CF00D7E2B82007C3983 /* runtime_array.h */,
</span><span class="cx">                          1A569CF10D7E2B82007C3983 /* runtime_method.cpp */,
</span><span class="lines">@@ -24895,6 +24898,8 @@
</span><span class="cx">                          E446139C0CD6331000FADA75 /* MediaError.idl */,
</span><span class="cx">                          07A6D1E91491137700051D0C /* MediaFragmentURIParser.cpp */,
</span><span class="cx">                          07A6D1EA1491137700051D0C /* MediaFragmentURIParser.h */,
</span><ins>+                               313E79EC273C86E80097F905 /* ModelDocument.cpp */,
+                               313E79E9273C86B80097F905 /* ModelDocument.h */,
</ins><span class="cx">                           F55B3D911251F12D003EF269 /* MonthInputType.cpp */,
</span><span class="cx">                          F55B3D921251F12D003EF269 /* MonthInputType.h */,
</span><span class="cx">                          F55B3D931251F12D003EF269 /* NumberInputType.cpp */,
</span><span class="lines">@@ -35213,6 +35218,7 @@
</span><span class="cx">                          CDF2B0191820540700F2B424 /* MockTracks.h in Headers */,
</span><span class="cx">                          5715610C234C1CA1008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */,
</span><span class="cx">                          2DC8D39825F2FE9700CFCBAB /* Model.h in Headers */,
</span><ins>+                               313E79EA273C86B80097F905 /* ModelDocument.h in Headers */,
</ins><span class="cx">                           BC2B41172732F41E00A2D191 /* ModelPlayer.h in Headers */,
</span><span class="cx">                          BC2B41192732F42900A2D191 /* ModelPlayerClient.h in Headers */,
</span><span class="cx">                          BC2B41182732F42300A2D191 /* ModelPlayerProvider.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCoredomDOMImplementationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DOMImplementation.cpp (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PluginData.h"
</span><span class="cx"> #include "PluginDocument.h"
</span><ins>+#include "RuntimeEnabledFeatures.h"
</ins><span class="cx"> #include "SVGDocument.h"
</span><span class="cx"> #include "SVGNames.h"
</span><span class="cx"> #include "SecurityOrigin.h"
</span><span class="lines">@@ -57,6 +58,10 @@
</span><span class="cx"> #include <wtf/IsoMallocInlines.h>
</span><span class="cx"> #include <wtf/StdLibExtras.h>
</span><span class="cx"> 
</span><ins>+#if ENABLE(MODEL_ELEMENT)
+#include "ModelDocument.h"
+#endif
+
</ins><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> using namespace HTMLNames;
</span><span class="lines">@@ -162,6 +167,11 @@
</span><span class="cx">         return MediaDocument::create(frame, settings, url);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MODEL_ELEMENT)
+    if (MIMETypeRegistry::isUSDMIMEType(contentType) && RuntimeEnabledFeatures::sharedFeatures().modelDocumentEnabled())
+        return ModelDocument::create(frame, settings, url);
+#endif
+
</ins><span class="cx"> #if ENABLE(FTPDIR)
</span><span class="cx">     if (equalLettersIgnoringASCIICase(contentType, "application/x-ftp-directory"))
</span><span class="cx">         return FTPDirectoryDocument::create(frame, settings, url);
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -302,8 +302,11 @@
</span><span class="cx">     SVGDocumentClass = 1 << 5,
</span><span class="cx">     TextDocumentClass = 1 << 6,
</span><span class="cx">     XMLDocumentClass = 1 << 7,
</span><ins>+#if ENABLE(MODEL_ELEMENT)
+    ModelDocumentClass = 1 << 8,
+#endif
</ins><span class="cx"> };
</span><del>-using DocumentClassFlags = unsigned char;
</del><ins>+using DocumentClassFlags = uint16_t;
</ins><span class="cx"> 
</span><span class="cx"> enum class DocumentCompatibilityMode : unsigned char {
</span><span class="cx">     NoQuirksMode = 1,
</span><span class="lines">@@ -540,6 +543,9 @@
</span><span class="cx">     bool isPluginDocument() const { return m_documentClasses & PluginDocumentClass; }
</span><span class="cx">     bool isMediaDocument() const { return m_documentClasses & MediaDocumentClass; }
</span><span class="cx">     bool isTextDocument() const { return m_documentClasses & TextDocumentClass; }
</span><ins>+#if ENABLE(MODEL_ELEMENT)
+    bool isModelDocument() const { return m_documentClasses & ModelDocumentClass; }
+#endif
</ins><span class="cx">     bool hasSVGRootNode() const;
</span><span class="cx">     virtual bool isFrameSet() const { return false; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlModelDocumentcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/ModelDocument.cpp (0 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/ModelDocument.cpp                              (rev 0)
+++ trunk/Source/WebCore/html/ModelDocument.cpp 2021-11-17 18:46:04 UTC (rev 285936)
</span><span class="lines">@@ -0,0 +1,154 @@
</span><ins>+/*
+ * 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
</ins><span class="cx">Property changes on: trunk/Source/WebCore/html/ModelDocument.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<ins>+Date Author Id Revision HeadURL
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceWebCorehtmlModelDocumenth"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/html/ModelDocument.h (0 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/ModelDocument.h                                (rev 0)
+++ trunk/Source/WebCore/html/ModelDocument.h   2021-11-17 18:46:04 UTC (rev 285936)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+/*
+ * 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)
</ins><span class="cx">Property changes on: trunk/Source/WebCore/html/ModelDocument.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<ins>+native
</ins><span class="cx">\ No newline at end of property
</span><a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<ins>+Date Author Id Revision HeadURL
</ins><span class="cx">\ No newline at end of property
</span><a id="trunkSourceWebCorepageRuntimeEnabledFeaturesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -258,6 +258,11 @@
</span><span class="cx">     bool builtInNotificationsEnabled() const { return m_builtInNotificationsEnabled; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MODEL_ELEMENT)
+    void setModelDocumentEnabled(bool isEnabled) { m_modelDocumentEnabled = isEnabled; }
+    bool modelDocumentEnabled() const { return m_modelDocumentEnabled; }
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     // Never instantiate.
</span><span class="cx">     RuntimeEnabledFeatures();
</span><span class="lines">@@ -398,6 +403,10 @@
</span><span class="cx">     bool m_builtInNotificationsEnabled { false };
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MODEL_ELEMENT)
+    bool m_modelDocumentEnabled { false };
+#endif
+
</ins><span class="cx">     friend class NeverDestroyed<RuntimeEnabledFeatures>;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMIMETypeRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.cpp (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -658,6 +658,11 @@
</span><span class="cx">         return true;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(MODEL_ELEMENT)
+    if (isSupportedModelMIMEType(mimeType))
+        return true;
+#endif
+
</ins><span class="cx">     if (startsWithLettersIgnoringASCIICase(mimeType, "text/"))
</span><span class="cx">         return !isUnsupportedTextMIMEType(mimeType);
</span><span class="cx"> 
</span><span class="lines">@@ -688,6 +693,11 @@
</span><span class="cx">     return usdMIMETypeSet.contains(mimeType);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool MIMETypeRegistry::isSupportedModelMIMEType(const String& mimeType)
+{
+    return MIMETypeRegistry::isUSDMIMEType(mimeType);
+}
+
</ins><span class="cx"> // FIXME: Not great that CURL needs this concept; other platforms do not.
</span><span class="cx"> static String normalizedImageMIMEType(const String& mimeType)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMIMETypeRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MIMETypeRegistry.h (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -108,6 +108,8 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT static bool isUSDMIMEType(const String& mimeType);
</span><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT static bool isSupportedModelMIMEType(const String& mimeType);
+
</ins><span class="cx">     // Check to see if a MIME type is suitable for being shown inside a page.
</span><span class="cx">     // Returns true if any of isSupportedImageMIMEType(), isSupportedNonImageMIMEType(),
</span><span class="cx">     // isSupportedMediaMIMEType(), isSupportedJavaScriptMIMEType(), isSupportedJSONMIMEType(),
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2021-11-17  Dean Jackson  <dino@apple.com>
+
+        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:]):
+
</ins><span class="cx"> 2021-11-17  Antoine Quint  <graouts@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         [Model] Create iOS ModelPlayer implementation
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessCocoaWKWebViewContentProviderRegistrymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKWebViewContentProviderRegistry.mm (285935 => 285936)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx">         [self registerProvider:[WKPDFView class] forMIMEType:@(type)];
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if USE(SYSTEM_PREVIEW) && !HAVE(UIKIT_WEBKIT_INTERNALS)
</del><ins>+#if USE(SYSTEM_PREVIEW) && !HAVE(UIKIT_WEBKIT_INTERNALS) && !ENABLE(MODEL_ELEMENT)
</ins><span class="cx">     if (configuration._systemPreviewEnabled) {
</span><span class="cx">         for (auto& type : WebCore::MIMETypeRegistry::usdMIMETypes())
</span><span class="cx">             [self registerProvider:[WKUSDPreviewView class] forMIMEType:@(type)];
</span></span></pre>
</div>
</div>

</body>
</html>