summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleProperties.cpp2
-rw-r--r--Userland/Libraries/LibWeb/CSS/StyleProperties.h2
-rw-r--r--Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp2
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLElement.cpp4
-rw-r--r--Userland/Libraries/LibWeb/Layout/LineBuilder.cpp6
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.cpp8
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.h12
7 files changed, 18 insertions, 18 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
index 49336f53d7..4a1d80b542 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp
@@ -138,7 +138,7 @@ NonnullRefPtr<Gfx::Font> StyleProperties::font_fallback(bool monospace, bool bol
return Platform::FontPlugin::the().default_font();
}
-float StyleProperties::line_height(Layout::Node const& layout_node) const
+CSSPixels StyleProperties::line_height(Layout::Node const& layout_node) const
{
auto line_height = property(CSS::PropertyID::LineHeight);
diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.h b/Userland/Libraries/LibWeb/CSS/StyleProperties.h
index 049977b92f..452f8c3cba 100644
--- a/Userland/Libraries/LibWeb/CSS/StyleProperties.h
+++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.h
@@ -106,7 +106,7 @@ public:
m_font = move(font);
}
- float line_height(Layout::Node const&) const;
+ CSSPixels line_height(Layout::Node const&) const;
bool operator==(StyleProperties const&) const;
diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
index 1cada0140c..e0b3c365c0 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp
@@ -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;
}
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
index 30df1d0256..e250d35744 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp
@@ -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
diff --git a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
index 8808991502..572fa0dba0 100644
--- a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
+++ b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp
@@ -181,7 +181,7 @@ void LineBuilder::update_last_line()
auto const typographic_height = font_metrics.ascent + font_metrics.descent;
auto const leading = line_height - typographic_height;
auto const half_leading = leading / 2;
- return font_metrics.ascent + half_leading;
+ return CSSPixels(font_metrics.ascent) + half_leading;
}();
auto line_box_baseline = [&] {
@@ -190,7 +190,7 @@ void LineBuilder::update_last_line()
auto const& font = fragment.layout_node().font();
auto const line_height = fragment.layout_node().line_height();
auto const font_metrics = font.pixel_metrics();
- auto const typographic_height = font_metrics.ascent + font_metrics.descent;
+ auto const typographic_height = CSSPixels(font_metrics.ascent + font_metrics.descent);
auto const leading = line_height - typographic_height;
auto const half_leading = leading / 2;
@@ -198,7 +198,7 @@ void LineBuilder::update_last_line()
CSSPixels fragment_baseline = 0;
if (fragment.layout_node().is_text_node()) {
- fragment_baseline = font_metrics.ascent + half_leading;
+ fragment_baseline = CSSPixels(font_metrics.ascent) + half_leading;
} else {
auto const& box = verify_cast<Layout::Box>(fragment.layout_node());
fragment_baseline = box_baseline(m_layout_state, box);
diff --git a/Userland/Libraries/LibWeb/Layout/Node.cpp b/Userland/Libraries/LibWeb/Layout/Node.cpp
index e84ec72499..2b6fcdda99 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.cpp
+++ b/Userland/Libraries/LibWeb/Layout/Node.cpp
@@ -164,16 +164,16 @@ void Node::set_needs_display()
});
}
-Gfx::FloatPoint Node::box_type_agnostic_position() const
+CSSPixelPoint Node::box_type_agnostic_position() const
{
if (is<Box>(*this))
- return verify_cast<Box>(*this).paint_box()->absolute_position().to_type<float>();
+ return verify_cast<Box>(*this).paint_box()->absolute_position();
VERIFY(is_inline());
- Gfx::FloatPoint position;
+ CSSPixelPoint position;
if (auto* block = containing_block()) {
block->paint_box()->for_each_fragment([&](auto& fragment) {
if (&fragment.layout_node() == this || is_ancestor_of(fragment.layout_node())) {
- position = fragment.absolute_rect().location().template to_type<float>();
+ position = fragment.absolute_rect().location();
return IterationDecision::Break;
}
return IterationDecision::Continue;
diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h
index 13d1ef42eb..4b7622ca75 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.h
+++ b/Userland/Libraries/LibWeb/Layout/Node.h
@@ -110,8 +110,8 @@ public:
bool can_contain_boxes_with_position_absolute() const;
Gfx::Font const& font() const;
- const CSS::ImmutableComputedValues& computed_values() const;
- float line_height() const;
+ CSS::ImmutableComputedValues const& computed_values() const;
+ CSSPixels line_height() const;
NodeWithStyle* parent();
NodeWithStyle const* parent() const;
@@ -128,7 +128,7 @@ public:
bool children_are_inline() const { return m_children_are_inline; }
void set_children_are_inline(bool value) { m_children_are_inline = value; }
- Gfx::FloatPoint box_type_agnostic_position() const;
+ CSSPixelPoint box_type_agnostic_position() const;
enum class SelectionState {
None, // No selection
@@ -177,7 +177,7 @@ public:
void apply_style(const CSS::StyleProperties&);
Gfx::Font const& font() const { return *m_font; }
- float line_height() const { return m_line_height; }
+ CSSPixels line_height() const { return m_line_height; }
Vector<CSS::BackgroundLayerData> const& background_layers() const { return computed_values().background_layers(); }
const CSS::AbstractImageStyleValue* list_style_image() const { return m_list_style_image; }
@@ -190,7 +190,7 @@ protected:
private:
CSS::ComputedValues m_computed_values;
RefPtr<Gfx::Font> m_font;
- float m_line_height { 0 };
+ CSSPixels m_line_height { 0 };
RefPtr<CSS::AbstractImageStyleValue> m_list_style_image;
};
@@ -230,7 +230,7 @@ inline const CSS::ImmutableComputedValues& Node::computed_values() const
return parent()->computed_values();
}
-inline float Node::line_height() const
+inline CSSPixels Node::line_height() const
{
if (m_has_style)
return static_cast<NodeWithStyle const*>(this)->line_height();