Title: [274033] trunk
Revision
274033
Author
[email protected]
Date
2021-03-06 03:13:42 -0800 (Sat, 06 Mar 2021)

Log Message

<model> should create a model-owning compositing layer
https://bugs.webkit.org/show_bug.cgi?id=222798

Reviewed by Simon Fraser.

Source/_javascript_Core:

* inspector/protocol/LayerTree.json:
Add a compositing reason for <model>.

Source/WebCore:

Test: model-element/model-element-graphics-layers.html

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setContentsToModel):
* platform/graphics/Model.cpp: Added.
(WebCore::Model::create):
(WebCore::Model::Model):
(WebCore::operator<<):
* platform/graphics/Model.h: Added.
(WebCore::Model::encode const):
(WebCore::Model::decode):
Add Model, a wrapper for the model.
For now, it just wraps a SharedBuffer.
In the future, it may contain other things, like file paths, identifiers, etc.

* Modules/model-element/HTMLModelElement.cpp:
(WebCore::HTMLModelElement::model const):
* Modules/model-element/HTMLModelElement.h:
HTMLModelElement can now vend a Model instead of just a SharedBuffer.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::createPlatformCALayer):
(WebCore::GraphicsLayerCA::setContentsToModel):
* platform/graphics/ca/GraphicsLayerCA.h:
* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::operator<<):
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
(WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
Allow a GraphicsLayer to be given a Model as contents (as we do for e.g. Image and other things).
For simplicity's sake, and because anything more is unnecessary, just re-create
the ModelLayer when the model changes.

* rendering/RenderBoxModelObject.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::contentChanged):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
(WebCore::RenderLayerBacking::contentChanged):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingLayer const):
(WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
(WebCore::RenderLayerCompositor::reasonsForCompositing const):
(WebCore::RenderLayerCompositor::logReasonsForCompositing):
(WebCore::RenderLayerCompositor::requiresCompositingForModel const):
* rendering/RenderLayerCompositor.h:
* rendering/RenderModel.cpp:
(WebCore::RenderModel::requiresLayer const):
(WebCore::RenderModel::updateFromElement):
(WebCore::RenderModel::update):
* rendering/RenderModel.h:
Require compositing for <model>, and add a custom layer type.

* inspector/agents/InspectorLayerTreeAgent.cpp:
(WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer):
Add a compositing reason for <model>.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
(WI.LayerTreeDetailsSidebarPanel.prototype._populateListOfCompositingReasons):
(WI.LayerTreeDetailsSidebarPanel):
* UserInterface/Views/Layers3DContentView.js:
(WI.Layers3DContentView.prototype._updateReasonsList):
(WI.Layers3DContentView):
Add a compositing reason for <model>.

Source/WebKit:

* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::display):
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
* Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const):
(WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
(WebKit::RemoteLayerTreeTransaction::description const):
* SourcesCocoa.txt:
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::makeNode):
* UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
(WebKit::RemoteLayerTreeHost::makeNode):
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
(WebKit::GraphicsLayerCARemote::createPlatformCALayer):
* WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::create):
(WebKit::PlatformCALayerRemote::populateCreationProperties):
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.h:
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
(WebKit::PlatformCALayerRemoteCustom::populateCreationProperties):
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.h: Added.
* WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.mm: Added.
(WebKit::PlatformCALayerRemoteModelHosting::create):
(WebKit::PlatformCALayerRemoteModelHosting::PlatformCALayerRemoteModelHosting):
(WebKit::PlatformCALayerRemoteModelHosting::clone const):
(WebKit::PlatformCALayerRemoteModelHosting::populateCreationProperties):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::layerDidEnterContext):
Create a new PlatformCALayerRemote subclass that knows about Model, and
passes its model along in the layer creation properties.

For now, the special model layer type will just make a plain layer.
Future patches will replace it with model-specific rendering.

LayoutTests:

* model-element/model-element-graphics-layers-expected.txt: Added.
* model-element/model-element-graphics-layers.html: Added.
* model-element/model-element-renderer-expected.txt:
* model-element/model-element-renderer-no-source-expected.txt:
Add a test ensuring that we make a compositing layer via layer dump, and update
existing tests that also happen to reveal this via render tree dump as well.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (274032 => 274033)


--- trunk/LayoutTests/ChangeLog	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/LayoutTests/ChangeLog	2021-03-06 11:13:42 UTC (rev 274033)
@@ -1,3 +1,17 @@
+2021-03-06  Tim Horton  <[email protected]>
+
+        <model> should create a model-owning compositing layer
+        https://bugs.webkit.org/show_bug.cgi?id=222798
+
+        Reviewed by Simon Fraser.
+
+        * model-element/model-element-graphics-layers-expected.txt: Added.
+        * model-element/model-element-graphics-layers.html: Added.
+        * model-element/model-element-renderer-expected.txt:
+        * model-element/model-element-renderer-no-source-expected.txt:
+        Add a test ensuring that we make a compositing layer via layer dump, and update
+        existing tests that also happen to reveal this via render tree dump as well.
+
 2021-03-05  Said Abou-Hallawa  <[email protected]>
 
         [GPU Process] Tests under imported/blink/fast/canvas are now fixed by r273956

Added: trunk/LayoutTests/model-element/model-element-graphics-layers-expected.txt (0 => 274033)


--- trunk/LayoutTests/model-element/model-element-graphics-layers-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/model-element/model-element-graphics-layers-expected.txt	2021-03-06 11:13:42 UTC (rev 274033)
@@ -0,0 +1,18 @@
+ (GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 300.00 150.00)
+          (drawsContent 1)
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/model-element/model-element-graphics-layers.html (0 => 274033)


--- trunk/LayoutTests/model-element/model-element-graphics-layers.html	                        (rev 0)
+++ trunk/LayoutTests/model-element/model-element-graphics-layers.html	2021-03-06 11:13:42 UTC (rev 274033)
@@ -0,0 +1,30 @@
+<!DOCTYPE html><!-- webkit-test-runner [ ModelElementEnabled=true ] -->
+<html>
+<body>
+<model id="model">
+    <source src=""
+</model>
+<pre id="layers"></p>
+<script>
+    let layers = document.getElementById("layers");
+
+    if (window.testRunner) {
+        testRunner.waitUntilDone();
+        testRunner.dumpAsText();
+    } else
+        layers.textContent = "This test requires testRunner.";
+
+    let model = document.getElementById("model");
+
+    model.ready.then(value => {
+        if (window.testRunner)
+            layers.innerText = window.internals.layerTreeAsText(document);
+    }, reason => {
+        layers.textContent = `Failed. Model did not load: ${reason}`;
+    }).finally(() => { 
+        if (window.testRunner)
+            testRunner.notifyDone();
+    });
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/model-element/model-element-renderer-expected.txt (274032 => 274033)


--- trunk/LayoutTests/model-element/model-element-renderer-expected.txt	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/LayoutTests/model-element/model-element-renderer-expected.txt	2021-03-06 11:13:42 UTC (rev 274033)
@@ -3,5 +3,6 @@
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
-      RenderModel {MODEL} at (0,0) size 300x150
       RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 300x150
+  RenderModel {MODEL} at (0,0) size 300x150

Modified: trunk/LayoutTests/model-element/model-element-renderer-no-source-expected.txt (274032 => 274033)


