Bug 222798 - <model> should create a model-owning compositing layer
Summary: <model> should create a model-owning compositing layer
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Tim Horton
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-03-05 04:25 PST by Tim Horton
Modified: 2021-03-06 20:16 PST (History)
21 users (show)

See Also:


Attachments
Patch (52.07 KB, patch)
2021-03-05 04:27 PST, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (70.70 KB, patch)
2021-03-05 16:37 PST, Tim Horton
no flags Details | Formatted Diff | Diff
Patch (70.71 KB, patch)
2021-03-06 02:31 PST, Tim Horton
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Horton 2021-03-05 04:25:07 PST
<model> should create a model-owning compositing layer
Comment 1 Tim Horton 2021-03-05 04:27:35 PST
Created attachment 422362 [details]
Patch
Comment 2 EWS Watchlist 2021-03-05 04:29:03 PST
This patch modifies the inspector protocol. Please ensure that any frontend changes appropriately use feature checks for new protocol features.
Comment 3 Dean Jackson 2021-03-05 08:56:48 PST
Comment on attachment 422362 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=422362&action=review

> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:1856
> +    if (m_uncommittedChanges & ContentsModelChanged) // Needs to happen before ChildrenChanged

Nit: .
Comment 4 Sam Weinig 2021-03-05 09:03:44 PST
Comment on attachment 422362 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=422362&action=review

> Source/WebCore/ChangeLog:8
> +        Test: model-element/model-element-graphics-layers.html

(heart emoji)

> Source/WebCore/Modules/model-element/Model.h:41
> +    WEBCORE_EXPORT static Ref<Model> create(RefPtr<SharedBuffer>);

Should the RefPtr<SharedBuffer> ever be null? Perhaps making this a Ref<SharedBuffer> and storing the SharedBuffer as a Ref<SharedBuffer> would be preferable.
Comment 5 Simon Fraser (smfr) 2021-03-05 09:04:51 PST
Comment on attachment 422362 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=422362&action=review

> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:39
> +#include "Model.h"

This is a layering violation. Platform code can't see Modules code.

> Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:186
> +    RefPtr<Model> model() const override;
> +    void setModel(RefPtr<Model>) override;

It's really weird that our CALayer wrapper knows anything about Model. Why doesn't Model just use a CALayer subclass?
Comment 6 Devin Rousso 2021-03-05 10:30:18 PST
Comment on attachment 422362 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=422362&action=review

> Source/JavaScriptCore/inspector/protocol/LayerTree.json:56
> +                { "name": "model", "type": "boolean", "optional": true, "description": "Composition due to association with a <model> element." },

You'll also need to add this to the Web Inspector frontend with a corresponding `WI.UIString` (which you'll want to add to `Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js`):
 - `WI.Layers3DContentView.prototype._updateReasonsList`
 - `WI.LayerTreeDetailsSidebarPanel.prototype._populateListOfCompositingReasons`
Comment 7 Tim Horton 2021-03-05 10:42:53 PST
(In reply to Dean Jackson from comment #3)
> Comment on attachment 422362 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=422362&action=review
> 
> > Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:1856
> > +    if (m_uncommittedChanges & ContentsModelChanged) // Needs to happen before ChildrenChanged
> 
> Nit: .

I will fix the others :)

(In reply to Sam Weinig from comment #4)
> Comment on attachment 422362 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=422362&action=review
> 
> > Source/WebCore/Modules/model-element/Model.h:41
> > +    WEBCORE_EXPORT static Ref<Model> create(RefPtr<SharedBuffer>);
> 
> Should the RefPtr<SharedBuffer> ever be null? Perhaps making this a
> Ref<SharedBuffer> and storing the SharedBuffer as a Ref<SharedBuffer> would
> be preferable.

I'll try it! Likely fine.

(In reply to Simon Fraser (smfr) from comment #5)
> Comment on attachment 422362 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=422362&action=review
> 
> > Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:39
> > +#include "Model.h"
> 
> This is a layering violation. Platform code can't see Modules code.

Of course! Good point. Also, if it's the <model> equivalent of Image, it doesn't belong here anyway.

> > Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h:186
> > +    RefPtr<Model> model() const override;
> > +    void setModel(RefPtr<Model>) override;
> 
> It's really weird that our CALayer wrapper knows anything about Model. Why
> doesn't Model just use a CALayer subclass?

Also a good point, let me see if I can make this dance a little cleaner.
Comment 8 Tim Horton 2021-03-05 10:43:54 PST
(In reply to Devin Rousso from comment #6)
> Comment on attachment 422362 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=422362&action=review
> 
> > Source/JavaScriptCore/inspector/protocol/LayerTree.json:56
> > +                { "name": "model", "type": "boolean", "optional": true, "description": "Composition due to association with a <model> element." },
> 
> You'll also need to add this to the Web Inspector frontend with a
> corresponding `WI.UIString` (which you'll want to add to
> `Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js`):
>  - `WI.Layers3DContentView.prototype._updateReasonsList`
>  -
> `WI.LayerTreeDetailsSidebarPanel.prototype._populateListOfCompositingReasons`

Ooh! I forgot to search for the string once I found this code. Thanks, Devin!
Comment 9 Tim Horton 2021-03-05 16:37:49 PST
Created attachment 422453 [details]
Patch
Comment 10 Simon Fraser (smfr) 2021-03-05 16:45:31 PST
Comment on attachment 422453 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=422453&action=review

> Source/WebCore/Modules/model-element/HTMLModelElement.cpp:77
> +    if (auto modelData = this->modelData())
> +        return Model::create(*modelData);

Seems weird to create one every time, but I guess for now it's just wrapping the data.

> Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:153
> +    WEBCORE_EXPORT void setContentsToModel(RefPtr<Model>) override;

RefPtr<Model>&&?
Comment 11 Tim Horton 2021-03-06 02:31:30 PST
Created attachment 422479 [details]
Patch
Comment 12 EWS 2021-03-06 03:13:47 PST
Committed r274033: <https://commits.webkit.org/r274033>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 422479 [details].
Comment 13 Radar WebKit Bug Importer 2021-03-06 03:14:14 PST
<rdar://problem/75130174>
Comment 14 Lauro Moura 2021-03-06 20:16:24 PST
(In reply to EWS from comment #12)
> Committed r274033: <https://commits.webkit.org/r274033>
> 
> All reviewed patches have been landed. Closing bug and clearing flags on
> attachment 422479 [details].

This revision is making the GTK/WPE layout tests to exit early with lots of failures. See b222878.