mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
LibWeb: Update the <textarea> shadow DOM after reseting its form owner
This generally happens after a form is submitted. We need to update the text node in the shadow DOM to actually display the reset value.
This commit is contained in:
parent
c0d594568d
commit
9eb38ce79c
3 changed files with 40 additions and 1 deletions
26
Tests/LibWeb/Layout/expected/textarea-reset.txt
Normal file
26
Tests/LibWeb/Layout/expected/textarea-reset.txt
Normal file
|
@ -0,0 +1,26 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x34 children: not-inline
|
||||
BlockContainer <form#form> at (8,8) content-size 784x34 children: inline
|
||||
frag 0 from BlockContainer start: 0, length: 0, rect: [11,11 185.875x28] baseline: 13.296875
|
||||
TextNode <#text>
|
||||
BlockContainer <textarea#textarea> at (11,11) content-size 185.875x28 inline-block [BFC] children: not-inline
|
||||
BlockContainer <div> at (11,11) content-size 185.875x17 children: not-inline
|
||||
BlockContainer <div> at (11,11) content-size 185.875x17 children: inline
|
||||
frag 0 from TextNode start: 0, length: 14, rect: [11,11 108.453125x17] baseline: 13.296875
|
||||
"Original value"
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
BlockContainer <(anonymous)> at (8,58) content-size 784x0 children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x34] overflow: [8,8 784x50]
|
||||
PaintableWithLines (BlockContainer<FORM>#form) [8,8 784x34]
|
||||
PaintableWithLines (BlockContainer<TEXTAREA>#textarea) [8,8 191.875x34]
|
||||
PaintableWithLines (BlockContainer<DIV>) [11,11 185.875x17]
|
||||
PaintableWithLines (BlockContainer<DIV>) [11,11 185.875x17]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer(anonymous)) [8,58 784x0]
|
10
Tests/LibWeb/Layout/input/textarea-reset.html
Normal file
10
Tests/LibWeb/Layout/input/textarea-reset.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<form id="form">
|
||||
<textarea id="textarea">Original value</textarea>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
let textarea = document.getElementById("textarea");
|
||||
textarea.value = "Modified value";
|
||||
|
||||
let form = document.getElementById("form");
|
||||
form.reset();
|
||||
</script>
|
|
@ -96,8 +96,11 @@ void HTMLTextAreaElement::reset_algorithm()
|
|||
// and set the raw value of element to its child text content.
|
||||
set_raw_value(child_text_content());
|
||||
|
||||
if (m_text_node) {
|
||||
m_text_node->set_text_content(m_raw_value);
|
||||
update_placeholder_visibility();
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLTextAreaElement::form_associated_element_was_inserted()
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue