|
@@ -974,7 +974,6 @@ JS::NonnullGCPtr<Geometry::DOMRectList> Element::get_client_rects() const
|
|
|
// or inline-table include both the table box and the caption box, if any, but not the anonymous container box.
|
|
|
// FIXME: - Replace each anonymous block box with its child box(es) and repeat this until no anonymous block boxes
|
|
|
// are left in the final list.
|
|
|
- auto viewport_offset = navigable->viewport_scroll_offset();
|
|
|
|
|
|
// NOTE: Make sure CSS transforms are resolved before it is used to calculate the rect position.
|
|
|
const_cast<Document&>(document()).update_paint_and_hit_testing_properties_if_needed();
|
|
@@ -988,21 +987,27 @@ JS::NonnullGCPtr<Geometry::DOMRectList> Element::get_client_rects() const
|
|
|
transform = Gfx::extract_2d_affine_transform(paintable_box->transform());
|
|
|
for (auto const* containing_block = paintable->containing_block(); !containing_block->is_viewport(); containing_block = containing_block->containing_block()) {
|
|
|
transform = Gfx::extract_2d_affine_transform(containing_block->transform()).multiply(transform);
|
|
|
- scroll_offset.translate_by(containing_block->scroll_offset());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (auto enclosing_scroll_offset = paintable_box->enclosing_scroll_frame(); enclosing_scroll_offset) {
|
|
|
+ scroll_offset.translate_by(-enclosing_scroll_offset->cumulative_offset());
|
|
|
}
|
|
|
|
|
|
auto absolute_rect = paintable_box->absolute_border_box_rect();
|
|
|
auto transformed_rect = transform.map(absolute_rect.translated(-paintable_box->transform_origin()).to_type<float>())
|
|
|
.to_type<CSSPixels>()
|
|
|
.translated(paintable_box->transform_origin())
|
|
|
- .translated(-scroll_offset)
|
|
|
- .translated(-viewport_offset);
|
|
|
+ .translated(-scroll_offset);
|
|
|
rects.append(Geometry::DOMRect::create(realm(), transformed_rect.to_type<float>()));
|
|
|
} else if (paintable && is<Painting::InlinePaintable>(*paintable)) {
|
|
|
auto const& inline_paintable = static_cast<Painting::InlinePaintable const&>(*paintable);
|
|
|
+
|
|
|
+ if (auto enclosing_scroll_offset = inline_paintable.enclosing_scroll_frame(); enclosing_scroll_offset) {
|
|
|
+ scroll_offset.translate_by(-enclosing_scroll_offset->cumulative_offset());
|
|
|
+ }
|
|
|
+
|
|
|
auto absolute_rect = inline_paintable.bounding_rect();
|
|
|
absolute_rect.translate_by(-scroll_offset);
|
|
|
- absolute_rect.translate_by(-viewport_offset);
|
|
|
rects.append(Geometry::DOMRect::create(realm(), transform.map(absolute_rect.to_type<float>())));
|
|
|
} else if (paintable) {
|
|
|
dbgln("FIXME: Failed to get client rects for element ({})", debug_description());
|