зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1765423 - Make tooltips look nicer with default window themes. r=dao
For that, make the Windows rounded-rect code apply to tooltips as well. Differential Revision: https://phabricator.services.mozilla.com/D145327
This commit is contained in:
Родитель
ae63baa75c
Коммит
f3edc98c4b
|
@ -19,11 +19,25 @@ tooltip {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (-moz-windows-default-theme) {
|
@media (-moz-windows-default-theme) {
|
||||||
/* We use Window / WindowText instead on the default theme because the
|
|
||||||
default yellowish styles are somewhat ugly */
|
|
||||||
tooltip {
|
tooltip {
|
||||||
background-color: Window;
|
/* These are the same colors as --menu-background-color and co., but we
|
||||||
color: WindowText;
|
can't quite use them because the default tooltip is native anonymous and
|
||||||
|
doesn't inherit from the root. */
|
||||||
|
background-color: #f9f9fb;
|
||||||
|
color: #15141a;
|
||||||
|
border-color: #cfcfd8;
|
||||||
|
|
||||||
|
/* Force a rounded-rect dropshadow to appear. */
|
||||||
|
-moz-window-shadow: cliprounded;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
tooltip {
|
||||||
|
background-color: #2b2a33;
|
||||||
|
color: #fbfbfe;
|
||||||
|
border-color: #5b5b66;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1816,7 +1816,8 @@ static bool ShouldHaveRoundedMenuDropShadow(nsWindow* aWindow) {
|
||||||
// XXX this is apparently still needed in Windows 7 and later
|
// XXX this is apparently still needed in Windows 7 and later
|
||||||
void nsWindow::ClearThemeRegion() {
|
void nsWindow::ClearThemeRegion() {
|
||||||
if (mWindowType == eWindowType_popup &&
|
if (mWindowType == eWindowType_popup &&
|
||||||
(mPopupType == ePopupTypeMenu || mPopupType == ePopupTypePanel) &&
|
(mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypeMenu ||
|
||||||
|
mPopupType == ePopupTypePanel) &&
|
||||||
ShouldHaveRoundedMenuDropShadow(this)) {
|
ShouldHaveRoundedMenuDropShadow(this)) {
|
||||||
SetWindowRgn(mWnd, nullptr, false);
|
SetWindowRgn(mWnd, nullptr, false);
|
||||||
} else if (!HasGlass() &&
|
} else if (!HasGlass() &&
|
||||||
|
@ -1830,9 +1831,9 @@ void nsWindow::ClearThemeRegion() {
|
||||||
void nsWindow::SetThemeRegion() {
|
void nsWindow::SetThemeRegion() {
|
||||||
// Clip the window to the rounded rect area of the popup if needed.
|
// Clip the window to the rounded rect area of the popup if needed.
|
||||||
if (mWindowType == eWindowType_popup &&
|
if (mWindowType == eWindowType_popup &&
|
||||||
(mPopupType == ePopupTypeMenu || mPopupType == ePopupTypePanel)) {
|
(mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypeMenu ||
|
||||||
nsView* view = nsView::GetViewFor(this);
|
mPopupType == ePopupTypePanel)) {
|
||||||
if (view) {
|
if (nsView* view = nsView::GetViewFor(this)) {
|
||||||
LayoutDeviceIntSize size =
|
LayoutDeviceIntSize size =
|
||||||
nsLayoutUtils::GetBorderRadiusForMenuDropShadow(view->GetFrame());
|
nsLayoutUtils::GetBorderRadiusForMenuDropShadow(view->GetFrame());
|
||||||
if (size.width || size.height) {
|
if (size.width || size.height) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче