Bug 1773891 - Remove duplicate tooltip styling. r=dao

I don't think why we have a mobile stylesheet (IIUC Android doesn't have
tooltips...), but I noticed that most tooltip styles are the same and it
should be doable to just unify them in xul.css.

We can't keep the platform-specific bits on their own stylesheet because
it loads _before_ xul.css, and thus overrides wouldn't quite do.

Depends on D151640

Differential Revision: https://phabricator.services.mozilla.com/D151641
This commit is contained in:
Emilio Cobos Álvarez 2022-07-12 23:00:46 +00:00
parent 256fc5605d
commit 18834df73a
10 changed files with 51 additions and 133 deletions

View File

@ -8,11 +8,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=405818
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<link rel="stylesheet" type="text/css" href="data:text/css,%23myDiv{color:green;}">
<link rel="stylesheet" type="text/css" href="chrome://global/skin/tooltip.css">
<link rel="stylesheet" type="text/css" href="chrome://global/skin/popup.css">
<!-- Script to make sure sheets gets a chance to load fully in Gecko 1.8 and earlier -->
<script type="text/javascript" src="data:text/javascript,"></script>
<link rel="stylesheet" type="text/css" href="data:text/css,%23myDiv{color:green;}">
<link rel="stylesheet" type="text/css" href="chrome://global/skin/tooltip.css">
<link rel="stylesheet" type="text/css" href="chrome://global/skin/popup.css">
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=405818">Mozilla Bug 405818</a>
@ -35,10 +35,10 @@ addLoadEvent(function() {
"Unexpected href for later linked sheet before cloning");
is(document.styleSheets[2].href,
"chrome://global/skin/tooltip.css",
"chrome://global/skin/popup.css",
"Unexpected href for linked chrome sheet before cloning");
is(document.styleSheets[4].href,
"chrome://global/skin/tooltip.css",
"chrome://global/skin/popup.css",
"Unexpected href for later linked chrome sheet before cloning");
// Force cloning of inners
@ -53,10 +53,10 @@ addLoadEvent(function() {
"Unexpected href for later linked sheet after cloning");
is(document.styleSheets[2].href,
"chrome://global/skin/tooltip.css",
"chrome://global/skin/popup.css",
"Unexpected href for linked chrome sheet after cloning");
is(document.styleSheets[4].href,
"chrome://global/skin/tooltip.css",
"chrome://global/skin/popup.css",
"Unexpected href for later linked chrome sheet after cloning");
var myDiv = document.getElementById("myDiv");

View File

@ -16,8 +16,6 @@
* browser.css.
*/
@import url("chrome://global/skin/tooltip.css");
@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 */
@ -258,8 +256,18 @@ tooltip {
}
tooltip {
appearance: auto;
-moz-default-appearance: tooltip;
-moz-font-smoothing-background-color: -moz-mac-tooltip;
-moz-box-orient: vertical;
white-space: pre-wrap;
background-color: InfoBackground;
color: InfoText;
font: message-box;
padding: 2px 3px;
max-width: 40em;
overflow: clip;
}
@ -267,6 +275,41 @@ tooltip:not([position]) {
margin-top: 21px;
}
/**
* It's important that these styles are in a UA sheet, because the default
* tooltip is native anonymous content
*/
@media (-moz-platform: linux) {
tooltip {
padding: 6px 10px; /* Matches Adwaita. */
line-height: 1.2;
}
}
@media (-moz-platform: windows) {
tooltip {
appearance: none;
border: 1px solid;
}
@media (-moz-windows-default-theme) {
tooltip {
background-color: #f9f9fb;
color: black;
border-color: #67676c;
border-radius: 4px;
}
@media (prefers-color-scheme: dark) {
tooltip {
background-color: #2b2a33;
color: white;
border-color: #f9f9fb;
}
}
}
}
@supports -moz-bool-pref("xul.panel-animations.enabled") {
@media (prefers-reduced-motion: no-preference) {
@media (-moz-platform: macos) {

View File

@ -19,7 +19,6 @@ toolkit.jar:
skin/classic/global/tabbox.css
skin/classic/global/toolbar.css
skin/classic/global/toolbarbutton.css
skin/classic/global/tooltip.css
skin/classic/global/icons/Authentication.png (icons/Authentication.png)

View File

@ -1,27 +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/. */
/*
* This file is imported as a UA stylesheet because the default tooltip is
* built as native anonymous content.
*/
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
tooltip {
appearance: auto;
-moz-default-appearance: tooltip;
max-width: 40em;
padding: 6px 10px; /* Matches Adwaita. */
color: InfoText;
background-color: InfoBackground;
font: message-box;
line-height: 1.2;
}
tooltip:not([position]) {
margin-top: 21px;
}

View File

@ -9,6 +9,3 @@
skin/classic/global/aboutMemory.css
skin/classic/global/aboutNetworking.css
skin/classic/global/aboutSupport.css
# XUL support:
skin/classic/global/tooltip.css

View File

@ -1,26 +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/. */
/*
* This file is imported as a UA stylesheet because the default tooltip is
* built as native anonymous content.
*/
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
tooltip {
appearance: auto;
-moz-default-appearance: tooltip;
max-width: 40em;
padding: 6px 10px; /* Matches Adwaita. */
color: InfoText;
background-color: InfoBackground;
font: message-box;
}
tooltip:not([position]) {
margin-top: 21px;
}

View File

@ -21,7 +21,6 @@ toolkit.jar:
skin/classic/global/tabbox.css
skin/classic/global/toolbar.css
skin/classic/global/toolbarbutton.css
skin/classic/global/tooltip.css
skin/classic/global/wizard.css
skin/classic/global/arrow/panelarrow-vertical.svg (arrow/panelarrow-vertical.svg)
skin/classic/global/icons/search-textbox.svg (icons/search-textbox.svg)

View File

@ -1,26 +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/. */
/*
* This file is imported as a UA stylesheet because the default tooltip is
* built as native anonymous content.
*/
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
tooltip {
appearance: auto;
-moz-default-appearance: tooltip;
-moz-font-smoothing-background-color: -moz-mac-tooltip;
padding: 2px 3px;
max-width: 40em;
color: InfoText;
background-color: InfoBackground;
font: message-box;
cursor: default;
}
tooltip:not([position]) {
margin-top: 18px;
}

View File

@ -20,7 +20,6 @@ toolkit.jar:
skin/classic/global/splitter.css
skin/classic/global/toolbar.css
skin/classic/global/toolbarbutton.css
skin/classic/global/tooltip.css
skin/classic/global/icons/Landscape.png (icons/Landscape.png)
skin/classic/global/icons/menu-check.svg (icons/menu-check.svg)
skin/classic/global/icons/Portrait.png (icons/Portrait.png)

View File

@ -1,40 +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/. */
/*
* This file is imported as a UA stylesheet because the default tooltip is
* built as native anonymous content.
*/
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
tooltip {
border: 1px solid;
padding: 2px 3px;
max-width: 40em;
background-color: InfoBackground;
color: InfoText;
font: message-box;
}
@media (-moz-windows-default-theme) {
tooltip {
background-color: #f9f9fb;
color: black;
border-color: #67676c;
border-radius: 4px;
}
@media (prefers-color-scheme: dark) {
tooltip {
background-color: #2b2a33;
color: white;
border-color: #f9f9fb;
}
}
}
tooltip:not([position]) {
margin-top: 21px;
}