mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Implement :placeholder-shown (fixes #10561)
This commit is contained in:
parent
6c5f5d35f5
commit
ff899dc703
7 changed files with 52 additions and 12 deletions
|
@ -549,6 +549,11 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Whether the content is empty.
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.lines.len() <= 1 && self.lines.get(0).map_or(true, |line| line.is_empty())
|
||||
}
|
||||
|
||||
/// The length of the content in bytes.
|
||||
pub fn len(&self) -> usize {
|
||||
self.lines.iter().fold(0, |m, l| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue