WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
227530
[Model] [macOS] Add support for rendering model resources
https://bugs.webkit.org/show_bug.cgi?id=227530
Summary
[Model] [macOS] Add support for rendering model resources
Antoine Quint
Reported
2021-06-30 08:26:37 PDT
[Model] [macOS] Add support for rendering model resources
Attachments
Patch
(64.08 KB, patch)
2021-06-30 08:36 PDT
,
Antoine Quint
no flags
Details
Formatted Diff
Diff
Patch
(64.21 KB, patch)
2021-06-30 08:42 PDT
,
Antoine Quint
no flags
Details
Formatted Diff
Diff
Patch
(39.29 KB, patch)
2021-06-30 13:48 PDT
,
Antoine Quint
dino
: review+
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Antoine Quint
Comment 1
2021-06-30 08:36:28 PDT
Created
attachment 432598
[details]
Patch
Radar WebKit Bug Importer
Comment 2
2021-06-30 08:37:45 PDT
<
rdar://problem/79968206
>
Antoine Quint
Comment 3
2021-06-30 08:42:12 PDT
Created
attachment 432599
[details]
Patch
Sam Weinig
Comment 4
2021-06-30 10:34:34 PDT
Comment on
attachment 432599
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=432599&action=review
> Source/WebCore/Modules/model-element/HTMLModelElement.mm:29 > +#if ENABLE(MODEL_ELEMENT)
We shouldn't use .mm for cross platform code like this. Please keep this a .cpp file and factor out the objective-c bits into their own classes.
Antoine Quint
Comment 5
2021-06-30 11:51:12 PDT
(In reply to Sam Weinig from
comment #4
)
> Comment on
attachment 432599
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=432599&action=review
> > > Source/WebCore/Modules/model-element/HTMLModelElement.mm:29 > > +#if ENABLE(MODEL_ELEMENT) > > We shouldn't use .mm for cross platform code like this. Please keep this a > .cpp file and factor out the objective-c bits into their own classes.
Right, so add a Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm with these bits?
Antoine Quint
Comment 6
2021-06-30 13:48:25 PDT
Created
attachment 432623
[details]
Patch
Dean Jackson
Comment 7
2021-06-30 17:31:20 PDT
Comment on
attachment 432623
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=432623&action=review
No test?
> Source/WebCore/ChangeLog:12 > + <model> element is created and message the UIProcess through the ChromeClient provinding the UUID generated for it. When
Typo provinding
> Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm:43 > +#include <wtf/UUID.h> > +SOFT_LINK_PRIVATE_FRAMEWORK(AssetViewer);
Add a space between these lines.
> Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm:66 > + auto fileName = FileSystem::encodeForFileName(createCanonicalUUIDString()) + ".usdz";
What about if it is a .reality file?
> Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm:74 > + auto file = FileSystem::openFile(filePath, FileSystem::FileOpenMode::Write); > + if (file <= 0) > + return; > + > + FileSystem::writeToFile(file, m_data->data(), m_data->size()); > + FileSystem::closeFile(file); > + m_filePath = filePath;
Can you put a note in here that this is a temporary solution and we don't want to write to files?
> Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm:92 > + FloatSize size; > + if (auto* renderer = this->renderer()) > + size = renderer->absoluteBoundingBoxRect(false).size();
If there isn't a renderer you probably just want to exit. if (!this->renderer()) return; auto size = this->renderer()->aBB...
> Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm:134 > + else > + iterator->value = preview;
I didn't know you could do this! Very nice.
Antoine Quint
Comment 8
2021-06-30 23:25:28 PDT
(In reply to Dean Jackson from
comment #7
)
> Comment on
attachment 432623
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=432623&action=review
> > > Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm:66 > > + auto fileName = FileSystem::encodeForFileName(createCanonicalUUIDString()) + ".usdz"; > > What about if it is a .reality file?
Filed
bug 227568
, will add a reference to it in the commit.
> > Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm:74 > > + auto file = FileSystem::openFile(filePath, FileSystem::FileOpenMode::Write); > > + if (file <= 0) > > + return; > > + > > + FileSystem::writeToFile(file, m_data->data(), m_data->size()); > > + FileSystem::closeFile(file); > > + m_filePath = filePath; > > Can you put a note in here that this is a temporary solution and we don't > want to write to files?
Filed
bug 227567
and adding a reference to it in the commit.
Antoine Quint
Comment 9
2021-06-30 23:32:23 PDT
Committed
r279451
(
239307@main
): <
https://commits.webkit.org/239307@main
>
Sam Weinig
Comment 10
2021-07-01 10:24:14 PDT
(In reply to Antoine Quint from
comment #5
)
> (In reply to Sam Weinig from
comment #4
) > > Comment on
attachment 432599
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=432599&action=review
> > > > > Source/WebCore/Modules/model-element/HTMLModelElement.mm:29 > > > +#if ENABLE(MODEL_ELEMENT) > > > > We shouldn't use .mm for cross platform code like this. Please keep this a > > .cpp file and factor out the objective-c bits into their own classes. > > Right, so add a > Source/WebCore/Modules/model-element/HTMLModelElementCocoa.mm with these > bits?
I usually try to add some c++ wrapper class in its own files instead to avoid having multiple implementation files for the same header which is not something that is very understandable.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug