LibWeb: Rename "position" enum to "positioning"

The postitioning enum values are used by the position CSS property.
Unfortunately, the prior naming clashes with the CSS Values-4 type
named position, which will be implemented in a later commit.
This commit is contained in:
Tobias Christiansen 2023-10-27 15:17:36 +02:00 committed by Sam Atkins
parent 60640fe38d
commit 6602b1ddb1
Notes: sideshowbarker 2024-07-16 22:51:10 +09:00
10 changed files with 23 additions and 23 deletions

View File

@ -90,7 +90,7 @@ public:
static CSS::WhiteSpace white_space() { return CSS::WhiteSpace::Normal; }
static CSS::TextAlign text_align() { return CSS::TextAlign::Left; }
static CSS::TextJustify text_justify() { return CSS::TextJustify::Auto; }
static CSS::Position position() { return CSS::Position::Static; }
static CSS::Positioning position() { return CSS::Positioning::Static; }
static CSS::TextDecorationLine text_decoration_line() { return CSS::TextDecorationLine::None; }
static CSS::Length text_decoration_thickness() { return Length::make_auto(); }
static CSS::TextDecorationStyle text_decoration_style() { return CSS::TextDecorationStyle::Solid; }
@ -304,7 +304,7 @@ public:
Color text_decoration_color() const { return m_noninherited.text_decoration_color; }
CSS::TextTransform text_transform() const { return m_inherited.text_transform; }
Vector<ShadowData> const& text_shadow() const { return m_inherited.text_shadow; }
CSS::Position position() const { return m_noninherited.position; }
CSS::Positioning position() const { return m_noninherited.position; }
CSS::WhiteSpace white_space() const { return m_inherited.white_space; }
CSS::FlexDirection flex_direction() const { return m_noninherited.flex_direction; }
CSS::FlexWrap flex_wrap() const { return m_noninherited.flex_wrap; }
@ -463,7 +463,7 @@ protected:
CSS::LengthPercentage text_decoration_thickness { InitialValues::text_decoration_thickness() };
CSS::TextDecorationStyle text_decoration_style { InitialValues::text_decoration_style() };
Color text_decoration_color { InitialValues::color() };
CSS::Position position { InitialValues::position() };
CSS::Positioning position { InitialValues::position() };
CSS::Size width { InitialValues::width() };
CSS::Size min_width { InitialValues::min_width() };
CSS::Size max_width { InitialValues::max_width() };
@ -570,7 +570,7 @@ public:
void set_text_transform(CSS::TextTransform value) { m_inherited.text_transform = value; }
void set_text_shadow(Vector<ShadowData>&& value) { m_inherited.text_shadow = move(value); }
void set_text_indent(CSS::LengthPercentage value) { m_inherited.text_indent = move(value); }
void set_position(CSS::Position position) { m_noninherited.position = position; }
void set_position(CSS::Positioning position) { m_noninherited.position = position; }
void set_white_space(CSS::WhiteSpace value) { m_inherited.white_space = value; }
void set_width(CSS::Size const& width) { m_noninherited.width = width; }
void set_min_width(CSS::Size const& width) { m_noninherited.min_width = width; }

View File

