mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +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:
parent
372f2dd7a1
commit
44bb2b7e32
Notes:
github-actions[bot]
2025-01-02 10:29:35 +00:00
Author: https://github.com/shannonbooth
Commit: 44bb2b7e32
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3077
Reviewed-by: https://github.com/awesomekling
3 changed files with 78 additions and 2 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue