1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:17:36 +00:00

LibWeb: Render text inside <input type=password> as asterisks (*)

This makes it possible to enter passwords while recording YouTube
videos. :^)
This commit is contained in:
Andreas Kling 2022-11-05 17:19:00 +01:00
parent b33a2eb9b1
commit 5839ef2ed8
3 changed files with 14 additions and 0 deletions

View file

@ -35,6 +35,12 @@ static bool is_all_whitespace(StringView string)
void TextNode::compute_text_for_rendering(bool collapse)
{
auto& data = dom_node().data();
if (dom_node().is_password_input()) {
m_text_for_rendering = String::repeated('*', data.length());
return;
}
if (!collapse || data.is_empty()) {
m_text_for_rendering = data;
return;