зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1768285 - Clean up unused -moz-window-shadow values. r=jwatt
After bug 1768278 and bug 1767815 there's no more uses of the cliprounded value in the tree (also it causes artifacts on HiDPI screens so we probably don't want new usages). The "sheet" value is unused, and the other values other than "default" and "none" are only derived from "default", so they don't need to be exposed in the style system. Differential Revision: https://phabricator.services.mozilla.com/D145821
This commit is contained in:
Родитель
3df14aa79d
Коммит
46ca6e2712
|
@ -6807,24 +6807,6 @@ bool nsLayoutUtils::HasNonZeroCornerOnSide(const BorderRadius& aCorners,
|
|||
return false;
|
||||
}
|
||||
|
||||
/* static */
|
||||
LayoutDeviceSize nsLayoutUtils::GetBorderRadiusForMenuDropShadow(
|
||||
const nsIFrame* aFrame) {
|
||||
if (aFrame->StyleUIReset()->mWindowShadow != StyleWindowShadow::Cliprounded) {
|
||||
return {};
|
||||
}
|
||||
|
||||
nscoord cssRadii[8];
|
||||
if (!aFrame->GetBorderRadii(cssRadii)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
RectCornerRadii devPxRadii;
|
||||
nsCSSRendering::ComputePixelRadii(
|
||||
cssRadii, aFrame->PresContext()->AppUnitsPerDevPixel(), &devPxRadii);
|
||||
return LayoutDeviceSize::FromUnknownSize(devPxRadii.TopLeft());
|
||||
}
|
||||
|
||||
/* static */
|
||||
nsTransparencyMode nsLayoutUtils::GetFrameTransparency(
|
||||
nsIFrame* aBackgroundFrame, nsIFrame* aCSSRootFrame) {
|
||||
|
|
|
@ -2065,13 +2065,6 @@ class nsLayoutUtils {
|
|||
static bool HasNonZeroCornerOnSide(const mozilla::BorderRadius& aCorners,
|
||||
mozilla::Side aSide);
|
||||
|
||||
/**
|
||||
* Return the border radius size (width, height) based only on the top-left
|
||||
* corner. This is a special case used for drawing the Windows 10 drop-shadow.
|
||||
*/
|
||||
static mozilla::LayoutDeviceSize GetBorderRadiusForMenuDropShadow(
|
||||
const nsIFrame*);
|
||||
|
||||
/**
|
||||
* Determine if a widget is likely to require transparency or translucency.
|
||||
* @param aBackgroundFrame The frame that the background is set on. For
|
||||
|
|
|
@ -629,10 +629,11 @@ enum class StyleImeMode : uint8_t {
|
|||
enum class StyleWindowShadow : uint8_t {
|
||||
None,
|
||||
Default,
|
||||
|
||||
// These can't be specified in CSS, they get computed from the "default"
|
||||
// value.
|
||||
Menu,
|
||||
Tooltip,
|
||||
Sheet,
|
||||
Cliprounded, // clip border to popup border-radius
|
||||
};
|
||||
|
||||
// dominant-baseline
|
||||
|
|
|
@ -367,11 +367,9 @@ nsresult nsMenuPopupFrame::CreateWidgetForView(nsView* aView) {
|
|||
widgetData.mSupportTranslucency = mode == eTransparencyTransparent;
|
||||
widgetData.mPopupLevel = PopupLevel(widgetData.mNoAutoHide);
|
||||
|
||||
// The special cases are menulists and handling the Windows 10
|
||||
// drop-shadow on menus with rounded borders.
|
||||
// The special cases are menulists.
|
||||
widgetData.mDropShadow =
|
||||
!(mode == eTransparencyTransparent || tag == nsGkAtoms::menulist) ||
|
||||
StyleUIReset()->mWindowShadow == StyleWindowShadow::Cliprounded;
|
||||
!(mode == eTransparencyTransparent || tag == nsGkAtoms::menulist);
|
||||
|
||||
// panels which have a parent level need a parent widget. This allows them to
|
||||
// always appear in front of the parent window but behind other windows that
|
||||
|
|
|
@ -51,12 +51,15 @@ ${helpers.single_keyword(
|
|||
spec="None (Nonstandard Firefox-only property)",
|
||||
)}
|
||||
|
||||
// TODO(emilio): Maybe make shadow behavior on macOS match Linux / Windows, and remove this
|
||||
// property.
|
||||
${helpers.single_keyword(
|
||||
"-moz-window-shadow",
|
||||
"default none menu tooltip sheet cliprounded",
|
||||
"default none",
|
||||
engines="gecko",
|
||||
gecko_ffi_name="mWindowShadow",
|
||||
gecko_enum_prefix="StyleWindowShadow",
|
||||
gecko_inexhaustive=True,
|
||||
animation_value_type="discrete",
|
||||
enabled_in="chrome",
|
||||
spec="None (Nonstandard internal property)",
|
||||
|
|
|
@ -4019,8 +4019,6 @@ static const NSUInteger kWindowShadowOptionsTooltipMojaveOrLater = 4;
|
|||
|
||||
case StyleWindowShadow::Default: // we treat "default" as "default panel"
|
||||
case StyleWindowShadow::Menu:
|
||||
case StyleWindowShadow::Sheet:
|
||||
case StyleWindowShadow::Cliprounded: // this is a Windows-only value.
|
||||
return kWindowShadowOptionsMenu;
|
||||
|
||||
case StyleWindowShadow::Tooltip:
|
||||
|
|
|
@ -1816,49 +1816,15 @@ bool nsWindow::IsVisible() const { return mIsVisible; }
|
|||
*
|
||||
**************************************************************/
|
||||
|
||||
static bool ShouldHaveRoundedMenuDropShadow(nsWindow* aWindow) {
|
||||
nsView* view = nsView::GetViewFor(aWindow);
|
||||
return view && view->GetFrame() &&
|
||||
view->GetFrame()->StyleUIReset()->mWindowShadow ==
|
||||
StyleWindowShadow::Cliprounded;
|
||||
}
|
||||
|
||||
// XP and Vista visual styles sometimes require window clipping regions to be
|
||||
// applied for proper transparency. These routines are called on size and move
|
||||
// operations.
|
||||
// XXX this is apparently still needed in Windows 7 and later
|
||||
void nsWindow::ClearThemeRegion() {
|
||||
if (mWindowType == eWindowType_popup &&
|
||||
(mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypeMenu ||
|
||||
mPopupType == ePopupTypePanel) &&
|
||||
ShouldHaveRoundedMenuDropShadow(this)) {
|
||||
if (!HasGlass() &&
|
||||
(mWindowType == eWindowType_popup && !IsPopupWithTitleBar() &&
|
||||
(mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypePanel))) {
|
||||
SetWindowRgn(mWnd, nullptr, false);
|
||||
} else if (!HasGlass() &&
|
||||
(mWindowType == eWindowType_popup && !IsPopupWithTitleBar() &&
|
||||
(mPopupType == ePopupTypeTooltip ||
|
||||
mPopupType == ePopupTypePanel))) {
|
||||
SetWindowRgn(mWnd, nullptr, false);
|
||||
}
|
||||
}
|
||||
|
||||
void nsWindow::SetThemeRegion() {
|
||||
// Clip the window to the rounded rect area of the popup if needed.
|
||||
if (mWindowType == eWindowType_popup &&
|
||||
(mPopupType == ePopupTypeTooltip || mPopupType == ePopupTypeMenu ||
|
||||
mPopupType == ePopupTypePanel)) {
|
||||
if (nsView* view = nsView::GetViewFor(this)) {
|
||||
LayoutDeviceSize size =
|
||||
nsLayoutUtils::GetBorderRadiusForMenuDropShadow(view->GetFrame());
|
||||
if (size.width || size.height) {
|
||||
int32_t width = NSToIntRound(size.width);
|
||||
int32_t height = NSToIntRound(size.height);
|
||||
HRGN region = CreateRoundRectRgn(0, 0, mBounds.Width() + 1,
|
||||
mBounds.Height() + 1, width, height);
|
||||
if (!SetWindowRgn(mWnd, region, false)) {
|
||||
DeleteObject(region); // region setting failed so delete the region.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2055,8 +2021,6 @@ void nsWindow::Move(double aX, double aY) {
|
|||
if (WinUtils::LogToPhysFactor(mWnd) != oldScale) {
|
||||
ChangedDPI();
|
||||
}
|
||||
|
||||
SetThemeRegion();
|
||||
}
|
||||
|
||||
ResizeDirectManipulationViewport();
|
||||
|
@ -2124,7 +2088,6 @@ void nsWindow::Resize(double aWidth, double aHeight, bool aRepaint) {
|
|||
if (WinUtils::LogToPhysFactor(mWnd) != oldScale) {
|
||||
ChangedDPI();
|
||||
}
|
||||
SetThemeRegion();
|
||||
}
|
||||
|
||||
ResizeDirectManipulationViewport();
|
||||
|
@ -2214,7 +2177,6 @@ void nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
|
|||
::SetWindowPos(mTransitionWnd, HWND_TOPMOST, 0, 0, 0, 0,
|
||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||
}
|
||||
SetThemeRegion();
|
||||
}
|
||||
|
||||
ResizeDirectManipulationViewport();
|
||||
|
|
|
@ -616,7 +616,6 @@ class nsWindow final : public nsBaseWidget {
|
|||
* XP and Vista theming support for windows with rounded edges
|
||||
*/
|
||||
void ClearThemeRegion();
|
||||
void SetThemeRegion();
|
||||
|
||||
/**
|
||||
* Popup hooks
|
||||
|
|
Загрузка…
Ссылка в новой задаче