mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Update placeholder visibility when the placeholder value changes
Otherwise, setting a placeholder on an element that previously did not have a placeholder would have no visible effect.
This commit is contained in:
parent
9f3c3925e0
commit
6af7f7e0f5
Notes:
sideshowbarker
2024-07-17 07:20:49 +09:00
Author: https://github.com/trflynn89
Commit: 6af7f7e0f5
Pull-request: https://github.com/SerenityOS/serenity/pull/23838
3 changed files with 31 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
||||||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||||
BlockContainer <html> at (0,0) content-size 800x42 [BFC] children: not-inline
|
BlockContainer <html> at (0,0) content-size 800x68 [BFC] children: not-inline
|
||||||
BlockContainer <body> at (8,8) content-size 784x26 children: inline
|
BlockContainer <body> at (8,8) content-size 784x52 children: inline
|
||||||
frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 200x24] baseline: 17
|
frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 200x24] baseline: 17
|
||||||
frag 1 from TextNode start: 0, length: 1, rect: [210,8 10x22] baseline: 17
|
frag 1 from TextNode start: 0, length: 1, rect: [210,8 10x22] baseline: 17
|
||||||
" "
|
" "
|
||||||
|
@ -8,6 +8,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||||
frag 3 from TextNode start: 0, length: 1, rect: [422,8 10x22] baseline: 17
|
frag 3 from TextNode start: 0, length: 1, rect: [422,8 10x22] baseline: 17
|
||||||
" "
|
" "
|
||||||
frag 4 from BlockContainer start: 0, length: 0, rect: [433,9 200x24] baseline: 17
|
frag 4 from BlockContainer start: 0, length: 0, rect: [433,9 200x24] baseline: 17
|
||||||
|
frag 5 from BlockContainer start: 0, length: 0, rect: [9,35 200x24] baseline: 17
|
||||||
BlockContainer <input> at (9,9) content-size 200x24 inline-block [BFC] children: not-inline
|
BlockContainer <input> at (9,9) content-size 200x24 inline-block [BFC] children: not-inline
|
||||||
Box <div> at (11,10) content-size 196x22 flex-container(row) [FFC] children: not-inline
|
Box <div> at (11,10) content-size 196x22 flex-container(row) [FFC] children: not-inline
|
||||||
BlockContainer <div> at (11,10) content-size 196x22 flex-item [BFC] children: inline
|
BlockContainer <div> at (11,10) content-size 196x22 flex-item [BFC] children: inline
|
||||||
|
@ -31,10 +32,22 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||||
"text"
|
"text"
|
||||||
TextNode <#text>
|
TextNode <#text>
|
||||||
TextNode <#text>
|
TextNode <#text>
|
||||||
|
BlockContainer <input#placeholder> at (9,35) content-size 200x24 inline-block [BFC] children: not-inline
|
||||||
|
Box <div> at (11,36) content-size 196x22 flex-container(row) [FFC] children: not-inline
|
||||||
|
BlockContainer <div> at (11,36) content-size 196x22 flex-item [BFC] children: inline
|
||||||
|
frag 0 from TextNode start: 0, length: 16, rect: [11,36 166.75x22] baseline: 17
|
||||||
|
"This placeholder"
|
||||||
|
frag 1 from TextNode start: 17, length: 14, rect: [11,58 147.90625x22] baseline: 17
|
||||||
|
"should also be"
|
||||||
|
frag 2 from TextNode start: 32, length: 8, rect: [11,80 73.046875x22] baseline: 17
|
||||||
|
"visisble"
|
||||||
|
TextNode <#text>
|
||||||
|
TextNode <#text>
|
||||||
|
TextNode <#text>
|
||||||
|
|
||||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x42]
|
PaintableWithLines (BlockContainer<HTML>) [0,0 800x68]
|
||||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x26]
|
PaintableWithLines (BlockContainer<BODY>) [8,8 784x52]
|
||||||
PaintableWithLines (BlockContainer<INPUT>) [8,8 202x26]
|
PaintableWithLines (BlockContainer<INPUT>) [8,8 202x26]
|
||||||
PaintableBox (Box<DIV>) [9,9 200x24]
|
PaintableBox (Box<DIV>) [9,9 200x24]
|
||||||
PaintableWithLines (BlockContainer<DIV>) [11,10 196x22]
|
PaintableWithLines (BlockContainer<DIV>) [11,10 196x22]
|
||||||
|
@ -49,3 +62,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||||
PaintableBox (Box<DIV>) [433,9 200x24]
|
PaintableBox (Box<DIV>) [433,9 200x24]
|
||||||
PaintableWithLines (BlockContainer<DIV>) [435,10 196x22]
|
PaintableWithLines (BlockContainer<DIV>) [435,10 196x22]
|
||||||
TextPaintable (TextNode<#text>)
|
TextPaintable (TextNode<#text>)
|
||||||
|
PaintableWithLines (BlockContainer<INPUT>#placeholder) [8,34 202x26] overflow: [9,35 200x67]
|
||||||
|
PaintableBox (Box<DIV>) [9,35 200x24] overflow: [9,35 200x67]
|
||||||
|
PaintableWithLines (BlockContainer<DIV>) [11,36 196x22] overflow: [11,36 196x66]
|
||||||
|
TextPaintable (TextNode<#text>)
|
||||||
|
|
|
@ -8,3 +8,10 @@ input {
|
||||||
</style></head><body><input type="text" value="text" />
|
</style></head><body><input type="text" value="text" />
|
||||||
<input type="text" placeholder="This placeholder should be visible" />
|
<input type="text" placeholder="This placeholder should be visible" />
|
||||||
<input type="text" value="text" placeholder="This placeholder should not be visible" />
|
<input type="text" value="text" placeholder="This placeholder should not be visible" />
|
||||||
|
<input id="placeholder" type="text" />
|
||||||
|
<script type="text/javascript">
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
let input = document.querySelector("#placeholder");
|
||||||
|
input.placeholder = "This placeholder should also be visisble";
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -1085,8 +1085,10 @@ void HTMLInputElement::form_associated_element_attribute_changed(FlyString const
|
||||||
update_shadow_tree();
|
update_shadow_tree();
|
||||||
}
|
}
|
||||||
} else if (name == HTML::AttributeNames::placeholder) {
|
} else if (name == HTML::AttributeNames::placeholder) {
|
||||||
if (m_placeholder_text_node)
|
if (m_placeholder_text_node) {
|
||||||
m_placeholder_text_node->set_data(placeholder());
|
m_placeholder_text_node->set_data(placeholder());
|
||||||
|
update_placeholder_visibility();
|
||||||
|
}
|
||||||
} else if (name == HTML::AttributeNames::readonly) {
|
} else if (name == HTML::AttributeNames::readonly) {
|
||||||
handle_readonly_attribute(value);
|
handle_readonly_attribute(value);
|
||||||
} else if (name == HTML::AttributeNames::src) {
|
} else if (name == HTML::AttributeNames::src) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue