mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibGfx: Unpublish FloatRect from the global namespace
This commit is contained in:
parent
418adf3e86
commit
8505d8d15d
Notes:
sideshowbarker
2024-07-19 09:34:25 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/8505d8d15d6
8 changed files with 18 additions and 20 deletions
|
@ -328,5 +328,3 @@ inline Rect enclosing_int_rect(const FloatRect& float_rect)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
using Gfx::FloatRect;
|
||||
|
|
|
@ -388,7 +388,7 @@ void HtmlView::scroll_to_anchor(const StringView& name)
|
|||
return;
|
||||
}
|
||||
auto& layout_node = *element->layout_node();
|
||||
FloatRect float_rect { layout_node.box_type_agnostic_position(), { (float)visible_content_rect().width(), (float)visible_content_rect().height() } };
|
||||
Gfx::FloatRect float_rect { layout_node.box_type_agnostic_position(), { (float)visible_content_rect().width(), (float)visible_content_rect().height() } };
|
||||
scroll_into_view(enclosing_int_rect(float_rect), true, true);
|
||||
window()->set_override_cursor(GUI::StandardCursor::None);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
//#define DRAW_BOXES_AROUND_LAYOUT_NODES
|
||||
//#define DRAW_BOXES_AROUND_HOVERED_NODES
|
||||
|
||||
void LayoutBox::paint_border(RenderingContext& context, Edge edge, const FloatRect& rect, CSS::PropertyID style_property_id, CSS::PropertyID color_property_id, CSS::PropertyID width_property_id)
|
||||
void LayoutBox::paint_border(RenderingContext& context, Edge edge, const Gfx::FloatRect& rect, CSS::PropertyID style_property_id, CSS::PropertyID color_property_id, CSS::PropertyID width_property_id)
|
||||
{
|
||||
auto border_width = style().property(width_property_id);
|
||||
if (!border_width.has_value())
|
||||
|
@ -59,7 +59,7 @@ void LayoutBox::paint_border(RenderingContext& context, Edge edge, const FloatRe
|
|||
color = Color::Black;
|
||||
}
|
||||
|
||||
auto first_point_for_edge = [](Edge edge, const FloatRect& rect) {
|
||||
auto first_point_for_edge = [](Edge edge, const Gfx::FloatRect& rect) {
|
||||
switch (edge) {
|
||||
case Edge::Top:
|
||||
return rect.top_left();
|
||||
|
@ -73,7 +73,7 @@ void LayoutBox::paint_border(RenderingContext& context, Edge edge, const FloatRe
|
|||
}
|
||||
};
|
||||
|
||||
auto second_point_for_edge = [](Edge edge, const FloatRect& rect) {
|
||||
auto second_point_for_edge = [](Edge edge, const Gfx::FloatRect& rect) {
|
||||
switch (edge) {
|
||||
case Edge::Top:
|
||||
return rect.top_right();
|
||||
|
@ -172,7 +172,7 @@ void LayoutBox::render(RenderingContext& context)
|
|||
if (node() && document().inspected_node() == node())
|
||||
context.painter().draw_rect(enclosing_int_rect(m_rect), Color::Magenta);
|
||||
|
||||
FloatRect padded_rect;
|
||||
Gfx::FloatRect padded_rect;
|
||||
padded_rect.set_x(x() - box_model().padding().left.to_px());
|
||||
padded_rect.set_width(width() + box_model().padding().left.to_px() + box_model().padding().right.to_px());
|
||||
padded_rect.set_y(y() - box_model().padding().top.to_px());
|
||||
|
@ -193,7 +193,7 @@ void LayoutBox::render(RenderingContext& context)
|
|||
}
|
||||
}
|
||||
|
||||
FloatRect bordered_rect;
|
||||
Gfx::FloatRect bordered_rect;
|
||||
bordered_rect.set_x(padded_rect.x() - box_model().border().left.to_px());
|
||||
bordered_rect.set_width(padded_rect.width() + box_model().border().left.to_px() + box_model().border().right.to_px());
|
||||
bordered_rect.set_y(padded_rect.y() - box_model().border().top.to_px());
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
class LayoutBox : public LayoutNodeWithStyleAndBoxModelMetrics {
|
||||
public:
|
||||
const FloatRect& rect() const { return m_rect; }
|
||||
FloatRect& rect() { return m_rect; }
|
||||
void set_rect(const FloatRect& rect) { m_rect = rect; }
|
||||
const Gfx::FloatRect& rect() const { return m_rect; }
|
||||
Gfx::FloatRect& rect() { return m_rect; }
|
||||
void set_rect(const Gfx::FloatRect& rect) { m_rect = rect; }
|
||||
|
||||
float x() const { return rect().x(); }
|
||||
float y() const { return rect().y(); }
|
||||
|
@ -64,9 +64,9 @@ private:
|
|||
Bottom,
|
||||
Left,
|
||||
};
|
||||
void paint_border(RenderingContext&, Edge, const FloatRect&, CSS::PropertyID style_property_id, CSS::PropertyID color_property_id, CSS::PropertyID width_property_id);
|
||||
void paint_border(RenderingContext&, Edge, const Gfx::FloatRect&, CSS::PropertyID style_property_id, CSS::PropertyID color_property_id, CSS::PropertyID width_property_id);
|
||||
|
||||
FloatRect m_rect;
|
||||
Gfx::FloatRect m_rect;
|
||||
};
|
||||
|
||||
template<>
|
||||
|
|
|
@ -59,7 +59,7 @@ void LayoutDocument::layout()
|
|||
|
||||
void LayoutDocument::did_set_viewport_rect(Badge<Frame>, const Gfx::Rect& a_viewport_rect)
|
||||
{
|
||||
FloatRect viewport_rect(a_viewport_rect.x(), a_viewport_rect.y(), a_viewport_rect.width(), a_viewport_rect.height());
|
||||
Gfx::FloatRect viewport_rect(a_viewport_rect.x(), a_viewport_rect.y(), a_viewport_rect.width(), a_viewport_rect.height());
|
||||
for_each_in_subtree_of_type<LayoutImage>([&](auto& layout_image) {
|
||||
const_cast<HTMLImageElement&>(layout_image.node()).set_volatile({}, !viewport_rect.intersects(layout_image.rect()));
|
||||
return IterationDecision::Continue;
|
||||
|
|
|
@ -47,6 +47,6 @@ void LayoutListItem::layout()
|
|||
append_child(*m_marker);
|
||||
}
|
||||
|
||||
FloatRect marker_rect { x() - 8, y(), 4, height() };
|
||||
Gfx::FloatRect marker_rect { x() - 8, y(), 4, height() };
|
||||
m_marker->set_rect(marker_rect);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ void LineBox::add_fragment(const LayoutNode& layout_node, int start, int length,
|
|||
m_fragments.last().m_length = (start - m_fragments.last().m_start) + length;
|
||||
m_fragments.last().m_rect.set_width(m_fragments.last().m_rect.width() + width);
|
||||
} else {
|
||||
m_fragments.empend(layout_node, start, length, FloatRect(m_width, 0, width, height));
|
||||
m_fragments.empend(layout_node, start, length, Gfx::FloatRect(m_width, 0, width, height));
|
||||
}
|
||||
m_width += width;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class RenderingContext;
|
|||
class LineBoxFragment {
|
||||
friend class LineBox;
|
||||
public:
|
||||
LineBoxFragment(const LayoutNode& layout_node, int start, int length, const FloatRect& rect)
|
||||
LineBoxFragment(const LayoutNode& layout_node, int start, int length, const Gfx::FloatRect& rect)
|
||||
: m_layout_node(layout_node)
|
||||
, m_start(start)
|
||||
, m_length(length)
|
||||
|
@ -45,8 +45,8 @@ public:
|
|||
const LayoutNode& layout_node() const { return m_layout_node; }
|
||||
int start() const { return m_start; }
|
||||
int length() const { return m_length; }
|
||||
const FloatRect& rect() const { return m_rect; }
|
||||
FloatRect& rect() { return m_rect; }
|
||||
const Gfx::FloatRect& rect() const { return m_rect; }
|
||||
Gfx::FloatRect& rect() { return m_rect; }
|
||||
|
||||
float width() const { return m_rect.width(); }
|
||||
|
||||
|
@ -61,5 +61,5 @@ private:
|
|||
const LayoutNode& m_layout_node;
|
||||
int m_start { 0 };
|
||||
int m_length { 0 };
|
||||
FloatRect m_rect;
|
||||
Gfx::FloatRect m_rect;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue