@@ -141,20 +141,23 @@ export class WebCompat extends ContentFeature {
141
141
if ( this . getFeatureSettingEnabled ( 'enumerateDevices' ) ) {
142
142
this . deviceEnumerationFix ( ) ;
143
143
}
144
+ // Used by Android in the non adsjs version
145
+ // This has to be enabled in the config for the injectName='android' now.
146
+ if ( this . getFeatureSettingEnabled ( 'viewportWidthLegacy' , 'disabled' ) ) {
147
+ this . viewportWidthFix ( ) ;
148
+ }
144
149
}
145
150
146
151
/**
147
152
* Handle user preference updates when merged during initialization.
148
153
* Re-applies viewport fixes if viewport configuration has changed.
154
+ * Used in the injectName='android-adsjs' instead of 'viewportWidthLegacy' from init.
149
155
* @param {object } _updatedConfig - The configuration with merged user preferences
150
156
*/
151
157
onUserPreferencesMerged ( _updatedConfig ) {
152
158
// Re-apply viewport width fix if viewport settings might have changed
153
159
if ( this . getFeatureSettingEnabled ( 'viewportWidth' ) ) {
154
- if ( ! this . _viewportWidthFixApplied ) {
155
- this . viewportWidthFix ( ) ;
156
- this . _viewportWidthFixApplied = true ;
157
- }
160
+ this . viewportWidthFix ( ) ;
158
161
}
159
162
}
160
163
@@ -698,6 +701,10 @@ export class WebCompat extends ContentFeature {
698
701
}
699
702
700
703
viewportWidthFix ( ) {
704
+ if ( this . _viewportWidthFixApplied ) {
705
+ return ;
706
+ }
707
+ this . _viewportWidthFixApplied = true ;
701
708
if ( document . readyState === 'loading' ) {
702
709
// if the document is not ready, we may miss the original viewport tag
703
710
document . addEventListener ( 'DOMContentLoaded' , ( ) => this . viewportWidthFixInner ( ) ) ;
0 commit comments