mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:17:35 +00:00
LibHTML: Rename "style_properties" to "style" everywhere
This commit is contained in:
parent
de49714f36
commit
15f3e64862
12 changed files with 53 additions and 53 deletions
|
@ -4,8 +4,8 @@
|
|||
#include <LibHTML/Layout/LayoutBlock.h>
|
||||
#include <LibHTML/Layout/LayoutInline.h>
|
||||
|
||||
LayoutBlock::LayoutBlock(const Node* node, NonnullRefPtr<StyleProperties> style_properties)
|
||||
: LayoutNode(node, move(style_properties))
|
||||
LayoutBlock::LayoutBlock(const Node* node, NonnullRefPtr<StyleProperties> style)
|
||||
: LayoutNode(node, move(style))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -79,17 +79,17 @@ void LayoutBlock::layout_inline_children()
|
|||
|
||||
void LayoutBlock::compute_width()
|
||||
{
|
||||
auto& style_properties = this->style();
|
||||
auto& style = this->style();
|
||||
|
||||
auto auto_value = Length();
|
||||
auto zero_value = Length(0, Length::Type::Absolute);
|
||||
auto width = style_properties.length_or_fallback("width", auto_value);
|
||||
auto margin_left = style_properties.length_or_fallback("margin-left", zero_value);
|
||||
auto margin_right = style_properties.length_or_fallback("margin-right", zero_value);
|
||||
auto border_left = style_properties.length_or_fallback("border-left", zero_value);
|
||||
auto border_right = style_properties.length_or_fallback("border-right", zero_value);
|
||||
auto padding_left = style_properties.length_or_fallback("padding-left", zero_value);
|
||||
auto padding_right = style_properties.length_or_fallback("padding-right", zero_value);
|
||||
auto width = style.length_or_fallback("width", auto_value);
|
||||
auto margin_left = style.length_or_fallback("margin-left", zero_value);
|
||||
auto margin_right = style.length_or_fallback("margin-right", zero_value);
|
||||
auto border_left = style.length_or_fallback("border-left", zero_value);
|
||||
auto border_right = style.length_or_fallback("border-right", zero_value);
|
||||
auto padding_left = style.length_or_fallback("padding-left", zero_value);
|
||||
auto padding_right = style.length_or_fallback("padding-right", zero_value);
|
||||
|
||||
#ifdef HTML_DEBUG
|
||||
dbg() << " Left: " << margin_left << "+" << border_left << "+" << padding_left;
|
||||
|
@ -153,19 +153,19 @@ void LayoutBlock::compute_width()
|
|||
|
||||
void LayoutBlock::compute_position()
|
||||
{
|
||||
auto& style_properties = this->style();
|
||||
auto& style = this->style();
|
||||
|
||||
auto auto_value = Length();
|
||||
auto zero_value = Length(0, Length::Type::Absolute);
|
||||
|
||||
auto width = style_properties.length_or_fallback("width", auto_value);
|
||||
auto width = style.length_or_fallback("width", auto_value);
|
||||
|
||||
box_model().margin().top = style_properties.length_or_fallback("margin-top", zero_value);
|
||||
box_model().margin().bottom = style_properties.length_or_fallback("margin-bottom", zero_value);
|
||||
box_model().border().top = style_properties.length_or_fallback("border-top", zero_value);
|
||||
box_model().border().bottom = style_properties.length_or_fallback("border-bottom", zero_value);
|
||||
box_model().padding().top = style_properties.length_or_fallback("padding-top", zero_value);
|
||||
box_model().padding().bottom = style_properties.length_or_fallback("padding-bottom", zero_value);
|
||||
box_model().margin().top = style.length_or_fallback("margin-top", zero_value);
|
||||
box_model().margin().bottom = style.length_or_fallback("margin-bottom", zero_value);
|
||||
box_model().border().top = style.length_or_fallback("border-top", zero_value);
|
||||
box_model().border().bottom = style.length_or_fallback("border-bottom", zero_value);
|
||||
box_model().padding().top = style.length_or_fallback("padding-top", zero_value);
|
||||
box_model().padding().bottom = style.length_or_fallback("padding-bottom", zero_value);
|
||||
rect().set_x(containing_block()->rect().x() + box_model().margin().left.to_px() + box_model().border().left.to_px() + box_model().padding().left.to_px());
|
||||
|
||||
int top_border = -1;
|
||||
|
@ -182,9 +182,9 @@ void LayoutBlock::compute_position()
|
|||
|
||||
void LayoutBlock::compute_height()
|
||||
{
|
||||
auto& style_properties = this->style();
|
||||
auto& style = this->style();
|
||||
|
||||
auto height_property = style_properties.property("height");
|
||||
auto height_property = style.property("height");
|
||||
if (!height_property.has_value())
|
||||
return;
|
||||
auto height_length = height_property.value()->to_length();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#include <LibHTML/Frame.h>
|
||||
#include <LibHTML/Layout/LayoutDocument.h>
|
||||
|
||||
LayoutDocument::LayoutDocument(const Document& document, NonnullRefPtr<StyleProperties> style_properties)
|
||||
: LayoutBlock(&document, move(style_properties))
|
||||
LayoutDocument::LayoutDocument(const Document& document, NonnullRefPtr<StyleProperties> style)
|
||||
: LayoutBlock(&document, move(style))
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
//#define DRAW_BOXES_AROUND_LAYOUT_NODES
|
||||
//#define DRAW_BOXES_AROUND_HOVERED_NODES
|
||||
|
||||
LayoutNode::LayoutNode(const Node* node, RefPtr<StyleProperties> style_properties)
|
||||
LayoutNode::LayoutNode(const Node* node, RefPtr<StyleProperties> style)
|
||||
: m_node(node)
|
||||
, m_style_properties(move(style_properties))
|
||||
, m_style(move(style))
|
||||
{
|
||||
if (m_node)
|
||||
m_node->set_layout_node({}, this);
|
||||
|
|
|
@ -27,8 +27,8 @@ public:
|
|||
Rect& rect() { return m_rect; }
|
||||
void set_rect(const Rect& rect) { m_rect = rect; }
|
||||
|
||||
BoxModelMetrics& box_model() { return m_style; }
|
||||
const BoxModelMetrics& box_model() const { return m_style; }
|
||||
BoxModelMetrics& box_model() { return m_box_metrics; }
|
||||
const BoxModelMetrics& box_model() const { return m_box_metrics; }
|
||||
|
||||
virtual HitTestResult hit_test(const Point&) const;
|
||||
|
||||
|
@ -68,8 +68,8 @@ public:
|
|||
|
||||
const StyleProperties& style() const
|
||||
{
|
||||
if (m_style_properties)
|
||||
return *m_style_properties;
|
||||
if (m_style)
|
||||
return *m_style;
|
||||
return parent()->style();
|
||||
}
|
||||
|
||||
|
@ -84,8 +84,8 @@ protected:
|
|||
private:
|
||||
const Node* m_node { nullptr };
|
||||
|
||||
RefPtr<StyleProperties> m_style_properties;
|
||||
BoxModelMetrics m_style;
|
||||
RefPtr<StyleProperties> m_style;
|
||||
BoxModelMetrics m_box_metrics;
|
||||
Rect m_rect;
|
||||
bool m_inline { false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue