File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11231123 } ;
11241124 }
11251125
1126+ function getCompactDesktopCssVarSnapshot ( layoutOverride ) {
1127+ if ( ! layoutOverride ) return 'desktop:none' ;
1128+ var parts = [ ] ;
1129+ if ( layoutOverride . workArea ) {
1130+ var workAreaWindowX = layoutOverride . windowBounds ? Math . round ( layoutOverride . windowBounds . x ) : Math . round ( layoutOverride . workArea . left ) ;
1131+ parts . push (
1132+ 'workarea' ,
1133+ Math . round ( layoutOverride . workArea . left - workAreaWindowX ) ,
1134+ Math . round ( layoutOverride . workArea . right - workAreaWindowX ) ,
1135+ Math . round ( layoutOverride . workArea . width ) ,
1136+ Math . round ( layoutOverride . workArea . height )
1137+ ) ;
1138+ } else {
1139+ parts . push ( 'workarea:none' ) ;
1140+ }
1141+ parts . push (
1142+ 'history' ,
1143+ Math . round ( layoutOverride . historyOffsetX || 0 ) ,
1144+ Number . isFinite ( layoutOverride . historyCenterX ) ? Math . round ( layoutOverride . historyCenterX ) : 'none'
1145+ ) ;
1146+ return parts . join ( ':' ) ;
1147+ }
1148+
11261149 function normalizeCompactDomRect ( rect ) {
11271150 if ( ! rect ) return null ;
11281151 var left = Number ( rect . left ) ;
16331656 Math . round ( target . top ) ,
16341657 Math . round ( target . width ) ,
16351658 Math . round ( target . height || COMPACT_SURFACE_DEFAULT_HEIGHT ) ,
1636- ( ! ! ( dragState && dragState . compactSurface ) || compactSurfaceDesktopDragActive ) ? 'dragging' : 'idle'
1659+ ( ! ! ( dragState && dragState . compactSurface ) || compactSurfaceDesktopDragActive ) ? 'dragging' : 'idle' ,
1660+ getCompactDesktopCssVarSnapshot ( layoutOverride )
16371661 ] . join ( ':' ) ;
16381662 if ( snapshot === compactSurfaceAnchorSnapshot ) {
16391663 return ;
Original file line number Diff line number Diff line change @@ -205,6 +205,19 @@ def test_desktop_compact_history_uses_workarea_not_browserwindow_viewport():
205205 assert "var workAreaWindowX = layoutOverride.windowBounds ? Math.round(layoutOverride.windowBounds.x) : Math.round(layoutOverride.workArea.left);" in script
206206 assert "Math.round(layoutOverride.workArea.left - workAreaWindowX) + 'px'" in script
207207 assert "Math.round(layoutOverride.workArea.right - workAreaWindowX) + 'px'" in script
208+ assert "function getCompactDesktopCssVarSnapshot(layoutOverride)" in script
209+ assert "Math.round(layoutOverride.workArea.left - workAreaWindowX)" in script
210+ assert "Math.round(layoutOverride.workArea.right - workAreaWindowX)" in script
211+ assert "Number.isFinite(layoutOverride.historyCenterX) ? Math.round(layoutOverride.historyCenterX) : 'none'" in script
212+
213+ sync_anchor_block = script .split ("function syncCompactSurfaceAnchor()" , 1 )[1 ].split (
214+ "function stopCompactMinimizeBallTracking()" ,
215+ 1 ,
216+ )[0 ]
217+ assert "getCompactDesktopCssVarSnapshot(layoutOverride)" in sync_anchor_block
218+ assert sync_anchor_block .index ("getCompactDesktopCssVarSnapshot(layoutOverride)" ) < sync_anchor_block .index (
219+ "if (snapshot === compactSurfaceAnchorSnapshot)"
220+ )
208221
209222 desktop_history_block = styles .split (
210223 "body.electron-chat-window.subtitle-web-host .compact-export-history-anchor" ,
You can’t perform that action at this time.
0 commit comments