Skip to content

Truly independent web browser

LibWeb: Measure table rows at the used inline sizes of their cells

Andreas Klingee920a0a0308
diff --git a/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs b/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
index 001c06e150f..bd62efbeef0 100644
--- a/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
+++ b/Libraries/LibWeb/Rust/src/layout/table_formatting_context.rs
@@ -641,8 +641,6 @@ pub(crate) struct TableCell {
pub(crate) outer_max_inline_size: CssPixels,
pub(crate) outer_min_block_size: CssPixels,
pub(crate) outer_max_block_size: CssPixels,
- // The block size the cell specifies with a length `height`, as an outer size (see cell_specified_outer_block_size).
- pub(crate) outer_specified_block_size: CssPixels,
// The max-content inline size of the cell's content box, if its column measures read it (see compute_cell_measures).
pub(crate) max_content_inline_size: Option<CssPixels>,
}
@@ -665,7 +663,6 @@ pub(crate) struct Row {
pub(crate) is_collapsed: bool,
pub(crate) has_intrinsic_percentage: bool,
pub(crate) intrinsic_percentage: f64,
- pub(crate) is_constrained: bool,
}
impl Row {
@@ -683,7 +680,6 @@ impl Row {
is_collapsed,
has_intrinsic_percentage: false,
intrinsic_percentage: 0.0,
- is_constrained: false,
}
}
}
@@ -953,7 +949,6 @@ pub(crate) fn calculate_table_grid<T: TableTree>(tree: &T, table: Node, missing_
outer_max_inline_size: CssPixels::default(),
outer_min_block_size: CssPixels::default(),
outer_max_block_size: CssPixels::default(),
- outer_specified_block_size: CssPixels::default(),
max_content_inline_size: None,
});
current_column += column_span;
@@ -1072,7 +1067,7 @@ pub(super) struct TableFormattingContext<'pass> {
collapsed_table_borders: Option<std::sync::Arc<OwnedCollapsedTableBorders>>,
table_box_content_block_offset_in_wrapper: CssPixels,
min_border_box_block_size_from_flex_item: Option<CssPixels>,
- needs_fixed_mode_row_measurement: bool,
+ needs_row_measurement: bool,
cells: Vec<TableCell>,
/// What the table keeps of each cell while it lays the cell out, by the cell's index in `cells`, once the table
/// prepared its participants.
@@ -1235,7 +1230,7 @@ impl<'pass> TableFormattingContext<'pass> {
collapsed_table_borders: None,
table_box_content_block_offset_in_wrapper: CssPixels::default(),
min_border_box_block_size_from_flex_item: None,
- needs_fixed_mode_row_measurement: false,
+ needs_row_measurement: false,
cells: Vec::new(),
cell_layouts: Vec::new(),
columns: Vec::new(),
@@ -1287,7 +1282,7 @@ impl<'pass> TableFormattingContext<'pass> {
}
self.column_track_ranges = self.collect_column_track_ranges();
- self.needs_fixed_mode_row_measurement = false;
+ self.needs_row_measurement = false;
self.prepare_table_participants(TableParticipantPreparation::CellsOfEveryParticipant);
self.border_conflict_resolution();
self.compute_table_inline_size();
@@ -1807,12 +1802,6 @@ impl<'pass> TableFormattingContext<'pass> {
}
}
}
- for row_index in 0..self.rows.len() {
- let row_box = self.rows[row_index].box_;
- if self.style(row_box).height().is_length() {
- self.rows[row_index].is_constrained = true;
- }
- }
for cell_index in 0..self.cells.len() {
let cell = self.cells[cell_index];
let style = self.style(cell.box_);
@@ -1828,9 +1817,6 @@ impl<'pass> TableFormattingContext<'pass> {
self.columns[index].is_constrained = true;
}
}
- if style.height().is_length() {
- self.rows[cell.row_index].is_constrained = true;
- }
}
}
@@ -1880,10 +1866,9 @@ impl<'pass> TableFormattingContext<'pass> {
cell_box
}
- fn compute_cell_measures(&mut self, include_rows: bool) {
+ fn compute_cell_measures(&mut self) {
// Implements https://www.w3.org/TR/css-tables-3/#computing-cell-measures.
let inline_basis = self.table_constraints.inline_basis();
- let block_basis = self.table_constraints.block_basis();
self.compute_constrainedness();
let fixed = self.use_fixed_mode_layout();
let collapsed = self.style(self.run.box_).border_collapse() != BORDER_COLLAPSE_SEPARATE;
@@ -1929,9 +1914,6 @@ impl<'pass> TableFormattingContext<'pass> {
} else {
CssPixels::default()
};
- // Rows are never measured in fixed mode here (see run_until_inline_size_calculation), so the block-axis
- // measures below are not needed.
- debug_assert!(!include_rows);
self.cells[cell_index].outer_min_inline_size = outer;
self.cells[cell_index].outer_max_inline_size = outer;
continue;
@@ -1958,66 +1940,6 @@ impl<'pass> TableFormattingContext<'pass> {
self.cells[cell_index].outer_min_inline_size = min_inline.max(capped_min_content_inline) + inline_offsets;
self.cells[cell_index].max_content_inline_size = (!fixed).then_some(max_content_inline);
- if include_rows {
- let min_content_block = self.sizing().calculate_min_content_block_size(
- self.sized_cell(cell_index),
- max_content_inline,
- self.participant_constraints,
- );
- let max_content_block = self.sizing().calculate_max_content_block_size(
- self.sized_cell(cell_index),
- min_content_inline,
- self.participant_constraints,
- );
- let block_offsets = cell_box.border_box_top(collapsed) + cell_box.border_box_bottom(collapsed);
- let mut min_block = style.min_height().to_px(block_basis);
- if style.box_sizing() == box_sizing::BORDER_BOX {
- min_block = (min_block - block_offsets).max(CssPixels::default());
- }
- // The outer min-content block size of a table cell is its minimum block size adjusted by the cell intrinsic offsets.
- self.cells[cell_index].outer_min_block_size = min_block.max(min_content_block) + block_offsets;
- // The tables specification isn't explicit on how to use the height and max-height CSS properties in the outer max-content formulas.
- // However, during this early phase we don't have enough information to resolve percentage sizes yet and the formulas for outer sizes
- // in the specification give enough clues to pick defaults in a way that makes sense.
- let height = style.height();
- let max_height = style.max_height();
- // The specified block size takes part in the row measures as an outer size (see
- // initialize_table_measures). A block size that contains a percentage takes no part, "percentages
- // being treated as 0px" (https://www.w3.org/TR/css-tables-3/#computing-the-table-height); it is
- // applied when the table block size is distributed to the rows (see distribute_block_size_to_rows).
- let specified_outer = if height.is_auto() || height.contains_percentage() {
- CssPixels::default()
- } else {
- self.cell_specified_outer_block_size(cell.box_, &style, height.to_px(block_basis), block_offsets)
- };
- self.cells[cell_index].outer_specified_block_size = specified_outer;
- // The specified sizes below are content box sizes (see cell_specified_block_size_is_border_box).
- let block_size = if height.is_length() {
- (specified_outer - block_offsets).max(CssPixels::default())
- } else {
- CssPixels::default()
- };
- let mut max_block = if max_height.is_length() {
- max_height.to_px(block_basis)
- } else {
- CssPixels::from_raw(i32::MAX)
- };
- if style.box_sizing() == box_sizing::BORDER_BOX {
- max_block = (max_block - block_offsets).max(CssPixels::default());
- }
- self.cells[cell_index].outer_max_block_size = if self.rows[cell.row_index].is_constrained {
- // The outer max-content height of a table-cell in a constrained row is
- // max(min-height, height, min-content height, min(max-height, height)) adjusted by the cell intrinsic offsets.
- // NB: min(max-height, height) doesn't have any effect here, we can simplify the expression to max(min-height, height, min-content height).
- min_block.max(block_size.max(min_content_block)) + block_offsets
- } else {
- // The outer max-content height of a table-cell in a non-constrained row is
- // max(min-height, height, min-content height, min(max-height, max-content height)) adjusted by the cell intrinsic offsets.
- min_block.max(block_size.max(min_content_block.max(max_block.min(max_content_block))))
- + block_offsets
- };
- }
-
// See the explanation for block_size and max_block_size above.
self.cells[cell_index].outer_max_inline_size = if self.columns[cell.column_index].is_constrained {
// The outer max-content width of a table-cell in a constrained column is
@@ -2340,12 +2262,9 @@ impl<'pass> TableFormattingContext<'pass> {
// the largest of the resulting height of the previous row layout, the height specified on the corresponding table-row (if any), and
// the largest height specified on cells that span this row only (the algorithm starts by considering cells of span 2 on top of that assignment).
// The row measures are outer sizes, so the specified height counts with the cell's padding and
- // borders (compute_cell_measures records it; a cell measured in fixed mode has it in its outer
- // minimum instead, see compute_table_block_size).
+ // borders (the cell's outer minimum has it, see compute_table_block_size).
let row = &mut self.rows[cell.row_index];
- row.min_size = row
- .min_size
- .max(cell.outer_min_block_size.max(cell.outer_specified_block_size));
+ row.min_size = row.min_size.max(cell.outer_min_block_size);
row.max_size = row.max_size.max(cell.outer_max_block_size);
}
}
@@ -2952,37 +2871,17 @@ impl<'pass> TableFormattingContext<'pass> {
self.prepare_table_participants(participant_preparation);
self.border_conflict_resolution();
- let mut include_rows = !skip_row_measurement;
- self.needs_fixed_mode_row_measurement = false;
- // OPTIMIZATION: Row intrinsic measurements are only needed when row block-size constraints or row spans can affect
- // the later row distribution. Simple tables get their actual row block sizes from cell layout.
- if include_rows && self.can_skip_row_intrinsic_measurement() {
- include_rows = false;
- }
- if include_rows && self.use_fixed_mode_layout() {
- // https://drafts.csswg.org/css-tables-3/#computing-column-measures
- // For the purpose of measuring a column when laid out in fixed mode ... the min-content and max-content width
- // of cells is considered zero.
- //
- // https://drafts.csswg.org/css-tables-3/#ROWMIN
- // ROWMIN is defined as the sum of the minimum block sizes of the rows after a first row layout pass.
- // NB: So defer fixed-mode row measurement until after columns have their used widths.
- include_rows = false;
- self.needs_fixed_mode_row_measurement = true;
- }
+ // https://drafts.csswg.org/css-tables-3/#ROWMIN
+ // ROWMIN is defined as the sum of the minimum block sizes of the rows after a first row layout pass.
+ // NB: So the rows are measured once the columns have their used inline sizes (see compute_table_block_size),
+ // where each cell is laid out at the inline size it will have.
+ // OPTIMIZATION: Row measurements are only needed when row block-size constraints or row spans can affect the
+ // later row distribution. Simple tables get their actual row block sizes from cell layout.
+ self.needs_row_measurement = !skip_row_measurement && !self.can_skip_row_intrinsic_measurement();
// Compute the minimum width of each column.
- self.compute_cell_measures(include_rows);
+ self.compute_cell_measures();
self.compute_outer_content_sizes();
self.compute_table_measures(TrackAxis::Column);
- if include_rows {
- // https://www.w3.org/TR/css-tables-3/#row-layout
- // Since specified cell block sizes were ignored during row layout and cells spanning multiple rows were not
- // sized correctly, their block size must eventually be distributed to the rows they span. This is done
- // by running the same algorithm as the column measurement, with the span=1 value being initialized (for min-content) with the largest
- // of the resulting block size of the previous row layout, the size specified on the corresponding table row,
- // and the largest block size specified on cells that span only this row.
- self.compute_table_measures(TrackAxis::Row);
- }
}
/// Lays out the contents of the cell at `cell_index` with `sizing`, in the cells and with the input this table
@@ -3145,7 +3044,7 @@ impl<'pass> TableFormattingContext<'pass> {
},
);
let cell_box = self.cell_layouts[cell_index].box_cells;
- if self.needs_fixed_mode_row_measurement {
+ if self.needs_row_measurement {
let min_size = style.min_height().to_px(participant_block_basis);
let offsets = cell_box.border_box_top(collapsed) + cell_box.border_box_bottom(collapsed);
let measured = cell_box.border_box_block_size(collapsed).max(min_size + offsets);
@@ -3165,7 +3064,7 @@ impl<'pass> TableFormattingContext<'pass> {
let size = cell_box.border_box_block_size(collapsed);
self.rows[cell.row_index].base_block_size = self.rows[cell.row_index].base_block_size.max(size);
}
- if !self.needs_fixed_mode_row_measurement {
+ if !self.needs_row_measurement {
self.rows[cell.row_index].base_block_size = self.rows[cell.row_index]
.base_block_size
.max(self.rows[cell.row_index].min_size);
@@ -3175,7 +3074,7 @@ impl<'pass> TableFormattingContext<'pass> {
}
self.grow_rows_to_aligned_cells(|row| &mut row.base_block_size);
- if self.needs_fixed_mode_row_measurement {
+ if self.needs_row_measurement {
self.initialize_row_content_sizes();
self.compute_table_measures(TrackAxis::Row);
for row in &mut self.rows {
diff --git a/Tests/LibWeb/Text/expected/layout-run-cache-nested-reuse-under-measurement.txt b/Tests/LibWeb/Text/expected/layout-run-cache-nested-reuse-under-measurement.txt
index 4f222126aad..27fded168f6 100644
--- a/Tests/LibWeb/Text/expected/layout-run-cache-nested-reuse-under-measurement.txt
+++ b/Tests/LibWeb/Text/expected/layout-run-cache-nested-reuse-under-measurement.txt
@@ -1,2 +1,2 @@
-PASS: the cell's commit replays the inline-block its measurement laid out (work + checks)
-PASS: a measured cell reuses its unchanged inline-block from the previous pass (work + checks)
+PASS: the cell lays out its changed inline-block once (work + checks)
+PASS: the cell reuses its unchanged inline-block from the previous pass (work + checks)
diff --git a/Tests/LibWeb/Text/expected/table-row-block-size-distribution.txt b/Tests/LibWeb/Text/expected/table-row-block-size-distribution.txt
index d9af7a499db..562b7b203c0 100644
--- a/Tests/LibWeb/Text/expected/table-row-block-size-distribution.txt
+++ b/Tests/LibWeb/Text/expected/table-row-block-size-distribution.txt
@@ -47,3 +47,8 @@
47: 0+100 0+100 0+100
48: 0+300 0+100 0+100 100+200
49: 0+20 0+20 0+20
+50: 0+400 0+112 112+288 112+20
+51: 0+400 0+112 0+112 112+288
+52: 0+162 0+112 0+112 112+50
+53: 0+112 0+56 0+112 56+56
+54: 0+112 0+112 0+112
diff --git a/Tests/LibWeb/Text/input/layout-run-cache-nested-reuse-under-measurement.html b/Tests/LibWeb/Text/input/layout-run-cache-nested-reuse-under-measurement.html
index 98fa00c9f48..b12e709c1c0 100644
--- a/Tests/LibWeb/Text/input/layout-run-cache-nested-reuse-under-measurement.html
+++ b/Tests/LibWeb/Text/input/layout-run-cache-nested-reuse-under-measurement.html
@@ -13,7 +13,7 @@
layoutTest({
steps: [
{
- name: "the cell's commit replays the inline-block its measurement laid out",
+ name: "the cell lays out its changed inline-block once",
mutate: () => {
nested.textContent = "other words that wrap";
},
@@ -25,19 +25,15 @@
TableWrapper(anonymous)/block RUN (cache=miss)
Box<TABLE>/table RUN (cache=miss)
BlockContainer<TD>#cell MEASURE min-content inline (cache=hit)
- BlockContainer<TD>#cell MEASURE max-content block (cache=miss)
- BlockContainer<TD>#cell/block RUN (cache=miss)
- BlockContainer<DIV>#nested/block RUN (cache=miss)
- BlockContainer<TD>#cell MEASURE max-content block (cache=hit)
BlockContainer<TD>#cell/block RUN (cache=miss)
- BlockContainer<DIV>#nested/block REPLAY FRAGMENTS
+ BlockContainer<DIV>#nested/block RUN (cache=miss)
`,
check: equal => {
equal(nested.getBoundingClientRect().width, 80, "nested width");
},
},
{
- name: "a measured cell reuses its unchanged inline-block from the previous pass",
+ name: "the cell reuses its unchanged inline-block from the previous pass",
mutate: () => {
cell.style.height = "120px";
},
@@ -49,10 +45,6 @@
TableWrapper(anonymous)/block RUN (cache=miss)
Box<TABLE>/table RUN (cache=miss)
BlockContainer<TD>#cell MEASURE min-content inline (cache=hit)
- BlockContainer<TD>#cell MEASURE max-content block (cache=miss)
- BlockContainer<TD>#cell/block RUN (cache=miss)
- BlockContainer<DIV>#nested/block REUSE SUBTREE
- BlockContainer<TD>#cell MEASURE max-content block (cache=hit)
BlockContainer<TD>#cell/block RUN (cache=miss)
BlockContainer<DIV>#nested/block REUSE SUBTREE
`,
diff --git a/Tests/LibWeb/Text/input/layout-run-cache-table-cell-ahead-of-intrinsic-padding.html b/Tests/LibWeb/Text/input/layout-run-cache-table-cell-ahead-of-intrinsic-padding.html
index 8da0065a9eb..40d27783074 100644
--- a/Tests/LibWeb/Text/input/layout-run-cache-table-cell-ahead-of-intrinsic-padding.html
+++ b/Tests/LibWeb/Text/input/layout-run-cache-table-cell-ahead-of-intrinsic-padding.html
@@ -61,11 +61,7 @@
TableWrapper(anonymous)/block RUN (cache=miss)
Box<TABLE>#table/table RUN (cache=miss)
BlockContainer<TD>#text-cell MEASURE min-content inline (cache=hit)
- BlockContainer<TD>#text-cell MEASURE max-content block (cache=hit)
- BlockContainer<TD>#text-cell MEASURE max-content block (cache=hit)
BlockContainer<TD>#markup-cell MEASURE min-content inline (cache=hit)
- BlockContainer<TD>#markup-cell MEASURE max-content block (cache=hit)
- BlockContainer<TD>#markup-cell MEASURE max-content block (cache=hit)
BlockContainer<TD>#text-cell/block RUN (cache=miss)
BlockContainer<TD>#markup-cell/block RUN (cache=miss)
`,
@@ -89,13 +85,7 @@
TableWrapper(anonymous)/block RUN (cache=miss)
Box<TABLE>#table/table RUN (cache=miss)
BlockContainer<TD>#text-cell MEASURE min-content inline (cache=hit)
- BlockContainer<TD>#text-cell MEASURE max-content block (cache=hit)
- BlockContainer<TD>#text-cell MEASURE max-content block (cache=hit)
BlockContainer<TD>#markup-cell MEASURE min-content inline (cache=hit)
- BlockContainer<TD>#markup-cell MEASURE max-content block (cache=miss)
- BlockContainer<TD>#markup-cell/block RUN (cache=miss)
- BlockContainer<TD>#markup-cell MEASURE max-content block (cache=miss)
- BlockContainer<TD>#markup-cell/block RUN (cache=miss)
BlockContainer<TD>#text-cell/block REPLAY FRAGMENTS
BlockContainer<TD>#markup-cell/block RUN (cache=miss)
`,
@@ -119,15 +109,7 @@
TableWrapper(anonymous)/block RUN (cache=miss)
Box<TABLE>#table/table RUN (cache=miss)
BlockContainer<TD>#text-cell MEASURE min-content inline (cache=hit)
- BlockContainer<TD>#text-cell MEASURE max-content block (cache=miss)
- BlockContainer<TD>#text-cell/block RUN (cache=miss)
- BlockContainer<TD>#text-cell MEASURE max-content block (cache=miss)
- BlockContainer<TD>#text-cell/block RUN (cache=miss)
BlockContainer<TD>#markup-cell MEASURE min-content inline (cache=hit)
- BlockContainer<TD>#markup-cell MEASURE max-content block (cache=miss)
- BlockContainer<TD>#markup-cell/block RUN (cache=miss)
- BlockContainer<TD>#markup-cell MEASURE max-content block (cache=miss)
- BlockContainer<TD>#markup-cell/block RUN (cache=miss)
BlockContainer<TD>#text-cell/block RUN (cache=miss)
BlockContainer<TD>#markup-cell/block RUN (cache=miss)
`,
diff --git a/Tests/LibWeb/Text/input/layout-run-cache-table-percentage-cell-height-misses.html b/Tests/LibWeb/Text/input/layout-run-cache-table-percentage-cell-height-misses.html
index 5906f2b192a..27d136136d5 100644
--- a/Tests/LibWeb/Text/input/layout-run-cache-table-percentage-cell-height-misses.html
+++ b/Tests/LibWeb/Text/input/layout-run-cache-table-percentage-cell-height-misses.html
@@ -34,9 +34,6 @@
TableWrapper(anonymous)/block RUN (cache=miss)
Box<TABLE>#percentage-table/table RUN (cache=miss)
BlockContainer<TD>#percentage-cell MEASURE min-content inline (cache=hit)
- BlockContainer<TD>#percentage-cell MEASURE max-content block (cache=miss)
- BlockContainer<TD>#percentage-cell/block RUN (cache=miss)
- BlockContainer<TD>#percentage-cell MEASURE max-content block (cache=hit)
BlockContainer<TD>#percentage-cell/block RUN (cache=miss)
BlockContainer<TD>#percentage-cell/block REPLAY FRAGMENTS
BlockContainer<TD>#fixed-cell MEASURE min-content inline (cache=hit)
diff --git a/Tests/LibWeb/Text/input/table-row-block-size-distribution.html b/Tests/LibWeb/Text/input/table-row-block-size-distribution.html
index d1a9b7e24fb..02a27991d66 100644
--- a/Tests/LibWeb/Text/input/table-row-block-size-distribution.html
+++ b/Tests/LibWeb/Text/input/table-row-block-size-distribution.html
@@ -335,10 +335,40 @@
<div class="case"><table class="m">
<tr class="m"><td style="height: 100%"><div class="m" style="height: 50%"><div style="height: 20px"></div></div></td></tr>
</table></div>
+<!-- 50: table in a fixed-height box with a scaled-down image above a 100% height row -->
+<div class="case"><div style="height: 400px"><div class="table m" style="height: 100%">
+ <div><a style="display: block; overflow: hidden"><img class="m" style="display: block; width: 100%" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='630' height='354'/%3E"></a></div>
+ <a class="row m" style="height: 100%"><div class="m" style="height: 20px"></div></a>
+</div></div></div>
+
+<!-- 51: scaled-down image row beside a 100% height row in a fixed-height table -->
+<div class="case"><table class="m" style="height: 400px">
+ <tr class="m"><td><img class="m" style="display: block; width: 100%" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='630' height='354'/%3E"></td></tr>
+ <tr class="m" style="height: 100%"><td><div style="height: 20px"></div></td></tr>
+</table></div>
+
+<!-- 52: scaled-down image row beside a fixed-height row -->
+<div class="case"><table class="m">
+ <tr class="m"><td><img class="m" style="display: block; width: 100%" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='630' height='354'/%3E"></td></tr>
+ <tr class="m" style="height: 50px"><td><div style="height: 20px"></div></td></tr>
+</table></div>
+
+<!-- 53: scaled-down image in a cell spanning two rows -->
+<div class="case"><table class="m">
+ <tr class="m"><td rowspan="2"><img class="m" style="display: block; width: 100%" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='630' height='354'/%3E"></td><td><div style="height: 20px"></div></td></tr>
+ <tr class="m"><td><div style="height: 20px"></div></td></tr>
+</table></div>
+
+<!-- 54: scaled-down image beside a cell with a min-height -->
+<div class="case"><table class="m">
+ <tr class="m"><td><img class="m" style="display: block; width: 100%" src="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='630' height='354'/%3E"></td><td style="min-height: 10px"><div style="height: 20px"></div></td></tr>
+</table></div>
</div>
<script src="include.js"></script>
<script>
- test(() => {
+ promiseTest(async () => {
+ // The data: URL images decode asynchronously, so wait for them before measuring.
+ await Promise.all([...document.images].map(image => image.decode()));
const cases = document.querySelectorAll(".case");
cases.forEach((c, index) => {
const origin = c.getBoundingClientRect().top;