diff --git a/Libraries/LibWeb/Layout/FormattingContext.cpp b/Libraries/LibWeb/Layout/FormattingContext.cpp index 726be189a8..3cd6a94d68 100644 --- a/Libraries/LibWeb/Layout/FormattingContext.cpp +++ b/Libraries/LibWeb/Layout/FormattingContext.cpp @@ -226,6 +226,19 @@ OwnPtr FormattingContext::create_independent_formatting_conte } } +NonnullOwnPtr FormattingContext::create_independent_formatting_context(LayoutState& state, LayoutMode layout_mode, Box const& child_box) +{ + if (auto context = create_independent_formatting_context_if_needed(state, layout_mode, child_box)) + return context.release_nonnull(); + + if (auto child_block_container = as_if(child_box)) + return make(state, layout_mode, *child_block_container, nullptr); + + // HACK: Instead of crashing in scenarios that assume the formatting context can be created, create a dummy formatting context that does nothing. + dbgln("FIXME: An independent formatting context was requested from a Box that does not have a formatting context type. A dummy formatting context will be created instead."); + return make(state, layout_mode, child_box); +} + OwnPtr FormattingContext::layout_inside(Box const& child_box, LayoutMode layout_mode, AvailableSpace const& available_space) { { @@ -1167,7 +1180,8 @@ CSSPixelRect FormattingContext::content_box_rect_in_static_position_ancestor_coo { auto box_used_values = m_state.get(box); CSSPixelRect rect = { { 0, 0 }, box_used_values.content_size() }; - VERIFY(box_used_values.offset.is_zero()); // Set as result of this calculation + // FIXME: ListItemMarkerBox's should also run this assertion once it has a supported FormattingContext type + VERIFY(box_used_values.offset.is_zero() || box.is_list_item_marker_box()); // Set as result of this calculation for (auto const* current = box.static_position_containing_block(); current; current = current->containing_block()) { if (current == box.containing_block()) return rect; @@ -1454,10 +1468,7 @@ CSSPixels FormattingContext::calculate_min_content_width(Layout::Box const& box) box_state.width_constraint = SizeConstraint::MinContent; box_state.set_indefinite_content_width(); - auto context = const_cast(this)->create_independent_formatting_context_if_needed(throwaway_state, LayoutMode::IntrinsicSizing, box); - if (!context) { - context = make(throwaway_state, LayoutMode::IntrinsicSizing, as(box), nullptr); - } + auto context = const_cast(this)->create_independent_formatting_context(throwaway_state, LayoutMode::IntrinsicSizing, box); auto available_width = AvailableSize::make_min_content(); auto available_height = box_state.has_definite_height() @@ -1494,10 +1505,7 @@ CSSPixels FormattingContext::calculate_max_content_width(Layout::Box const& box) box_state.border_right = actual_box_state.border_right; box_state.padding_right = actual_box_state.padding_right; - auto context = const_cast(this)->create_independent_formatting_context_if_needed(throwaway_state, LayoutMode::IntrinsicSizing, box); - if (!context) { - context = make(throwaway_state, LayoutMode::IntrinsicSizing, as(box), nullptr); - } + auto context = const_cast(this)->create_independent_formatting_context(throwaway_state, LayoutMode::IntrinsicSizing, box); auto available_width = AvailableSize::make_max_content(); auto available_height = box_state.has_definite_height() @@ -1535,10 +1543,7 @@ CSSPixels FormattingContext::calculate_min_content_height(Layout::Box const& box box_state.set_indefinite_content_height(); box_state.set_content_width(width); - auto context = const_cast(this)->create_independent_formatting_context_if_needed(throwaway_state, LayoutMode::IntrinsicSizing, box); - if (!context) { - context = make(throwaway_state, LayoutMode::IntrinsicSizing, as(box), nullptr); - } + auto context = const_cast(this)->create_independent_formatting_context(throwaway_state, LayoutMode::IntrinsicSizing, box); context->run(AvailableSpace(AvailableSize::make_definite(width), AvailableSize::make_min_content())); @@ -1566,10 +1571,7 @@ CSSPixels FormattingContext::calculate_max_content_height(Layout::Box const& box box_state.set_indefinite_content_height(); box_state.set_content_width(width); - auto context = const_cast(this)->create_independent_formatting_context_if_needed(throwaway_state, LayoutMode::IntrinsicSizing, box); - if (!context) { - context = make(throwaway_state, LayoutMode::IntrinsicSizing, as(box), nullptr); - } + auto context = const_cast(this)->create_independent_formatting_context(throwaway_state, LayoutMode::IntrinsicSizing, box); context->run(AvailableSpace(AvailableSize::make_definite(width), AvailableSize::make_max_content())); diff --git a/Libraries/LibWeb/Layout/FormattingContext.h b/Libraries/LibWeb/Layout/FormattingContext.h index c5b0b91cf2..2645b0ebca 100644 --- a/Libraries/LibWeb/Layout/FormattingContext.h +++ b/Libraries/LibWeb/Layout/FormattingContext.h @@ -64,6 +64,7 @@ public: CSSPixels compute_height_for_replaced_element(Box const&, AvailableSpace const&) const; OwnPtr create_independent_formatting_context_if_needed(LayoutState&, LayoutMode, Box const& child_box); + NonnullOwnPtr create_independent_formatting_context(LayoutState&, LayoutMode, Box const& child_box); virtual void parent_context_did_dimension_child_root_box() { } diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-pseudo/parsing/marker-supported-properties-in-animation.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-pseudo/parsing/marker-supported-properties-in-animation.txt new file mode 100644 index 0000000000..eb77fa9df4 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-pseudo/parsing/marker-supported-properties-in-animation.txt @@ -0,0 +1,102 @@ +Harness status: OK + +Found 96 tests + +39 Pass +57 Fail +Pass Animation of font in ::marker +Pass Animation of font-family in ::marker +Fail Animation of font-feature-settings in ::marker +Fail Animation of font-kerning in ::marker +Pass Animation of font-size in ::marker +Fail Animation of font-size-adjust in ::marker +Pass Animation of font-stretch in ::marker +Pass Animation of font-style in ::marker +Fail Animation of font-synthesis in ::marker +Fail Animation of font-synthesis-small-caps in ::marker +Fail Animation of font-synthesis-style in ::marker +Fail Animation of font-synthesis-weight in ::marker +Pass Animation of font-variant in ::marker +Pass Animation of font-variant-caps in ::marker +Fail Animation of font-variant-east-asian in ::marker +Fail Animation of font-variant-ligatures in ::marker +Fail Animation of font-variant-numeric in ::marker +Fail Animation of font-variant-position in ::marker +Pass Animation of font-weight in ::marker +Pass Animation of line-height in ::marker +Fail Animation of white-space in ::marker +Fail Animation of color in ::marker +Fail Animation of text-combine-upright in ::marker +Pass Animation of unicode-bidi in ::marker +Pass Animation of direction in ::marker +Fail Animation of content in ::marker +Fail Animation of hyphens in ::marker +Fail Animation of letter-spacing in ::marker +Fail Animation of line-break in ::marker +Fail Animation of overflow-wrap in ::marker +Fail Animation of tab-size in ::marker +Fail Animation of text-transform in ::marker +Fail Animation of word-break in ::marker +Fail Animation of word-spacing in ::marker +Fail Animation of text-decoration-skip-ink in ::marker +Fail Animation of text-emphasis in ::marker +Fail Animation of text-emphasis-color in ::marker +Fail Animation of text-emphasis-position in ::marker +Fail Animation of text-emphasis-style in ::marker +Fail Animation of text-shadow in ::marker +Fail Animation of cursor in ::marker +Pass Animation of display in ::marker +Pass Animation of position in ::marker +Pass Animation of float in ::marker +Fail Animation of list-style in ::marker +Pass Animation of list-style-image in ::marker +Pass Animation of list-style-position in ::marker +Pass Animation of list-style-type in ::marker +Pass Transition of font in ::marker +Pass Transition of font-family in ::marker +Pass Transition of font-feature-settings in ::marker +Pass Transition of font-kerning in ::marker +Fail Transition of font-size in ::marker +Fail Transition of font-size-adjust in ::marker +Fail Transition of font-stretch in ::marker +Fail Transition of font-style in ::marker +Fail Transition of font-synthesis in ::marker +Fail Transition of font-synthesis-small-caps in ::marker +Fail Transition of font-synthesis-style in ::marker +Fail Transition of font-synthesis-weight in ::marker +Pass Transition of font-variant in ::marker +Pass Transition of font-variant-caps in ::marker +Pass Transition of font-variant-east-asian in ::marker +Pass Transition of font-variant-ligatures in ::marker +Pass Transition of font-variant-numeric in ::marker +Pass Transition of font-variant-position in ::marker +Fail Transition of font-weight in ::marker +Fail Transition of line-height in ::marker +Pass Transition of white-space in ::marker +Pass Transition of color in ::marker +Fail Transition of text-combine-upright in ::marker +Pass Transition of unicode-bidi in ::marker +Pass Transition of direction in ::marker +Pass Transition of content in ::marker +Fail Transition of hyphens in ::marker +Pass Transition of letter-spacing in ::marker +Fail Transition of line-break in ::marker +Pass Transition of overflow-wrap in ::marker +Pass Transition of tab-size in ::marker +Pass Transition of text-transform in ::marker +Pass Transition of word-break in ::marker +Pass Transition of word-spacing in ::marker +Fail Transition of text-decoration-skip-ink in ::marker +Fail Transition of text-emphasis in ::marker +Fail Transition of text-emphasis-color in ::marker +Fail Transition of text-emphasis-position in ::marker +Fail Transition of text-emphasis-style in ::marker +Fail Transition of text-shadow in ::marker +Pass Transition of cursor in ::marker +Fail Transition of display in ::marker +Fail Transition of position in ::marker +Fail Transition of float in ::marker +Fail Transition of list-style in ::marker +Fail Transition of list-style-image in ::marker +Fail Transition of list-style-position in ::marker +Fail Transition of list-style-type in ::marker \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-pseudo/parsing/marker-supported-properties-in-animation.html b/Tests/LibWeb/Text/input/wpt-import/css/css-pseudo/parsing/marker-supported-properties-in-animation.html new file mode 100644 index 0000000000..9dad046d6d --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-pseudo/parsing/marker-supported-properties-in-animation.html @@ -0,0 +1,405 @@ + + +CSS Pseudo-Elements Test: Supported properties in ::marker animations + + + + + + + + +
+
    +
  • target
  • +
+