11// Copyright 2023 The Chromium Authors. All rights reserved.
22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
4- /* eslint-disable rulesdir/no-lit-render-outside-of-view */
4+ /* eslint-disable rulesdir/no-lit-render-outside-of-view, rulesdir/inject-checkbox-styles */
55
66import '../../ui/components/adorners/adorners.js' ;
77import '../../ui/legacy/components/data_grid/data_grid.js' ;
@@ -17,19 +17,11 @@ import * as Input from '../../ui/components/input/input.js';
1717import * as LegacyWrapper from '../../ui/components/legacy_wrapper/legacy_wrapper.js' ;
1818// inspectorCommonStyles is imported for the empty state styling that is used for the start view
1919// eslint-disable-next-line rulesdir/es-modules-import
20- import inspectorCommonStylesRaw from '../../ui/legacy/inspectorCommon.css.js' ;
20+ import inspectorCommonStyles from '../../ui/legacy/inspectorCommon.css.js' ;
2121import * as Lit from '../../ui/lit/lit.js' ;
2222import * as VisualLogging from '../../ui/visual_logging/visual_logging.js' ;
2323
24- import autofillViewStylesRaw from './autofillView.css.js' ;
25-
26- // TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
27- const autofillViewStyles = new CSSStyleSheet ( ) ;
28- autofillViewStyles . replaceSync ( autofillViewStylesRaw . cssText ) ;
29-
30- // TODO(crbug.com/391381439): Fully migrate off of constructed style sheets.
31- const inspectorCommonStyles = new CSSStyleSheet ( ) ;
32- inspectorCommonStyles . replaceSync ( inspectorCommonStylesRaw . cssText ) ;
24+ import autofillViewStyles from './autofillView.css.js' ;
3325
3426const { html, render, Directives : { styleMap} } = Lit ;
3527const { FillingStrategy} = Protocol . Autofill ;
@@ -135,7 +127,6 @@ export class AutofillView extends LegacyWrapper.LegacyWrapper.WrappableComponent
135127 }
136128
137129 connectedCallback ( ) : void {
138- this . #shadow. adoptedStyleSheets = [ Input . checkboxStyles , autofillViewStyles , inspectorCommonStyles ] ;
139130 const autofillManager = AutofillManager . AutofillManager . AutofillManager . instance ( ) ;
140131 const formFilledEvent = autofillManager . getLastFilledAddressForm ( ) ;
141132 if ( formFilledEvent ) {
@@ -183,6 +174,9 @@ export class AutofillView extends LegacyWrapper.LegacyWrapper.WrappableComponent
183174 // Disabled until https://crbug.com/1079231 is fixed.
184175 // clang-format off
185176 render ( html `
177+ < style > ${ Input . checkboxStylesRaw } </ style >
178+ < style > ${ autofillViewStyles . cssText } </ style >
179+ < style > ${ inspectorCommonStyles . cssText } </ style >
186180 < main >
187181 < div class ="top-left-corner ">
188182 < label class ="checkbox-label " title =${ i18nString ( UIStrings . showTestAddressesInAutofillMenu ) } >
@@ -221,6 +215,9 @@ export class AutofillView extends LegacyWrapper.LegacyWrapper.WrappableComponent
221215 // Disabled until https://crbug.com/1079231 is fixed.
222216 // clang-format off
223217 render ( html `
218+ < style > ${ Input . checkboxStylesRaw } </ style >
219+ < style > ${ autofillViewStyles . cssText } </ style >
220+ < style > ${ inspectorCommonStyles . cssText } </ style >
224221 < main >
225222 < div class ="content-container " jslog =${ VisualLogging . pane ( 'autofill' ) } >
226223 < div class ="right-to-left " role ="region " aria-label =${ i18nString ( UIStrings . addressPreview ) } >
0 commit comments