1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

LibHTML: Use floating point numbers throughout the layout tree

This commit is contained in:
Andreas Kling 2019-11-18 16:25:38 +01:00
parent da23864c8d
commit c628ebda0f
15 changed files with 59 additions and 52 deletions

View file

@ -1,19 +1,20 @@
#pragma once
#include <LibDraw/FloatRect.h>
#include <LibHTML/Layout/LayoutNode.h>
class LayoutBox : public LayoutNodeWithStyleAndBoxModelMetrics {
public:
const Rect& rect() const { return m_rect; }
Rect& rect() { return m_rect; }
void set_rect(const Rect& rect) { m_rect = rect; }
const FloatRect& rect() const { return m_rect; }
FloatRect& rect() { return m_rect; }
void set_rect(const FloatRect& rect) { m_rect = rect; }
int x() const { return rect().x(); }
int y() const { return rect().y(); }
int width() const { return rect().width(); }
int height() const { return rect().height(); }
Size size() const { return rect().size(); }
Point position() const { return rect().location(); }
float x() const { return rect().x(); }
float y() const { return rect().y(); }
float width() const { return rect().width(); }
float height() const { return rect().height(); }
FloatSize size() const { return rect().size(); }
FloatPoint position() const { return rect().location(); }
virtual HitTestResult hit_test(const Point& position) const override;
virtual void set_needs_display() override;
@ -31,7 +32,7 @@ protected:
private:
virtual bool is_box() const override { return true; }
Rect m_rect;
FloatRect m_rect;
};
template<>