Update _elemSizeCache with the observed sizes.
(entries: ResizeObserverEntry[])
| 534 | |
| 535 | /** Update _elemSizeCache with the observed sizes. */ |
| 536 | private _updateCachedSizes(entries: ResizeObserverEntry[]) { |
| 537 | let needsColumnUpdate = false; |
| 538 | for (const entry of entries) { |
| 539 | const newEntry = entry.borderBoxSize?.length |
| 540 | ? { |
| 541 | width: entry.borderBoxSize[0].inlineSize, |
| 542 | height: entry.borderBoxSize[0].blockSize, |
| 543 | } |
| 544 | : { |
| 545 | width: entry.contentRect.width, |
| 546 | height: entry.contentRect.height, |
| 547 | }; |
| 548 | |
| 549 | if ( |
| 550 | newEntry.width !== this._elemSizeCache.get(entry.target as HTMLElement)?.width && |
| 551 | isCell(entry.target) |
| 552 | ) { |
| 553 | needsColumnUpdate = true; |
| 554 | } |
| 555 | |
| 556 | this._elemSizeCache.set(entry.target as HTMLElement, newEntry); |
| 557 | } |
| 558 | |
| 559 | if (needsColumnUpdate && this._updatedStickyColumnsParamsToReplay.length) { |
| 560 | if (this._stickyColumnsReplayTimeout) { |
| 561 | clearTimeout(this._stickyColumnsReplayTimeout); |
| 562 | } |
| 563 | |
| 564 | this._stickyColumnsReplayTimeout = setTimeout(() => { |
| 565 | if (this._destroyed) { |
| 566 | return; |
| 567 | } |
| 568 | |
| 569 | for (const update of this._updatedStickyColumnsParamsToReplay) { |
| 570 | this.updateStickyColumns( |
| 571 | update.rows, |
| 572 | update.stickyStartStates, |
| 573 | update.stickyEndStates, |
| 574 | true, |
| 575 | false, |
| 576 | ); |
| 577 | } |
| 578 | this._updatedStickyColumnsParamsToReplay = []; |
| 579 | this._stickyColumnsReplayTimeout = null; |
| 580 | }, 0); |
| 581 | } |
| 582 | } |
| 583 | } |
| 584 | |
| 585 | function isCell(element: Element) { |
no test coverage detected