Skip to content

Truly independent web browser

LibWeb: Center a range input’s thumb whatever its size

sideshowbarkerb0eed76bfeab
diff --git a/Libraries/LibWeb/CSS/Default.css b/Libraries/LibWeb/CSS/Default.css
index 8ceb3d7218b..99acb0f813f 100644
--- a/Libraries/LibWeb/CSS/Default.css
+++ b/Libraries/LibWeb/CSS/Default.css
@@ -174,7 +174,6 @@ input[type=range] {
&::slider-thumb {
display: block;
position: relative;
- margin-top: -6px;
width: 16px;
height: 16px;
border-radius: 50%;
diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 4ac8384516f..8a0992d9582 100644
--- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -1673,8 +1673,19 @@ void HTMLInputElement::update_slider_shadow_tree_elements()
auto style = computed_style();
bool const is_native = !style || style->appearance() != CSS::Appearance::None;
- if (m_slider_runnable_track)
+ if (m_slider_runnable_track) {
MUST(m_slider_runnable_track->style()->set_property(CSS::PropertyID::BorderRadius, is_native ? u"2px"sv : u"0"sv));
+ // NB: A slider with `appearance: none` draws no band for its track, and its track wraps the thumb, so that a
+ // thumb of any size sits in the middle of the slider. An author who sizes the track positions the thumb
+ // on it themselves.
+ if (is_native) {
+ (void)MUST(m_slider_runnable_track->style()->remove_property(CSS::PropertyID::Height));
+ (void)MUST(m_slider_runnable_track->style()->remove_property(CSS::PropertyID::BackgroundColor));
+ } else {
+ MUST(m_slider_runnable_track->style()->set_property(CSS::PropertyID::Height, "auto"_utf16));
+ MUST(m_slider_runnable_track->style()->set_property(CSS::PropertyID::BackgroundColor, "transparent"_utf16));
+ }
+ }
if (m_slider_progress_element) {
auto width = Utf16String::formatted("calc({}% + {}px)", position, thumb_width / 2 - thumb_offset);
@@ -1686,11 +1697,13 @@ void HTMLInputElement::update_slider_shadow_tree_elements()
update_slider_ticks();
if (m_slider_thumb) {
- // NB: The thumb moves back by the same fraction of its own width, whatever width an author gives it.
+ // NB: The thumb moves back by the same fraction of its own width, whatever width an author gives it. On the
+ // band of a native slider, it's centered by its own height.
auto margin_left = Utf16String::formatted("{}%", position);
MUST(m_slider_thumb->style()->set_property(CSS::PropertyID::MarginLeft, margin_left.utf16_view()));
- auto translate = Utf16String::formatted("{}%", -position);
+ auto translate = Utf16String::formatted("{}% {}", -position, is_native ? "-50%"sv : "0"sv);
MUST(m_slider_thumb->style()->set_property(CSS::PropertyID::Translate, translate.utf16_view()));
+ MUST(m_slider_thumb->style()->set_property(CSS::PropertyID::Top, is_native ? u"50%"sv : u"0"sv));
}
}
diff --git a/Tests/LibWeb/Layout/expected/form-controls-generate-no-before-and-after.txt b/Tests/LibWeb/Layout/expected/form-controls-generate-no-before-and-after.txt
index 2452f05c22b..cbadd476f1b 100644
--- a/Tests/LibWeb/Layout/expected/form-controls-generate-no-before-and-after.txt
+++ b/Tests/LibWeb/Layout/expected/form-controls-generate-no-before-and-after.txt
@@ -54,7 +54,7 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
Box <div> at [500.96875,26] flex-container(row) [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [500.96875,32] positioned flex-item [0+0+0 129 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [500.96875,32] positioned [0+0+0 64.5 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
- BlockContainer <div> at [565.46875,26] positioned [64.5+0+0 16 0+0+48.5] [-6+0+0 16 0+0+0] children: not-inline
+ BlockContainer <div> at [565.46875,34] positioned [64.5+0+0 16 0+0+48.5] [0+0+0 16 0+0+0] children: not-inline
TextNode <#text> (not painted)
BlockContainer <select.g> at [648.96875,31] inline-block [0+1+8 62.609375 8+1+0] [0+1+2 14 2+1+0] [BFC] children: not-inline
Box <div> at [648.96875,31] positioned flex-container(row) [0+0+0 62.609375 0+0+0] [0+0+0 14 0+0+0] [FFC] children: not-inline
@@ -92,4 +92,4 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
SC for BlockContainer<HTML> [0,0 800x92] (z-index: auto)
- SC for BlockContainer<DIV> [565.46875,26 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [565.46875,34 16x16] (z-index: auto), has_transform
diff --git a/Tests/LibWeb/Layout/expected/input-range-datalist-ticks-attribute-changes.txt b/Tests/LibWeb/Layout/expected/input-range-datalist-ticks-attribute-changes.txt
index 7005b477d45..eb16bae9fe1 100644
--- a/Tests/LibWeb/Layout/expected/input-range-datalist-ticks-attribute-changes.txt
+++ b/Tests/LibWeb/Layout/expected/input-range-datalist-ticks-attribute-changes.txt
@@ -13,16 +13,16 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <div> at [17.5,22] positioned [0+0+0 1 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [74,22] positioned [0+0+0 1 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [130.5,22] positioned [0+0+0 1 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
- BlockContainer <div> at [74.5,10] positioned [64.5+0+0 16 0+0+48.5] [-6+0+0 16 0+0+0] children: not-inline
+ BlockContainer <div> at [74.5,18] positioned [64.5+0+0 16 0+0+48.5] [0+0+0 16 0+0+0] children: not-inline
TextNode <#text> (not painted)
RangeInputBox <input#orphaned> at [151,10] inline-block [2+0+0 129 0+0+2] [2+0+0 16 0+0+2] [BFC] children: not-inline
Box <div> at [151,10] flex-container(row) [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [151,16] positioned flex-item [0+0+0 129 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [151,16] positioned [0+0+0 64.5 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
- BlockContainer <div> at [215.5,10] positioned [64.5+0+0 16 0+0+48.5] [-6+0+0 16 0+0+0] children: not-inline
+ BlockContainer <div> at [215.5,18] positioned [64.5+0+0 16 0+0+48.5] [0+0+0 16 0+0+0] children: not-inline
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
SC for BlockContainer<HTML> [0,0 800x37] (z-index: auto)
- SC for BlockContainer<DIV> [74.5,10 16x16] (z-index: auto), has_transform
- SC for BlockContainer<DIV> [215.5,10 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [74.5,18 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [215.5,18 16x16] (z-index: auto), has_transform
diff --git a/Tests/LibWeb/Layout/expected/input-range-datalist-ticks-option-changes.txt b/Tests/LibWeb/Layout/expected/input-range-datalist-ticks-option-changes.txt
index de8bc80e6ca..3974022b822 100644
--- a/Tests/LibWeb/Layout/expected/input-range-datalist-ticks-option-changes.txt
+++ b/Tests/LibWeb/Layout/expected/input-range-datalist-ticks-option-changes.txt
@@ -10,9 +10,9 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <div> at [28.796875,22] positioned [0+0+0 1 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [74,22] positioned [0+0+0 1 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [102.25,22] positioned [0+0+0 1 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
- BlockContainer <div> at [74.5,10] positioned [64.5+0+0 16 0+0+48.5] [-6+0+0 16 0+0+0] children: not-inline
+ BlockContainer <div> at [74.5,18] positioned [64.5+0+0 16 0+0+48.5] [0+0+0 16 0+0+0] children: not-inline
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
SC for BlockContainer<HTML> [0,0 800x37] (z-index: auto)
- SC for BlockContainer<DIV> [74.5,10 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [74.5,18 16x16] (z-index: auto), has_transform
diff --git a/Tests/LibWeb/Layout/expected/input-range-datalist-ticks.txt b/Tests/LibWeb/Layout/expected/input-range-datalist-ticks.txt
index d1213eccbb0..553a0ea4813 100644
--- a/Tests/LibWeb/Layout/expected/input-range-datalist-ticks.txt
+++ b/Tests/LibWeb/Layout/expected/input-range-datalist-ticks.txt
@@ -1,10 +1,10 @@
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 42 0+0+0] [BFC] children: not-inline
- BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 26 0+0+8] children: inline
+ BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 37 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 21 0+0+8] children: inline
frag 0 from RangeInputBox start: 0, length: 0, rect: [10,10 129x16] baseline: 18
frag 1 from TextNode start: 0, length: 1, rect: [141,13 8x16] baseline: 13
" "
- frag 2 from BlockContainer start: 0, length: 0, rect: [151,16 129x16] baseline: 12
+ frag 2 from BlockContainer start: 0, length: 0, rect: [151,10 129x16] baseline: 18
RangeInputBox <input> at [10,10] inline-block [2+0+0 129 0+0+2] [2+0+0 16 0+0+2] [BFC] children: not-inline
Box <div> at [10,10] flex-container(row) [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [10,16] positioned flex-item [0+0+0 129 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
@@ -13,16 +13,16 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <div> at [17.5,22] positioned [0+0+0 1 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [74,22] positioned [0+0+0 1 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [130.5,22] positioned [0+0+0 1 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
- BlockContainer <div> at [48.6875,10] positioned [38.6875+0+0 16 0+0+74.3125] [-6+0+0 16 0+0+0] children: not-inline
+ BlockContainer <div> at [48.6875,18] positioned [38.6875+0+0 16 0+0+74.3125] [0+0+0 16 0+0+0] children: not-inline
TextNode <#text> (not painted)
- BlockContainer <input> at [151,16] inline-block [2+0+0 129 0+0+2] [2+0+0 16 0+0+2] [BFC] children: not-inline
- Box <div> at [151,16] flex-container(row) [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
- BlockContainer <div> at [151,22] positioned flex-item [0+0+0 129 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
- BlockContainer <div> at [151,22] positioned [0+0+0 64.5 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
- BlockContainer <div> at [215.5,16] positioned [64.5+0+0 16 0+0+48.5] [-6+0+0 16 0+0+0] children: not-inline
+ BlockContainer <input> at [151,10] inline-block [2+0+0 129 0+0+2] [2+0+0 16 0+0+2] [BFC] children: not-inline
+ Box <div> at [151,10] flex-container(row) [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [151,10] positioned flex-item [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [151,10] positioned [0+0+0 64.5 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [215.5,10] positioned [64.5+0+0 16 0+0+48.5] [0+0+0 16 0+0+0] children: not-inline
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
- SC for BlockContainer<HTML> [0,0 800x42] (z-index: auto)
- SC for BlockContainer<DIV> [48.6875,10 16x16] (z-index: auto), has_transform
- SC for BlockContainer<DIV> [215.5,16 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<HTML> [0,0 800x37] (z-index: auto)
+ SC for BlockContainer<DIV> [48.6875,18 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [215.5,10 16x16] (z-index: auto), has_transform
diff --git a/Tests/LibWeb/Layout/expected/input-range-stretch-in-grid.txt b/Tests/LibWeb/Layout/expected/input-range-stretch-in-grid.txt
index cb4dd91cd8e..51ede88f990 100644
--- a/Tests/LibWeb/Layout/expected/input-range-stretch-in-grid.txt
+++ b/Tests/LibWeb/Layout/expected/input-range-stretch-in-grid.txt
@@ -10,8 +10,8 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
Box <div> at [63.3125,10] flex-container(row) [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [63.3125,16] positioned flex-item [0+0+0 129 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [63.3125,16] positioned [0+0+0 64.5 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
- BlockContainer <div> at [127.8125,10] positioned [64.5+0+0 16 0+0+48.5] [-6+0+0 16 0+0+0] children: not-inline
+ BlockContainer <div> at [127.8125,18] positioned [64.5+0+0 16 0+0+48.5] [0+0+0 16 0+0+0] children: not-inline
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
SC for BlockContainer<HTML> [0,0 800x36] (z-index: auto)
- SC for BlockContainer<DIV> [127.8125,10 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [127.8125,18 16x16] (z-index: auto), has_transform
diff --git a/Tests/LibWeb/Layout/expected/input-range.txt b/Tests/LibWeb/Layout/expected/input-range.txt
index 9ca67bf7fd5..f0a4c684934 100644
--- a/Tests/LibWeb/Layout/expected/input-range.txt
+++ b/Tests/LibWeb/Layout/expected/input-range.txt
@@ -7,15 +7,15 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
Box <div> at [10,10] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [10,16] positioned flex-item [0+0+0 200 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [10,16] positioned [0+0+0 100 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
- BlockContainer <div> at [110,10] positioned [100+0+0 16 0+0+84] [-6+0+0 16 0+0+0] children: not-inline
+ BlockContainer <div> at [110,18] positioned [100+0+0 16 0+0+84] [0+0+0 16 0+0+0] children: not-inline
RangeInputBox <input> at [214,10] inline-block [2+0+0 200 0+0+2] [2+0+0 16 0+0+2] [BFC] children: not-inline
Box <div> at [214,10] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
BlockContainer <div> at [214,16] positioned flex-item [0+0+0 200 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
BlockContainer <div> at [214,16] positioned [0+0+0 26.390625 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
- BlockContainer <div> at [234,10] positioned [20+0+0 16 0+0+164] [-6+0+0 16 0+0+0] children: not-inline
+ BlockContainer <div> at [234,18] positioned [20+0+0 16 0+0+164] [0+0+0 16 0+0+0] children: not-inline
TextNode <#text> (not painted)
SC for Viewport<#document> [0,0 800x600] (z-index: auto)
SC for BlockContainer<HTML> [0,0 800x38] (z-index: auto)
- SC for BlockContainer<DIV> [110,10 16x16] (z-index: auto), has_transform
- SC for BlockContainer<DIV> [234,10 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [110,18 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [234,18 16x16] (z-index: auto), has_transform
diff --git a/Tests/LibWeb/Layout/expected/range-input-thumb-centered-with-appearance-none.txt b/Tests/LibWeb/Layout/expected/range-input-thumb-centered-with-appearance-none.txt
new file mode 100644
index 00000000000..2a1dfe8dc01
--- /dev/null
+++ b/Tests/LibWeb/Layout/expected/range-input-thumb-centered-with-appearance-none.txt
@@ -0,0 +1,53 @@
+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 127 0+0+0] [BFC] children: not-inline
+ BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 111 0+0+8] children: not-inline
+ BlockContainer <input.custom> at [8,8] [0+0+0 200 0+0+584] [0+0+0 25 0+0+0] children: not-inline
+ Box <div> at [8,8] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 25 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [8,8] positioned flex-item [0+0+0 200 0+0+0] [0+0+0 25 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [8,8] positioned [0+0+0 100 0+0+0] [0+0+0 25 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [108,8] positioned [100+0+0 25 0+0+75] [0+0+0 25 0+0+0] children: not-inline
+ BlockContainer <input.custom.tall> at [8,33] [0+0+0 200 0+0+584] [0+0+0 40 0+0+0] children: not-inline
+ Box <div> at [8,33] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 40 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [8,40.5] positioned flex-item [0+0+0 200 0+0+0] [0+0+0 25 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [8,40.5] positioned [0+0+0 100 0+0+0] [0+0+0 25 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [108,40.5] positioned [100+0+0 25 0+0+75] [0+0+0 25 0+0+0] children: not-inline
+ BlockContainer <input.custom.small-thumb> at [8,73] [0+0+0 200 0+0+584] [0+0+0 25 0+0+0] children: not-inline
+ Box <div> at [8,73] flex-container(row) [0+0+0 200 0+0+0] [0+0+0 25 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [8,80.5] positioned flex-item [0+0+0 200 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [8,80.5] positioned [0+0+0 100 0+0+0] [0+0+0 10 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [108,80.5] positioned [100+0+0 10 0+0+90] [0+0+0 10 0+0+0] children: not-inline
+ BlockContainer <(anonymous)> at [8,98] [0+0+0 784 0+0+0] [0+0+0 21 0+0+0] children: inline
+ frag 0 from BlockContainer start: 0, length: 0, rect: [10,100 129x16] baseline: 18
+ frag 1 from TextNode start: 0, length: 1, rect: [141,103 8x16] baseline: 13
+ " "
+ frag 2 from RangeInputBox start: 0, length: 0, rect: [151,100 129x16] baseline: 18
+ frag 3 from TextNode start: 0, length: 1, rect: [282,103 8x16] baseline: 13
+ " "
+ frag 4 from RangeInputBox start: 0, length: 0, rect: [292,100 129x16] baseline: 18
+ BlockContainer <input> at [10,100] inline-block [2+0+0 129 0+0+2] [2+0+0 16 0+0+2] [BFC] children: not-inline
+ Box <div> at [10,100] flex-container(row) [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [10,100] positioned flex-item [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [10,100] positioned [0+0+0 64.5 0+0+0] [0+0+0 16 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [74.5,100] positioned [64.5+0+0 16 0+0+48.5] [0+0+0 16 0+0+0] children: not-inline
+ TextNode <#text> (not painted)
+ RangeInputBox <input> at [151,100] inline-block [2+0+0 129 0+0+2] [2+0+0 16 0+0+2] [BFC] children: not-inline
+ Box <div> at [151,100] flex-container(row) [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [151,106] positioned flex-item [0+0+0 129 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [151,106] positioned [0+0+0 64.5 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [215.5,108] positioned [64.5+0+0 16 0+0+48.5] [0+0+0 16 0+0+0] children: not-inline
+ TextNode <#text> (not painted)
+ RangeInputBox <input.native-large-thumb> at [292,100] inline-block [2+0+0 129 0+0+2] [2+0+0 16 0+0+2] [BFC] children: not-inline
+ Box <div> at [292,100] flex-container(row) [0+0+0 129 0+0+0] [0+0+0 16 0+0+0] [FFC] children: not-inline
+ BlockContainer <div> at [292,106] positioned flex-item [0+0+0 129 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [292,106] positioned [0+0+0 64.5 0+0+0] [0+0+0 4 0+0+0] [BFC] children: not-inline
+ BlockContainer <div> at [356.5,108] positioned [64.5+0+0 24 0+0+40.5] [0+0+0 24 0+0+0] children: not-inline
+ TextNode <#text> (not painted)
+
+SC for Viewport<#document> [0,0 800x600] (z-index: auto)
+ SC for BlockContainer<HTML> [0,0 800x127] (z-index: auto)
+ SC for BlockContainer<DIV> [108,8 25x25] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [108,40.5 25x25] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [108,80.5 10x10] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [74.5,100 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [215.5,108 16x16] (z-index: auto), has_transform
+ SC for BlockContainer<DIV> [356.5,108 24x24] (z-index: auto), has_transform
diff --git a/Tests/LibWeb/Layout/input/range-input-thumb-centered-with-appearance-none.html b/Tests/LibWeb/Layout/input/range-input-thumb-centered-with-appearance-none.html
new file mode 100644
index 00000000000..74be8ac06ac
--- /dev/null
+++ b/Tests/LibWeb/Layout/input/range-input-thumb-centered-with-appearance-none.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<style>
+ .custom { appearance: none; background: #ccc; width: 200px; height: 25px; margin: 0; display: block; }
+ .custom::-webkit-slider-thumb { appearance: none; background: green; width: 25px; height: 25px; }
+ .tall { height: 40px; }
+ .small-thumb::-webkit-slider-thumb { width: 10px; height: 10px; }
+ .native-large-thumb::-webkit-slider-thumb { width: 24px; height: 24px; }
+</style>
+<input type="range" class="custom" value="50">
+<input type="range" class="custom tall" value="50">
+<input type="range" class="custom small-thumb" value="50">
+<input type="range" style="appearance: none" value="50">
+<input type="range" value="50">
+<input type="range" class="native-large-thumb" value="50">