Truly independent web browser
LibWeb: Mask password characters with a bullet
Andreas Kling52fc38e66d22
diff --git a/Libraries/LibWeb/Rust/src/layout/text_transform.rs b/Libraries/LibWeb/Rust/src/layout/text_transform.rsindex 9bfb54a51f6..6559078a111 100644--- a/Libraries/LibWeb/Rust/src/layout/text_transform.rs+++ b/Libraries/LibWeb/Rust/src/layout/text_transform.rs@@ -249,7 +249,7 @@ pub(super) fn render_text(assert!(options.dom_start_offset <= source_length);assert!(options.dom_length_in_code_units <= source_length - options.dom_start_offset);let mut result = if options.is_password_input {- map_code_points(&source, |_| 0x25cf)+ map_code_points(&source, |_| 0x2022)} else {match options.text_transform {text_transform::NONE | text_transform::FULL_SIZE_KANA => {@@ -418,8 +418,8 @@ mod tests {#[test]fn password_masking_counts_code_points_and_preserves_dom_spans() {let source = [0x61, 0xd83d, 0xde00, 0xd800, 0x62];- let masked = map_code_points(&source, |_| 0x25cf);- assert_eq!(masked.text, [0x25cf; 4]);+ let masked = map_code_points(&source, |_| 0x2022);+ assert_eq!(masked.text, [0x2022; 4]);assert_eq!(masked.edits,[RenderedTextEdit {diff --git a/Tests/LibWeb/Layout/expected/input-text-to-password.txt b/Tests/LibWeb/Layout/expected/input-text-to-password.txtindex 59595e4aaf8..eba089b5a04 100644--- a/Tests/LibWeb/Layout/expected/input-text-to-password.txt+++ b/Tests/LibWeb/Layout/expected/input-text-to-password.txt@@ -6,7 +6,7 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenBox <div> at [13,11] flex-container(row) [0+0+0 159.6875 0+0+0] [0+0+0 14 0+0+0] [FFC] children: not-inlineBlockContainer <div> at [13,11] flex-item [0+0+0 159.6875 0+0+0] [0+0+0 14 0+0+0] [BFC] children: inlinefrag 0 from TextNode start: 0, length: 7, rect: [13,11 34.125x14] baseline: 10.984375- "●●●●●●●"+ "•••••••"TextNode <#text> (not painted)TextNode <#text> (not painted)TextNode <#text> (not painted)diff --git a/Tests/LibWeb/Layout/expected/unicode-password-input.txt b/Tests/LibWeb/Layout/expected/unicode-password-input.txtindex 529613e8897..c79e7899d38 100644--- a/Tests/LibWeb/Layout/expected/unicode-password-input.txt+++ b/Tests/LibWeb/Layout/expected/unicode-password-input.txt@@ -6,7 +6,7 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] childrenBox <div> at [13,11] flex-container(row) [0+0+0 159.6875 0+0+0] [0+0+0 14 0+0+0] [FFC] children: not-inlineBlockContainer <div> at [13,11] flex-item [0+0+0 159.6875 0+0+0] [0+0+0 14 0+0+0] [BFC] children: inlinefrag 0 from TextNode start: 0, length: 14, rect: [13,11 68.25x14] baseline: 10.984375- "●●●●●●●●●●●●●●"+ "••••••••••••••"TextNode <#text> (not painted)TextNode <#text> (not painted)