--- trunk/LayoutTests/model-element/model-element-renderer-no-source-expected.txt	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/LayoutTests/model-element/model-element-renderer-no-source-expected.txt	2021-03-06 11:13:42 UTC (rev 274033)
@@ -3,5 +3,6 @@
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
-      RenderModel {MODEL} at (0,0) size 300x150
       RenderText {#text} at (0,0) size 0x0
+layer at (8,8) size 300x150
+  RenderModel {MODEL} at (0,0) size 300x150

Modified: trunk/Source/_javascript_Core/ChangeLog (274032 => 274033)


--- trunk/Source/_javascript_Core/ChangeLog	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-03-06 11:13:42 UTC (rev 274033)
@@ -1,3 +1,13 @@
+2021-03-06  Tim Horton  <[email protected]>
+
+        <model> should create a model-owning compositing layer
+        https://bugs.webkit.org/show_bug.cgi?id=222798
+
+        Reviewed by Simon Fraser.
+
+        * inspector/protocol/LayerTree.json:
+        Add a compositing reason for <model>.
+
 2021-03-05  Yusuke Suzuki  <[email protected]>
 
         Unreviewed, suppress warning as it is done in DFGOperations.cpp

Modified: trunk/Source/_javascript_Core/inspector/protocol/LayerTree.json (274032 => 274033)


--- trunk/Source/_javascript_Core/inspector/protocol/LayerTree.json	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/_javascript_Core/inspector/protocol/LayerTree.json	2021-03-06 11:13:42 UTC (rev 274033)
@@ -53,6 +53,7 @@
                 { "name": "canvas", "type": "boolean", "optional": true, "description": "Composition due to the element being a <canvas> element." },
                 { "name": "plugin", "type": "boolean", "optional": true, "description": "Composition due to association with a plugin." },
                 { "name": "iFrame", "type": "boolean", "optional": true, "description": "Composition due to association with an <iframe> element." },
+                { "name": "model", "type": "boolean", "optional": true, "description": "Composition due to association with a <model> element." },
                 { "name": "backfaceVisibilityHidden", "type": "boolean", "optional": true, "description": "Composition due to association with an element with a \"backface-visibility: hidden\" style." },
                 { "name": "clipsCompositingDescendants", "type": "boolean", "optional": true, "description": "Composition due to association with an element clipping compositing descendants." },
                 { "name": "animation", "type": "boolean", "optional": true, "description": "Composition due to association with an animated element." },

Modified: trunk/Source/WebCore/ChangeLog (274032 => 274033)


--- trunk/Source/WebCore/ChangeLog	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/ChangeLog	2021-03-06 11:13:42 UTC (rev 274033)
@@ -1,3 +1,69 @@
+2021-03-06  Tim Horton  <[email protected]>
+
+        <model> should create a model-owning compositing layer
+        https://bugs.webkit.org/show_bug.cgi?id=222798
+
+        Reviewed by Simon Fraser.
+
+        Test: model-element/model-element-graphics-layers.html
+
+        * Sources.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::setContentsToModel):
+        * platform/graphics/Model.cpp: Added.
+        (WebCore::Model::create):
+        (WebCore::Model::Model):
+        (WebCore::operator<<):
+        * platform/graphics/Model.h: Added.
+        (WebCore::Model::encode const):
+        (WebCore::Model::decode):
+        Add Model, a wrapper for the model.
+        For now, it just wraps a SharedBuffer.
+        In the future, it may contain other things, like file paths, identifiers, etc.
+
+        * Modules/model-element/HTMLModelElement.cpp:
+        (WebCore::HTMLModelElement::model const):
+        * Modules/model-element/HTMLModelElement.h:
+        HTMLModelElement can now vend a Model instead of just a SharedBuffer.
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::createPlatformCALayer):
+        (WebCore::GraphicsLayerCA::setContentsToModel):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        * platform/graphics/ca/PlatformCALayer.cpp:
+        (WebCore::operator<<):
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm:
+        (WebCore::PlatformCALayerCocoa::PlatformCALayerCocoa):
+        Allow a GraphicsLayer to be given a Model as contents (as we do for e.g. Image and other things).
+        For simplicity's sake, and because anything more is unnecessary, just re-create
+        the ModelLayer when the model changes.
+
+        * rendering/RenderBoxModelObject.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::contentChanged):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateConfiguration):
+        (WebCore::RenderLayerBacking::contentChanged):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingLayer const):
+        (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
+        (WebCore::RenderLayerCompositor::reasonsForCompositing const):
+        (WebCore::RenderLayerCompositor::logReasonsForCompositing):
+        (WebCore::RenderLayerCompositor::requiresCompositingForModel const):
+        * rendering/RenderLayerCompositor.h:
+        * rendering/RenderModel.cpp:
+        (WebCore::RenderModel::requiresLayer const):
+        (WebCore::RenderModel::updateFromElement):
+        (WebCore::RenderModel::update):
+        * rendering/RenderModel.h:
+        Require compositing for <model>, and add a custom layer type.
+
+        * inspector/agents/InspectorLayerTreeAgent.cpp:
+        (WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer):
+        Add a compositing reason for <model>.
+
 2021-03-05  Wenson Hsieh  <[email protected]>
 
         [iOS] Implement additional accessibility support for image overlays

Modified: trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp (274032 => 274033)


--- trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/Modules/model-element/HTMLModelElement.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -34,6 +34,8 @@
 #include "HTMLNames.h"
 #include "HTMLParserIdioms.h"
 #include "HTMLSourceElement.h"
+#include "JSEventTarget.h"
+#include "Model.h"
 #include "RenderModel.h"
 #include <wtf/IsoMallocInlines.h>
 #include <wtf/URL.h>
@@ -69,6 +71,13 @@
     return m_data;
 }
 
