@@ -40,13 +40,8 @@ const {getTextColorForBackground} = require('../../../../js/lib/color')
40
40
const { isIntermediateAboutPage} = require ( '../../../../js/lib/appUrlUtil' )
41
41
const contextMenus = require ( '../../../../js/contextMenus' )
42
42
const dnd = require ( '../../../../js/dnd' )
43
- const throttle = require ( '../../../../js/lib/throttle' )
44
43
const frameStateUtil = require ( '../../../../js/state/frameStateUtil' )
45
- const {
46
- getTabBreakpoint,
47
- tabUpdateFrameRate,
48
- hasTabAsRelatedTarget
49
- } = require ( '../../lib/tabUtil' )
44
+ const { hasTabAsRelatedTarget} = require ( '../../lib/tabUtil' )
50
45
const isWindows = require ( '../../../common/lib/platformUtil' ) . isWindows ( )
51
46
const { getCurrentWindowId} = require ( '../../currentWindow' )
52
47
const { setObserver} = require ( '../../lib/observerUtil' )
@@ -58,7 +53,6 @@ class Tab extends React.Component {
58
53
this . onMouseMove = this . onMouseMove . bind ( this )
59
54
this . onMouseEnter = this . onMouseEnter . bind ( this )
60
55
this . onMouseLeave = this . onMouseLeave . bind ( this )
61
- this . onUpdateTabSize = this . onUpdateTabSize . bind ( this )
62
56
this . onDragStart = this . onDragStart . bind ( this )
63
57
this . onDragEnd = this . onDragEnd . bind ( this )
64
58
this . onDragOver = this . onDragOver . bind ( this )
@@ -191,22 +185,6 @@ class Tab extends React.Component {
191
185
}
192
186
}
193
187
194
- get tabSize ( ) {
195
- const tab = this . tabNode
196
- // Avoid TypeError keeping it null until component is mounted
197
- return tab && ! this . props . isPinnedTab ? tab . getBoundingClientRect ( ) . width : null
198
- }
199
-
200
- onUpdateTabSize ( ) {
201
- const currentSize = getTabBreakpoint ( this . tabSize )
202
- // Avoid updating breakpoint when user enters fullscreen (see #7301)
203
- // Also there can be a race condition for pinned tabs if we update when not needed
204
- // since a new tab component with the same key gets created which is not pinned.
205
- if ( this . props . breakpoint !== currentSize && ! this . props . hasTabInFullScreen ) {
206
- windowActions . setTabBreakpoint ( this . props . frameKey , currentSize )
207
- }
208
- }
209
-
210
188
componentDidMount ( ) {
211
189
// do not observe pinned tabs
212
190
if ( this . props . isPinned ) {
@@ -219,9 +197,7 @@ class Tab extends React.Component {
219
197
this . observer = setObserver ( this . tabSentinel , threshold , margin , this . onObserve )
220
198
this . observer . observe ( this . tabSentinel )
221
199
222
- this . onUpdateTabSize ( ) // TODO: this will be depreacated
223
200
this . tabNode . addEventListener ( 'auxclick' , this . onAuxClick . bind ( this ) )
224
- window . addEventListener ( 'resize' , throttle ( this . onUpdateTabSize , tabUpdateFrameRate ) , { passive : true } )
225
201
}
226
202
227
203
componentDidUpdate ( ) {
@@ -230,12 +206,10 @@ class Tab extends React.Component {
230
206
if ( this . props . isPinnedTab ) {
231
207
this . observer . unobserve ( this . tabSentinel )
232
208
}
233
- this . onUpdateTabSize ( ) // TODO: deprecate
234
209
}
235
210
236
211
componentWillUnmount ( ) {
237
212
this . observer . unobserve ( this . tabSentinel )
238
- window . removeEventListener ( 'resize' , this . onUpdateTabSize )
239
213
}
240
214
241
215
onObserve ( entries ) {
@@ -270,23 +244,18 @@ class Tab extends React.Component {
270
244
// used in renderer
271
245
props . frameKey = ownProps . frameKey
272
246
props . isPrivateTab = frame . get ( 'isPrivate' )
273
- props . breakpoint = frame . get ( 'breakpoint' )
274
247
props . notificationBarActive = notificationBarActive
275
248
props . isActive = frameStateUtil . isFrameKeyActive ( currentWindow , props . frameKey )
276
249
props . tabWidth = currentWindow . getIn ( [ 'ui' , 'tabs' , 'fixTabWidth' ] )
277
250
props . isPinnedTab = tabState . isTabPinned ( state , tabId )
278
251
props . canPlayAudio = audioState . canPlayAudio ( currentWindow , props . frameKey )
279
252
props . themeColor = tabUIState . getThemeColor ( currentWindow , props . frameKey )
280
- props . isNarrowView = tabUIState . isNarrowView ( currentWindow , props . frameKey )
281
- props . isNarrowestView = tabUIState . isNarrowestView ( currentWindow , props . frameKey )
282
- props . isPlayIndicatorBreakpoint = tabUIState . isMediumView ( currentWindow , props . frameKey ) || props . isNarrowView
283
253
props . title = frame . get ( 'title' )
284
254
props . partOfFullPageSet = ownProps . partOfFullPageSet
285
255
286
256
// used in other functions
287
257
props . totalTabs = state . get ( 'tabs' ) . size
288
258
props . dragData = state . getIn ( [ 'dragData' , 'type' ] ) === dragTypes . TAB && state . get ( 'dragData' )
289
- props . hasTabInFullScreen = tabUIState . hasTabInFullScreen ( currentWindow )
290
259
props . tabId = tabId
291
260
props . previewMode = currentWindow . getIn ( [ 'ui' , 'tabs' , 'previewMode' ] )
292
261
@@ -335,19 +304,12 @@ class Tab extends React.Component {
335
304
isWindows && styles . tabForWindows ,
336
305
this . props . isPinnedTab && styles . isPinned ,
337
306
this . props . isActive && styles . active ,
338
- this . props . isPlayIndicatorBreakpoint && this . props . canPlayAudio && styles . narrowViewPlayIndicator ,
339
307
this . props . isActive && this . props . themeColor && perPageStyles . themeColor ,
340
308
// Private color should override themeColor
341
309
this . props . isPrivateTab && styles . private ,
342
- this . props . isActive && this . props . isPrivateTab && styles . activePrivateTab ,
343
- ! this . props . isPinnedTab && this . props . isNarrowView && styles . tabNarrowView ,
344
- ! this . props . isPinnedTab && this . props . isNarrowestView && styles . tabNarrowestView ,
345
- ! this . props . isPinnedTab && this . props . breakpoint === 'smallest' && styles . tabMinAllowedSize
310
+ this . props . isActive && this . props . isPrivateTab && styles . activePrivateTab
346
311
) }
347
312
data-test-id = 'tab'
348
- data-test-active-tab = { this . props . isActive }
349
- data-test-pinned-tab = { this . props . isPinnedTab }
350
- data-test-private-tab = { this . props . isPrivateTab }
351
313
data-frame-key = { this . props . frameKey }
352
314
draggable
353
315
title = { this . props . title }
@@ -361,11 +323,7 @@ class Tab extends React.Component {
361
323
ref = { ( node ) => { this . tabSentinel = node } }
362
324
className = { css ( styles . tab__sentinel ) }
363
325
/>
364
- < div className = { css (
365
- styles . tabId ,
366
- this . props . isNarrowView && styles . tabIdNarrowView ,
367
- this . props . breakpoint === 'smallest' && styles . tabIdMinAllowedSize
368
- ) } >
326
+ < div className = { css ( styles . tabId ) } >
369
327
< Favicon tabId = { this . props . tabId } />
370
328
< AudioTabIcon tabId = { this . props . tabId } />
371
329
< TabTitle tabId = { this . props . tabId } />
@@ -422,44 +380,6 @@ const styles = StyleSheet.create({
422
380
width : globalStyles . spacing . sentinelSize
423
381
} ,
424
382
425
- // Custom classes based on tab's width and behaviour
426
- tabNarrowView : {
427
- padding : '0 2px'
428
- } ,
429
-
430
- narrowViewPlayIndicator : {
431
- '::before' : {
432
- content : `''` ,
433
- display : 'block' ,
434
- position : 'absolute' ,
435
- top : 0 ,
436
- left : 0 ,
437
- right : 0 ,
438
- height : '2px' ,
439
- background : 'lightskyblue'
440
- }
441
- } ,
442
-
443
- tabNarrowestView : {
444
- justifyContent : 'center'
445
- } ,
446
-
447
- tabMinAllowedSize : {
448
- padding : 0
449
- } ,
450
-
451
- tabIdNarrowView : {
452
- flex : 'inherit'
453
- } ,
454
-
455
- tabIdMinAllowedSize : {
456
- overflow : 'hidden'
457
- } ,
458
-
459
- alternativePlayIndicator : {
460
- borderTop : '2px solid lightskyblue'
461
- } ,
462
-
463
383
tabId : {
464
384
justifyContent : 'center' ,
465
385
alignItems : 'center' ,
@@ -514,29 +434,6 @@ const styles = StyleSheet.create({
514
434
opacity : '0'
515
435
}
516
436
}
517
- } ,
518
-
519
- icon : {
520
- width : globalStyles . spacing . iconSize ,
521
- minWidth : globalStyles . spacing . iconSize ,
522
- height : globalStyles . spacing . iconSize ,
523
- backgroundSize : globalStyles . spacing . iconSize ,
524
- fontSize : globalStyles . fontSize . tabIcon ,
525
- backgroundPosition : 'center' ,
526
- backgroundRepeat : 'no-repeat' ,
527
- paddingLeft : globalStyles . spacing . defaultIconPadding ,
528
- paddingRight : globalStyles . spacing . defaultIconPadding
529
- } ,
530
-
531
- icon_audio : {
532
- color : globalStyles . color . highlightBlue ,
533
-
534
- // 16px
535
- fontSize : `calc(${ globalStyles . fontSize . tabIcon } + 2px)` ,
536
-
537
- // equal spacing around audio icon (favicon and tabTitle)
538
- padding : globalStyles . spacing . defaultTabPadding ,
539
- paddingRight : '0 !important'
540
437
}
541
438
} )
542
439
0 commit comments