1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:37:44 +00:00

LibGfx: Rename Rect,Point,Size => IntRect,IntPoint,IntSize

This fits nicer with FloatRect,FloatPoint,FloatSize and gives a much
better visual clue about what type of metric is being used.
This commit is contained in:
Andreas Kling 2020-06-10 10:57:59 +02:00
parent 656b01eb0f
commit 116cf92156
212 changed files with 1144 additions and 1144 deletions

View file

@ -38,7 +38,7 @@
namespace Web {
static Gfx::Point compute_mouse_event_offset(const Gfx::Point& position, const LayoutNode& layout_node)
static Gfx::IntPoint compute_mouse_event_offset(const Gfx::IntPoint& position, const LayoutNode& layout_node)
{
auto top_left_of_layout_node = layout_node.box_type_agnostic_position();
return {
@ -70,7 +70,7 @@ LayoutDocument* EventHandler::layout_root()
return const_cast<LayoutDocument*>(m_frame.document()->layout_node());
}
bool EventHandler::handle_mouseup(const Gfx::Point& position, unsigned button, unsigned modifiers)
bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button, unsigned modifiers)
{
auto* layout_root_ptr = this->layout_root();
if (!layout_root_ptr)
@ -98,7 +98,7 @@ bool EventHandler::handle_mouseup(const Gfx::Point& position, unsigned button, u
return handled_event;
}
bool EventHandler::handle_mousedown(const Gfx::Point& position, unsigned button, unsigned modifiers)
bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned button, unsigned modifiers)
{
auto* layout_root_ptr = this->layout_root();
if (!layout_root_ptr)
@ -154,7 +154,7 @@ bool EventHandler::handle_mousedown(const Gfx::Point& position, unsigned button,
return true;
}
bool EventHandler::handle_mousemove(const Gfx::Point& position, unsigned buttons, unsigned modifiers)
bool EventHandler::handle_mousemove(const Gfx::IntPoint& position, unsigned buttons, unsigned modifiers)
{
auto* layout_root_ptr = this->layout_root();
if (!layout_root_ptr)

View file

@ -40,9 +40,9 @@ public:
explicit EventHandler(Badge<Frame>, Frame&);
~EventHandler();
bool handle_mouseup(const Gfx::Point&, unsigned button, unsigned modifiers);
bool handle_mousedown(const Gfx::Point&, unsigned button, unsigned modifiers);
bool handle_mousemove(const Gfx::Point&, unsigned buttons, unsigned modifiers);
bool handle_mouseup(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
bool handle_mousedown(const Gfx::IntPoint&, unsigned button, unsigned modifiers);
bool handle_mousemove(const Gfx::IntPoint&, unsigned buttons, unsigned modifiers);
private:
LayoutDocument* layout_root();

View file

@ -69,7 +69,7 @@ void Frame::set_document(Document* document)
page().client().page_did_set_document_in_main_frame(m_document);
}
void Frame::set_size(const Gfx::Size& size)
void Frame::set_size(const Gfx::IntSize& size)
{
if (m_size == size)
return;
@ -78,7 +78,7 @@ void Frame::set_size(const Gfx::Size& size)
m_document->layout();
}
void Frame::set_viewport_rect(const Gfx::Rect& rect)
void Frame::set_viewport_rect(const Gfx::IntRect& rect)
{
if (m_viewport_rect == rect)
return;
@ -88,7 +88,7 @@ void Frame::set_viewport_rect(const Gfx::Rect& rect)
m_document->layout_node()->did_set_viewport_rect({}, rect);
}
void Frame::set_needs_display(const Gfx::Rect& rect)
void Frame::set_needs_display(const Gfx::IntRect& rect)
{
if (!m_viewport_rect.intersects(rect))
return;
@ -121,14 +121,14 @@ void Frame::scroll_to_anchor(const String& fragment)
page().client().page_did_request_scroll_to_anchor(fragment);
}
Gfx::Rect Frame::to_main_frame_rect(const Gfx::Rect& a_rect)
Gfx::IntRect Frame::to_main_frame_rect(const Gfx::IntRect& a_rect)
{
auto rect = a_rect;
rect.set_location(to_main_frame_position(a_rect.location()));
return rect;
}
Gfx::Point Frame::to_main_frame_position(const Gfx::Point& a_position)
Gfx::IntPoint Frame::to_main_frame_position(const Gfx::IntPoint& a_position)
{
auto position = a_position;
for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {

View file

@ -55,13 +55,13 @@ public:
Page& page() { return m_page; }
const Page& page() const { return m_page; }
const Gfx::Size& size() const { return m_size; }
void set_size(const Gfx::Size&);
const Gfx::IntSize& size() const { return m_size; }
void set_size(const Gfx::IntSize&);
void set_needs_display(const Gfx::Rect&);
void set_needs_display(const Gfx::IntRect&);
void set_viewport_rect(const Gfx::Rect&);
Gfx::Rect viewport_rect() const { return m_viewport_rect; }
void set_viewport_rect(const Gfx::IntRect&);
Gfx::IntRect viewport_rect() const { return m_viewport_rect; }
void did_scroll(Badge<PageView>);
@ -79,8 +79,8 @@ public:
Element* host_element() { return m_host_element; }
const Element* host_element() const { return m_host_element; }
Gfx::Point to_main_frame_position(const Gfx::Point&);
Gfx::Rect to_main_frame_rect(const Gfx::Rect&);
Gfx::IntPoint to_main_frame_position(const Gfx::IntPoint&);
Gfx::IntRect to_main_frame_rect(const Gfx::IntRect&);
private:
explicit Frame(Element& host_element, Frame& main_frame);
@ -94,8 +94,8 @@ private:
WeakPtr<Element> m_host_element;
RefPtr<Document> m_document;
Gfx::Size m_size;
Gfx::Rect m_viewport_rect;
Gfx::IntSize m_size;
Gfx::IntRect m_viewport_rect;
};
}