+RefPtr<Model> HTMLModelElement::model() const
+{
+    if (auto modelData = this->modelData())
+        return Model::create(*modelData);
+    return nullptr;
+}
+
 void HTMLModelElement::sourcesChanged()
 {
     if (!document().hasBrowsingContext()) {

Modified: trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h (274032 => 274033)


--- trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/Modules/model-element/HTMLModelElement.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -37,6 +37,8 @@
 
 namespace WebCore {
 
+class Model;
+
 template<typename IDLType> class DOMPromiseProxyWithResolveCallback;
 
 class HTMLModelElement final : public HTMLElement, private CachedRawResourceClient {
@@ -52,6 +54,8 @@
     ReadyPromise& ready() { return m_readyPromise.get(); }
 
     RefPtr<SharedBuffer> modelData() const;
+    
+    RefPtr<Model> model() const;
 
 private:
     HTMLModelElement(const QualifiedName&, Document&);

Modified: trunk/Source/WebCore/Sources.txt (274032 => 274033)


--- trunk/Source/WebCore/Sources.txt	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/Sources.txt	2021-03-06 11:13:42 UTC (rev 274033)
@@ -1987,6 +1987,7 @@
 platform/graphics/LayoutSize.cpp
 platform/graphics/MIMETypeCache.cpp
 platform/graphics/MediaPlayer.cpp
+platform/graphics/Model.cpp
 platform/graphics/NamedImageGeneratedImage.cpp
 platform/graphics/NativeImage.cpp
 platform/graphics/Path.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (274032 => 274033)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2021-03-06 11:13:42 UTC (rev 274033)
@@ -843,6 +843,7 @@
 		2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */ = {isa = PBXBuildFile; fileRef = 2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */; };
 		2DACB9E923755D0000B4C185 /* GraphicsContextImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F00123F1FAD87D600531D76 /* GraphicsContextImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2DAF343D1EA7E0F100382CD3 /* ConstantPropertyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAF343B1EA7E0F100382CD3 /* ConstantPropertyMap.h */; };
+		2DC8D39825F2FE9700CFCBAB /* Model.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DC8D39725F2FE9400CFCBAB /* Model.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2DD5A7271EBEE47D009BA597 /* CompositionUnderline.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DD5A7261EBEE47D009BA597 /* CompositionUnderline.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		2DE70023192FE82A00B0975C /* DisplayRefreshMonitorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DE70022192FE82A00B0975C /* DisplayRefreshMonitorMac.h */; };
 		2DF512CE1D873E47001D6780 /* ReplaceRangeWithTextCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DF512CC1D873E47001D6780 /* ReplaceRangeWithTextCommand.h */; };
@@ -7238,6 +7239,8 @@
 		2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockPageOverlayClient.h; sourceTree = "<group>"; };
 		2DAF343A1EA7E0F100382CD3 /* ConstantPropertyMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConstantPropertyMap.cpp; sourceTree = "<group>"; };
 		2DAF343B1EA7E0F100382CD3 /* ConstantPropertyMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstantPropertyMap.h; sourceTree = "<group>"; };
+		2DC8D39625F2FE9300CFCBAB /* Model.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Model.cpp; sourceTree = "<group>"; };
+		2DC8D39725F2FE9400CFCBAB /* Model.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Model.h; sourceTree = "<group>"; };
 		2DD5A7261EBEE47D009BA597 /* CompositionUnderline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompositionUnderline.h; sourceTree = "<group>"; };
 		2DE70022192FE82A00B0975C /* DisplayRefreshMonitorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRefreshMonitorMac.h; sourceTree = "<group>"; };
 		2DF512CB1D873E47001D6780 /* ReplaceRangeWithTextCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReplaceRangeWithTextCommand.cpp; sourceTree = "<group>"; };
@@ -26835,6 +26838,8 @@
 				07611DB8243FB75C00D80704 /* MediaUsageInfo.h */,
 				07B93FFB23B92AAB0036F8EA /* MIMETypeCache.cpp */,
 				07B93FF923B92AAA0036F8EA /* MIMETypeCache.h */,
+				2DC8D39625F2FE9300CFCBAB /* Model.cpp */,
+				2DC8D39725F2FE9400CFCBAB /* Model.h */,
 				314BE3A41B3103FB00141982 /* NamedImageGeneratedImage.cpp */,
 				314BE3A51B3103FB00141982 /* NamedImageGeneratedImage.h */,
 				7252396B254CADC200F5FB15 /* NativeImage.cpp */,
@@ -29644,9 +29649,9 @@
 				C2015C091BE6FE2C00822389 /* FontVariantBuilder.h */,
 				CD4E0AFA11F7BC27009D3811 /* fullscreen.css */,
 				93CA4C9909DF93FA00DF8677 /* html.css */,
+				E54CA6DD255DE2D500F901A3 /* legacyFormControlsIOS.css */,
 				E55F4979151B888000BB67DB /* LengthFunctions.cpp */,
 				E5BA7D62151437CA00FE1E3F /* LengthFunctions.h */,
-				E54CA6DD255DE2D500F901A3 /* legacyFormControlsIOS.css */,
 				93CA4C9A09DF93FA00DF8677 /* make-css-file-arrays.pl */,
 				93CA4C9B09DF93FA00DF8677 /* makeprop.pl */,
 				43B85ED018CBEACE00E31AF4 /* makeSelectorPseudoClassAndCompatibilityElementMap.py */,
@@ -33962,6 +33967,7 @@
 				CDF2B0171820540700F2B424 /* MockSourceBufferPrivate.h in Headers */,
 				CDF2B0191820540700F2B424 /* MockTracks.h in Headers */,
 				5715610C234C1CA1008FC7AB /* MockWebAuthenticationConfiguration.h in Headers */,
+				2DC8D39825F2FE9700CFCBAB /* Model.h in Headers */,
 				C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */,
 				709A01FE1E3D0BDD006B0D4C /* ModuleFetchFailureKind.h in Headers */,
 				E3201C1A1F8E82130076A032 /* ModuleFetchParameters.h in Headers */,

Modified: trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp (274032 => 274033)


--- trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -257,6 +257,8 @@
         compositingReasons->setPlugin(true);
     else if (reasons.contains(CompositingReason::IFrame))
         compositingReasons->setIFrame(true);
+    else if (reasons.contains(CompositingReason::Model))
+        compositingReasons->setModel(true);
 
     if (reasons.contains(CompositingReason::BackfaceVisibilityHidden))
         compositingReasons->setBackfaceVisibilityHidden(true);

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (274032 => 274033)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -59,6 +59,7 @@
 class GraphicsContext;
 class GraphicsLayerFactory;
 class Image;
+class Model;
 class TiledBacking;
 class TimingFunction;
 class TransformationMatrix;
@@ -509,12 +510,16 @@
         Media,
         Canvas,
         BackgroundColor,
-        Plugin
+        Plugin,
+        Model
     };
 
     // Pass an invalid color to remove the contents layer.
     virtual void setContentsToSolidColor(const Color&) { }
     virtual void setContentsToPlatformLayer(PlatformLayer*, ContentsLayerPurpose) { }
+#if ENABLE(MODEL_ELEMENT)
+    virtual void setContentsToModel(RefPtr<Model>&&) { }
+#endif
     virtual bool usesContentsLayer() const { return false; }
 
     // Callback from the underlying graphics system to draw layer contents.

Added: trunk/Source/WebCore/platform/graphics/Model.cpp (0 => 274033)


