1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 03:58:12 +00:00

LibGfx: Unpublish FloatPoint from the global namespace

This commit is contained in:
Andreas Kling 2020-02-06 14:35:54 +01:00
parent 5c2028db24
commit 8bb75084fd
5 changed files with 5 additions and 7 deletions

View file

@ -145,5 +145,3 @@ inline const LogStream& operator<<(const LogStream& stream, const FloatPoint& va
} }
} }
using Gfx::FloatPoint;

View file

@ -212,7 +212,7 @@ HitTestResult LayoutBox::hit_test(const Gfx::Point& position) const
// FIXME: It would be nice if we could confidently skip over hit testing // FIXME: It would be nice if we could confidently skip over hit testing
// parts of the layout tree, but currently we can't just check // parts of the layout tree, but currently we can't just check
// m_rect.contains() since inline text rects can't be trusted.. // m_rect.contains() since inline text rects can't be trusted..
HitTestResult result { m_rect.contains(FloatPoint(position.x(), position.y())) ? this : nullptr }; HitTestResult result { m_rect.contains(position.x(), position.y()) ? this : nullptr };
for_each_child([&](auto& child) { for_each_child([&](auto& child) {
auto child_result = child.hit_test(position); auto child_result = child.hit_test(position);
if (child_result.layout_node) if (child_result.layout_node)

View file

@ -40,7 +40,7 @@ public:
float width() const { return rect().width(); } float width() const { return rect().width(); }
float height() const { return rect().height(); } float height() const { return rect().height(); }
Gfx::FloatSize size() const { return rect().size(); } Gfx::FloatSize size() const { return rect().size(); }
FloatPoint position() const { return rect().location(); } Gfx::FloatPoint position() const { return rect().location(); }
virtual HitTestResult hit_test(const Gfx::Point& position) const override; virtual HitTestResult hit_test(const Gfx::Point& position) const override;
virtual void set_needs_display() override; virtual void set_needs_display() override;

View file

@ -135,12 +135,12 @@ void LayoutNode::set_needs_display()
} }
} }
FloatPoint LayoutNode::box_type_agnostic_position() const Gfx::FloatPoint LayoutNode::box_type_agnostic_position() const
{ {
if (is_box()) if (is_box())
return to<LayoutBox>(*this).position(); return to<LayoutBox>(*this).position();
ASSERT(is_inline()); ASSERT(is_inline());
FloatPoint position; Gfx::FloatPoint position;
if (auto* block = containing_block()) { if (auto* block = containing_block()) {
block->for_each_fragment([&](auto& fragment) { block->for_each_fragment([&](auto& fragment) {
if (&fragment.layout_node() == this || is_ancestor_of(fragment.layout_node())) { if (&fragment.layout_node() == this || is_ancestor_of(fragment.layout_node())) {

View file

@ -137,7 +137,7 @@ public:
template<typename T> template<typename T>
T* first_ancestor_of_type(); T* first_ancestor_of_type();
FloatPoint box_type_agnostic_position() const; Gfx::FloatPoint box_type_agnostic_position() const;
protected: protected:
explicit LayoutNode(const Node*); explicit LayoutNode(const Node*);