Changeset 250858 in webkit


Ignore:
Timestamp:
Oct 8, 2019 1:49:48 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: Canvas: don't show an empty preview for WebGPU devices
https://bugs.webkit.org/show_bug.cgi?id=202679

Reviewed by Matt Baker.

HTMLCanvasElement.prototype.toDataURL hasn't been hooked up for GPUCanvasContext yet, so
calling Canvas.requestContent with a WebGPUDevice won't give us any good results.

As such, the Web Inspector frontend should show something slightly more actionable, such as
a more generic non-error "No Preview Available" message.

  • UserInterface/Models/Canvas.js:

(WI.Canvas.supportsRequestContentForContextType): Added.
(WI.Canvas.prototype.requestContent):

  • UserInterface/Views/CanvasContentView.js:

(WI.CanvasContentView.prototype._showError):

Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r250855 r250858  
     12019-10-08  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: Canvas: don't show an empty preview for WebGPU devices
     4        https://bugs.webkit.org/show_bug.cgi?id=202679
     5
     6        Reviewed by Matt Baker.
     7
     8        `HTMLCanvasElement.prototype.toDataURL` hasn't been hooked up for `GPUCanvasContext` yet, so
     9        calling `Canvas.requestContent` with a `WebGPUDevice` won't give us any good results.
     10
     11        As such, the Web Inspector frontend should show something slightly more actionable, such as
     12        a more generic non-error "No Preview Available" message.
     13
     14        * UserInterface/Models/Canvas.js:
     15        (WI.Canvas.supportsRequestContentForContextType): Added.
     16        (WI.Canvas.prototype.requestContent):
     17
     18        * UserInterface/Views/CanvasContentView.js:
     19        (WI.CanvasContentView.prototype._showError):
     20
    1212019-10-08  Devin Rousso  <drousso@apple.com>
    222
  • trunk/Source/WebInspectorUI/UserInterface/Models/Canvas.js

    r250258 r250858  
    118118    }
    119119
     120    static supportsRequestContentForContextType(contextType)
     121    {
     122        switch (contextType) {
     123        case Canvas.ContextType.WebGPU:
     124        case Canvas.ContextType.WebMetal:
     125            return false;
     126        }
     127        return true;
     128    }
     129
    120130    // Public
    121131
     
    200210    requestContent()
    201211    {
     212        if (!Canvas.supportsRequestContentForContextType(this._contextType))
     213            return Promise.resolve(null);
    202214        return CanvasAgent.requestContent(this._identifier).then((result) => result.content).catch((error) => console.error(error));
    203215    }
  • trunk/Source/WebInspectorUI/UserInterface/Views/CanvasContentView.js

    r250814 r250858  
    249249
    250250        if (!this._errorElement) {
    251             const isError = true;
     251            let isError = WI.Canvas.supportsRequestContentForContextType(this.representedObject.contextType);
    252252            this._errorElement = WI.createMessageTextView(WI.UIString("No Preview Available"), isError);
    253253        }
Note: See TracChangeset for help on using the changeset viewer.