Truly independent web browser
LibWeb: Give a file input’s button the font of a button
sideshowbarkera73c13e8264e
diff --git a/Libraries/LibWeb/CSS/Default.css b/Libraries/LibWeb/CSS/Default.cssindex 63be92bb199..64af6ec6a59 100644--- a/Libraries/LibWeb/CSS/Default.css+++ b/Libraries/LibWeb/CSS/Default.css@@ -742,8 +742,19 @@ input, select, button, textarea {appearance: auto;}+/* NB: A file input's button uses the system font at the size of the input's font, like other buttons, rather than the+ * page font that an author style gives the input. Nor does it take on the input's text styling. */::file-selector-button {appearance: auto;+ font: medium system-ui;+ font-size: inherit;+ letter-spacing: initial;+ word-spacing: initial;+ text-transform: initial;+ text-indent: initial;+ text-shadow: initial;+ text-align: center;+ white-space: nowrap;}input:not([type=range i], [type=checkbox i], [type=radio i]) {diff --git a/Tests/LibWeb/Text/expected/file-selector-button-own-font.txt b/Tests/LibWeb/Text/expected/file-selector-button-own-font.txtnew file mode 100644index 00000000000..6aa6f16e8a0--- /dev/null+++ b/Tests/LibWeb/Text/expected/file-selector-button-own-font.txt@@ -0,0 +1,30 @@+plain fontFamily: system-ui+plain fontSize: 13.333333px+plain fontWeight: 400+plain fontStyle: normal+plain fontVariantCaps: normal+plain fontStretch: 100%+plain fontFeatureSettings: normal+plain lineHeight: normal+plain letterSpacing: normal+plain wordSpacing: 0px+plain textTransform: none+plain textIndent: 0px+plain textShadow: none+plain whiteSpace: nowrap+plain textAlign: center+styled fontFamily: system-ui+styled fontSize: 30px+styled fontWeight: 400+styled fontStyle: normal+styled fontVariantCaps: normal+styled fontStretch: 100%+styled fontFeatureSettings: normal+styled lineHeight: normal+styled letterSpacing: normal+styled wordSpacing: 0px+styled textTransform: none+styled textIndent: 0px+styled textShadow: none+styled whiteSpace: nowrap+styled textAlign: centerdiff --git a/Tests/LibWeb/Text/input/file-selector-button-own-font.html b/Tests/LibWeb/Text/input/file-selector-button-own-font.htmlnew file mode 100644index 00000000000..72d8ca5901f--- /dev/null+++ b/Tests/LibWeb/Text/input/file-selector-button-own-font.html@@ -0,0 +1,14 @@+<!doctype html>+<script src="include.js"></script>+<input type="file" id="plain">+<input type="file" id="styled" style="font: italic small-caps bold condensed 30px/50px cursive; font-feature-settings: 'smcp'; letter-spacing: 3px; word-spacing: 7px; text-transform: uppercase; text-indent: 9px; text-shadow: 1px 1px red; white-space: pre; text-align: right">+<script>+ test(() => {+ const properties = ["fontFamily", "fontSize", "fontWeight", "fontStyle", "fontVariantCaps", "fontStretch", "fontFeatureSettings", "lineHeight", "letterSpacing", "wordSpacing", "textTransform", "textIndent", "textShadow", "whiteSpace", "textAlign"];+ for (const id of ["plain", "styled"]) {+ const style = getComputedStyle(document.getElementById(id), "::file-selector-button");+ for (const property of properties)+ println(`${id} ${property}: ${style[property]}`);+ }+ });+</script>