Back out bug 1592739 due to multiple regressions (bug 1599366, bug 1601183, bug 1602193). a=backout

Differential Revision: https://phabricator.services.mozilla.com/D62753

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2020-02-13 14:26:51 +00:00
parent 147ec7bc5e
commit ac0687ac8b
17 changed files with 254 additions and 30 deletions

View File

@ -74,6 +74,11 @@
text-shadow: inherit;
}
:root {
-moz-appearance: none;
background-color: #eeeeee;
}
/** Begin titlebar **/
#titlebar {
@ -492,16 +497,9 @@
#sidebar-box {
/* Default font size is 11px on mac, so this is 12px */
font-size: 1.0909rem;
--sidebar-background-color: -moz-mac-source-list;
}
/* Give the sidebar a vibrant -moz-appearance. Only do this when no lwtheme is
* in use, because vibrant -moz-appearance values only work if there is no
* background-color rendered behind the element, and we have :root:-moz-lwtheme
* rules which set -moz-appearance: none and an opaque background color on the
* root element. That background color would interfere with the vibrancy.
* See bug 1594132 for fixing this. */
#sidebar-box:not(:-moz-lwtheme) {
#sidebar-box:not([lwt-sidebar]) {
-moz-appearance: -moz-mac-source-list;
-moz-font-smoothing-background-color: -moz-mac-source-list;
}

View File

