Skip to content

Truly independent web browser

LibWeb: Give checkboxes and radio buttons default margins

Andreas Klinge7fa2e3d1edc
diff --git a/Libraries/LibWeb/CSS/Default.css b/Libraries/LibWeb/CSS/Default.css
index d28115d52d3..7f8905da30d 100644
--- a/Libraries/LibWeb/CSS/Default.css
+++ b/Libraries/LibWeb/CSS/Default.css
@@ -759,6 +759,16 @@ input:is([type=radio i], [type=checkbox i], [type=reset i], [type=button i],
textarea { white-space: pre-wrap; }
+input[type=checkbox i] {
+ margin-block: 3px;
+ margin-inline: 4px 3px;
+}
+
+input[type=radio i] {
+ margin-block: 3px 0;
+ margin-inline: 5px 3px;
+}
+
/* 15.3.11 The hr element
* https://html.spec.whatwg.org/multipage/rendering.html#the-hr-element-2
*/
diff --git a/Tests/LibWeb/Layout/expected/acid1.txt b/Tests/LibWeb/Layout/expected/acid1.txt
index 9ac6dc1c514..e28a4dda633 100644
--- a/Tests/LibWeb/Layout/expected/acid1.txt
+++ b/Tests/LibWeb/Layout/expected/acid1.txt
@@ -29,26 +29,26 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
frag 0 from TextNode start: 0, length: 14, rect: [235,55 74.296875x10] baseline: 8
"the world ends"
TextNode <#text> (not painted)
- BlockContainer <(anonymous)> at [235,65] [0+0+0 139.96875 0+0+0] [0+0+0 38 0+0+0] children: inline
+ BlockContainer <(anonymous)> at [235,65] [0+0+0 139.96875 0+0+0] [0+0+0 43 0+0+0] children: inline
TextNode <#text> (not painted)
InlineNode <form> at [235,65] [0+0+0 0 0+0+0] [0+0+0 0 0+0+0]
- frag 0 from BlockContainer start: 0, length: 0, rect: [235,65 139.96875x19] baseline: 0
- frag 0 from BlockContainer start: 0, length: 0, rect: [235,84 139.96875x19] baseline: 0
+ frag 0 from BlockContainer start: 0, length: 0, rect: [235,65 139.96875x21.5] baseline: 0
+ frag 0 from BlockContainer start: 0, length: 0, rect: [235,86.5 139.96875x21.5] baseline: 0
TextNode <#text> (not painted)
- BlockContainer <p> at [235,65] [0+0+0 139.96875 0+0+0] [0+0+0 19 0+0+0] children: inline
- frag 0 from TextNode start: 33, length: 5, rect: [235,69.5 27.5x10] baseline: 8
+ BlockContainer <p> at [235,65] [0+0+0 139.96875 0+0+0] [0+0+0 21.5 0+0+0] children: inline
+ frag 0 from TextNode start: 33, length: 5, rect: [235,71.5 27.5x10] baseline: 8
"bang "
- frag 1 from RadioButton start: 0, length: 0, rect: [262.5,65 12x12] baseline: 12
+ frag 1 from RadioButton start: 0, length: 0, rect: [267.5,68 12x12] baseline: 15
TextNode <#text> (not painted)
- RadioButton <input> at [262.5,65] inline-block [0+0+0 12 0+0+0] [0+0+0 12 0+0+0] children: not-inline
+ RadioButton <input> at [267.5,68] inline-block [5+0+0 12 0+0+3] [3+0+0 12 0+0+0] children: not-inline
TextNode <#text> (not painted)
TextNode <#text> (not painted)
- BlockContainer <p> at [235,84] [0+0+0 139.96875 0+0+0] [0+0+0 19 0+0+0] children: inline
- frag 0 from TextNode start: 33, length: 8, rect: [235,88.5 45.171875x10] baseline: 8
+ BlockContainer <p> at [235,86.5] [0+0+0 139.96875 0+0+0] [0+0+0 21.5 0+0+0] children: inline
+ frag 0 from TextNode start: 33, length: 8, rect: [235,93 45.171875x10] baseline: 8
"whimper "
- frag 1 from RadioButton start: 0, length: 0, rect: [280.171875,84 12x12] baseline: 12
+ frag 1 from RadioButton start: 0, length: 0, rect: [285.171875,89.5 12x12] baseline: 15
TextNode <#text> (not painted)
- RadioButton <input> at [280.171875,84] inline-block [0+0+0 12 0+0+0] [0+0+0 12 0+0+0] children: not-inline
+ RadioButton <input> at [285.171875,89.5] inline-block [5+0+0 12 0+0+3] [3+0+0 12 0+0+0] children: not-inline
TextNode <#text> (not painted)
TextNode <#text> (not painted)
TextNode <#text> (not painted)
diff --git a/Tests/LibWeb/Layout/expected/css-appearance-none.txt b/Tests/LibWeb/Layout/expected/css-appearance-none.txt
index 32fedc1f1ba..393aa546b20 100644
--- a/Tests/LibWeb/Layout/expected/css-appearance-none.txt
+++ b/Tests/LibWeb/Layout/expected/css-appearance-none.txt
@@ -1,23 +1,23 @@
Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children: not-inline
- BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 120.40625 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 104.40625 0+0+8] children: inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 129.21875 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 113.21875 0+0+8] children: inline
frag 0 from BlockContainer start: 0, length: 0, rect: [17,11 0x14] baseline: 13.984375
frag 1 from TextNode start: 0, length: 13, rect: [26,9 116.171875x16] baseline: 12.796875
"Normal button"
frag 2 from BlockContainer start: 0, length: 0, rect: [17,31 0x14] baseline: 13.984375
frag 3 from TextNode start: 0, length: 20, rect: [26,29 181.203125x16] baseline: 12.796875
"No appearance button"
- frag 4 from CheckBox start: 0, length: 0, rect: [8,48 13x13] baseline: 13
- frag 5 from TextNode start: 0, length: 15, rect: [21,48 136.296875x16] baseline: 12.796875
+ frag 4 from CheckBox start: 0, length: 0, rect: [12,51 13x13] baseline: 19
+ frag 5 from TextNode start: 0, length: 15, rect: [28,54 136.296875x16] baseline: 12.796875
"Normal checkbox"
- frag 6 from BlockContainer start: 0, length: 0, rect: [8,77 0x0] baseline: 0
- frag 7 from TextNode start: 0, length: 22, rect: [8,64 201.328125x16] baseline: 12.796875
+ frag 6 from BlockContainer start: 0, length: 0, rect: [12,80 0x0] baseline: 6
+ frag 7 from TextNode start: 0, length: 22, rect: [15,70 201.328125x16] baseline: 12.796875
"No appearance checkbox"
- frag 8 from RadioButton start: 0, length: 0, rect: [8,81 12x12] baseline: 12
- frag 9 from TextNode start: 0, length: 12, rect: [20,80 104.203125x16] baseline: 12.796875
+ frag 8 from RadioButton start: 0, length: 0, rect: [13,89 12x12] baseline: 15
+ frag 9 from TextNode start: 0, length: 12, rect: [28,88 104.203125x16] baseline: 12.796875
"Normal radio"
- frag 10 from BlockContainer start: 0, length: 0, rect: [8,109 0x0] baseline: 0
- frag 11 from TextNode start: 0, length: 19, rect: [8,96 169.234375x16] baseline: 12.796875
+ frag 10 from BlockContainer start: 0, length: 0, rect: [13,117 0x0] baseline: 3
+ frag 11 from TextNode start: 0, length: 19, rect: [16,104 169.234375x16] baseline: 12.796875
"No appearance radio"
BlockContainer <input> at [17,11] inline-block [0+1+8 0 8+1+0] [0+1+2 14 2+1+0] [BFC] children: not-inline
BlockContainer <(anonymous)> at [17,11] flex-container(column) [0+0+0 0 0+0+0] [0+0+0 14 0+0+0] [FFC] children: not-inline
@@ -39,22 +39,22 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
TextNode <#text> (not painted)
BreakNode <br> (not painted)
TextNode <#text> (not painted)
- CheckBox <input> at [8,48] inline-block [0+0+0 13 0+0+0] [0+0+0 13 0+0+0] children: not-inline
+ CheckBox <input> at [12,51] inline-block [4+0+0 13 0+0+3] [3+0+0 13 0+0+3] children: not-inline
TextNode <#text> (not painted)
BreakNode <br> (not painted)
TextNode <#text> (not painted)
- BlockContainer <input> at [8,77] inline-block [0+0+0 0 0+0+0] [0+0+0 0 0+0+0] [BFC] children: not-inline
+ BlockContainer <input> at [12,80] inline-block [4+0+0 0 0+0+3] [3+0+0 0 0+0+3] [BFC] children: not-inline
TextNode <#text> (not painted)
BreakNode <br> (not painted)
TextNode <#text> (not painted)
- RadioButton <input> at [8,81] inline-block [0+0+0 12 0+0+0] [0+0+0 12 0+0+0] children: not-inline
+ RadioButton <input> at [13,89] inline-block [5+0+0 12 0+0+3] [3+0+0 12 0+0+0] children: not-inline
TextNode <#text> (not painted)
BreakNode <br> (not painted)
TextNode <#text> (not painted)
- BlockContainer <input> at [8,109] inline-block [0+0+0 0 0+0+0] [0+0+0 0 0+0+0] [BFC] children: not-inline
+ BlockContainer <input> at [13,117] inline-block [5+0+0 0 0+0+3] [3+0+0 0 0+0+0] [BFC] children: not-inline
TextNode <#text> (not painted)
BreakNode <br> (not painted)
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x120.40625] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x129.21875] (z-index: auto)
diff --git a/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png b/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png
index 727bf8ac982..3918fcf08a1 100644
Binary files a/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png and b/Tests/LibWeb/Screenshot/expected-macos/color-scheme.png differ
diff --git a/Tests/LibWeb/Screenshot/expected/checkbox-accent-color-and-color-scheme.png b/Tests/LibWeb/Screenshot/expected/checkbox-accent-color-and-color-scheme.png
index 5c59a9c1a19..32f066ab459 100644
Binary files a/Tests/LibWeb/Screenshot/expected/checkbox-accent-color-and-color-scheme.png and b/Tests/LibWeb/Screenshot/expected/checkbox-accent-color-and-color-scheme.png differ
diff --git a/Tests/LibWeb/Screenshot/expected/color-scheme.png b/Tests/LibWeb/Screenshot/expected/color-scheme.png
index 32c284a2687..59ef5ee49d8 100644
Binary files a/Tests/LibWeb/Screenshot/expected/color-scheme.png and b/Tests/LibWeb/Screenshot/expected/color-scheme.png differ
diff --git a/Tests/LibWeb/Screenshot/expected/non-square-checkboxes.png b/Tests/LibWeb/Screenshot/expected/non-square-checkboxes.png
index 07ae878fba9..85640829ec4 100644
Binary files a/Tests/LibWeb/Screenshot/expected/non-square-checkboxes.png and b/Tests/LibWeb/Screenshot/expected/non-square-checkboxes.png differ
diff --git a/Tests/LibWeb/Screenshot/expected/non-square-radio-buttons.png b/Tests/LibWeb/Screenshot/expected/non-square-radio-buttons.png
index 2ecf688f770..4fc186bad46 100644
Binary files a/Tests/LibWeb/Screenshot/expected/non-square-radio-buttons.png and b/Tests/LibWeb/Screenshot/expected/non-square-radio-buttons.png differ
diff --git a/Tests/LibWeb/Screenshot/input/non-square-radio-buttons.html b/Tests/LibWeb/Screenshot/input/non-square-radio-buttons.html
index 9ba264a7499..9f6493d6f42 100644
--- a/Tests/LibWeb/Screenshot/input/non-square-radio-buttons.html
+++ b/Tests/LibWeb/Screenshot/input/non-square-radio-buttons.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-1817" />
+<meta name="fuzzy" content="maxDifference=0-1;totalPixels=0-1821" />
<style>
input.a {
width: 10px;