Add RB.ContentViewport for managing safe content areas.

Review Request #13228 — Created Aug. 22, 2023 and submitted

Information

Review Board
release-6.x

Reviewers

This introduces a new RB.ContentViewport class and
RB.contentViewport global that's used for tracking offsets into the
main browwser viewport that are safe for content. Its primarily useful
for helping dock content and align elements.

Elements can be registered for tracking, ensuring that any element
resizes automatically update the content area. The machinery for
tracking is only enabled when first used, to save on memory in places
where nothing is docked.

All tracking is done with a WeakMap. If the element disappears, it
will be untracked automatically. Worth noting, though, that the viewport
won't automatically adjust until another resize event occurs. We could
track removals down the road, but currently, it's not necessary.

The Unified Banner is registered as a tracked item on instantiation
during construction.

This will be used in an upcoming change to help properly center the
collapse button for diffs.

Unit tests pass.

Tested with upcoming changes for the diff collapse button, and
verified that any resizes to the Unified Banner were factored in
for positioning.

Summary ID
Add RB.ContentViewport for managing safe content areas.
This introduces a new `RB.ContentViewport` class and `RB.contentViewport` global that's used for tracking offsets into the main browwser viewport that are safe for content. Its primarily useful for helping dock content and align elements. Elements can be registered for tracking, ensuring that any element resizes automatically update the content area. The machinery for tracking is only enabled when first used, to save on memory in places where nothing is docked. All tracking is done with a `WeakMap`. If the element disappears, it will be untracked automatically. Worth noting, though, that the viewport won't automatically adjust until another resize event occurs. We could track removals down the road, but currently, it's not necessary. The Unified Banner is registered as a tracked item on instantiation during construction. This will be used in an upcoming change to help properly center the collapse button for diffs.
5d1e8d3b512607855224ba3f09b3e17afefd566d
Description From Last Updated

Leftover debug output.

daviddavid

suite should come from @beanbag/jasmine-suites

daviddavid
maubin
  1. Ship It!
  2. 
      
david
  1. 
      
  2. Show all issues

    Leftover debug output.

  3. Show all issues

    suite should come from @beanbag/jasmine-suites

  4. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-6.x (2c4e793)