Commit f0b3aa55 authored by Markus Stange's avatar Markus Stange
Browse files

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
parent 5b429038
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -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
+0 −1
Original line number Diff line number Diff line
@@ -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)
+1 −50
Original line number Diff line number Diff line
@@ -710,7 +710,7 @@ void nsDisplayListBuilder::SetGlassDisplayItem(nsDisplayItem* aItem) {

bool nsDisplayListBuilder::NeedToForceTransparentSurfaceForItem(
    nsDisplayItem* aItem) {
  return aItem == mGlassDisplayItem || aItem->ClearsBackground();
  return aItem == mGlassDisplayItem;
}

AnimatedGeometryRoot* nsDisplayListBuilder::WrapAGRForFrame(
@@ -3551,13 +3551,6 @@ bool nsDisplayBackgroundImage::AppendBackgroundItemsToTop(
  }

  if (isThemed) {
    nsITheme* theme = presContext->Theme();
    if (theme->NeedToClearBackgroundBehindWidget(
            aFrame, aFrame->StyleDisplay()->mAppearance) &&
        aBuilder->IsInChromeDocumentOrPopup() && !aBuilder->IsInTransform()) {
      bgItemList.AppendNewToTop<nsDisplayClearBackground>(aBuilder, aFrame);
    }

    nsDisplayThemedBackground* bgItem = CreateThemedBackground(
        aBuilder, aFrame, aSecondaryReferenceFrame, bgRect);

@@ -4662,48 +4655,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(DeviceColor());
  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;
+0 −45
Original line number Diff line number Diff line
@@ -2762,8 +2762,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.
@@ -5040,49 +5038,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.
 */
+0 −2
Original line number Diff line number Diff line
@@ -416,8 +416,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,
Loading