LibWeb: Handle changes to an input element's "multiple" attribute

Update the shadow tree so that the attribute is reflected on the page.
This commit is contained in:
Timothy Flynn 2024-04-04 13:21:50 -04:00 committed by Andreas Kling
parent 6af7f7e0f5
commit 06a3ca734e
Notes: sideshowbarker 2024-07-18 22:57:59 +09:00
3 changed files with 35 additions and 0 deletions

View file

@ -5,6 +5,9 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
frag 1 from TextNode start: 0, length: 1, rect: [245,8 8x17] baseline: 13.296875
" "
frag 2 from BlockContainer start: 0, length: 0, rect: [253,8 255.34375x21] baseline: 13.296875
frag 3 from TextNode start: 0, length: 1, rect: [508,8 8x17] baseline: 13.296875
" "
frag 4 from BlockContainer start: 0, length: 0, rect: [516,8 255.34375x21] baseline: 13.296875
BlockContainer <input> at (8,8) content-size 236.65625x21 inline-block [BFC] children: inline
frag 0 from BlockContainer start: 0, length: 0, rect: [13,10 94.375x17] baseline: 13.296875
frag 1 from Label start: 0, length: 0, rect: [116,8 128.28125x17] baseline: 13.296875
@ -33,6 +36,21 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
"No files selected."
TextNode <#text>
TextNode <#text>
BlockContainer <input#multiple> at (516,8) content-size 255.34375x21 inline-block [BFC] children: inline
frag 0 from BlockContainer start: 0, length: 0, rect: [521,10 103.71875x17] baseline: 13.296875
frag 1 from Label start: 0, length: 0, rect: [634,8 137.625x17] baseline: 13.296875
BlockContainer <button> at (521,10) content-size 103.71875x17 inline-block [BFC] children: not-inline
BlockContainer <(anonymous)> at (521,10) content-size 103.71875x17 flex-container(column) [FFC] children: not-inline
BlockContainer <(anonymous)> at (521,10) content-size 103.71875x17 flex-item [BFC] children: inline
frag 0 from TextNode start: 0, length: 15, rect: [521,10 103.71875x17] baseline: 13.296875
"Select files..."
TextNode <#text>
Label <label> at (634,8) content-size 137.625x17 inline-block [BFC] children: inline
frag 0 from TextNode start: 0, length: 18, rect: [634,8 137.625x17] baseline: 13.296875
"No files selected."
TextNode <#text>
TextNode <#text>
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
@ -52,3 +70,11 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
TextPaintable (TextNode<#text>)
PaintableWithLines (Label<LABEL>) [367,8 141.625x17]
TextPaintable (TextNode<#text>)
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<INPUT>#multiple) [516,8 255.34375x21] overflow: [516,8 255.625x21]
PaintableWithLines (BlockContainer<BUTTON>) [516,8 113.71875x21]
PaintableWithLines (BlockContainer(anonymous)) [521,10 103.71875x17]
PaintableWithLines (BlockContainer(anonymous)) [521,10 103.71875x17]
TextPaintable (TextNode<#text>)
PaintableWithLines (Label<LABEL>) [630,8 141.625x17]
TextPaintable (TextNode<#text>)

View file

@ -1,2 +1,9 @@
<input type="file" />
<input type="file" multiple />
<input id="multiple" type="file" />
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", () => {
let input = document.querySelector("#multiple");
input.multiple = true;
});
</script>

View file

@ -1098,6 +1098,8 @@ void HTMLInputElement::form_associated_element_attribute_changed(FlyString const
did_update_alt_text(verify_cast<Layout::ImageBox>(*layout_node()));
} else if (name == HTML::AttributeNames::maxlength) {
handle_maxlength_attribute();
} else if (name == HTML::AttributeNames::multiple) {
update_shadow_tree();
}
}