@@ -52,15 +52,19 @@ const UIStrings = {
5252 /**
5353 *@description Text of a DOM element in DView of the Layers panel
5454 */
55- layerInformationIsNotYet : 'Layer information is not yet available.' ,
55+ noLayerInformation : 'No layers detected yet' ,
56+ /**
57+ *@description Text of a DOM element in DView of the Layers panel that explains the panel
58+ */
59+ layerExplanation : 'On this page you will be able to view and inspect document layers.' ,
5660 /**
5761 *@description Accessibility label for canvas view in Layers tool
5862 */
5963 dLayersView : '3D Layers View' ,
6064 /**
6165 *@description Text in DView of the Layers panel
6266 */
63- cantDisplayLayers : 'Can\'t display layers, ' ,
67+ cantDisplayLayers : 'Can\'t display layers' ,
6468 /**
6569 *@description Text in DView of the Layers panel
6670 */
@@ -106,7 +110,7 @@ const imageForTexture = new Map<WebGLTexture, HTMLImageElement>();
106110
107111export class Layers3DView extends Common . ObjectWrapper . eventMixin < EventTypes , typeof UI . Widget . VBox > ( UI . Widget . VBox )
108112 implements LayerView {
109- private readonly failBanner : UI . Widget . VBox ;
113+ private failBanner : UI . EmptyWidget . EmptyWidget ;
110114 private readonly layerViewHost : LayerViewHost ;
111115 private transformController : TransformController ;
112116 private canvasElement : HTMLCanvasElement ;
@@ -141,9 +145,8 @@ export class Layers3DView extends Common.ObjectWrapper.eventMixin<EventTypes, ty
141145 this . element . setAttribute ( 'jslog' , `${ VisualLogging . pane ( 'layers-3d-view' ) } ` ) ;
142146
143147 this . contentElement . classList . add ( 'layers-3d-view' ) ;
144- this . failBanner = new UI . Widget . VBox ( ) ;
145- this . failBanner . element . classList . add ( 'full-widget-dimmed-banner' ) ;
146- UI . UIUtils . createTextChild ( this . failBanner . element , i18nString ( UIStrings . layerInformationIsNotYet ) ) ;
148+ this . failBanner = new UI . EmptyWidget . EmptyWidget (
149+ i18nString ( UIStrings . noLayerInformation ) , i18nString ( UIStrings . layerExplanation ) ) ;
147150
148151 this . layerViewHost = layerViewHost ;
149152 this . layerViewHost . registerView ( this ) ;
@@ -763,8 +766,8 @@ export class Layers3DView extends Common.ObjectWrapper.eventMixin<EventTypes, ty
763766 }
764767 const gl = this . initGLIfNecessary ( ) ;
765768 if ( ! gl ) {
766- this . failBanner . element . removeChildren ( ) ;
767- this . failBanner . element . appendChild ( this . webglDisabledBanner ( ) ) ;
769+ this . failBanner . detach ( ) ;
770+ this . failBanner = this . webglDisabledBanner ( ) ;
768771 this . failBanner . show ( this . contentElement ) ;
769772 return ;
770773 }
@@ -783,14 +786,13 @@ export class Layers3DView extends Common.ObjectWrapper.eventMixin<EventTypes, ty
783786 this . drawViewportAndChrome ( ) ;
784787 }
785788
786- private webglDisabledBanner ( ) : Node {
787- const fragment = this . contentElement . ownerDocument . createDocumentFragment ( ) ;
788- fragment . createChild ( 'div' ) . textContent = i18nString ( UIStrings . cantDisplayLayers ) ;
789- fragment . createChild ( 'div' ) . textContent = i18nString ( UIStrings . webglSupportIsDisabledInYour ) ;
790- fragment . appendChild ( i18n . i18n . getFormatLocalizedString (
789+ private webglDisabledBanner ( ) : UI . EmptyWidget . EmptyWidget {
790+ const emptyWidget = new UI . EmptyWidget . EmptyWidget (
791+ i18nString ( UIStrings . cantDisplayLayers ) , i18nString ( UIStrings . webglSupportIsDisabledInYour ) ) ;
792+ emptyWidget . contentElement . appendChild ( i18n . i18n . getFormatLocalizedString (
791793 str_ , UIStrings . checkSForPossibleReasons ,
792794 { PH1 : UI . XLink . XLink . create ( 'about:gpu' , undefined , undefined , undefined , 'about-gpu' ) } ) ) ;
793- return fragment ;
795+ return emptyWidget ;
794796 }
795797
796798 private selectionFromEventPoint ( event : Event ) : Selection | null {
0 commit comments