Bug 1768004 - Remove proton places tooltip code. r=dao

There's nobody working on it, and tooltips should hopefully be nice
enough after recent changes (bug 1765423).

Having it enabled causes artifacts like bug 1767815 comment 3. We can
always rescue this from hg history if needed.

Differential Revision: https://phabricator.services.mozilla.com/D145621
This commit is contained in:
Emilio Cobos Álvarez 2022-05-05 16:18:17 +00:00
parent ad86a6bcc6
commit b73c08693f
10 changed files with 45 additions and 166 deletions

View File

@ -533,17 +533,6 @@ XPCOMUtils.defineLazyPreferenceGetter(
false
);
/* Temporary pref while the dust settles around the updated tooltip design
for tabs and bookmarks toolbar. This is a bit of an orphan from the
proton project. We should figure out what happens with this in
bug 1746909. */
XPCOMUtils.defineLazyPreferenceGetter(
this,
"gProtonPlacesTooltip",
"browser.proton.places-tooltip.enabled",
false
);
customElements.setElementCreationCallback("translation-notification", () => {
Services.scriptloader.loadSubScript(
"chrome://browser/content/translation-notification.js",

View File

@ -34,81 +34,58 @@ function closeTooltip(node, tooltip) {
// This test verifies that the tab tooltip appears at the correct location, aligned
// with the bottom of the tab, and that the tooltip appears near the close button.
add_task(async function() {
for (let useProtonTooltips of [false, true]) {
await SpecialPowers.pushPrefEnv({
set: [["browser.proton.places-tooltip.enabled", useProtonTooltips]],
});
const tabUrl =
"data:text/html,<html><head><title>A Tab</title></head><body>Hello</body></html>";
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl);
const tabUrl =
"data:text/html,<html><head><title>A Tab</title></head><body>Hello</body></html>";
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl);
let tooltip = document.getElementById("tabbrowser-tab-tooltip");
await openTooltip(tab, tooltip);
let tooltip = document.getElementById("tabbrowser-tab-tooltip");
await openTooltip(tab, tooltip);
let tabRect = tab.getBoundingClientRect();
let tooltipRect = tooltip.getBoundingClientRect();
let tabRect = tab.getBoundingClientRect();
let tooltipRect = tooltip.getBoundingClientRect();
isfuzzy(
tooltipRect.left,
tabRect.left + MOUSE_OFFSET,
1,
"tooltip left position for tab"
);
ok(
tooltipRect.top >= tabRect.top + MIN_VERTICAL_TOOLTIP_OFFSET + MOUSE_OFFSET,
"tooltip top position for tab"
);
is(
tooltip.getAttribute("position"),
"",
"tooltip position attribute for tab"
);
if (useProtonTooltips) {
// Add the margin when using photon tooltips, but not when that is disabled.
isfuzzy(
tooltipRect.left,
tabRect.left + parseInt(getComputedStyle(tooltip).marginLeft),
1,
"tooltip left position for tab"
);
isfuzzy(
tooltipRect.top,
tabRect.bottom + parseInt(getComputedStyle(tooltip).marginTop),
1,
"tooltip top position for tab"
);
} else {
isfuzzy(
tooltipRect.left,
tabRect.left + MOUSE_OFFSET,
1,
"tooltip left position for tab"
);
ok(
tooltipRect.top >=
tabRect.top + MIN_VERTICAL_TOOLTIP_OFFSET + MOUSE_OFFSET,
"tooltip top position for tab"
);
}
is(
tooltip.getAttribute("position"),
useProtonTooltips ? "after_start" : "",
"tooltip position attribute for tab"
);
await closeTooltip(tab, tooltip);
await closeTooltip(tab, tooltip);
await openTooltip(tab.closeButton, tooltip);
await openTooltip(tab.closeButton, tooltip);
let closeButtonRect = tab.closeButton.getBoundingClientRect();
tooltipRect = tooltip.getBoundingClientRect();
let closeButtonRect = tab.closeButton.getBoundingClientRect();
tooltipRect = tooltip.getBoundingClientRect();
isfuzzy(
tooltipRect.left,
closeButtonRect.left + MOUSE_OFFSET,
1,
"tooltip left position for close button"
);
ok(
tooltipRect.top >
closeButtonRect.top + MIN_VERTICAL_TOOLTIP_OFFSET + MOUSE_OFFSET,
"tooltip top position for close button"
);
ok(
!tooltip.hasAttribute("position"),
"tooltip position attribute for close button"
);
isfuzzy(
tooltipRect.left,
closeButtonRect.left + MOUSE_OFFSET,
1,
"tooltip left position for close button"
);
ok(
tooltipRect.top >
closeButtonRect.top + MIN_VERTICAL_TOOLTIP_OFFSET + MOUSE_OFFSET,
"tooltip top position for close button"
);
ok(
!tooltip.hasAttribute("position"),
"tooltip position attribute for close button"
);
await closeTooltip(tab, tooltip);
await closeTooltip(tab, tooltip);
BrowserTestUtils.removeTab(tab);
}
BrowserTestUtils.removeTab(tab);
});
// This test verifies that a mouse wheel closes the tooltip.

View File

@ -4,7 +4,6 @@
@import url("chrome://browser/skin/downloads/indicator.css");
@import url("chrome://browser/skin/addons/extension-controlled.css");
@import url("chrome://browser/skin/places/places-tooltip.css");
@import url("chrome://browser/skin/toolbarbuttons.css");
@import url("chrome://browser/skin/toolbarbutton-icons.css");
@import url("chrome://browser/skin/menupanel.css");

View File

@ -252,7 +252,6 @@
skin/classic/browser/places/bookmarksToolbar.svg (../shared/places/bookmarksToolbar.svg)
skin/classic/browser/places/editBookmarkPanel.css (../shared/places/editBookmarkPanel.css)
skin/classic/browser/places/folder-smart.svg (../shared/places/folder-smart.svg)
skin/classic/browser/places/places-tooltip.css (../shared/places/places-tooltip.css)
skin/classic/browser/places/tag.svg (../shared/places/tag.svg)
skin/classic/browser/places/tree-icons.css (../shared/places/tree-icons.css)
skin/classic/browser/privatebrowsing/aboutPrivateBrowsing.css (../shared/privatebrowsing/aboutPrivateBrowsing.css)

View File

@ -1,73 +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 stylesheet is not loaded by the sidebars since it relies
on extra theming and proton variables that would need to be
injected into the sidebar. */
@media (-moz-proton-places-tooltip) {
.places-tooltip-title {
font-weight: 600;
/* Clip after 2 lines, this should ideally use a different method like -webkit-line-clamp or
overflow: hidden; to get ellipsis support but XUL tooltip sizing makes that difficult. */
max-height: 2.5em;
overflow-y: clip;
}
@media (-moz-platform: macos) {
.places-tooltip-title {
font-size: 1.1em;
}
}
.places-tooltip-uri {
color: color-mix(in srgb, currentColor 50%, transparent);
}
#places-tooltip-insecure-icon {
/* Using the same broken-lock icon as the main identity-block styles. */
list-style-image: url(chrome://global/skin/icons/security-broken.svg);
-moz-context-properties: fill;
fill: currentColor;
width: 1em;
height: 1em;
margin-inline-start: 0;
margin-inline-end: .2em;
}
@media (-moz-platform: macos), (-moz-platform: windows) {
@media not (prefers-contrast) {
.places-tooltip {
--places-tooltip-shadow-size: 6px;
appearance: none;
background: transparent;
border: none;
/* The tooltip has internal padding to allow for the
box-shadow to not get clipped. The negative margin
here keeps the tooltip aligned horizontally with the
anchor, and should match the padding-inline-start of
the tooltip. */
padding: var(--places-tooltip-shadow-size);
}
.places-tooltip[position] {
margin-inline-start: calc(-1 * var(--places-tooltip-shadow-size));
margin-block-start: calc(-1 * var(--places-tooltip-shadow-size));
}
.places-tooltip-box {
padding: 3px 5px;
background: var(--arrowpanel-background);
color: var(--arrowpanel-color);
border: 1px solid transparent;
border-radius: 4px;
box-shadow: 0 2px var(--places-tooltip-shadow-size) rgba(58,57,68,.2);
}
.places-tooltip-uri {
color: var(--panel-description-color);
}
}
}
} /*** END proton ***/

View File

@ -25,7 +25,6 @@ const CHROME_ONLY_TOGGLES = [
"-moz-gtk-csd-maximize-button",
"-moz-gtk-csd-close-button",
"-moz-gtk-csd-reversed-placement",
"-moz-proton-places-tooltip",
];
// Non-parseable queries can be tested directly in

View File

@ -1320,12 +1320,6 @@
mirror: always
rust: true
- name: browser.proton.places-tooltip.enabled
type: RelaxedAtomicBool
value: false
mirror: always
rust: true
# Blocked plugin content
- name: browser.safebrowsing.blockedURIs.enabled
type: bool

View File

@ -537,6 +537,7 @@ macro_rules! lnf_int_feature {
/// pref, with `rust: true`. The feature name needs to be defined in
/// `StaticAtoms.py` just like the others. In order to support dynamic changes,
/// you also need to add them to kMediaQueryPrefs in nsXPLookAndFeel.cpp
#[allow(unused)]
macro_rules! bool_pref_feature {
($feature_name:expr, $pref:tt) => {{
fn __eval(_: &Context) -> bool {
@ -557,7 +558,7 @@ macro_rules! bool_pref_feature {
/// to support new types in these entries and (2) ensuring that either
/// nsPresContext::MediaFeatureValuesChanged is called when the value that
/// would be returned by the evaluator function could change.
pub static MEDIA_FEATURES: [QueryFeatureDescription; 60] = [
pub static MEDIA_FEATURES: [QueryFeatureDescription; 59] = [
feature!(
atom!("width"),
AllowsRanges::Yes,
@ -846,8 +847,4 @@ pub static MEDIA_FEATURES: [QueryFeatureDescription; 60] = [
GTKCSDReversedPlacement
),
lnf_int_feature!(atom!("-moz-system-dark-theme"), SystemUsesDarkTheme),
bool_pref_feature!(
atom!("-moz-proton-places-tooltip"),
"browser.proton.places-tooltip.enabled"
),
];

View File

@ -431,7 +431,6 @@ static constexpr struct {
widget::ThemeChangeKind::MediaQueriesOnly;
} kMediaQueryPrefs[] = {
{"browser.display.windows.native_menus"_ns},
{"browser.proton.places-tooltip.enabled"_ns},
// Affects env().
{"layout.css.prefers-color-scheme.content-override"_ns,
widget::ThemeChangeKind::Style},

View File

@ -2250,7 +2250,6 @@ STATIC_ATOMS = [
Atom("_moz_gtk_csd_menu_radius", "-moz-gtk-csd-menu-radius"),
Atom("_moz_content_prefers_color_scheme", "-moz-content-prefers-color-scheme"),
Atom("_moz_content_preferred_color_scheme", "-moz-content-preferred-color-scheme"),
Atom("_moz_proton_places_tooltip", "-moz-proton-places-tooltip"),
Atom("_moz_system_dark_theme", "-moz-system-dark-theme"),
# application commands
Atom("Back", "Back"),