--- trunk/Source/WebCore/platform/graphics/Model.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/Model.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -0,0 +1,56 @@
+/*
+ * 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 "Model.h"
+
+#if ENABLE(MODEL_ELEMENT)
+
+namespace WebCore {
+
+Ref<Model> Model::create(Ref<SharedBuffer> data)
+{
+    return adoptRef(*new Model(data));
+}
+
+Model::Model(Ref<SharedBuffer> data)
+    : m_data(data)
+{
+}
+
+Model::~Model() = default;
+
+TextStream& operator<<(TextStream& ts, const Model& model)
+{
+    TextStream::GroupScope groupScope(ts);
+    
+    ts.dumpProperty("data-size", model.data()->size());
+    
+    return ts;
+}
+
+}
+
+#endif // ENABLE(MODEL_ELEMENT)

Added: trunk/Source/WebCore/platform/graphics/Model.h (0 => 274033)


--- trunk/Source/WebCore/platform/graphics/Model.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/Model.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -0,0 +1,87 @@
+/*
+ * 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 "SharedBuffer.h"
+#include <wtf/RefCounted.h>
+
+namespace WTF {
+class TextStream;
+}
+
+namespace WebCore {
+
+class Model final : public RefCounted<Model> {
+public:
+    WEBCORE_EXPORT static Ref<Model> create(Ref<SharedBuffer>);
+    WEBCORE_EXPORT ~Model();
+
+    Ref<SharedBuffer> data() const { return m_data; }
+    
+    template<class Encoder> void encode(Encoder&) const;
+    template<class Decoder> static RefPtr<Model> decode(Decoder&);
+
+private:
+    explicit Model(Ref<SharedBuffer>);
+
+    Ref<SharedBuffer> m_data;
+};
+
+template<class Encoder>
+void Model::encode(Encoder& encoder) const
+{
+    encoder << static_cast<size_t>(m_data->size());
+    encoder.encodeFixedLengthData(m_data->dataAsUInt8Ptr(), m_data->size(), 1);
+}
+
+template<class Decoder>
+RefPtr<Model> Model::decode(Decoder& decoder)
+{
+    Optional<size_t> length;
+    decoder >> length;
+    if (!length)
+        return nullptr;
+
+    if (!decoder.template bufferIsLargeEnoughToContain<uint8_t>(length.value())) {
+        decoder.markInvalid();
+        return nullptr;
+    }
+
+    Vector<uint8_t> data;
+    data.grow(*length);
+    if (!decoder.decodeFixedLengthData(data.data(), data.size(), 1))
+        return nullptr;
+
+    return Model::create(SharedBuffer::create(WTFMove(data)));
+}
+
+WEBCORE_EXPORT WTF::TextStream& operator<<(WTF::TextStream&, const Model&);
+
+} // namespace WebCore
+
+#endif // ENABLE(MODEL_ELEMENT)

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (274032 => 274033)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -36,6 +36,7 @@
 #include "GraphicsLayerFactory.h"
 #include "Image.h"
 #include "Logging.h"
+#include "Model.h"
 #include "PlatformCAFilters.h"
 #include "PlatformCALayer.h"
 #include "PlatformScreen.h"
@@ -384,6 +385,14 @@
 #endif
 }
 
+#if ENABLE(MODEL_ELEMENT)
+Ref<PlatformCALayer> GraphicsLayerCA::createPlatformCALayer(Ref<WebCore::Model>, PlatformCALayerClient* owner)
+{
+    // By default, just make a plain layer; subclasses can override to provide a custom PlatformCALayer for Model.
+    return GraphicsLayerCA::createPlatformCALayer(PlatformCALayer::LayerTypeLayer, owner);
+}
+#endif
+
 Ref<PlatformCAAnimation> GraphicsLayerCA::createPlatformCAAnimation(PlatformCAAnimation::AnimationType type, const String& keyPath)
 {
 #if PLATFORM(COCOA)
@@ -1204,6 +1213,37 @@
     noteLayerPropertyChanged(ContentsImageChanged);
 }
 
+#if ENABLE(MODEL_ELEMENT)
+void GraphicsLayerCA::setContentsToModel(RefPtr<Model>&& model)
+{
+    if (model == m_contentsModel)
+        return;
+
+    m_contentsModel = model;
+
+    bool contentsLayerChanged = false;
+
+    if (model) {
+        m_contentsLayer = createPlatformCALayer(*model, this);
+#if ENABLE(TREE_DEBUGGING)
+        m_contentsLayer->setName(makeString("contents model ", m_contentsLayer->layerID()));
+#else
+        m_contentsLayer->setName("contents model");
+#endif
+
+        m_contentsLayerPurpose = ContentsLayerPurpose::Model;
+        contentsLayerChanged = true;
+    } else {
+        contentsLayerChanged = m_contentsLayer;
+        m_contentsLayerPurpose = ContentsLayerPurpose::None;
+        m_contentsLayer = nullptr;
+    }
+
+    if (contentsLayerChanged)
+        noteSublayersChanged();
+}
+#endif
+
 void GraphicsLayerCA::setContentsToPlatformLayer(PlatformLayer* platformLayer, ContentsLayerPurpose purpose)
 {
     if (m_contentsLayer && platformLayer == m_contentsLayer->platformLayer())

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (274032 => 274033)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -149,6 +149,9 @@
 #endif
     WEBCORE_EXPORT void setContentsToPlatformLayer(PlatformLayer*, ContentsLayerPurpose) override;
     WEBCORE_EXPORT void setContentsToSolidColor(const Color&) override;
+#if ENABLE(MODEL_ELEMENT)
+    WEBCORE_EXPORT void setContentsToModel(RefPtr<Model>&&) override;
+#endif
 
     bool usesContentsLayer() const override { return m_contentsLayerPurpose != ContentsLayerPurpose::None; }
     
@@ -237,6 +240,9 @@
 
     virtual Ref<PlatformCALayer> createPlatformCALayer(PlatformCALayer::LayerType, PlatformCALayerClient* owner);
     virtual Ref<PlatformCALayer> createPlatformCALayer(PlatformLayer*, PlatformCALayerClient* owner);
+#if ENABLE(MODEL_ELEMENT)
+    virtual Ref<PlatformCALayer> createPlatformCALayer(Ref<WebCore::Model>, PlatformCALayerClient* owner);
+#endif
     virtual Ref<PlatformCAAnimation> createPlatformCAAnimation(PlatformCAAnimation::AnimationType, const String& keyPath);
 
     PlatformCALayer* primaryLayer() const { return m_structuralLayer.get() ? m_structuralLayer.get() : m_layer.get(); }
@@ -613,7 +619,11 @@
 
     RefPtr<NativeImage> m_uncorrectedContentsImage;
     RefPtr<NativeImage> m_pendingContentsImage;
-    
+
+#if ENABLE(MODEL_ELEMENT)
+    RefPtr<Model> m_contentsModel;
+#endif
+
     Vector<LayerPropertyAnimation> m_animations;
     Vector<LayerPropertyAnimation> m_baseValueTransformAnimations;
     Vector<LayerPropertyAnimation> m_animationGroups;

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp (274032 => 274033)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -245,6 +245,11 @@
     case PlatformCALayer::LayerTypeDarkSystemBackdropLayer:
         ts << "dark-system-backdrop-layer";
         break;
+#if ENABLE(MODEL_ELEMENT)
+    case PlatformCALayer::LayerTypeModelLayer:
+        ts << "model-layer";
+        break;
+#endif
     }
     return ts;
 }

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (274032 => 274033)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -76,6 +76,9 @@
         LayerTypeLightSystemBackdropLayer,
         LayerTypeDarkSystemBackdropLayer,
         LayerTypeScrollContainerLayer,
+#if ENABLE(MODEL_ELEMENT)
+        LayerTypeModelLayer,
+#endif
         LayerTypeCustom,
     };
     enum FilterType { Linear, Nearest, Trilinear };
@@ -347,6 +350,9 @@
         WebCore::PlatformCALayer::LayerType::LayerTypeLightSystemBackdropLayer,
         WebCore::PlatformCALayer::LayerType::LayerTypeDarkSystemBackdropLayer,
         WebCore::PlatformCALayer::LayerType::LayerTypeScrollContainerLayer,
+#if ENABLE(MODEL_ELEMENT)
+        WebCore::PlatformCALayer::LayerType::LayerTypeModelLayer,
+#endif
         WebCore::PlatformCALayer::LayerType::LayerTypeCustom
     >;
 };

Modified: trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm (274032 => 274033)


--- trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm	2021-03-06 11:13:42 UTC (rev 274033)
@@ -32,6 +32,7 @@
 #import "IOSurface.h"
 #import "LengthFunctions.h"
 #import "LocalCurrentGraphicsContext.h"
+#import "Model.h"
 #import "PlatformCAAnimationCocoa.h"
 #import "PlatformCAFilters.h"
 #import "ScrollbarThemeMac.h"
@@ -275,6 +276,11 @@
         // We don't create PlatformCALayerCocoas wrapped around WebGLLayers or WebGPULayers.
         ASSERT_NOT_REACHED();
         break;
+#if ENABLE(MODEL_ELEMENT)
+    case LayerTypeModelLayer:
+        layerClass = [CALayer class];
+        break;
+#endif
     case LayerTypeShapeLayer:
         layerClass = [CAShapeLayer class];
         // fillColor defaults to opaque black.

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (274032 => 274033)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -54,7 +54,8 @@
     CanvasChanged,
     CanvasPixelsChanged,
     VideoChanged,
-    FullScreenChanged
+    FullScreenChanged,
+    ModelChanged
 };
 
 class BorderEdge;

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (274032 => 274033)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -819,7 +819,7 @@
 
 void RenderLayer::contentChanged(ContentChangeType changeType)
 {
-    if (changeType == CanvasChanged || changeType == VideoChanged || changeType == FullScreenChanged || (isComposited() && changeType == ImageChanged)) {
+    if (changeType == CanvasChanged || changeType == VideoChanged || changeType == FullScreenChanged || changeType == ModelChanged || (isComposited() && changeType == ImageChanged)) {
         setNeedsPostLayoutCompositingUpdate();
         setNeedsCompositingConfigurationUpdate();
     }

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (274032 => 274033)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -43,6 +43,7 @@
 #include "HTMLCanvasElement.h"
 #include "HTMLIFrameElement.h"
 #include "HTMLMediaElement.h"
+#include "HTMLModelElement.h"
 #include "HTMLNames.h"
 #include "HTMLPlugInElement.h"
 #include "InspectorInstrumentation.h"
@@ -49,6 +50,7 @@
 #include "KeyframeList.h"
 #include "LayerAncestorClippingStack.h"
 #include "Logging.h"
+#include "Model.h"
 #include "Page.h"
 #include "PerformanceLoggingClient.h"
 #include "PluginViewBase.h"
@@ -62,6 +64,7 @@
 #include "RenderLayerCompositor.h"
 #include "RenderLayerScrollableArea.h"
 #include "RenderMedia.h"
+#include "RenderModel.h"
 #include "RenderVideo.h"
 #include "RenderView.h"
 #include "RuntimeEnabledFeatures.h"
@@ -1068,6 +1071,15 @@
         layerConfigChanged = true;
     }
 #endif
+#if ENABLE(MODEL_ELEMENT)
+    else if (is<RenderModel>(renderer())) {
+        auto element = downcast<HTMLModelElement>(renderer().element());
+        if (auto model = element->model())
+            m_graphicsLayer->setContentsToModel(WTFMove(model));
+
+        layerConfigChanged = true;
+    }
+#endif
     if (is<RenderWidget>(renderer()) && compositor.parentFrameContentLayers(downcast<RenderWidget>(renderer()))) {
         m_owningLayer.setNeedsCompositingGeometryUpdate();
         layerConfigChanged = true;
@@ -2852,6 +2864,13 @@
         return;
     }
 
+#if ENABLE(MODEL_ELEMENT)
+    if (changeType == ModelChanged) {
+        compositor().scheduleCompositingLayerUpdate();
+        return;
+    }
+#endif
+
     if ((changeType == BackgroundImageChanged) && canDirectlyCompositeBackgroundBackgroundImage(renderer().style()))
         m_owningLayer.setNeedsCompositingConfigurationUpdate();
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (274032 => 274033)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -2539,6 +2539,7 @@
         || requiresCompositingForWillChange(renderer)
         || requiresCompositingForBackfaceVisibility(renderer)
         || requiresCompositingForVideo(renderer)
+        || requiresCompositingForModel(renderer)
         || requiresCompositingForFrame(renderer, queryData)
         || requiresCompositingForPlugin(renderer, queryData)
         || requiresCompositingForOverflowScrolling(*renderer.layer(), queryData);
@@ -2599,6 +2600,7 @@
         || requiresCompositingForWillChange(renderer)
         || requiresCompositingForBackfaceVisibility(renderer)
         || requiresCompositingForVideo(renderer)
+        || requiresCompositingForModel(renderer)
         || requiresCompositingForFrame(renderer, queryData)
         || requiresCompositingForPlugin(renderer, queryData)
         || requiresCompositingForOverflowScrolling(layer, queryData)
@@ -2648,6 +2650,8 @@
         reasons.add(CompositingReason::Video);
     else if (requiresCompositingForCanvas(renderer))
         reasons.add(CompositingReason::Canvas);
+    else if (requiresCompositingForModel(renderer))
+        reasons.add(CompositingReason::Model);
     else if (requiresCompositingForPlugin(renderer, queryData))
         reasons.add(CompositingReason::Plugin);
     else if (requiresCompositingForFrame(renderer, queryData))
@@ -2809,6 +2813,9 @@
     if (reasons & CompositingReason::Root)
         return "root";
 
+    if (reasons & CompositingReason::Model)
+        return "model";
+
     return "";
 }
 #endif
@@ -3124,6 +3131,16 @@
     return renderer.style().willChange()->canTriggerCompositingOnInline();
 }
 
+bool RenderLayerCompositor::requiresCompositingForModel(RenderLayerModelObject& renderer) const
+{
+#if ENABLE(MODEL_ELEMENT)
+    if (!is<RenderModel>(renderer))
+        return false;
+#endif
+
+    return true;
+}
+
 bool RenderLayerCompositor::requiresCompositingForPlugin(RenderLayerModelObject& renderer, RequiresCompositingData& queryData) const
 {
     if (!(m_compositingTriggers & ChromeClient::PluginTrigger))

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (274032 => 274033)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -83,6 +83,7 @@
     WillChange                             = 1 << 24,
     Root                                   = 1 << 25,
     IsolatesCompositedBlendingDescendants  = 1 << 26,
+    Model                                  = 1 << 27,
 };
 
 enum class ScrollCoordinationRole {
@@ -496,6 +497,7 @@
     bool requiresCompositingForCanvas(RenderLayerModelObject&) const;
     bool requiresCompositingForFilters(RenderLayerModelObject&) const;
     bool requiresCompositingForWillChange(RenderLayerModelObject&) const;
+    bool requiresCompositingForModel(RenderLayerModelObject&) const;
 
     // Layout-dependent
     bool requiresCompositingForPlugin(RenderLayerModelObject&, RequiresCompositingData&) const;

Modified: trunk/Source/WebCore/rendering/RenderModel.cpp (274032 => 274033)


--- trunk/Source/WebCore/rendering/RenderModel.cpp	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/rendering/RenderModel.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -49,11 +49,23 @@
     return downcast<HTMLModelElement>(nodeForNonAnonymous());
 }
 
+bool RenderModel::requiresLayer() const
+{
+    return true;
+}
+
 void RenderModel::updateFromElement()
 {
     RenderReplaced::updateFromElement();
+    update();
+}
 
-    // FIXME: Do something here.
+void RenderModel::update()
+{
+    if (renderTreeBeingDestroyed())
+        return;
+    
+    contentChanged(ModelChanged);
 }
 
 }

Modified: trunk/Source/WebCore/rendering/RenderModel.h (274032 => 274033)


--- trunk/Source/WebCore/rendering/RenderModel.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebCore/rendering/RenderModel.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -46,7 +46,10 @@
     const char* renderName() const final { return "RenderModel"; }
     bool isRenderModel() const final { return true; }
 
+    bool requiresLayer() const final;
     void updateFromElement() final;
+
+    void update();
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebInspectorUI/ChangeLog (274032 => 274033)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-03-06 11:13:42 UTC (rev 274033)
@@ -1,3 +1,19 @@
+2021-03-06  Tim Horton  <[email protected]>
+
+        <model> should create a model-owning compositing layer
+        https://bugs.webkit.org/show_bug.cgi?id=222798
+
+        Reviewed by Simon Fraser.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
+        (WI.LayerTreeDetailsSidebarPanel.prototype._populateListOfCompositingReasons):
+        (WI.LayerTreeDetailsSidebarPanel):
+        * UserInterface/Views/Layers3DContentView.js:
+        (WI.Layers3DContentView.prototype._updateReasonsList):
+        (WI.Layers3DContentView):
+        Add a compositing reason for <model>.
+
 2021-03-05  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: border color of "grid" badge should match color of corresponding outline

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (274032 => 274033)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2021-03-06 11:13:42 UTC (rev 274033)
@@ -547,6 +547,7 @@
 localizedStrings["Element has perspective applied"] = "Element has perspective applied";
 localizedStrings["Element is <canvas>"] = "Element is <canvas>";
 localizedStrings["Element is <iframe>"] = "Element is <iframe>";
+localizedStrings["Element is <model>"] = "Element is <model>";
 localizedStrings["Element is <video>"] = "Element is <video>";
 localizedStrings["Element is a plug-in"] = "Element is a plug-in";
 localizedStrings["Element is a stacking context and has composited descendants with CSS blending applied"] = "Element is a stacking context and has composited descendants with CSS blending applied";

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js (274032 => 274033)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js	2021-03-06 11:13:42 UTC (rev 274033)
@@ -389,6 +389,8 @@
             addReason(WI.UIString("Element is a plug-in"));
         if (compositingReasons.iFrame)
             addReason(WI.UIString("Element is <iframe>"));
+        if (compositingReasons.model)
+            addReason(WI.UIString("Element is <model>"));
         if (compositingReasons.backfaceVisibilityHidden)
             addReason(WI.UIString("Element has \u201Cbackface-visibility: hidden\u201D style"));
         if (compositingReasons.clipsCompositingDescendants)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js (274032 => 274033)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js	2021-03-06 11:13:42 UTC (rev 274033)
@@ -481,6 +481,8 @@
             addReason(WI.UIString("Element is a plug-in"));
         if (compositingReasons.iFrame)
             addReason(WI.UIString("Element is <iframe>"));
+        if (compositingReasons.model)
+            addReason(WI.UIString("Element is <model>"));
         if (compositingReasons.backfaceVisibilityHidden)
             addReason(WI.UIString("Element has \u201Cbackface-visibility: hidden\u201D style"));
         if (compositingReasons.clipsCompositingDescendants)

Modified: trunk/Source/WebKit/ChangeLog (274032 => 274033)


--- trunk/Source/WebKit/ChangeLog	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/ChangeLog	2021-03-06 11:13:42 UTC (rev 274033)
@@ -1,3 +1,47 @@
+2021-03-06  Tim Horton  <[email protected]>
+
+        <model> should create a model-owning compositing layer
+        https://bugs.webkit.org/show_bug.cgi?id=222798
+
+        Reviewed by Simon Fraser.
+
+        * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::display):
+        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
+        * Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::encode const):
+        (WebKit::RemoteLayerTreeTransaction::LayerCreationProperties::decode):
+        (WebKit::RemoteLayerTreeTransaction::description const):
+        * SourcesCocoa.txt:
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
+        (WebKit::RemoteLayerTreeHost::makeNode):
+        * UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm:
+        (WebKit::RemoteLayerTreeHost::makeNode):
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
+        (WebKit::GraphicsLayerCARemote::createPlatformCALayer):
+        * WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::create):
+        (WebKit::PlatformCALayerRemote::populateCreationProperties):
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h:
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.h:
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm:
+        (WebKit::PlatformCALayerRemoteCustom::populateCreationProperties):
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.h: Added.
+        * WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.mm: Added.
+        (WebKit::PlatformCALayerRemoteModelHosting::create):
+        (WebKit::PlatformCALayerRemoteModelHosting::PlatformCALayerRemoteModelHosting):
+        (WebKit::PlatformCALayerRemoteModelHosting::clone const):
+        (WebKit::PlatformCALayerRemoteModelHosting::populateCreationProperties):
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
+        (WebKit::RemoteLayerTreeContext::layerDidEnterContext):
+        Create a new PlatformCALayerRemote subclass that knows about Model, and
+        passes its model along in the layer creation properties.
+
+        For now, the special model layer type will just make a plain layer.
+        Future patches will replace it with model-specific rendering.
+
 2021-03-05  Wenson Hsieh  <[email protected]>
 
         [iOS] Implement additional accessibility support for image overlays

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (274032 => 274033)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2021-03-06 11:13:42 UTC (rev 274033)
@@ -39,6 +39,7 @@
 #import <WebCore/GraphicsContextCG.h>
 #import <WebCore/IOSurface.h>
 #import <WebCore/ImageBuffer.h>
+#import <WebCore/Model.h>
 #import <WebCore/PlatformCALayerClient.h>
 #import <WebCore/WebLayer.h>
 #import <mach/mach_port.h>
@@ -322,6 +323,9 @@
     case WebCore::PlatformCALayer::LayerTypeContentsProvidedLayer:
     case WebCore::PlatformCALayer::LayerTypeShapeLayer:
     case WebCore::PlatformCALayer::LayerTypeScrollContainerLayer:
+#if ENABLE(MODEL_ELEMENT)
+    case WebCore::PlatformCALayer::LayerTypeModelLayer:
+#endif
     case WebCore::PlatformCALayer::LayerTypeCustom:
         ASSERT_NOT_REACHED();
         break;

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h (274032 => 274033)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -37,6 +37,7 @@
 #include <WebCore/FloatPoint3D.h>
 #include <WebCore/FloatSize.h>
 #include <WebCore/LayoutMilestone.h>
+#include <WebCore/Model.h>
 #include <WebCore/PlatformCALayer.h>
 #include <WebCore/TransformationMatrix.h>
 #include <wtf/HashMap.h>
@@ -110,6 +111,10 @@
 
         uint32_t hostingContextID;
         float hostingDeviceScaleFactor;
+        
+#if ENABLE(MODEL_ELEMENT)
+        RefPtr<WebCore::Model> model;
+#endif
     };
 
     struct LayerProperties {

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm (274032 => 274033)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm	2021-03-06 11:13:42 UTC (rev 274033)
@@ -33,6 +33,7 @@
 #import <QuartzCore/QuartzCore.h>
 #import <WebCore/EventRegion.h>
 #import <WebCore/LengthFunctions.h>
+#import <WebCore/Model.h>
 #import <WebCore/TimingFunction.h>
 #import <wtf/text/CString.h>
 #import <wtf/text/TextStream.h>
@@ -54,8 +55,17 @@
 {
     encoder << layerID;
     encoder << type;
+    
+    // PlatformCALayerRemoteCustom
     encoder << hostingContextID;
     encoder << hostingDeviceScaleFactor;
+    
+#if ENABLE(MODEL_ELEMENT)
+    // PlatformCALayerRemoteModelHosting
+    encoder << !!model;
+    if (model)
+        encoder << *model;
+#endif
 }
 
 auto RemoteLayerTreeTransaction::LayerCreationProperties::decode(IPC::Decoder& decoder) -> Optional<LayerCreationProperties>
@@ -66,12 +76,26 @@
 
     if (!decoder.decode(result.type))
         return WTF::nullopt;
-
+    
+    // PlatformCALayerRemoteCustom
     if (!decoder.decode(result.hostingContextID))
         return WTF::nullopt;
 
     if (!decoder.decode(result.hostingDeviceScaleFactor))
         return WTF::nullopt;
+    
+#if ENABLE(MODEL_ELEMENT)
+    // PlatformCALayerRemoteModelHosting
+    bool hasModel;
+    if (!decoder.decode(hasModel))
+        return WTF::nullopt;
+    if (hasModel) {
+        auto model = WebCore::Model::decode(decoder);
+        if (!model)
+            return WTF::nullopt;
+        result.model = model;
+    }
+#endif
 
     return WTFMove(result);
 }
@@ -967,6 +991,11 @@
             case WebCore::PlatformCALayer::LayerTypeCustom:
                 ts << " (context-id " << createdLayer.hostingContextID << ")";
                 break;
+#if ENABLE(MODEL_ELEMENT)
+            case WebCore::PlatformCALayer::LayerTypeModelLayer:
+                ts << " (model " << *createdLayer.model << ")";
+                break;
+#endif
             default:
                 break;
             }

Modified: trunk/Source/WebKit/SourcesCocoa.txt (274032 => 274033)


--- trunk/Source/WebKit/SourcesCocoa.txt	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2021-03-06 11:13:42 UTC (rev 274033)
@@ -684,6 +684,7 @@
 WebProcess/WebPage/RemoteLayerTree/PlatformCAAnimationRemote.mm
 WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp
 WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm
+WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.mm
 WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteTiledBacking.cpp
 WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm
 WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDisplayRefreshMonitor.mm

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm (274032 => 274033)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm	2021-03-06 11:13:42 UTC (rev 274033)
@@ -271,6 +271,9 @@
     case PlatformCALayer::LayerTypePageTiledBackingLayer:
     case PlatformCALayer::LayerTypeTiledBackingTileLayer:
     case PlatformCALayer::LayerTypeScrollContainerLayer:
+#if ENABLE(MODEL_ELEMENT)
+    case PlatformCALayer::LayerTypeModelLayer:
+#endif
         return RemoteLayerTreeNode::createWithPlainLayer(properties.layerID);
 
     case PlatformCALayer::LayerTypeTransformLayer:

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm (274032 => 274033)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm	2021-03-06 11:13:42 UTC (rev 274033)
@@ -51,6 +51,9 @@
     case PlatformCALayer::LayerTypeSimpleLayer:
     case PlatformCALayer::LayerTypeTiledBackingLayer:
     case PlatformCALayer::LayerTypePageTiledBackingLayer:
+#if ENABLE(MODEL_ELEMENT)
+    case PlatformCALayer::LayerTypeModelLayer:
+#endif
         return makeWithView(adoptNS([[WKCompositingView alloc] init]));
 
     case PlatformCALayer::LayerTypeTiledBackingTileLayer:

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (274032 => 274033)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2021-03-06 11:13:42 UTC (rev 274033)
@@ -3428,6 +3428,8 @@
 		2DC4CF7A1D2DE24B00ECCC94 /* WebPageCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPageCocoa.mm; sourceTree = "<group>"; };
 		2DC6D9C118C44A610043BAD4 /* WKWebViewContentProviderRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebViewContentProviderRegistry.h; sourceTree = "<group>"; };
 		2DC6D9C218C44A610043BAD4 /* WKWebViewContentProviderRegistry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewContentProviderRegistry.mm; sourceTree = "<group>"; };
+		2DC8D39325F2E16500CFCBAB /* PlatformCALayerRemoteModelHosting.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = PlatformCALayerRemoteModelHosting.mm; sourceTree = "<group>"; };
+		2DC8D39425F2E16500CFCBAB /* PlatformCALayerRemoteModelHosting.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformCALayerRemoteModelHosting.h; sourceTree = "<group>"; };
 		2DD12A071A8177F3002C74E6 /* WKPageRenderingProgressEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKPageRenderingProgressEvents.h; sourceTree = "<group>"; };
 		2DD13BD318F7DADD00E130A1 /* FindControllerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FindControllerIOS.mm; path = ios/FindControllerIOS.mm; sourceTree = "<group>"; };
 		2DD45ADC1E5F8972006C355F /* InputViewUpdateDeferrer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InputViewUpdateDeferrer.h; path = ios/InputViewUpdateDeferrer.h; sourceTree = "<group>"; };
@@ -7156,6 +7158,8 @@
 				2DA049B2180CCCD300AAFA9E /* PlatformCALayerRemote.h */,
 				2D8710151828415D0018FA01 /* PlatformCALayerRemoteCustom.h */,
 				2D8710141828415D0018FA01 /* PlatformCALayerRemoteCustom.mm */,