@ -1215,7 +1215,11 @@ bool LayerManagerComposite::Render(const nsIntRegion& aInvalidRegion,
// opaque parts of the window are covered by different layers and we can
// update those parts separately.
IntRegion opaqueRegion;
opaqueRegion.And(aOpaqueRegion, mRenderBounds);
#ifdef XP_MACOSX
opaqueRegion =
mCompositor->GetWidget()->GetOpaqueWidgetRegion().ToUnknownRegion();
#endif
opaqueRegion.AndWith(mRenderBounds);
// Limit the complexity of these regions. Usually, opaqueRegion should be
// only one or two rects, so this SimplifyInward call will not change the

View File

@ -168,6 +168,11 @@ class nsITheme : public nsISupports {
return false;
}
virtual bool NeedToClearBackgroundBehindWidget(nsIFrame* aFrame,
StyleAppearance aWidgetType) {
return false;
}
/**
* ThemeGeometryType values are used for describing themed nsIFrames in
* calls to nsIWidget::UpdateThemeGeometries. We don't simply pass the

View File

@ -5080,16 +5080,11 @@ void PresShell::UpdateCanvasBackground() {
// style frame but we don't have access to the canvasframe here. It isn't
// a problem because only a few frames can return something other than true
// and none of them would be a canvas frame or root element style frame.
bool drawBackgroundImage = false;
bool drawBackgroundColor = false;
if (rootStyleFrame->IsThemed()) {
// Ignore the CSS background-color if -moz-appearance is used.
mCanvasBackgroundColor = NS_RGBA(0, 0, 0, 0);
} else {
mCanvasBackgroundColor = nsCSSRendering::DetermineBackgroundColor(
mPresContext, bgStyle, rootStyleFrame, drawBackgroundImage,
drawBackgroundColor);
}
bool drawBackgroundImage;
bool drawBackgroundColor;
mCanvasBackgroundColor = nsCSSRendering::DetermineBackgroundColor(
mPresContext, bgStyle, rootStyleFrame, drawBackgroundImage,
drawBackgroundColor);
mHasCSSBackgroundColor = drawBackgroundColor;
if (mPresContext->IsRootContentDocumentCrossProcess() &&
!IsTransparentContainerElement(mPresContext)) {

View File

@ -34,6 +34,7 @@ DECLARE_DISPLAY_ITEM_TYPE(CHECKED_CHECKBOX,
TYPE_RENDERS_NO_IMAGES | TYPE_IS_CONTENTFUL)
DECLARE_DISPLAY_ITEM_TYPE(CHECKED_RADIOBUTTON,
TYPE_RENDERS_NO_IMAGES | TYPE_IS_CONTENTFUL)
DECLARE_DISPLAY_ITEM_TYPE(CLEAR_BACKGROUND, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(COLUMN_RULE, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(COMBOBOX_FOCUS, TYPE_RENDERS_NO_IMAGES)
DECLARE_DISPLAY_ITEM_TYPE(COMPOSITOR_HITTEST_INFO, TYPE_RENDERS_NO_IMAGES)

View File

@ -1371,7 +1371,7 @@ void nsDisplayListBuilder::SetGlassDisplayItem(nsDisplayItem* aItem) {
bool nsDisplayListBuilder::NeedToForceTransparentSurfaceForItem(
nsDisplayItem* aItem) {
return aItem == mGlassDisplayItem;
return aItem == mGlassDisplayItem || aItem->ClearsBackground();
}
AnimatedGeometryRoot* nsDisplayListBuilder::WrapAGRForFrame(
@ -4172,6 +4172,12 @@ bool nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
}
if (isThemed) {
nsITheme* theme = presContext->GetTheme();
if (theme->NeedToClearBackgroundBehindWidget(
aFrame, aFrame->StyleDisplay()->mAppearance) &&
aBuilder->IsInChromeDocumentOrPopup() && !aBuilder->IsInTransform()) {
bgItemList.AppendNewToTop<nsDisplayClearBackground>(aBuilder, aFrame);
}
if (aSecondaryReferenceFrame) {
nsDisplayTableThemedBackground* bgItem =
MakeDisplayItem<nsDisplayTableThemedBackground>(
@ -5285,6 +5291,48 @@ void nsDisplayBackgroundColor::WriteDebugInfo(std::stringstream& aStream) {
aStream << " backgroundRect" << mBackgroundRect;
}
already_AddRefed<Layer> nsDisplayClearBackground::BuildLayer(
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerLayerParameters& aParameters) {
RefPtr<ColorLayer> layer = static_cast<ColorLayer*>(
aManager->GetLayerBuilder()->GetLeafLayerFor(aBuilder, this));
if (!layer) {
layer = aManager->CreateColorLayer();
if (!layer) {
return nullptr;
}
}
layer->SetColor(Color());
layer->SetMixBlendMode(gfx::CompositionOp::OP_SOURCE);
bool snap;
nsRect bounds = GetBounds(aBuilder, &snap);
int32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
layer->SetBounds(bounds.ToNearestPixels(appUnitsPerDevPixel)); // XXX Do we
// need to
// respect the
// parent
// layer's
// scale here?
return layer.forget();
}
bool nsDisplayClearBackground::CreateWebRenderCommands(
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
mozilla::layers::RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) {
LayoutDeviceRect bounds = LayoutDeviceRect::FromAppUnits(
nsRect(ToReferenceFrame(), mFrame->GetSize()),
mFrame->PresContext()->AppUnitsPerDevPixel());
aBuilder.PushClearRect(wr::ToLayoutRect(bounds));
return true;
}
nsRect nsDisplayOutline::GetBounds(nsDisplayListBuilder* aBuilder,
bool* aSnap) const {
*aSnap = false;

View File

@ -2749,6 +2749,8 @@ class nsDisplayItem : public nsDisplayItemBase {
return false;
}
virtual bool ClearsBackground() const { return false; }
/**
* Returns true if all layers that can be active should be forced to be
* active. Requires setting the pref layers.force-active=true.
@ -5082,6 +5084,49 @@ class nsDisplayTableBackgroundColor : public nsDisplayBackgroundColor {
TableType mTableType;
};
class nsDisplayClearBackground : public nsPaintedDisplayItem {
public:
nsDisplayClearBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsPaintedDisplayItem(aBuilder, aFrame) {}
NS_DISPLAY_DECL_NAME("ClearBackground", TYPE_CLEAR_BACKGROUND)
nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override {
*aSnap = true;
return nsRect(ToReferenceFrame(), Frame()->GetSize());
}
nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
bool* aSnap) const override {
*aSnap = false;
return GetBounds(aBuilder, aSnap);
}
mozilla::Maybe<nscolor> IsUniform(
nsDisplayListBuilder* aBuilder) const override {
return mozilla::Some(NS_RGBA(0, 0, 0, 0));
}
bool ClearsBackground() const override { return true; }
LayerState GetLayerState(
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerLayerParameters& aParameters) override {
return mozilla::LayerState::LAYER_ACTIVE_FORCE;
}
already_AddRefed<Layer> BuildLayer(
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerLayerParameters& aContainerParameters) override;
bool CreateWebRenderCommands(
mozilla::wr::DisplayListBuilder& aBuilder,
mozilla::wr::IpcResourceUpdateQueue& aResources,
const StackingContextHelper& aSc,
mozilla::layers::RenderRootStateManager* aManager,
nsDisplayListBuilder* aDisplayListBuilder) override;
};
/**
* The standard display item to paint the outer CSS box-shadows of a frame.
*/

View File

@ -231,6 +231,24 @@ class CompositorWidget {
*/
virtual already_AddRefed<gfx::SourceSurface> EndBackBufferDrawing();
#ifdef XP_MACOSX
/**
* Return the opaque region of the widget. This is racy and can only be used
* on macOS, where the widget works around the raciness.
* Bug 1576491 tracks fixing this properly.
* The problem with this method is that it can return values "from the future"
* - the compositor might be working on frame N but the widget will return its
* opaque region from frame N + 1.
* It is believed that this won't lead to visible glitches on macOS due to the
* SuspendAsyncCATransactions call when the vibrant region changes or when the
* window resizes. Whenever the compositor uses an opaque region that's a
* frame ahead, the result it renders won't be shown on the screen; instead,
* the next composite will happen with the correct display list, and that's
* what's shown on the screen once the FlushRendering call completes.
*/
virtual LayoutDeviceIntRegion GetOpaqueWidgetRegion() { return {}; }
#endif
/**
* Observe or unobserve vsync.
*/

View File

@ -96,6 +96,12 @@ uintptr_t InProcessCompositorWidget::GetWidgetKey() {
nsIWidget* InProcessCompositorWidget::RealWidget() { return mWidget; }
#ifdef XP_MACOSX
LayoutDeviceIntRegion InProcessCompositorWidget::GetOpaqueWidgetRegion() {
return mWidget->GetOpaqueWidgetRegion();
}
#endif
void InProcessCompositorWidget::ObserveVsync(VsyncObserver* aObserver) {
if (RefPtr<CompositorVsyncDispatcher> cvd =
mWidget->GetCompositorVsyncDispatcher()) {

View File

@ -33,6 +33,9 @@ class InProcessCompositorWidget : public CompositorWidget {
virtual bool InitCompositor(layers::Compositor* aCompositor) override;
virtual LayoutDeviceIntSize GetClientSize() override;
virtual uint32_t GetGLFrameBufferFormat() override;
#ifdef XP_MACOSX
virtual LayoutDeviceIntRegion GetOpaqueWidgetRegion() override;
#endif
virtual void ObserveVsync(VsyncObserver* aObserver) override;
virtual uintptr_t GetWidgetKey() override;

View File

@ -27,6 +27,7 @@ enum class VibrancyType {
TOOLTIP,
MENU,
HIGHLIGHTED_MENUITEM,
SHEET,
SOURCE_LIST,
SOURCE_LIST_SELECTION,
ACTIVE_SOURCE_LIST_SELECTION

View File

@ -66,6 +66,7 @@ static id AppearanceForVibrancyType(VibrancyType aType) {
case VibrancyType::TOOLTIP:
case VibrancyType::MENU:
case VibrancyType::HIGHLIGHTED_MENUITEM:
case VibrancyType::SHEET:
case VibrancyType::SOURCE_LIST:
case VibrancyType::SOURCE_LIST_SELECTION:
case VibrancyType::ACTIVE_SOURCE_LIST_SELECTION:
@ -96,8 +97,10 @@ static NSUInteger VisualEffectStateForVibrancyType(VibrancyType aType) {
case VibrancyType::TOOLTIP:
case VibrancyType::MENU:
case VibrancyType::HIGHLIGHTED_MENUITEM:
// Tooltip and menu windows are never "key", so we need to tell the vibrancy effect to look
// active regardless of window state.
case VibrancyType::SHEET:
// Tooltip and menu windows are never "key" and sheets always looks
// active, so we need to tell the vibrancy effect to look active
// regardless of window state.
return NSVisualEffectStateActive;
default:
return NSVisualEffectStateFollowsWindowActiveState;

View File

@ -429,8 +429,6 @@ class nsChildView final : public nsBaseWidget {
virtual void CreateCompositor() override;
virtual bool WidgetPaintsBackground() override { return true; }
virtual bool PreRender(mozilla::widget::WidgetRenderingContext* aContext) override;
virtual void PostRender(mozilla::widget::WidgetRenderingContext* aContext) override;
virtual RefPtr<mozilla::layers::NativeLayerRoot> GetNativeLayerRoot() override;
@ -491,6 +489,8 @@ class nsChildView final : public nsBaseWidget {
virtual LayoutDeviceIntPoint GetClientOffset() override;
virtual LayoutDeviceIntRegion GetOpaqueWidgetRegion() override;
void DispatchAPZWheelInputEvent(mozilla::InputData& aEvent, bool aCanTriggerSwipe);
nsEventStatus DispatchAPZInputEvent(mozilla::InputData& aEvent);
@ -534,6 +534,8 @@ class nsChildView final : public nsBaseWidget {
void UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries);
mozilla::VibrancyManager& EnsureVibrancyManager();
void UpdateInternalOpaqueRegion();
nsIWidget* GetWidgetForListenerEvents();
struct SwipeInfo {
@ -595,6 +597,9 @@ class nsChildView final : public nsBaseWidget {
RefPtr<mozilla::CancelableRunnable> mUnsuspendAsyncCATransactionsRunnable;
// The widget's opaque region. Written on the main thread, read on any thread.
mozilla::DataMutex<mozilla::LayoutDeviceIntRegion> mOpaqueRegion;
// This flag is only used when APZ is off. It indicates that the current pan
// gesture was processed as a swipe. Sometimes the swipe animation can finish
// before momentum events of the pan gesture have stopped firing, so this

View File

@ -236,6 +236,7 @@ nsChildView::nsChildView()
mDrawing(false),
mIsDispatchPaint(false),
mPluginFocused{false},
mOpaqueRegion("nsChildView::mOpaqueRegion"),
mCurrentPanGestureBelongsToSwipe{false} {}
nsChildView::~nsChildView() {
@ -497,6 +498,8 @@ void nsChildView::SetTransparencyMode(nsTransparencyMode aMode) {
windowWidget->SetTransparencyMode(aMode);
}
UpdateInternalOpaqueRegion();
NS_OBJC_END_TRY_ABORT_BLOCK;
}
@ -1423,6 +1426,11 @@ LayoutDeviceIntPoint nsChildView::WidgetToScreenOffset() {
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(LayoutDeviceIntPoint(0, 0));
}
LayoutDeviceIntRegion nsChildView::GetOpaqueWidgetRegion() {
auto opaqueRegion = mOpaqueRegion.Lock();
return *opaqueRegion;
}
nsresult nsChildView::SetTitle(const nsAString& title) {
// child views don't have titles
return NS_OK;
@ -1795,6 +1803,8 @@ static Maybe<VibrancyType> ThemeGeometryTypeToVibrancyType(
case nsNativeThemeCocoa::eThemeGeometryTypeVibrancyDark:
case nsNativeThemeCocoa::eThemeGeometryTypeVibrantTitlebarDark:
return Some(VibrancyType::DARK);
case nsNativeThemeCocoa::eThemeGeometryTypeSheet:
return Some(VibrancyType::SHEET);
case nsNativeThemeCocoa::eThemeGeometryTypeTooltip:
return Some(VibrancyType::TOOLTIP);
case nsNativeThemeCocoa::eThemeGeometryTypeMenu:
@ -1848,6 +1858,7 @@ void nsChildView::UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries
return;
}
LayoutDeviceIntRegion sheetRegion = GatherVibrantRegion(aThemeGeometries, VibrancyType::SHEET);
LayoutDeviceIntRegion vibrantLightRegion =
GatherVibrantRegion(aThemeGeometries, VibrancyType::LIGHT);
LayoutDeviceIntRegion vibrantDarkRegion =
@ -1864,9 +1875,9 @@ void nsChildView::UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries
LayoutDeviceIntRegion activeSourceListSelectionRegion =
GatherVibrantRegion(aThemeGeometries, VibrancyType::ACTIVE_SOURCE_LIST_SELECTION);
MakeRegionsNonOverlapping(vibrantLightRegion, vibrantDarkRegion, menuRegion, tooltipRegion,
highlightedMenuItemRegion, sourceListRegion, sourceListSelectionRegion,
activeSourceListSelectionRegion);
MakeRegionsNonOverlapping(sheetRegion, vibrantLightRegion, vibrantDarkRegion, menuRegion,
tooltipRegion, highlightedMenuItemRegion, sourceListRegion,
sourceListSelectionRegion, activeSourceListSelectionRegion);
auto& vm = EnsureVibrancyManager();
bool changed = false;
@ -1875,11 +1886,14 @@ void nsChildView::UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries
changed |= vm.UpdateVibrantRegion(VibrancyType::MENU, menuRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::TOOLTIP, tooltipRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::HIGHLIGHTED_MENUITEM, highlightedMenuItemRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::SHEET, sheetRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::SOURCE_LIST, sourceListRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::SOURCE_LIST_SELECTION, sourceListSelectionRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::ACTIVE_SOURCE_LIST_SELECTION,
activeSourceListSelectionRegion);
UpdateInternalOpaqueRegion();
if (changed) {
SuspendAsyncCATransactions();
}
@ -1893,6 +1907,19 @@ mozilla::VibrancyManager& nsChildView::EnsureVibrancyManager() {
return *mVibrancyManager;
}
void nsChildView::UpdateInternalOpaqueRegion() {
MOZ_RELEASE_ASSERT(NS_IsMainThread(), "This should only be called on the main thread.");
auto opaqueRegion = mOpaqueRegion.Lock();
bool widgetIsOpaque = GetTransparencyMode() == eTransparencyOpaque;
if (!widgetIsOpaque) {
opaqueRegion->SetEmpty();
} else if (VibrancyManager::SystemSupportsVibrancy()) {
opaqueRegion->Sub(mBounds, EnsureVibrancyManager().GetUnionOfVibrantRegions());
} else {
*opaqueRegion = mBounds;
}
}
nsChildView::SwipeInfo nsChildView::SendMayStartSwipe(
const mozilla::PanGestureInput& aSwipeStartEvent) {
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);

View File

@ -43,6 +43,7 @@ class nsNativeThemeCocoa : private nsNativeTheme, public nsITheme {
eThemeGeometryTypeVibrantTitlebarLight,
eThemeGeometryTypeVibrantTitlebarDark,
eThemeGeometryTypeTooltip,
eThemeGeometryTypeSheet,
eThemeGeometryTypeSourceList,
eThemeGeometryTypeSourceListSelection,
eThemeGeometryTypeActiveSourceListSelection
@ -419,6 +420,8 @@ class nsNativeThemeCocoa : private nsNativeTheme, public nsITheme {
bool ThemeDrawsFocusForWidget(StyleAppearance aAppearance) override;
bool ThemeNeedsComboboxDropmarker() override;
virtual bool WidgetAppearanceDependsOnWindowFocus(StyleAppearance aAppearance) override;
virtual bool NeedToClearBackgroundBehindWidget(nsIFrame* aFrame,
StyleAppearance aAppearance) override;
virtual ThemeGeometryType ThemeGeometryTypeForWidget(nsIFrame* aFrame,
StyleAppearance aAppearance) override;
virtual Transparency GetWidgetTransparency(nsIFrame* aFrame,
@ -436,6 +439,7 @@ class nsNativeThemeCocoa : private nsNativeTheme, public nsITheme {
LayoutDeviceIntMargin DirectionAwareMargin(const LayoutDeviceIntMargin& aMargin,
nsIFrame* aFrame);
nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter);
bool IsWindowSheet(nsIFrame* aFrame);
ControlParams ComputeControlParams(nsIFrame* aFrame, mozilla::EventStates aEventState);
MenuBackgroundParams ComputeMenuBackgroundParams(nsIFrame* aFrame,
mozilla::EventStates aEventState);

View File

@ -2692,6 +2692,15 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
EventStates eventState = GetContentState(aFrame, aAppearance);
switch (aAppearance) {
case StyleAppearance::Dialog:
if (IsWindowSheet(aFrame)) {
if (VibrancyManager::SystemSupportsVibrancy()) {
return Nothing();
}
return Some(WidgetInfo::SheetBackground());
}
return Some(WidgetInfo::DialogBackground());
case StyleAppearance::Menupopup:
if (VibrancyManager::SystemSupportsVibrancy()) {
return Nothing();
@ -3032,8 +3041,11 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
case StyleAppearance::MozMacSourceListSelection:
case StyleAppearance::MozMacActiveSourceListSelection: {
// We only support vibrancy for source list selections if we're inside
// a source list.
// If we're in XUL tree, we need to rely on the source list's clear
// background display item. If we cleared the background behind the
// selections, the source list would not pick up the right font
// smoothing background. So, to simplify a bit, we only support vibrancy
// if we're in a source list.
if (VibrancyManager::SystemSupportsVibrancy() && IsInSourceList(aFrame)) {
return Nothing();
}
@ -3361,6 +3373,12 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
// - If the case in DrawWidgetBackground draws something complicated for the
// given widget type, return false here.
switch (aAppearance) {
case StyleAppearance::Dialog:
if (IsWindowSheet(aFrame) && VibrancyManager::SystemSupportsVibrancy()) {
return true;
}
return false;
case StyleAppearance::Menupopup:
if (VibrancyManager::SystemSupportsVibrancy()) {
return true;
@ -4262,6 +4280,42 @@ bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(StyleAppearance aA
}
}
bool nsNativeThemeCocoa::IsWindowSheet(nsIFrame* aFrame) {
NSWindow* win = NativeWindowForFrame(aFrame);
id winDelegate = [win delegate];
nsIWidget* widget = [(WindowDelegate*)winDelegate geckoWidget];
if (!widget) {
return false;
}
return (widget->WindowType() == eWindowType_sheet);
}
bool nsNativeThemeCocoa::NeedToClearBackgroundBehindWidget(nsIFrame* aFrame,
StyleAppearance aAppearance) {
switch (aAppearance) {
case StyleAppearance::MozMacSourceList:
// If we're in a XUL tree, we don't want to clear the background behind the
// selections below, since that would make our source list to not pick up
// the right font smoothing background. But since we don't call this method
// in nsTreeBodyFrame::BuildDisplayList, we never get here.
case StyleAppearance::MozMacSourceListSelection:
case StyleAppearance::MozMacActiveSourceListSelection:
case StyleAppearance::MozMacVibrancyLight:
case StyleAppearance::MozMacVibrancyDark:
case StyleAppearance::MozMacVibrantTitlebarLight:
case StyleAppearance::MozMacVibrantTitlebarDark:
case StyleAppearance::Tooltip:
case StyleAppearance::Menupopup:
case StyleAppearance::Menuitem:
case StyleAppearance::Checkmenuitem:
return true;
case StyleAppearance::Dialog:
return IsWindowSheet(aFrame);
default:
return false;
}
}
nsITheme::ThemeGeometryType nsNativeThemeCocoa::ThemeGeometryTypeForWidget(
nsIFrame* aFrame, StyleAppearance aAppearance) {
switch (aAppearance) {
@ -4294,6 +4348,8 @@ nsITheme::ThemeGeometryType nsNativeThemeCocoa::ThemeGeometryTypeForWidget(
bool isSelected = !isDisabled && CheckBooleanAttr(aFrame, nsGkAtoms::menuactive);
return isSelected ? eThemeGeometryTypeHighlightedMenuItem : eThemeGeometryTypeMenu;
}
case StyleAppearance::Dialog:
return IsWindowSheet(aFrame) ? eThemeGeometryTypeSheet : eThemeGeometryTypeUnknown;
case StyleAppearance::MozMacSourceList:
return eThemeGeometryTypeSourceList;
case StyleAppearance::MozMacSourceListSelection:
@ -4312,9 +4368,11 @@ nsITheme::Transparency nsNativeThemeCocoa::GetWidgetTransparency(nsIFrame* aFram
switch (aAppearance) {
case StyleAppearance::Menupopup:
case StyleAppearance::Tooltip:
case StyleAppearance::Dialog:
return eTransparent;
case StyleAppearance::Dialog:
return IsWindowSheet(aFrame) ? eTransparent : eOpaque;
case StyleAppearance::ScrollbarSmall:
case StyleAppearance::Scrollbar:
case StyleAppearance::Scrollcorner: {

View File

@ -466,6 +466,9 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
}
virtual uint32_t GetGLFrameBufferFormat();
virtual bool CompositorInitiallyPaused() { return false; }
#ifdef XP_MACOSX
virtual LayoutDeviceIntRegion GetOpaqueWidgetRegion() { return {}; }
#endif
protected:
void ResolveIconName(const nsAString& aIconName, const nsAString& aIconSuffix,