From 6abcd8686302b072cf7e585e63e2807a78301fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Mon, 8 Oct 2018 19:47:56 +0200 Subject: [PATCH] Bug 1473927 - Load textbox.css and numberbox.css as document stylesheets. r=paolo --- editor/reftests/xul/input.css | 9 ++-- toolkit/content/jar.mn | 1 - toolkit/content/textbox.css | 45 ------------------- toolkit/content/widgets.css | 5 +++ toolkit/content/widgets/numberbox.xml | 5 --- toolkit/content/widgets/textbox.xml | 5 --- toolkit/content/xul.css | 9 ++++ toolkit/themes/linux/global/textbox.css | 18 +++++--- .../themes/osx/global/in-content/common.css | 5 +++ toolkit/themes/osx/global/textbox.css | 18 +++++--- .../themes/shared/in-content/common.inc.css | 6 ++- toolkit/themes/windows/global/textbox.css | 18 +++++--- 12 files changed, 68 insertions(+), 76 deletions(-) delete mode 100644 toolkit/content/textbox.css diff --git a/editor/reftests/xul/input.css b/editor/reftests/xul/input.css index 59e839163891..ec260d648d5f 100644 --- a/editor/reftests/xul/input.css +++ b/editor/reftests/xul/input.css @@ -8,12 +8,14 @@ padding-inline-start: 5px; } -#mac html|input, #mac html|textarea { +#mac > html|input, +#mac > html|textarea { margin: 4px; padding: 0 1px; } -textbox[multiline="true"], html|textarea { +textbox[multiline="true"], +html|textarea { border: none !important; -moz-appearance: none !important; background-color: white !important; @@ -21,7 +23,8 @@ textbox[multiline="true"], html|textarea { border-bottom-left-radius: 0; } -html|input, html|textarea { +html|input, +html|textarea { font: inherit; } diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn index d35f05231f23..c3b756941987 100644 --- a/toolkit/content/jar.mn +++ b/toolkit/content/jar.mn @@ -4,7 +4,6 @@ toolkit.jar: content/global/minimal-xul.css * content/global/xul.css content/global/components.css - content/global/textbox.css content/global/autocomplete.css content/global/aboutAbout.js content/global/aboutAbout.xhtml diff --git a/toolkit/content/textbox.css b/toolkit/content/textbox.css deleted file mode 100644 index 50000402304e..000000000000 --- a/toolkit/content/textbox.css +++ /dev/null @@ -1,45 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); /* set default namespace to XUL */ -@namespace html url("http://www.w3.org/1999/xhtml"); /* namespace for HTML elements */ - -html|*.textbox-input { - -moz-appearance: none; - text-align: inherit; - text-shadow: inherit; - box-sizing: border-box; - -moz-box-flex: 1; -} - -html|*.textbox-textarea { - -moz-appearance: none !important; - text-shadow: inherit; - box-sizing: border-box; - -moz-box-flex: 1; -} - - -@supports -moz-bool-pref("layout.css.emulate-moz-box-with-flex") { - html|*.textbox-input, - html|*.textbox-textarea { - /* Be block-level, so that -moz-box-flex can take effect, when we are an item - in a -moz-box being emulated by modified modern flex. */ - display: block; - } -} - -/* -html|*.textbox-input::placeholder, -html|*.textbox-textarea::placeholder { - text-align: left; - direction: ltr; -} - -html|*.textbox-input::placeholder:-moz-locale-dir(rtl), -html|*.textbox-textarea::placeholder:-moz-locale-dir(rtl) { - text-align: right; - direction: rtl; -} -*/ diff --git a/toolkit/content/widgets.css b/toolkit/content/widgets.css index 7a0d6032a563..15d306075af1 100644 --- a/toolkit/content/widgets.css +++ b/toolkit/content/widgets.css @@ -23,6 +23,11 @@ @import url("chrome://global/skin/scrollbox.css"); @import url("chrome://global/skin/splitter.css"); @import url("chrome://global/skin/tabbox.css"); + +/* numberbox.css needs to be loaded after textbox.css since it overrides it */ +@import url("chrome://global/skin/textbox.css"); +@import url("chrome://global/skin/numberbox.css"); + @import url("chrome://global/skin/toolbar.css"); @import url("chrome://global/skin/toolbarbutton.css"); @import url("chrome://global/skin/tree.css"); diff --git a/toolkit/content/widgets/numberbox.xml b/toolkit/content/widgets/numberbox.xml index 292a55d7def6..68ffe7d606ab 100644 --- a/toolkit/content/widgets/numberbox.xml +++ b/toolkit/content/widgets/numberbox.xml @@ -12,11 +12,6 @@ - - - - - - - - - - diff --git a/toolkit/content/xul.css b/toolkit/content/xul.css index a10e086c5878..13d5c65dfd7f 100644 --- a/toolkit/content/xul.css +++ b/toolkit/content/xul.css @@ -624,6 +624,15 @@ textbox[type="number"] { -moz-binding: url("chrome://global/content/bindings/numberbox.xml#numberbox"); } +@supports -moz-bool-pref("layout.css.emulate-moz-box-with-flex") { + html|*.textbox-input, + html|*.textbox-textarea { + /* Be block-level, so that -moz-box-flex can take effect, when we are an item + in a -moz-box being emulated by modified modern flex. */ + display: block; + } +} + .textbox-contextmenu:-moz-locale-dir(rtl) { direction: rtl; } diff --git a/toolkit/themes/linux/global/textbox.css b/toolkit/themes/linux/global/textbox.css index 465c033be5e3..f07aa94a6e5b 100644 --- a/toolkit/themes/linux/global/textbox.css +++ b/toolkit/themes/linux/global/textbox.css @@ -21,14 +21,22 @@ textbox { color: -moz-FieldText; } -html|*.textbox-input, +html|*.textbox-input, html|*.textbox-textarea { - margin: 0px !important; - border: none !important; - padding: 0px 1px !important; - background-color: inherit; + -moz-appearance: none; + margin: 0; + border: none; + padding: 0 1px; + background-color: transparent; color: inherit; font: inherit; + text-shadow: inherit; + box-sizing: border-box; + -moz-box-flex: 1; +} + +html|*.textbox-input { + text-align: inherit; } .textbox-contextmenu { diff --git a/toolkit/themes/osx/global/in-content/common.css b/toolkit/themes/osx/global/in-content/common.css index b9b6ea2dbd94..5f3162694080 100644 --- a/toolkit/themes/osx/global/in-content/common.css +++ b/toolkit/themes/osx/global/in-content/common.css @@ -89,6 +89,11 @@ html|*.numberbox-input::-moz-number-spin-down { border-radius: 0 0 4px 4px; } +textbox[type="search"] { + -moz-appearance: none; + padding-inline-start: 10px; +} + xul|textbox[type="search"]:not([searchbutton]) > moz-input-box > .textbox-search-sign { list-style-image: url(chrome://global/skin/icons/search-textbox.svg); margin-inline-end: 5px; diff --git a/toolkit/themes/osx/global/textbox.css b/toolkit/themes/osx/global/textbox.css index d3661601a33d..324260af03b5 100644 --- a/toolkit/themes/osx/global/textbox.css +++ b/toolkit/themes/osx/global/textbox.css @@ -14,14 +14,22 @@ textbox { color: -moz-FieldText; } -html|*.textbox-input, +html|*.textbox-input, html|*.textbox-textarea { - margin: 0px !important; - border: none !important; - padding: 0px 1px !important; - background-color: inherit; + -moz-appearance: none; + margin: 0; + border: none; + padding: 0 1px; + background-color: transparent; color: inherit; font: inherit; + text-shadow: inherit; + box-sizing: border-box; + -moz-box-flex: 1; +} + +html|*.textbox-input { + text-align: inherit; } .textbox-contextmenu { diff --git a/toolkit/themes/shared/in-content/common.inc.css b/toolkit/themes/shared/in-content/common.inc.css index 8d25442bf128..7f6aeb4a1322 100644 --- a/toolkit/themes/shared/in-content/common.inc.css +++ b/toolkit/themes/shared/in-content/common.inc.css @@ -393,10 +393,12 @@ html|input[type="text"], html|textarea, xul|textbox { -moz-appearance: none; - color: var(--in-content-text-color); border: 1px solid var(--in-content-box-border-color); border-radius: 2px; - background-color: var(--in-content-box-background); + /* !important to override disabled styling from textbox.css. We reduce the + opacity instead of changing colors. */ + color: var(--in-content-text-color) !important; + background-color: var(--in-content-box-background) !important; } xul|textbox { diff --git a/toolkit/themes/windows/global/textbox.css b/toolkit/themes/windows/global/textbox.css index e305ce247b57..a5694d146cb2 100644 --- a/toolkit/themes/windows/global/textbox.css +++ b/toolkit/themes/windows/global/textbox.css @@ -21,14 +21,22 @@ textbox { color: -moz-FieldText; } -html|*.textbox-input, +html|*.textbox-input, html|*.textbox-textarea { - margin: 0px !important; - border: none !important; - padding: 0px 1px !important; - background-color: inherit; + -moz-appearance: none; + margin: 0; + border: none; + padding: 0 1px; + background-color: transparent; color: inherit; font: inherit; + text-shadow: inherit; + box-sizing: border-box; + -moz-box-flex: 1; +} + +html|*.textbox-input { + text-align: inherit; } @media (-moz-windows-default-theme) and (-moz-os-version: windows-win7) {