+				2DC8D39425F2E16500CFCBAB /* PlatformCALayerRemoteModelHosting.h */,
+				2DC8D39325F2E16500CFCBAB /* PlatformCALayerRemoteModelHosting.mm */,
 				2D8949EE182044F600E898AA /* PlatformCALayerRemoteTiledBacking.cpp */,
 				2D8949EF182044F600E898AA /* PlatformCALayerRemoteTiledBacking.h */,
 				1AB16AE8164B3A8800290D62 /* RemoteLayerTreeContext.h */,

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp (274032 => 274033)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -29,6 +29,7 @@
 #include "PlatformCAAnimationRemote.h"
 #include "PlatformCALayerRemote.h"
 #include "RemoteLayerTreeContext.h"
+#include <WebCore/Model.h>
 #include <WebCore/PlatformScreen.h>
 
 namespace WebKit {
@@ -67,6 +68,13 @@
     return PlatformCALayerRemote::create(platformLayer, owner, *m_context);
 }
 
+#if ENABLE(MODEL_ELEMENT)
+Ref<PlatformCALayer> GraphicsLayerCARemote::createPlatformCALayer(Ref<WebCore::Model> model, PlatformCALayerClient* owner)
+{
+    return PlatformCALayerRemote::create(model, owner, *m_context);
+}
+#endif
+
 Ref<PlatformCAAnimation> GraphicsLayerCARemote::createPlatformCAAnimation(PlatformCAAnimation::AnimationType type, const String& keyPath)
 {
     return PlatformCAAnimationRemote::create(type, keyPath);

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h (274032 => 274033)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -47,6 +47,9 @@
 
     Ref<WebCore::PlatformCALayer> createPlatformCALayer(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner) override;
     Ref<WebCore::PlatformCALayer> createPlatformCALayer(PlatformLayer*, WebCore::PlatformCALayerClient* owner) override;
+#if ENABLE(MODEL_ELEMENT)
+    Ref<WebCore::PlatformCALayer> createPlatformCALayer(Ref<WebCore::Model>, WebCore::PlatformCALayerClient* owner) override;
+#endif
     Ref<WebCore::PlatformCAAnimation> createPlatformCAAnimation(WebCore::PlatformCAAnimation::AnimationType, const String& keyPath) override;
 
     // PlatformCALayerRemote can't currently proxy directly composited image contents, so opt out of this optimization.

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp (274032 => 274033)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp	2021-03-06 11:13:42 UTC (rev 274033)
@@ -27,6 +27,7 @@
 #import "PlatformCALayerRemote.h"
 
 #import "PlatformCALayerRemoteCustom.h"
+#import "PlatformCALayerRemoteModelHosting.h"
 #import "PlatformCALayerRemoteTiledBacking.h"
 #import "RemoteLayerBackingStore.h"
 #import "RemoteLayerTreeContext.h"
@@ -63,6 +64,13 @@
     return PlatformCALayerRemoteCustom::create(platformLayer, owner, context);
 }
 
