Bug 1592739 - Stop clearing the background behind vibrant -moz-appearance items. r=mattwoodrow

Now that there is no Gecko-contributed background color in the window any more,
there's nothing that needs to be cleared away. This simplifies things.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2019-11-05 18:48:29 +00:00
Родитель 7bb6e93a25
Коммит 80992e260c
6 изменённых файлов: 3 добавлений и 131 удалений

Просмотреть файл

@ -168,11 +168,6 @@ 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

Просмотреть файл

@ -34,7 +34,6 @@ 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)

Просмотреть файл

@ -1508,7 +1508,7 @@ void nsDisplayListBuilder::SetGlassDisplayItem(nsDisplayItem* aItem) {
bool nsDisplayListBuilder::NeedToForceTransparentSurfaceForItem(
nsDisplayItem* aItem) {
return aItem == mGlassDisplayItem || aItem->ClearsBackground();
return aItem == mGlassDisplayItem;
}
AnimatedGeometryRoot* nsDisplayListBuilder::WrapAGRForFrame(
@ -4311,12 +4311,6 @@ 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>(
@ -5439,48 +5433,6 @@ 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;

Просмотреть файл

@ -2764,8 +2764,6 @@ 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.
@ -5107,49 +5105,6 @@ class nsDisplayTableBackgroundColor : public nsDisplayBackgroundColor {
nsIFrame* mAncestorFrame;
};
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.
*/

Просмотреть файл

@ -419,8 +419,6 @@ 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,

Просмотреть файл

@ -3030,11 +3030,8 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
case StyleAppearance::MozMacSourceListSelection:
case StyleAppearance::MozMacActiveSourceListSelection: {
// 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.
// We only support vibrancy for source list selections if we're inside
// a source list.
if (VibrancyManager::SystemSupportsVibrancy() && IsInSourceList(aFrame)) {
return Nothing();
}
@ -4263,30 +4260,6 @@ bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(StyleAppearance aA
}
}
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;
default:
return false;
}
}
nsITheme::ThemeGeometryType nsNativeThemeCocoa::ThemeGeometryTypeForWidget(
nsIFrame* aFrame, StyleAppearance aAppearance) {
switch (aAppearance) {