mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 07:41:01 +00:00
LibWeb: Invalidate layout for ol
-attributes that affect it
This commit is contained in:
parent
263b125782
commit
370098514a
Notes:
github-actions[bot]
2025-05-10 23:15:32 +00:00
Author: https://github.com/InvalidUsernameException
Commit: 370098514a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4686
9 changed files with 78 additions and 0 deletions
|
@ -114,6 +114,7 @@ enum class SetNeedsLayoutReason {
|
||||||
X(ElementSetInnerHTML) \
|
X(ElementSetInnerHTML) \
|
||||||
X(DetailsElementOpenedOrClosed) \
|
X(DetailsElementOpenedOrClosed) \
|
||||||
X(HTMLInputElementSrcAttribute) \
|
X(HTMLInputElementSrcAttribute) \
|
||||||
|
X(HTMLOListElementOrdinalValues) \
|
||||||
X(HTMLObjectElementUpdateLayoutAndChildObjects) \
|
X(HTMLObjectElementUpdateLayoutAndChildObjects) \
|
||||||
X(KeyframeEffect) \
|
X(KeyframeEffect) \
|
||||||
X(NodeInsertBefore) \
|
X(NodeInsertBefore) \
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
#include <LibWeb/CSS/StyleValues/CSSKeywordValue.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
|
#include <LibWeb/HTML/AttributeNames.h>
|
||||||
#include <LibWeb/HTML/HTMLOListElement.h>
|
#include <LibWeb/HTML/HTMLOListElement.h>
|
||||||
#include <LibWeb/HTML/Numbers.h>
|
#include <LibWeb/HTML/Numbers.h>
|
||||||
|
|
||||||
|
@ -28,6 +29,15 @@ void HTMLOListElement::initialize(JS::Realm& realm)
|
||||||
Base::initialize(realm);
|
Base::initialize(realm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void HTMLOListElement::attribute_changed(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> 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
|
// https://html.spec.whatwg.org/multipage/grouping-content.html#dom-ol-start
|
||||||
WebIDL::Long HTMLOListElement::start()
|
WebIDL::Long HTMLOListElement::start()
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,6 +34,7 @@ private:
|
||||||
HTMLOListElement(DOM::Document&, DOM::QualifiedName);
|
HTMLOListElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
|
virtual void attribute_changed(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_) override;
|
||||||
|
|
||||||
virtual bool is_presentational_hint(FlyString const&) const override;
|
virtual bool is_presentational_hint(FlyString const&) const override;
|
||||||
virtual void apply_presentational_hints(GC::Ref<CSS::CascadedProperties>) const override;
|
virtual void apply_presentational_hints(GC::Ref<CSS::CascadedProperties>) const override;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<ol reversed>
|
||||||
|
<li>Item a</li>
|
||||||
|
<li>Item b</li>
|
||||||
|
</ol>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<ol start="42">
|
||||||
|
<li>Item a</li>
|
||||||
|
<li>Item b</li>
|
||||||
|
</ol>
|
|
@ -0,0 +1,5 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<ol type="I">
|
||||||
|
<li>Item a</li>
|
||||||
|
<li>Item b</li>
|
||||||
|
</ol>
|
17
Tests/LibWeb/Ref/input/ol-change-reversed-attribute.html
Normal file
17
Tests/LibWeb/Ref/input/ol-change-reversed-attribute.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="reftest-wait">
|
||||||
|
<link rel="match" href="../expected/ol-change-reversed-attribute-ref.html" />
|
||||||
|
<ol id="list">
|
||||||
|
<li>Item a</li>
|
||||||
|
<li>Item b</li>
|
||||||
|
</ol>
|
||||||
|
<script>
|
||||||
|
// Two nested requestAnimationFrame() calls to force code execution _after_ initial paint
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
document.getElementById("list").reversed = true;
|
||||||
|
document.documentElement.className = '';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</html>
|
17
Tests/LibWeb/Ref/input/ol-change-start-attribute.html
Normal file
17
Tests/LibWeb/Ref/input/ol-change-start-attribute.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="reftest-wait">
|
||||||
|
<link rel="match" href="../expected/ol-change-start-attribute-ref.html" />
|
||||||
|
<ol id="list">
|
||||||
|
<li>Item a</li>
|
||||||
|
<li>Item b</li>
|
||||||
|
</ol>
|
||||||
|
<script>
|
||||||
|
// Two nested requestAnimationFrame() calls to force code execution _after_ initial paint
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
document.getElementById("list").start = 42;
|
||||||
|
document.documentElement.className = '';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</html>
|
17
Tests/LibWeb/Ref/input/ol-change-type-attribute.html
Normal file
17
Tests/LibWeb/Ref/input/ol-change-type-attribute.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html class="reftest-wait">
|
||||||
|
<link rel="match" href="../expected/ol-change-type-attribute-ref.html" />
|
||||||
|
<ol id="list">
|
||||||
|
<li>Item a</li>
|
||||||
|
<li>Item b</li>
|
||||||
|
</ol>
|
||||||
|
<script>
|
||||||
|
// Two nested requestAnimationFrame() calls to force code execution _after_ initial paint
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
document.getElementById("list").type = 'I';
|
||||||
|
document.documentElement.className = '';
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</html>
|
Loading…
Add table
Add a link
Reference in a new issue