mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
This avoids some minor code duplication. Testing: not needed (no behavior change) Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
parent
0aa08042d5
commit
601517e3aa
2 changed files with 7 additions and 13 deletions
|
@ -211,12 +211,8 @@ fn traverse_children_of<'dom, Node>(
|
|||
|
||||
if is_text_input_element || is_textarea_element {
|
||||
let info = NodeAndStyleInfo::new(parent_element, parent_element.style(context));
|
||||
|
||||
if parent_element
|
||||
.to_threadsafe()
|
||||
.node_text_content()
|
||||
.is_empty()
|
||||
{
|
||||
let node_text_content = parent_element.to_threadsafe().node_text_content();
|
||||
if node_text_content.is_empty() {
|
||||
// The addition of zero-width space here forces the text input to have an inline formatting
|
||||
// context that might otherwise be trimmed if there's no text. This is important to ensure
|
||||
// that the input element is at least as tall as the line gap of the caret:
|
||||
|
@ -225,9 +221,9 @@ fn traverse_children_of<'dom, Node>(
|
|||
// This is also used to ensure that the caret will still be rendered when the input is empty.
|
||||
// TODO: Is there a less hacky way to do this?
|
||||
handler.handle_text(&info, "\u{200B}".into());
|
||||
} else {
|
||||
handler.handle_text(&info, node_text_content);
|
||||
}
|
||||
|
||||
handler.handle_text(&info, parent_element.to_threadsafe().node_text_content());
|
||||
}
|
||||
|
||||
if !is_text_input_element && !is_textarea_element {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue