mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
LibWeb: Make intrinsic width/height/ratio a Box concept and simplify it
Apparently it's not only replaced elements that can have intrinsic sizes, so let's move this concept from ReplacedBox to Box. To avoid bloating Box, we make the accessors virtual.
This commit is contained in:
parent
1b1bf5c321
commit
81590b1804
9 changed files with 21 additions and 40 deletions
|
@ -121,6 +121,14 @@ public:
|
|||
|
||||
Painting::BorderRadiusData normalized_border_radius_data();
|
||||
|
||||
virtual Optional<float> intrinsic_width() const { return {}; }
|
||||
virtual Optional<float> intrinsic_height() const { return {}; }
|
||||
virtual Optional<float> intrinsic_ratio() const { return {}; }
|
||||
|
||||
bool has_intrinsic_width() const { return intrinsic_width().has_value(); }
|
||||
bool has_intrinsic_height() const { return intrinsic_height().has_value(); }
|
||||
bool has_intrinsic_ratio() const { return intrinsic_ratio().has_value(); }
|
||||
|
||||
protected:
|
||||
Box(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> style)
|
||||
: NodeWithStyleAndBoxModelMetrics(document, node, move(style))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue