1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:37:35 +00:00

LibWeb: Convert Layout::Node to new pixel units

This commit is contained in:
Sam Atkins 2022-11-08 11:31:24 +00:00 committed by Linus Groh
parent 65cdf89a8b
commit 5d8e3f5122
7 changed files with 18 additions and 18 deletions

View file

@ -447,7 +447,7 @@ CSSPixelPoint BrowsingContext::to_top_level_position(CSSPixelPoint a_position)
return {};
if (!ancestor->container()->layout_node())
return {};
position.translate_by(ancestor->container()->layout_node()->box_type_agnostic_position().to_type<CSSPixels>());
position.translate_by(ancestor->container()->layout_node()->box_type_agnostic_position());
}
return position;
}

View file

@ -170,7 +170,7 @@ int HTMLElement::offset_top() const
return 0;
auto position = layout_node()->box_type_agnostic_position();
auto parent_position = parent_element()->layout_node()->box_type_agnostic_position();
return position.y() - parent_position.y();
return position.y().value() - parent_position.y().value();
}
// https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetleft
@ -183,7 +183,7 @@ int HTMLElement::offset_left() const
return 0;
auto position = layout_node()->box_type_agnostic_position();
auto parent_position = parent_element()->layout_node()->box_type_agnostic_position();
return position.x() - parent_position.x();
return position.x().value() - parent_position.x().value();
}
// https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsetwidth