diff options
author | MacDue <macdue@dueutil.tech> | 2022-12-06 20:57:07 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-07 11:48:27 +0100 |
commit | e011eafd3790ca0375a4678a9cb2debd0ae95ac7 (patch) | |
tree | 0a0b3a8131a2a61befe85aa841e32958bd53c50d /Userland/Libraries/LibWeb | |
parent | 7be0b27dd3cd7185c1b8dc52747c50aad479bc6a (diff) | |
download | serenity-e011eafd3790ca0375a4678a9cb2debd0ae95ac7.zip |
Meta+Userland: Pass Gfx::FloatPoint by value
Just a small 8-byte value like Gfx::IntPoint.
Diffstat (limited to 'Userland/Libraries/LibWeb')
10 files changed, 17 insertions, 17 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp index e46bbda70d..9048b167a4 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp +++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.cpp @@ -27,7 +27,7 @@ bool BlockContainer::is_scrollable() const return computed_values().overflow_y() == CSS::Overflow::Scroll; } -void BlockContainer::set_scroll_offset(Gfx::FloatPoint const& offset) +void BlockContainer::set_scroll_offset(Gfx::FloatPoint offset) { // FIXME: If there is horizontal and vertical scroll ignore only part of the new offset if (offset.y() < 0 || m_scroll_offset == offset) diff --git a/Userland/Libraries/LibWeb/Layout/BlockContainer.h b/Userland/Libraries/LibWeb/Layout/BlockContainer.h index 4f89a7659b..7ead413d5e 100644 --- a/Userland/Libraries/LibWeb/Layout/BlockContainer.h +++ b/Userland/Libraries/LibWeb/Layout/BlockContainer.h @@ -26,8 +26,8 @@ public: BlockContainer const* next_sibling() const { return verify_cast<BlockContainer>(Node::next_sibling()); } bool is_scrollable() const; - Gfx::FloatPoint const& scroll_offset() const { return m_scroll_offset; } - void set_scroll_offset(Gfx::FloatPoint const&); + Gfx::FloatPoint scroll_offset() const { return m_scroll_offset; } + void set_scroll_offset(Gfx::FloatPoint); Painting::PaintableWithLines const* paint_box() const; diff --git a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h index cdbc5ad0bb..d78efcfa83 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h +++ b/Userland/Libraries/LibWeb/Layout/LineBoxFragment.h @@ -22,7 +22,7 @@ public: Trailing, }; - LineBoxFragment(Node const& layout_node, int start, int length, Gfx::FloatPoint const& offset, Gfx::FloatSize const& size, float border_box_top, float border_box_bottom, Type type) + LineBoxFragment(Node const& layout_node, int start, int length, Gfx::FloatPoint offset, Gfx::FloatSize const& size, float border_box_top, float border_box_bottom, Type type) : m_layout_node(layout_node) , m_start(start) , m_length(length) @@ -40,8 +40,8 @@ public: const Gfx::FloatRect absolute_rect() const; Type type() const { return m_type; } - Gfx::FloatPoint const& offset() const { return m_offset; } - void set_offset(Gfx::FloatPoint const& offset) { m_offset = offset; } + Gfx::FloatPoint offset() const { return m_offset; } + void set_offset(Gfx::FloatPoint offset) { m_offset = offset; } // The baseline of a fragment is the number of pixels from the top to the text baseline. void set_baseline(float y) { m_baseline = y; } diff --git a/Userland/Libraries/LibWeb/Painting/Paintable.cpp b/Userland/Libraries/LibWeb/Painting/Paintable.cpp index 82307810b3..1fcc14fd27 100644 --- a/Userland/Libraries/LibWeb/Painting/Paintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/Paintable.cpp @@ -41,7 +41,7 @@ bool Paintable::handle_mousewheel(Badge<EventHandler>, Gfx::IntPoint, unsigned, return false; } -Optional<HitTestResult> Paintable::hit_test(Gfx::FloatPoint const&, HitTestType) const +Optional<HitTestResult> Paintable::hit_test(Gfx::FloatPoint, HitTestType) const { return {}; } diff --git a/Userland/Libraries/LibWeb/Painting/Paintable.h b/Userland/Libraries/LibWeb/Painting/Paintable.h index c0b335f4cc..a868ff9ab3 100644 --- a/Userland/Libraries/LibWeb/Painting/Paintable.h +++ b/Userland/Libraries/LibWeb/Painting/Paintable.h @@ -89,7 +89,7 @@ public: virtual void before_children_paint(PaintContext&, PaintPhase) const { } virtual void after_children_paint(PaintContext&, PaintPhase) const { } - virtual Optional<HitTestResult> hit_test(Gfx::FloatPoint const&, HitTestType) const; + virtual Optional<HitTestResult> hit_test(Gfx::FloatPoint, HitTestType) const; virtual bool wants_mouse_events() const { return false; } diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 6bc37f41f6..def34ab773 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -53,7 +53,7 @@ PaintableWithLines::~PaintableWithLines() { } -void PaintableBox::set_offset(Gfx::FloatPoint const& offset) +void PaintableBox::set_offset(Gfx::FloatPoint offset) { m_offset = offset; // FIXME: This const_cast is gross. @@ -655,7 +655,7 @@ void PaintableBox::set_stacking_context(NonnullOwnPtr<StackingContext> stacking_ m_stacking_context = move(stacking_context); } -Optional<HitTestResult> PaintableBox::hit_test(Gfx::FloatPoint const& position, HitTestType type) const +Optional<HitTestResult> PaintableBox::hit_test(Gfx::FloatPoint position, HitTestType type) const { if (!is_visible()) return {}; @@ -679,7 +679,7 @@ Optional<HitTestResult> PaintableBox::hit_test(Gfx::FloatPoint const& position, return HitTestResult { *this }; } -Optional<HitTestResult> PaintableWithLines::hit_test(Gfx::FloatPoint const& position, HitTestType type) const +Optional<HitTestResult> PaintableWithLines::hit_test(Gfx::FloatPoint position, HitTestType type) const { if (!layout_box().children_are_inline()) return PaintableBox::hit_test(position, type); diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.h b/Userland/Libraries/LibWeb/Painting/PaintableBox.h index fe453aa6b0..b4eec2fb6a 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.h +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.h @@ -35,7 +35,7 @@ public: Gfx::FloatRect absolute_rect() const; Gfx::FloatPoint effective_offset() const; - void set_offset(Gfx::FloatPoint const&); + void set_offset(Gfx::FloatPoint); void set_offset(float x, float y) { set_offset({ x, y }); } Gfx::FloatSize const& content_size() const { return m_content_size; } @@ -115,7 +115,7 @@ public: virtual void before_children_paint(PaintContext&, PaintPhase) const override; virtual void after_children_paint(PaintContext&, PaintPhase) const override; - virtual Optional<HitTestResult> hit_test(Gfx::FloatPoint const&, HitTestType) const override; + virtual Optional<HitTestResult> hit_test(Gfx::FloatPoint, HitTestType) const override; void invalidate_stacking_context(); @@ -190,7 +190,7 @@ public: virtual bool wants_mouse_events() const override { return false; } virtual bool handle_mousewheel(Badge<EventHandler>, Gfx::IntPoint, unsigned buttons, unsigned modifiers, int wheel_delta_x, int wheel_delta_y) override; - virtual Optional<HitTestResult> hit_test(Gfx::FloatPoint const&, HitTestType) const override; + virtual Optional<HitTestResult> hit_test(Gfx::FloatPoint, HitTestType) const override; protected: PaintableWithLines(Layout::BlockContainer const&); diff --git a/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp b/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp index d9a1adee93..ab124398d3 100644 --- a/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/SVGGeometryPaintable.cpp @@ -56,7 +56,7 @@ void SVGGeometryPaintable::paint(PaintContext& context, PaintPhase phase) const auto scaling = layout_box().viewbox_scaling(); auto origin = layout_box().viewbox_origin(); - auto transform_point = [&scaling, &origin](Gfx::FloatPoint const& point) -> Gfx::FloatPoint { + auto transform_point = [&scaling, &origin](Gfx::FloatPoint point) -> Gfx::FloatPoint { auto new_point = point; new_point.translate_by({ -origin.x(), -origin.y() }); new_point.scale_by(scaling); diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp index 747008ab46..b4c0444599 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.cpp +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.cpp @@ -439,7 +439,7 @@ static TraversalDecision for_each_in_subtree_of_type_within_same_stacking_contex return TraversalDecision::Continue; } -Optional<HitTestResult> StackingContext::hit_test(Gfx::FloatPoint const& position, HitTestType type) const +Optional<HitTestResult> StackingContext::hit_test(Gfx::FloatPoint position, HitTestType type) const { if (!m_box.is_visible()) return {}; diff --git a/Userland/Libraries/LibWeb/Painting/StackingContext.h b/Userland/Libraries/LibWeb/Painting/StackingContext.h index 0fc7173c2a..72aba5dce6 100644 --- a/Userland/Libraries/LibWeb/Painting/StackingContext.h +++ b/Userland/Libraries/LibWeb/Painting/StackingContext.h @@ -32,7 +32,7 @@ public: void paint_descendants(PaintContext&, Layout::Node const&, StackingContextPaintPhase) const; void paint(PaintContext&) const; - Optional<HitTestResult> hit_test(Gfx::FloatPoint const&, HitTestType) const; + Optional<HitTestResult> hit_test(Gfx::FloatPoint, HitTestType) const; Gfx::FloatMatrix4x4 const& transform_matrix() const { return m_transform; } Gfx::AffineTransform affine_transform_matrix() const; |