diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h index 03016591df7..aaa640ebedd 100644 --- a/Libraries/LibWeb/DOM/Node.h +++ b/Libraries/LibWeb/DOM/Node.h @@ -114,6 +114,7 @@ enum class SetNeedsLayoutReason { X(ElementSetInnerHTML) \ X(DetailsElementOpenedOrClosed) \ X(HTMLInputElementSrcAttribute) \ + X(HTMLOListElementOrdinalValues) \ X(HTMLObjectElementUpdateLayoutAndChildObjects) \ X(KeyframeEffect) \ X(NodeInsertBefore) \ diff --git a/Libraries/LibWeb/HTML/HTMLOListElement.cpp b/Libraries/LibWeb/HTML/HTMLOListElement.cpp index f32c367fc34..e0c51e4d98b 100644 --- a/Libraries/LibWeb/HTML/HTMLOListElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLOListElement.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -28,6 +29,15 @@ void HTMLOListElement::initialize(JS::Realm& realm) Base::initialize(realm); } +void HTMLOListElement::attribute_changed(FlyString const& local_name, Optional const& old_value, Optional const& value, Optional const& namespace_) +{ + Base::attribute_changed(local_name, old_value, value, namespace_); + + if (local_name.is_one_of(HTML::AttributeNames::reversed, HTML::AttributeNames::start, HTML::AttributeNames::type)) { + set_needs_layout_tree_update(true, DOM::SetNeedsLayoutTreeUpdateReason::HTMLOListElementOrdinalValues); + } +} + // https://html.spec.whatwg.org/multipage/grouping-content.html#dom-ol-start WebIDL::Long HTMLOListElement::start() { diff --git a/Libraries/LibWeb/HTML/HTMLOListElement.h b/Libraries/LibWeb/HTML/HTMLOListElement.h index 49fc153d853..7687efeeefc 100644 --- a/Libraries/LibWeb/HTML/HTMLOListElement.h +++ b/Libraries/LibWeb/HTML/HTMLOListElement.h @@ -34,6 +34,7 @@ private: HTMLOListElement(DOM::Document&, DOM::QualifiedName); virtual void initialize(JS::Realm&) override; + virtual void attribute_changed(FlyString const& local_name, Optional const& old_value, Optional const& value, Optional const& namespace_) override; virtual bool is_presentational_hint(FlyString const&) const override; virtual void apply_presentational_hints(GC::Ref) const override; diff --git a/Tests/LibWeb/Ref/expected/ol-change-reversed-attribute-ref.html b/Tests/LibWeb/Ref/expected/ol-change-reversed-attribute-ref.html new file mode 100644 index 00000000000..d3dd7fe6741 --- /dev/null +++ b/Tests/LibWeb/Ref/expected/ol-change-reversed-attribute-ref.html @@ -0,0 +1,5 @@ + +
    +
  1. Item a
  2. +
  3. Item b
  4. +
diff --git a/Tests/LibWeb/Ref/expected/ol-change-start-attribute-ref.html b/Tests/LibWeb/Ref/expected/ol-change-start-attribute-ref.html new file mode 100644 index 00000000000..4819d18cea4 --- /dev/null +++ b/Tests/LibWeb/Ref/expected/ol-change-start-attribute-ref.html @@ -0,0 +1,5 @@ + +
    +
  1. Item a
  2. +
  3. Item b
  4. +
diff --git a/Tests/LibWeb/Ref/expected/ol-change-type-attribute-ref.html b/Tests/LibWeb/Ref/expected/ol-change-type-attribute-ref.html new file mode 100644 index 00000000000..271db09d3ea --- /dev/null +++ b/Tests/LibWeb/Ref/expected/ol-change-type-attribute-ref.html @@ -0,0 +1,5 @@ + +
    +
  1. Item a
  2. +
  3. Item b
  4. +
diff --git a/Tests/LibWeb/Ref/input/ol-change-reversed-attribute.html b/Tests/LibWeb/Ref/input/ol-change-reversed-attribute.html new file mode 100644 index 00000000000..a8bfdce1722 --- /dev/null +++ b/Tests/LibWeb/Ref/input/ol-change-reversed-attribute.html @@ -0,0 +1,17 @@ + + + +
    +
  1. Item a
  2. +
  3. Item b
  4. +
+ + diff --git a/Tests/LibWeb/Ref/input/ol-change-start-attribute.html b/Tests/LibWeb/Ref/input/ol-change-start-attribute.html new file mode 100644 index 00000000000..80cc54bd6f7 --- /dev/null +++ b/Tests/LibWeb/Ref/input/ol-change-start-attribute.html @@ -0,0 +1,17 @@ + + + +
    +
  1. Item a
  2. +
  3. Item b
  4. +
+ + diff --git a/Tests/LibWeb/Ref/input/ol-change-type-attribute.html b/Tests/LibWeb/Ref/input/ol-change-type-attribute.html new file mode 100644 index 00000000000..50960847a45 --- /dev/null +++ b/Tests/LibWeb/Ref/input/ol-change-type-attribute.html @@ -0,0 +1,17 @@ + + + +
    +
  1. Item a
  2. +
  3. Item b
  4. +
+ +