+#if ENABLE(MODEL_ELEMENT)
+Ref<PlatformCALayerRemote> PlatformCALayerRemote::create(Ref<WebCore::Model> model, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
+{
+    return PlatformCALayerRemoteModelHosting::create(model, owner, context);
+}
+#endif
+
 Ref<PlatformCALayerRemote> PlatformCALayerRemote::create(const PlatformCALayerRemote& other, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
 {
     auto layer = adoptRef(*new PlatformCALayerRemote(other, owner, context));
@@ -120,6 +128,12 @@
     m_properties.notePropertiesChanged(m_properties.everChangedProperties);
 }
 
+void PlatformCALayerRemote::populateCreationProperties(RemoteLayerTreeTransaction::LayerCreationProperties& properties, const RemoteLayerTreeContext& context, PlatformCALayer::LayerType type)
+{
+    properties.layerID = layerID();
+    properties.type = type;
+}
+
 void PlatformCALayerRemote::updateClonedLayerProperties(PlatformCALayerRemote& clone, bool copyContents) const
 {
     clone.setPosition(position());

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h (274032 => 274033)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -41,6 +41,9 @@
 public:
     static Ref<PlatformCALayerRemote> create(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
     static Ref<PlatformCALayerRemote> create(PlatformLayer *, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
+#if ENABLE(MODEL_ELEMENT)
+    static Ref<PlatformCALayerRemote> create(Ref<WebCore::Model>, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
+#endif
     static Ref<PlatformCALayerRemote> create(const PlatformCALayerRemote&, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
 
     virtual ~PlatformCALayerRemote();
@@ -202,6 +205,8 @@
     void moveToContext(RemoteLayerTreeContext&);
     void clearContext() { m_context = nullptr; }
     RemoteLayerTreeContext* context() const { return m_context; }
+    
+    virtual void populateCreationProperties(RemoteLayerTreeTransaction::LayerCreationProperties&, const RemoteLayerTreeContext&, WebCore::PlatformCALayer::LayerType);
 
 protected:
     PlatformCALayerRemote(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext&);

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.h (274032 => 274033)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.h	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -50,6 +50,8 @@
     PlatformCALayerRemoteCustom(WebCore::PlatformCALayer::LayerType, PlatformLayer *, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext&);
 
     Ref<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const override;
+    
+    void populateCreationProperties(RemoteLayerTreeTransaction::LayerCreationProperties&, const RemoteLayerTreeContext&, WebCore::PlatformCALayer::LayerType) override;
 
     bool isPlatformCALayerRemoteCustom() const override { return true; }
 

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm (274032 => 274033)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.mm	2021-03-06 11:13:42 UTC (rev 274033)
@@ -100,6 +100,13 @@
     return m_layerHostingContext->contextID();
 }
 
+void PlatformCALayerRemoteCustom::populateCreationProperties(RemoteLayerTreeTransaction::LayerCreationProperties& properties, const RemoteLayerTreeContext& context, PlatformCALayer::LayerType type)
+{
+    PlatformCALayerRemote::populateCreationProperties(properties, context, type);
+    properties.hostingContextID = hostingContextID();
+    properties.hostingDeviceScaleFactor = context.deviceScaleFactor();
+}
+
 Ref<WebCore::PlatformCALayer> PlatformCALayerRemoteCustom::clone(PlatformCALayerClient* owner) const
 {
     RetainPtr<CALayer> clonedLayer;

Copied: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.h (from rev 274032, trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.h) (0 => 274033)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.h	2021-03-06 11:13:42 UTC (rev 274033)
@@ -0,0 +1,51 @@
+/*
+ * 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
+
+#include "PlatformCALayerRemote.h"
+
+namespace WebKit {
+
+class PlatformCALayerRemoteModelHosting final : public PlatformCALayerRemote {
+    friend class PlatformCALayerRemote;
+public:
+    static Ref<PlatformCALayerRemote> create(Ref<WebCore::Model>, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
+
+    virtual ~PlatformCALayerRemoteModelHosting();
+
+private:
+    PlatformCALayerRemoteModelHosting(Ref<WebCore::Model>, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext&);
+
+    Ref<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const override;
+    
+    void populateCreationProperties(RemoteLayerTreeTransaction::LayerCreationProperties&, const RemoteLayerTreeContext&, WebCore::PlatformCALayer::LayerType) override;
+
+    Ref<Model> m_model;
+};
+
+} // namespace WebKit
+
+SPECIALIZE_TYPE_TRAITS_PLATFORM_CALAYER(WebKit::PlatformCALayerRemoteModelHosting, isPlatformCALayerRemote())

Added: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.mm (0 => 274033)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.mm	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.mm	2021-03-06 11:13:42 UTC (rev 274033)
@@ -0,0 +1,69 @@
+/*
+ * 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.
+ */
+
+#import "config.h"
+#import "PlatformCALayerRemoteModelHosting.h"
+
+#import "RemoteLayerTreeContext.h"
+#import "WebProcess.h"
+#import <WebCore/GraphicsLayerCA.h>
+#import <WebCore/PlatformCALayerCocoa.h>
+#import <wtf/RetainPtr.h>
+
+namespace WebKit {
+
+Ref<PlatformCALayerRemote> PlatformCALayerRemoteModelHosting::create(Ref<WebCore::Model> model, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
+{
+    auto layer = adoptRef(*new PlatformCALayerRemoteModelHosting(model, owner, context));
+    context.layerDidEnterContext(layer.get(), layer->layerType());
+    return WTFMove(layer);
+}
+
+PlatformCALayerRemoteModelHosting::PlatformCALayerRemoteModelHosting(Ref<WebCore::Model> model, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
+    : PlatformCALayerRemote(WebCore::PlatformCALayer::LayerTypeModelLayer, owner, context)
+    , m_model(model)
+{
+}
+
+PlatformCALayerRemoteModelHosting::~PlatformCALayerRemoteModelHosting() = default;
+
+Ref<WebCore::PlatformCALayer> PlatformCALayerRemoteModelHosting::clone(WebCore::PlatformCALayerClient* owner) const
+{
+    auto clone = adoptRef(*new PlatformCALayerRemoteModelHosting(m_model, owner, *context()));
+    context()->layerDidEnterContext(clone.get(), clone->layerType());
+
+    updateClonedLayerProperties(clone.get(), false);
+
+    clone->setClonedLayer(this);
+    return WTFMove(clone);
+}
+
+void PlatformCALayerRemoteModelHosting::populateCreationProperties(RemoteLayerTreeTransaction::LayerCreationProperties& properties, const RemoteLayerTreeContext& context, PlatformCALayer::LayerType type)
+{
+    PlatformCALayerRemote::populateCreationProperties(properties, context, type);
+    properties.model = m_model.ptr();
+}
+
+} // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm (274032 => 274033)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm	2021-03-06 07:52:41 UTC (rev 274032)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm	2021-03-06 11:13:42 UTC (rev 274033)
@@ -90,14 +90,8 @@
     GraphicsLayer::PlatformLayerID layerID = layer.layerID();
 
     RemoteLayerTreeTransaction::LayerCreationProperties creationProperties;
-    creationProperties.layerID = layerID;
-    creationProperties.type = type;
+    layer.populateCreationProperties(creationProperties, *this, type);
 
-    if (layer.isPlatformCALayerRemoteCustom()) {
-        creationProperties.hostingContextID = layer.hostingContextID();
-        creationProperties.hostingDeviceScaleFactor = deviceScaleFactor();
-    }
-
     m_createdLayers.add(layerID, WTFMove(creationProperties));
     m_livePlatformLayers.add(layerID, &layer);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to