WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 173569
Web Inspector: Support getting the content of WebGL/WebGL2 contexts
https://bugs.webkit.org/show_bug.cgi?id=173569
Summary
Web Inspector: Support getting the content of WebGL/WebGL2 contexts
Devin Rousso
Reported
2017-06-19 16:17:44 PDT
For WebGL/WebGL2/WebGPU canvases that do not have the "preserveDrawingBuffer" attribute set to true, it is not possible to get the content of the canvas via toDataURL. In order to display a snapshot of the canvas, we need another way to get its content.
Attachments
Patch
(19.27 KB, patch)
2017-06-20 18:39 PDT
,
Devin Rousso
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews106 for mac-elcapitan-wk2
(1.06 MB, application/zip)
2017-06-20 19:46 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from ews112 for mac-elcapitan
(1.76 MB, application/zip)
2017-06-20 20:04 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from ews101 for mac-elcapitan
(1.82 MB, application/zip)
2017-06-20 20:16 PDT
,
Build Bot
no flags
Details
Patch
(27.49 KB, patch)
2017-07-03 13:51 PDT
,
Devin Rousso
joepeck
: review-
Details
Formatted Diff
Diff
Patch
(27.10 KB, patch)
2017-07-05 10:49 PDT
,
Devin Rousso
buildbot
: commit-queue-
Details
Formatted Diff
Diff
Archive of layout-test-results from ews102 for mac-elcapitan
(1.09 MB, application/zip)
2017-07-05 11:24 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from ews104 for mac-elcapitan-wk2
(1.25 MB, application/zip)
2017-07-05 11:34 PDT
,
Build Bot
no flags
Details
Archive of layout-test-results from ews116 for mac-elcapitan
(1.87 MB, application/zip)
2017-07-05 12:04 PDT
,
Build Bot
no flags
Details
Patch
(26.66 KB, patch)
2017-07-05 13:12 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Patch
(27.03 KB, patch)
2017-07-05 13:20 PDT
,
Devin Rousso
joepeck
: review+
Details
Formatted Diff
Diff
Patch
(26.85 KB, patch)
2017-07-06 10:13 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Show Obsolete
(11)
View All
Add attachment
proposed patch, testcase, etc.
Devin Rousso
Comment 1
2017-06-20 18:39:13 PDT
Created
attachment 313465
[details]
Patch
Build Bot
Comment 2
2017-06-20 19:46:02 PDT
Comment on
attachment 313465
[details]
Patch
Attachment 313465
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.webkit.org/results/3969295
New failing tests: inspector/canvas/requestContent.html
Build Bot
Comment 3
2017-06-20 19:46:04 PDT
Created
attachment 313474
[details]
Archive of layout-test-results from ews106 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews106 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Build Bot
Comment 4
2017-06-20 20:04:08 PDT
Comment on
attachment 313465
[details]
Patch
Attachment 313465
[details]
did not pass mac-debug-ews (mac): Output:
http://webkit-queues.webkit.org/results/3969306
New failing tests: inspector/canvas/requestContent.html
Build Bot
Comment 5
2017-06-20 20:04:09 PDT
Created
attachment 313479
[details]
Archive of layout-test-results from ews112 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews112 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Build Bot
Comment 6
2017-06-20 20:16:23 PDT
Comment on
attachment 313465
[details]
Patch
Attachment 313465
[details]
did not pass mac-ews (mac): Output:
http://webkit-queues.webkit.org/results/3969461
New failing tests: inspector/canvas/requestContent.html
Build Bot
Comment 7
2017-06-20 20:16:24 PDT
Created
attachment 313481
[details]
Archive of layout-test-results from ews101 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews101 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Devin Rousso
Comment 8
2017-07-03 13:51:44 PDT
Created
attachment 314513
[details]
Patch
Radar WebKit Bug Importer
Comment 9
2017-07-03 13:52:46 PDT
<
rdar://problem/33112420
>
Joseph Pecoraro
Comment 10
2017-07-03 17:01:59 PDT
Comment on
attachment 314513
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=314513&action=review
r- just because of the bunch of comments I'd like to see an updated patch. The approach seems good to me.
> LayoutTests/inspector/canvas/requestContent-webgl2.html:27 > + CanvasAgent.requestContent(canvas.identifier, (error, content) => {
You should be able to write this like: CanvasAgent.requestContent(canvas.identifier) .then(({content}) => { InspectorTest.log(content); }) .then(resolve, reject); Which looks a little cleaner.
> Source/WebCore/html/canvas/WebGLRenderingContextBase.h:213 > + void preventBufferClearForInspector(bool value) { m_preventBufferClearForInspector = value; }
This should be a setter `setPreventBufferClearForInspector(bool)`. And you might as well include a getter even if it is not used.
> Source/WebCore/html/canvas/WebGLRenderingContextBase.h:841 > + bool m_preventBufferClearForInspector { false };
The rest of the member variables are in the protected area. For example: 572 bool m_synthesizedErrorsToConsole { true }; 573 int m_numGLErrorsToConsoleAllowed; I'd expect this to go near those.
> Source/WebCore/inspector/InspectorCanvasAgent.cpp:151 > + return;
This would return without clearing the PreventBufferClearForInspector state you just added. I'd expect code more like: WebGLRenderingContextBase* glContext = downcast<WebGLRenderingContextBase>(context); glContext->setPreventBufferClearForInspector(true); ExceptionOr<String> result = canvasEntry->element->toDataURL(ASCIILiteral("image/png")); glContext->setPreventBufferClearForInspector(false); if (result.hasException()) { errorString = result.releaseException().releaseMessage(); return; }
Devin Rousso
Comment 11
2017-07-05 10:49:05 PDT
Created
attachment 314617
[details]
Patch
Build Bot
Comment 12
2017-07-05 11:24:45 PDT
Comment on
attachment 314617
[details]
Patch
Attachment 314617
[details]
did not pass mac-ews (mac): Output:
http://webkit-queues.webkit.org/results/4057530
New failing tests: inspector/canvas/requestContent-2d.html
Build Bot
Comment 13
2017-07-05 11:24:46 PDT
Created
attachment 314624
[details]
Archive of layout-test-results from ews102 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Build Bot
Comment 14
2017-07-05 11:34:26 PDT
Comment on
attachment 314617
[details]
Patch
Attachment 314617
[details]
did not pass mac-wk2-ews (mac-wk2): Output:
http://webkit-queues.webkit.org/results/4057550
New failing tests: inspector/canvas/requestContent-2d.html
Build Bot
Comment 15
2017-07-05 11:34:27 PDT
Created
attachment 314627
[details]
Archive of layout-test-results from ews104 for mac-elcapitan-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-elcapitan-wk2 Platform: Mac OS X 10.11.6
Build Bot
Comment 16
2017-07-05 12:04:12 PDT
Comment on
attachment 314617
[details]
Patch
Attachment 314617
[details]
did not pass mac-debug-ews (mac): Output:
http://webkit-queues.webkit.org/results/4057623
New failing tests: inspector/canvas/requestContent-2d.html
Build Bot
Comment 17
2017-07-05 12:04:13 PDT
Created
attachment 314633
[details]
Archive of layout-test-results from ews116 for mac-elcapitan The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews116 Port: mac-elcapitan Platform: Mac OS X 10.11.6
Devin Rousso
Comment 18
2017-07-05 13:12:18 PDT
Created
attachment 314645
[details]
Patch
Devin Rousso
Comment 19
2017-07-05 13:20:14 PDT
Created
attachment 314647
[details]
Patch
Joseph Pecoraro
Comment 20
2017-07-05 20:04:10 PDT
Comment on
attachment 314647
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=314647&action=review
r=me
> Source/WebCore/html/canvas/WebGLRenderingContextBase.h:213 > + bool getPreventBufferClearForInspector() const { return m_preventBufferClearForInspector; }
Getter should not have a `get` prefix.
> Source/WebCore/inspector/InspectorCanvasAgent.cpp:160 > + gl->setPreventBufferClearForInspector(true); > + > + ExceptionOr<String> result = canvasEntry->element->toDataURL(ASCIILiteral("image/png")); > + > + gl->setPreventBufferClearForInspector(false);
Can you group these right next to the toDataURL line? That is the significant part to me.
Devin Rousso
Comment 21
2017-07-06 10:13:57 PDT
Created
attachment 314732
[details]
Patch
WebKit Commit Bot
Comment 22
2017-07-06 11:36:02 PDT
Comment on
attachment 314732
[details]
Patch Clearing flags on attachment: 314732 Committed
r219208
: <
http://trac.webkit.org/changeset/219208
>
WebKit Commit Bot
Comment 23
2017-07-06 11:36:04 PDT
All reviewed patches have been landed. Closing bug.
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