mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
LibWeb: Rename ComputedValues::offset() => inset()
This commit is contained in:
parent
d77dfc6b48
commit
fa71401bec
3 changed files with 19 additions and 19 deletions
|
@ -148,7 +148,7 @@ public:
|
||||||
Optional<CSS::LengthPercentage> const& max_height() const { return m_noninherited.max_height; }
|
Optional<CSS::LengthPercentage> const& max_height() const { return m_noninherited.max_height; }
|
||||||
Variant<CSS::VerticalAlign, CSS::LengthPercentage> const& vertical_align() const { return m_noninherited.vertical_align; }
|
Variant<CSS::VerticalAlign, CSS::LengthPercentage> const& vertical_align() const { return m_noninherited.vertical_align; }
|
||||||
|
|
||||||
const CSS::LengthBox& offset() const { return m_noninherited.offset; }
|
CSS::LengthBox const& inset() const { return m_noninherited.inset; }
|
||||||
const CSS::LengthBox& margin() const { return m_noninherited.margin; }
|
const CSS::LengthBox& margin() const { return m_noninherited.margin; }
|
||||||
const CSS::LengthBox& padding() const { return m_noninherited.padding; }
|
const CSS::LengthBox& padding() const { return m_noninherited.padding; }
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ protected:
|
||||||
Optional<CSS::LengthPercentage> height;
|
Optional<CSS::LengthPercentage> height;
|
||||||
Optional<CSS::LengthPercentage> min_height;
|
Optional<CSS::LengthPercentage> min_height;
|
||||||
Optional<CSS::LengthPercentage> max_height;
|
Optional<CSS::LengthPercentage> max_height;
|
||||||
CSS::LengthBox offset;
|
CSS::LengthBox inset;
|
||||||
CSS::LengthBox margin;
|
CSS::LengthBox margin;
|
||||||
CSS::LengthBox padding;
|
CSS::LengthBox padding;
|
||||||
BorderData border_left;
|
BorderData border_left;
|
||||||
|
@ -293,7 +293,7 @@ public:
|
||||||
void set_height(CSS::LengthPercentage const& height) { m_noninherited.height = height; }
|
void set_height(CSS::LengthPercentage const& height) { m_noninherited.height = height; }
|
||||||
void set_min_height(CSS::LengthPercentage const& height) { m_noninherited.min_height = height; }
|
void set_min_height(CSS::LengthPercentage const& height) { m_noninherited.min_height = height; }
|
||||||
void set_max_height(CSS::LengthPercentage const& height) { m_noninherited.max_height = height; }
|
void set_max_height(CSS::LengthPercentage const& height) { m_noninherited.max_height = height; }
|
||||||
void set_offset(const CSS::LengthBox& offset) { m_noninherited.offset = offset; }
|
void set_inset(CSS::LengthBox const& inset) { m_noninherited.inset = inset; }
|
||||||
void set_margin(const CSS::LengthBox& margin) { m_noninherited.margin = margin; }
|
void set_margin(const CSS::LengthBox& margin) { m_noninherited.margin = margin; }
|
||||||
void set_padding(const CSS::LengthBox& padding) { m_noninherited.padding = padding; }
|
void set_padding(const CSS::LengthBox& padding) { m_noninherited.padding = padding; }
|
||||||
void set_overflow_x(CSS::Overflow value) { m_noninherited.overflow_x = value; }
|
void set_overflow_x(CSS::Overflow value) { m_noninherited.overflow_x = value; }
|
||||||
|
|
|
@ -495,8 +495,8 @@ void FormattingContext::compute_width_for_absolutely_positioned_non_replaced_ele
|
||||||
margin_left = computed_values.margin().left.resolved(box, width_of_containing_block).resolved(box);
|
margin_left = computed_values.margin().left.resolved(box, width_of_containing_block).resolved(box);
|
||||||
margin_right = computed_values.margin().right.resolved(box, width_of_containing_block).resolved(box);
|
margin_right = computed_values.margin().right.resolved(box, width_of_containing_block).resolved(box);
|
||||||
|
|
||||||
auto left = computed_values.offset().left.resolved(box, width_of_containing_block).resolved(box);
|
auto left = computed_values.inset().left.resolved(box, width_of_containing_block).resolved(box);
|
||||||
auto right = computed_values.offset().right.resolved(box, width_of_containing_block).resolved(box);
|
auto right = computed_values.inset().right.resolved(box, width_of_containing_block).resolved(box);
|
||||||
auto width = a_width;
|
auto width = a_width;
|
||||||
|
|
||||||
auto solve_for_left = [&] {
|
auto solve_for_left = [&] {
|
||||||
|
@ -640,8 +640,8 @@ void FormattingContext::compute_height_for_absolutely_positioned_non_replaced_el
|
||||||
auto width_of_containing_block = CSS::Length::make_px(containing_block_state.content_width);
|
auto width_of_containing_block = CSS::Length::make_px(containing_block_state.content_width);
|
||||||
auto height_of_containing_block = CSS::Length::make_px(containing_block_state.content_height);
|
auto height_of_containing_block = CSS::Length::make_px(containing_block_state.content_height);
|
||||||
|
|
||||||
CSS::Length specified_top = computed_values.offset().top.resolved(box, height_of_containing_block).resolved(box);
|
CSS::Length specified_top = computed_values.inset().top.resolved(box, height_of_containing_block).resolved(box);
|
||||||
CSS::Length specified_bottom = computed_values.offset().bottom.resolved(box, height_of_containing_block).resolved(box);
|
CSS::Length specified_bottom = computed_values.inset().bottom.resolved(box, height_of_containing_block).resolved(box);
|
||||||
CSS::Length specified_height = CSS::Length::make_auto();
|
CSS::Length specified_height = CSS::Length::make_auto();
|
||||||
|
|
||||||
if (computed_values.height().has_value() && computed_values.height()->is_percentage()
|
if (computed_values.height().has_value() && computed_values.height()->is_percentage()
|
||||||
|
@ -707,16 +707,16 @@ void FormattingContext::layout_absolutely_positioned_element(Box const& box)
|
||||||
box_state.border_top = box.computed_values().border_top().width;
|
box_state.border_top = box.computed_values().border_top().width;
|
||||||
box_state.border_bottom = box.computed_values().border_bottom().width;
|
box_state.border_bottom = box.computed_values().border_bottom().width;
|
||||||
|
|
||||||
box_state.inset_left = box.computed_values().offset().left.resolved(box, width_of_containing_block).to_px(box);
|
box_state.inset_left = box.computed_values().inset().left.resolved(box, width_of_containing_block).to_px(box);
|
||||||
box_state.inset_top = box.computed_values().offset().top.resolved(box, height_of_containing_block).to_px(box);
|
box_state.inset_top = box.computed_values().inset().top.resolved(box, height_of_containing_block).to_px(box);
|
||||||
box_state.inset_right = box.computed_values().offset().right.resolved(box, width_of_containing_block).to_px(box);
|
box_state.inset_right = box.computed_values().inset().right.resolved(box, width_of_containing_block).to_px(box);
|
||||||
box_state.inset_bottom = box.computed_values().offset().bottom.resolved(box, height_of_containing_block).to_px(box);
|
box_state.inset_bottom = box.computed_values().inset().bottom.resolved(box, height_of_containing_block).to_px(box);
|
||||||
|
|
||||||
auto is_auto = [](auto const& length_percentage) {
|
auto is_auto = [](auto const& length_percentage) {
|
||||||
return length_percentage.is_length() && length_percentage.length().is_auto();
|
return length_percentage.is_length() && length_percentage.length().is_auto();
|
||||||
};
|
};
|
||||||
|
|
||||||
if (is_auto(box.computed_values().offset().left) && specified_width.is_auto() && is_auto(box.computed_values().offset().right)) {
|
if (is_auto(box.computed_values().inset().left) && specified_width.is_auto() && is_auto(box.computed_values().inset().right)) {
|
||||||
if (is_auto(box.computed_values().margin().left))
|
if (is_auto(box.computed_values().margin().left))
|
||||||
box_state.margin_left = 0;
|
box_state.margin_left = 0;
|
||||||
if (is_auto(box.computed_values().margin().right))
|
if (is_auto(box.computed_values().margin().right))
|
||||||
|
@ -725,11 +725,11 @@ void FormattingContext::layout_absolutely_positioned_element(Box const& box)
|
||||||
|
|
||||||
Gfx::FloatPoint used_offset;
|
Gfx::FloatPoint used_offset;
|
||||||
|
|
||||||
if (!is_auto(box.computed_values().offset().left)) {
|
if (!is_auto(box.computed_values().inset().left)) {
|
||||||
float x_offset = box_state.inset_left
|
float x_offset = box_state.inset_left
|
||||||
+ box_state.border_box_left();
|
+ box_state.border_box_left();
|
||||||
used_offset.set_x(x_offset + box_state.margin_left);
|
used_offset.set_x(x_offset + box_state.margin_left);
|
||||||
} else if (!is_auto(box.computed_values().offset().right)) {
|
} else if (!is_auto(box.computed_values().inset().right)) {
|
||||||
float x_offset = 0
|
float x_offset = 0
|
||||||
- box_state.inset_right
|
- box_state.inset_right
|
||||||
- box_state.border_box_right();
|
- box_state.border_box_right();
|
||||||
|
@ -739,11 +739,11 @@ void FormattingContext::layout_absolutely_positioned_element(Box const& box)
|
||||||
used_offset.set_x(x_offset);
|
used_offset.set_x(x_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_auto(box.computed_values().offset().top)) {
|
if (!is_auto(box.computed_values().inset().top)) {
|
||||||
float y_offset = box_state.inset_top
|
float y_offset = box_state.inset_top
|
||||||
+ box_state.border_box_top();
|
+ box_state.border_box_top();
|
||||||
used_offset.set_y(y_offset + box_state.margin_top);
|
used_offset.set_y(y_offset + box_state.margin_top);
|
||||||
} else if (!is_auto(box.computed_values().offset().bottom)) {
|
} else if (!is_auto(box.computed_values().inset().bottom)) {
|
||||||
float y_offset = 0
|
float y_offset = 0
|
||||||
- box_state.inset_bottom
|
- box_state.inset_bottom
|
||||||
- box_state.border_box_bottom();
|
- box_state.border_box_bottom();
|
||||||
|
@ -779,8 +779,8 @@ void FormattingContext::compute_inset(Box const& box)
|
||||||
float width_of_containing_block = m_state.get(*box.containing_block()).content_width;
|
float width_of_containing_block = m_state.get(*box.containing_block()).content_width;
|
||||||
auto width_of_containing_block_as_length = CSS::Length::make_px(width_of_containing_block);
|
auto width_of_containing_block_as_length = CSS::Length::make_px(width_of_containing_block);
|
||||||
|
|
||||||
auto specified_left = computed_values.offset().left.resolved(box, width_of_containing_block_as_length).resolved(box);
|
auto specified_left = computed_values.inset().left.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||||
auto specified_right = computed_values.offset().right.resolved(box, width_of_containing_block_as_length).resolved(box);
|
auto specified_right = computed_values.inset().right.resolved(box, width_of_containing_block_as_length).resolved(box);
|
||||||
|
|
||||||
if (specified_left.is_auto() && specified_right.is_auto()) {
|
if (specified_left.is_auto() && specified_right.is_auto()) {
|
||||||
// If both 'left' and 'right' are 'auto' (their initial values), the used values are '0' (i.e., the boxes stay in their original position).
|
// If both 'left' and 'right' are 'auto' (their initial values), the used values are '0' (i.e., the boxes stay in their original position).
|
||||||
|
|
|
@ -509,7 +509,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
|
||||||
if (auto maybe_length_percentage = computed_style.length_percentage(CSS::PropertyID::MaxHeight); maybe_length_percentage.has_value())
|
if (auto maybe_length_percentage = computed_style.length_percentage(CSS::PropertyID::MaxHeight); maybe_length_percentage.has_value())
|
||||||
computed_values.set_max_height(maybe_length_percentage.release_value());
|
computed_values.set_max_height(maybe_length_percentage.release_value());
|
||||||
|
|
||||||
computed_values.set_offset(computed_style.length_box(CSS::PropertyID::Left, CSS::PropertyID::Top, CSS::PropertyID::Right, CSS::PropertyID::Bottom, CSS::Length::make_auto()));
|
computed_values.set_inset(computed_style.length_box(CSS::PropertyID::Left, CSS::PropertyID::Top, CSS::PropertyID::Right, CSS::PropertyID::Bottom, CSS::Length::make_auto()));
|
||||||
computed_values.set_margin(computed_style.length_box(CSS::PropertyID::MarginLeft, CSS::PropertyID::MarginTop, CSS::PropertyID::MarginRight, CSS::PropertyID::MarginBottom, CSS::Length::make_px(0)));
|
computed_values.set_margin(computed_style.length_box(CSS::PropertyID::MarginLeft, CSS::PropertyID::MarginTop, CSS::PropertyID::MarginRight, CSS::PropertyID::MarginBottom, CSS::Length::make_px(0)));
|
||||||
computed_values.set_padding(computed_style.length_box(CSS::PropertyID::PaddingLeft, CSS::PropertyID::PaddingTop, CSS::PropertyID::PaddingRight, CSS::PropertyID::PaddingBottom, CSS::Length::make_px(0)));
|
computed_values.set_padding(computed_style.length_box(CSS::PropertyID::PaddingLeft, CSS::PropertyID::PaddingTop, CSS::PropertyID::PaddingRight, CSS::PropertyID::PaddingBottom, CSS::Length::make_px(0)));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue