mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 21:59:07 +00:00
Everywhere: Hoist the Libraries folder to the top-level
This commit is contained in:
parent
950e819ee7
commit
93712b24bf
Notes:
github-actions[bot]
2024-11-10 11:51:52 +00:00
Author: https://github.com/trflynn89
Commit: 93712b24bf
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2256
Reviewed-by: https://github.com/sideshowbarker
4547 changed files with 104 additions and 113 deletions
121
Libraries/LibWeb/CSS/StyleValues/BasicShapeStyleValue.h
Normal file
121
Libraries/LibWeb/CSS/StyleValues/BasicShapeStyleValue.h
Normal file
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* Copyright (c) 2024, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Variant.h>
|
||||
#include <LibGfx/WindingRule.h>
|
||||
#include <LibWeb/CSS/CSSStyleValue.h>
|
||||
#include <LibWeb/CSS/LengthBox.h>
|
||||
#include <LibWeb/CSS/PercentageOr.h>
|
||||
#include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
|
||||
|
||||
namespace Web::CSS {
|
||||
|
||||
struct Inset {
|
||||
Gfx::Path to_path(CSSPixelRect reference_box, Layout::Node const&) const;
|
||||
String to_string() const;
|
||||
|
||||
bool operator==(Inset const&) const = default;
|
||||
|
||||
LengthBox inset_box;
|
||||
};
|
||||
|
||||
struct Xywh {
|
||||
Gfx::Path to_path(CSSPixelRect reference_box, Layout::Node const&) const;
|
||||
String to_string() const;
|
||||
|
||||
bool operator==(Xywh const&) const = default;
|
||||
|
||||
LengthPercentage x;
|
||||
LengthPercentage y;
|
||||
LengthPercentage width;
|
||||
LengthPercentage height;
|
||||
};
|
||||
|
||||
struct Rect {
|
||||
Gfx::Path to_path(CSSPixelRect reference_box, Layout::Node const&) const;
|
||||
String to_string() const;
|
||||
|
||||
bool operator==(Rect const&) const = default;
|
||||
|
||||
LengthBox box;
|
||||
};
|
||||
|
||||
enum class FitSide {
|
||||
ClosestSide,
|
||||
FarthestSide,
|
||||
};
|
||||
|
||||
using ShapeRadius = Variant<LengthPercentage, FitSide>;
|
||||
|
||||
struct Circle {
|
||||
Gfx::Path to_path(CSSPixelRect reference_box, Layout::Node const&) const;
|
||||
String to_string() const;
|
||||
|
||||
bool operator==(Circle const&) const = default;
|
||||
|
||||
ShapeRadius radius;
|
||||
ValueComparingNonnullRefPtr<PositionStyleValue> position;
|
||||
};
|
||||
|
||||
struct Ellipse {
|
||||
Gfx::Path to_path(CSSPixelRect reference_box, Layout::Node const&) const;
|
||||
String to_string() const;
|
||||
|
||||
bool operator==(Ellipse const&) const = default;
|
||||
|
||||
ShapeRadius radius_x;
|
||||
ShapeRadius radius_y;
|
||||
ValueComparingNonnullRefPtr<PositionStyleValue> position;
|
||||
};
|
||||
|
||||
struct Polygon {
|
||||
struct Point {
|
||||
bool operator==(Point const&) const = default;
|
||||
LengthPercentage x;
|
||||
LengthPercentage y;
|
||||
};
|
||||
|
||||
Gfx::Path to_path(CSSPixelRect reference_box, Layout::Node const&) const;
|
||||
String to_string() const;
|
||||
|
||||
bool operator==(Polygon const&) const = default;
|
||||
|
||||
Gfx::WindingRule fill_rule;
|
||||
Vector<Point> points;
|
||||
};
|
||||
|
||||
// FIXME: Implement path(). See: https://www.w3.org/TR/css-shapes-1/#basic-shape-functions
|
||||
using BasicShape = Variant<Inset, Xywh, Rect, Circle, Ellipse, Polygon>;
|
||||
|
||||
class BasicShapeStyleValue : public StyleValueWithDefaultOperators<BasicShapeStyleValue> {
|
||||
public:
|
||||
static ValueComparingNonnullRefPtr<BasicShapeStyleValue> create(BasicShape basic_shape)
|
||||
{
|
||||
return adopt_ref(*new (nothrow) BasicShapeStyleValue(move(basic_shape)));
|
||||
}
|
||||
virtual ~BasicShapeStyleValue() override;
|
||||
|
||||
BasicShape const& basic_shape() const { return m_basic_shape; }
|
||||
|
||||
virtual String to_string() const override;
|
||||
|
||||
bool properties_equal(BasicShapeStyleValue const& other) const { return m_basic_shape == other.m_basic_shape; }
|
||||
|
||||
Gfx::Path to_path(CSSPixelRect reference_box, Layout::Node const&) const;
|
||||
|
||||
private:
|
||||
BasicShapeStyleValue(BasicShape basic_shape)
|
||||
: StyleValueWithDefaultOperators(Type::BasicShape)
|
||||
, m_basic_shape(move(basic_shape))
|
||||
{
|
||||
}
|
||||
|
||||
BasicShape m_basic_shape;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue