Commit 2fdf702d authored by Robert Longson's avatar Robert Longson
Browse files

Bug 1828291 - Give SVGImageFrame its own implementation of IsInvisible r=emilio

parent 671f8253
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -669,10 +669,6 @@ bool SVGGeometryFrame::IsInvisible() const {
    return true;
  }

  if (IsSVGImageFrame()) {
    return false;
  }

  const nsStyleSVG* style = StyleSVG();
  SVGContextPaint* contextPaint =
      SVGContextPaint::GetContextPaint(GetContent());
+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ class SVGGeometryFrame : public nsIFrame, public ISVGDisplayableFrame {
  // SVGGeometryFrame methods
  gfxMatrix GetCanvasTM();

  bool IsInvisible() const;
  virtual bool IsInvisible() const;

 protected:
  // ISVGDisplayableFrame interface:
+11 −0
Original line number Diff line number Diff line
@@ -423,6 +423,17 @@ void SVGImageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
  aLists.Content()->AppendNewToTop<DisplaySVGGeometry>(aBuilder, this);
}

bool SVGImageFrame::IsInvisible() const {
  if (!StyleVisibility()->IsVisible()) {
    return true;
  }

  // Anything below will round to zero later down the pipeline.
  constexpr float opacity_threshold = 1.0 / 128.0;

  return StyleEffects()->mOpacity <= opacity_threshold;
}

bool SVGImageFrame::CreateWebRenderCommands(
    mozilla::wr::DisplayListBuilder& aBuilder,
    mozilla::wr::IpcResourceUpdateQueue& aResources,
+3 −0
Original line number Diff line number Diff line
@@ -94,6 +94,9 @@ class SVGImageFrame final : public SVGGeometryFrame, public nsIReflowCallback {
  /// Always sync decode our image when painting if @aForce is true.
  void SetForceSyncDecoding(bool aForce) { mForceSyncDecoding = aForce; }

  // SVGImageFrame methods:
  bool IsInvisible() const override;

 private:
  uint16_t GetHitTestFlags();