Add RB.ContentViewport for managing safe content areas.
Review Request #13228 — Created Aug. 22, 2023 and submitted
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.
- Change Summary:
-
- Removed leftover debug output.
- Fixed a bad import.
- Commits:
-
Summary ID 0e68bfae65f78056eb06b17b5595635f0f5cd151 5d1e8d3b512607855224ba3f09b3e17afefd566d - Diff:
-
Revision 2 (+1392)