mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 19:04:58 +00:00
LibWeb/HTML: Use paintable box for 'associated CSS layout box' check
This is consistent with other functions such as HTMLElement::offset_width and fixes a crash for the included test. Returning an offset of zero is not correct for this case, but this is still an improvement to not crash.
This commit is contained in:
committed by
Andreas Kling
parent
372f2dd7a1
commit
44bb2b7e32
@@ -460,7 +460,7 @@ int HTMLElement::offset_top() const
|
||||
// NOTE: Ensure that layout is up-to-date before looking at metrics.
|
||||
const_cast<DOM::Document&>(document()).update_layout();
|
||||
|
||||
if (!layout_node())
|
||||
if (!paintable_box())
|
||||
return 0;
|
||||
|
||||
CSSPixels top_border_edge_of_element = paintable_box()->absolute_border_box_rect().y();
|
||||
@@ -502,7 +502,7 @@ int HTMLElement::offset_left() const
|
||||
// NOTE: Ensure that layout is up-to-date before looking at metrics.
|
||||
const_cast<DOM::Document&>(document()).update_layout();
|
||||
|
||||
if (!layout_node())
|
||||
if (!paintable_box())
|
||||
return 0;
|
||||
|
||||
CSSPixels left_border_edge_of_element = paintable_box()->absolute_border_box_rect().x();
|
||||
|
||||
Reference in New Issue
Block a user