@ -319,7 +319,7 @@
"all",
"none"
],
"position": [
"positioning": [
"absolute",
"fixed",
"relative",

View File

@ -1863,7 +1863,7 @@
"inherited": false,
"initial": "static",
"valid-types": [
"position"
"positioning"
]
},
"quotes": {

View File

@ -1986,7 +1986,7 @@ static BoxTypeTransformation required_box_type_transformation(StyleProperties co
return BoxTypeTransformation::None;
// Absolute positioning or floating an element blockifies the boxs display type. [CSS2]
if (style.position() == CSS::Position::Absolute || style.position() == CSS::Position::Fixed || style.float_() != CSS::Float::None)
if (style.position() == CSS::Positioning::Absolute || style.position() == CSS::Positioning::Fixed || style.float_() != CSS::Float::None)
return BoxTypeTransformation::Blockify;
// FIXME: Containment in a ruby container inlinifies the boxs display type, as described in [CSS-RUBY-1].

View File

@ -558,10 +558,10 @@ CSS::BackdropFilter StyleProperties::backdrop_filter() const
return BackdropFilter::make_none();
}
Optional<CSS::Position> StyleProperties::position() const
Optional<CSS::Positioning> StyleProperties::position() const
{
auto value = property(CSS::PropertyID::Position);
return value_id_to_position(value->to_identifier());
return value_id_to_positioning(value->to_identifier());
}
bool StyleProperties::operator==(StyleProperties const& other) const

View File

@ -145,7 +145,7 @@ public:
bool operator==(StyleProperties const&) const;
Optional<CSS::Position> position() const;
Optional<CSS::Positioning> position() const;
Optional<int> z_index() const;
void set_math_depth(int math_depth);

View File

@ -1204,7 +1204,7 @@ void FormattingContext::compute_height_for_absolutely_positioned_replaced_elemen
// https://www.w3.org/TR/css-position-3/#relpos-insets
void FormattingContext::compute_inset(NodeWithStyleAndBoxModelMetrics const& box)
{
if (box.computed_values().position() != CSS::Position::Relative)
if (box.computed_values().position() != CSS::Positioning::Relative)
return;
auto resolve_two_opposing_insets = [&](CSS::LengthPercentage const& computed_first, CSS::LengthPercentage const& computed_second, CSSPixels& used_start, CSSPixels& used_end, CSSPixels reference_for_percentage) {
@ -1486,7 +1486,7 @@ CSS::Length FormattingContext::calculate_inner_height(Layout::Box const& box, Av
auto const* containing_block = box.non_anonymous_containing_block();
auto const& containing_block_state = m_state.get(*containing_block);
auto height_of_containing_block = containing_block_state.content_height();
if (box.computed_values().position() == CSS::Position::Absolute) {
if (box.computed_values().position() == CSS::Positioning::Absolute) {
// https://www.w3.org/TR/css-position-3/#def-cb
// If the box has position: absolute, then the containing block is formed by the padding edge of the ancestor
height_of_containing_block += containing_block_state.padding_top + containing_block_state.padding_bottom;

View File

@ -163,7 +163,7 @@ void LayoutState::resolve_relative_positions(Vector<Painting::PaintableWithLines
offset = used_values.offset;
}
// Apply relative position inset if appropriate.
if (node.computed_values().position() == CSS::Position::Relative && is<NodeWithStyleAndBoxModelMetrics>(node)) {
if (node.computed_values().position() == CSS::Positioning::Relative && is<NodeWithStyleAndBoxModelMetrics>(node)) {
auto& inset = static_cast<NodeWithStyleAndBoxModelMetrics const&>(node).box_model().inset;
offset.translate_by(inset.left, inset.top);
}
@ -184,7 +184,7 @@ void LayoutState::resolve_relative_positions(Vector<Painting::PaintableWithLines
break;
if (!ancestor->display().is_inline_outside() || !ancestor->display().is_flow_inside())
break;
if (ancestor->computed_values().position() == CSS::Position::Relative) {
if (ancestor->computed_values().position() == CSS::Positioning::Relative) {
auto const& ancestor_node = static_cast<Layout::NodeWithStyleAndBoxModelMetrics const&>(*ancestor);
auto const& inset = ancestor_node.box_model().inset;
offset.translate_by(inset.left, inset.top);

View File

@ -75,7 +75,7 @@ bool Node::is_out_of_flow(FormattingContext const& formatting_context) const
bool Node::can_contain_boxes_with_position_absolute() const
{
if (computed_values().position() != CSS::Position::Static)
if (computed_values().position() != CSS::Positioning::Static)
return true;
if (is<Viewport>(*this))
@ -110,7 +110,7 @@ Box const* Node::containing_block() const
auto position = computed_values().position();
// https://drafts.csswg.org/css-position-3/#absolute-cb
if (position == CSS::Position::Absolute) {
if (position == CSS::Positioning::Absolute) {
auto const* ancestor = parent();
while (ancestor && !ancestor->can_contain_boxes_with_position_absolute())
ancestor = ancestor->parent();
@ -119,7 +119,7 @@ Box const* Node::containing_block() const
return static_cast<Box const*>(ancestor);
}
if (position == CSS::Position::Fixed)
if (position == CSS::Positioning::Fixed)
return &root();
return nearest_ancestor_capable_of_forming_a_containing_block(*this);
@ -157,14 +157,14 @@ bool Node::establishes_stacking_context() const
auto position = computed_values().position();
// Element with a position value absolute or relative and z-index value other than auto.
if (position == CSS::Position::Absolute || position == CSS::Position::Relative) {
if (position == CSS::Positioning::Absolute || position == CSS::Positioning::Relative) {
if (computed_values().z_index().has_value()) {
return true;
}
}
// Element with a position value fixed or sticky.
if (position == CSS::Position::Fixed || position == CSS::Position::Sticky)
if (position == CSS::Positioning::Fixed || position == CSS::Positioning::Sticky)
return true;
if (!computed_values().transformations().is_empty())
@ -273,7 +273,7 @@ bool Node::is_floating() const
bool Node::is_positioned() const
{
return has_style() && computed_values().position() != CSS::Position::Static;
return has_style() && computed_values().position() != CSS::Positioning::Static;
}
bool Node::is_absolutely_positioned() const
@ -281,7 +281,7 @@ bool Node::is_absolutely_positioned() const
if (!has_style())
return false;
auto position = computed_values().position();
return position == CSS::Position::Absolute || position == CSS::Position::Fixed;
return position == CSS::Positioning::Absolute || position == CSS::Positioning::Fixed;
}
bool Node::is_fixed_position() const
@ -289,7 +289,7 @@ bool Node::is_fixed_position() const
if (!has_style())
return false;
auto position = computed_values().position();
return position == CSS::Position::Fixed;
return position == CSS::Positioning::Fixed;
}
NodeWithStyle::NodeWithStyle(DOM::Document& document, DOM::Node* node, NonnullRefPtr<CSS::StyleProperties> computed_style)

View File

@ -35,7 +35,7 @@ bool Paintable::is_positioned() const
// grid items with z_index should behave as if position were "relative"
return true;
}
return computed_values().position() != CSS::Position::Static;
return computed_values().position() != CSS::Positioning::Static;
}
void Paintable::set_dom_node(JS::GCPtr<DOM::Node> dom_node)