Backed out changeset c43fa1320372 (bug 1258510)

This commit is contained in:
Carsten "Tomcat" Book 2016-07-13 08:37:24 +02:00
Родитель 4ee5e3ab50
Коммит 96d9ab7d51
17 изменённых файлов: 86 добавлений и 99 удалений

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

@ -51,7 +51,6 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::image;
// ============================================================================ // ============================================================================
// Utility functions // Utility functions
@ -3200,8 +3199,7 @@ nsDisplaySVGText::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* ctx = aCtx->ThebesContext(); gfxContext* ctx = aCtx->ThebesContext();
ctx->Save(); ctx->Save();
DrawResult result = static_cast<SVGTextFrame*>(mFrame)->PaintSVG(*ctx, tm); static_cast<SVGTextFrame*>(mFrame)->PaintSVG(*ctx, tm);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
ctx->Restore(); ctx->Restore();
} }
@ -3637,7 +3635,7 @@ ShouldPaintCaret(const TextRenderedRun& aThisRun, nsCaret* aCaret)
return false; return false;
} }
DrawResult nsresult
SVGTextFrame::PaintSVG(gfxContext& aContext, SVGTextFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect) const nsIntRect *aDirtyRect)
@ -3646,7 +3644,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
nsIFrame* kid = PrincipalChildList().FirstChild(); nsIFrame* kid = PrincipalChildList().FirstChild();
if (!kid) if (!kid)
return DrawResult::SUCCESS; return NS_OK;
nsPresContext* presContext = PresContext(); nsPresContext* presContext = PresContext();
@ -3659,7 +3657,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
// dirty. // dirty.
if (presContext->PresShell()->InDrawWindowNotFlushing() && if (presContext->PresShell()->InDrawWindowNotFlushing() &&
NS_SUBTREE_DIRTY(this)) { NS_SUBTREE_DIRTY(this)) {
return DrawResult::SUCCESS; return NS_OK;
} }
// Text frames inside <clipPath>, <mask>, etc. will never have had // Text frames inside <clipPath>, <mask>, etc. will never have had
// ReflowSVG called on them, so call UpdateGlyphPositioning to do this now. // ReflowSVG called on them, so call UpdateGlyphPositioning to do this now.
@ -3668,12 +3666,12 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
// If we are asked to paint before reflow has recomputed mPositions etc. // If we are asked to paint before reflow has recomputed mPositions etc.
// directly via PaintSVG, rather than via a display list, then we need // directly via PaintSVG, rather than via a display list, then we need
// to bail out here too. // to bail out here too.
return DrawResult::SUCCESS; return NS_OK;
} }
if (aTransform.IsSingular()) { if (aTransform.IsSingular()) {
NS_WARNING("Can't render text element!"); NS_WARNING("Can't render text element!");
return DrawResult::BAD_ARGS; return NS_ERROR_FAILURE;
} }
gfxMatrix matrixForPaintServers = aTransform * initialMatrix; gfxMatrix matrixForPaintServers = aTransform * initialMatrix;
@ -3695,7 +3693,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
nsRect canvasRect = nsLayoutUtils::RoundGfxRectToAppRect( nsRect canvasRect = nsLayoutUtils::RoundGfxRectToAppRect(
GetCanvasTM().TransformBounds(frameRect), 1); GetCanvasTM().TransformBounds(frameRect), 1);
if (!canvasRect.Intersects(dirtyRect)) { if (!canvasRect.Intersects(dirtyRect)) {
return DrawResult::SUCCESS; return NS_OK;
} }
} }
@ -3782,7 +3780,7 @@ SVGTextFrame::PaintSVG(gfxContext& aContext,
run = it.Next(); run = it.Next();
} }
return DrawResult::SUCCESS; return NS_OK;
} }
nsIFrame* nsIFrame*

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

@ -263,7 +263,6 @@ class SVGTextFrame final : public nsSVGDisplayContainerFrame
typedef mozilla::gfx::Path Path; typedef mozilla::gfx::Path Path;
typedef mozilla::gfx::Point Point; typedef mozilla::gfx::Point Point;
typedef mozilla::SVGTextContextPaint SVGTextContextPaint; typedef mozilla::SVGTextContextPaint SVGTextContextPaint;
typedef mozilla::image::DrawResult DrawResult;
protected: protected:
explicit SVGTextFrame(nsStyleContext* aContext) explicit SVGTextFrame(nsStyleContext* aContext)
@ -326,7 +325,7 @@ public:
// nsISVGChildFrame interface: // nsISVGChildFrame interface:
virtual void NotifySVGChanged(uint32_t aFlags) override; virtual void NotifySVGChanged(uint32_t aFlags) override;
virtual DrawResult PaintSVG(gfxContext& aContext, virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override; const nsIntRect* aDirtyRect = nullptr) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override; virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;

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

@ -43,7 +43,6 @@ public:
typedef mozilla::SVGAnimatedLengthList SVGAnimatedLengthList; typedef mozilla::SVGAnimatedLengthList SVGAnimatedLengthList;
typedef mozilla::SVGLengthList SVGLengthList; typedef mozilla::SVGLengthList SVGLengthList;
typedef mozilla::SVGUserUnitList SVGUserUnitList; typedef mozilla::SVGUserUnitList SVGUserUnitList;
typedef mozilla::image::DrawResult DrawResult;
NS_DECL_QUERYFRAME_TARGET(nsISVGChildFrame) NS_DECL_QUERYFRAME_TARGET(nsISVGChildFrame)
@ -74,7 +73,7 @@ public:
* @param aDirtyRect The area being redrawn, in frame offset pixel * @param aDirtyRect The area being redrawn, in frame offset pixel
* coordinates. * coordinates.
*/ */
virtual DrawResult PaintSVG(gfxContext& aContext, virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) = 0; const nsIntRect* aDirtyRect = nullptr) = 0;

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

@ -248,7 +248,7 @@ nsSVGDisplayContainerFrame::IsSVGTransformed(gfx::Matrix *aOwnTransform,
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// nsISVGChildFrame methods // nsISVGChildFrame methods
DrawResult nsresult
nsSVGDisplayContainerFrame::PaintSVG(gfxContext& aContext, nsSVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect) const nsIntRect *aDirtyRect)
@ -260,7 +260,7 @@ nsSVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
"SVG should take this code path"); "SVG should take this code path");
if (StyleEffects()->mOpacity == 0.0) { if (StyleEffects()->mOpacity == 0.0) {
return DrawResult::SUCCESS; return NS_OK;
} }
gfxMatrix matrix = aTransform; gfxMatrix matrix = aTransform;
@ -268,7 +268,7 @@ nsSVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
matrix = static_cast<const nsSVGElement*>(GetContent())-> matrix = static_cast<const nsSVGElement*>(GetContent())->
PrependLocalTransformsTo(matrix, eChildToUserSpace); PrependLocalTransformsTo(matrix, eChildToUserSpace);
if (matrix.IsSingular()) { if (matrix.IsSingular()) {
return DrawResult::SUCCESS; return NS_OK;
} }
} }
@ -291,7 +291,7 @@ nsSVGDisplayContainerFrame::PaintSVG(gfxContext& aContext,
nsSVGUtils::PaintFrameWithEffects(kid, aContext, m, aDirtyRect); nsSVGUtils::PaintFrameWithEffects(kid, aContext, m, aDirtyRect);
} }
return DrawResult::SUCCESS; return NS_OK;
} }
nsIFrame* nsIFrame*

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

@ -140,7 +140,7 @@ public:
Matrix *aFromParentTransform = nullptr) const override; Matrix *aFromParentTransform = nullptr) const override;
// nsISVGChildFrame interface: // nsISVGChildFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext, virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect = nullptr) override; const nsIntRect *aDirtyRect = nullptr) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override; virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;

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

@ -198,7 +198,7 @@ nsSVGForeignObjectFrame::IsSVGTransformed(Matrix *aOwnTransform,
return foundTransform; return foundTransform;
} }
DrawResult nsresult
nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext, nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect) const nsIntRect* aDirtyRect)
@ -209,15 +209,15 @@ nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
"SVG should take this code path"); "SVG should take this code path");
if (IsDisabled()) if (IsDisabled())
return DrawResult::SUCCESS; return NS_OK;
nsIFrame* kid = PrincipalChildList().FirstChild(); nsIFrame* kid = PrincipalChildList().FirstChild();
if (!kid) if (!kid)
return DrawResult::SUCCESS; return NS_OK;
if (aTransform.IsSingular()) { if (aTransform.IsSingular()) {
NS_WARNING("Can't render foreignObject element!"); NS_WARNING("Can't render foreignObject element!");
return DrawResult::BAD_ARGS; return NS_ERROR_FAILURE;
} }
nsRect kidDirtyRect = kid->GetVisualOverflowRect(); nsRect kidDirtyRect = kid->GetVisualOverflowRect();
@ -245,7 +245,7 @@ nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
// int32_t appUnitsPerDevPx = PresContext()->AppUnitsPerDevPixel(); // int32_t appUnitsPerDevPx = PresContext()->AppUnitsPerDevPixel();
// mRect.ToOutsidePixels(appUnitsPerDevPx).Intersects(*aDirtyRect) // mRect.ToOutsidePixels(appUnitsPerDevPx).Intersects(*aDirtyRect)
if (kidDirtyRect.IsEmpty()) if (kidDirtyRect.IsEmpty())
return DrawResult::SUCCESS; return NS_OK;
} }
aContext.Save(); aContext.Save();
@ -276,16 +276,14 @@ nsSVGForeignObjectFrame::PaintSVG(gfxContext& aContext,
flags |= PaintFrameFlags::PAINT_TO_WINDOW; flags |= PaintFrameFlags::PAINT_TO_WINDOW;
} }
nsRenderingContext rendCtx(&aContext); nsRenderingContext rendCtx(&aContext);
nsLayoutUtils::PaintFrame(&rendCtx, kid, nsRegion(kidDirtyRect),
NS_RGBA(0,0,0,0),
nsDisplayListBuilderMode::PAINTING, flags);
nsresult rv = nsLayoutUtils::PaintFrame(&rendCtx, kid, nsRegion(kidDirtyRect), nsresult rv = nsLayoutUtils::PaintFrame(&rendCtx, kid, nsRegion(kidDirtyRect),
NS_RGBA(0,0,0,0), NS_RGBA(0,0,0,0),
nsDisplayListBuilderMode::PAINTING, nsDisplayListBuilderMode::PAINTING,
flags); flags);
aContext.Restore(); aContext.Restore();
return NS_FAILED(rv) ? DrawResult::BAD_ARGS : DrawResult::SUCCESS; return rv;
} }
nsIFrame* nsIFrame*

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

@ -74,7 +74,7 @@ public:
#endif #endif
// nsISVGChildFrame interface: // nsISVGChildFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext, virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override; const nsIntRect* aDirtyRect = nullptr) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override; virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;

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

@ -26,7 +26,6 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::image;
class nsSVGImageFrame; class nsSVGImageFrame;
@ -66,7 +65,7 @@ public:
NS_DECL_FRAMEARENA_HELPERS NS_DECL_FRAMEARENA_HELPERS
// nsISVGChildFrame interface: // nsISVGChildFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext, virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override; const nsIntRect* aDirtyRect = nullptr) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override; virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
@ -325,13 +324,15 @@ nsSVGImageFrame::TransformContextForPainting(gfxContext* aGfxContext,
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// nsISVGChildFrame methods: // nsISVGChildFrame methods:
DrawResult nsresult
nsSVGImageFrame::PaintSVG(gfxContext& aContext, nsSVGImageFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect) const nsIntRect *aDirtyRect)
{ {
nsresult rv = NS_OK;
if (!StyleVisibility()->IsVisible()) if (!StyleVisibility()->IsVisible())
return DrawResult::SUCCESS; return NS_OK;
float x, y, width, height; float x, y, width, height;
SVGImageElement *imgElem = static_cast<SVGImageElement*>(mContent); SVGImageElement *imgElem = static_cast<SVGImageElement*>(mContent);
@ -350,7 +351,6 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
currentRequest->GetImage(getter_AddRefs(mImageContainer)); currentRequest->GetImage(getter_AddRefs(mImageContainer));
} }
DrawResult result = DrawResult::SUCCESS;
if (mImageContainer) { if (mImageContainer) {
gfxContextAutoSaveRestore autoRestorer(&aContext); gfxContextAutoSaveRestore autoRestorer(&aContext);
@ -361,7 +361,7 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
} }
if (!TransformContextForPainting(&aContext, aTransform)) { if (!TransformContextForPainting(&aContext, aTransform)) {
return DrawResult::SUCCESS; return NS_ERROR_FAILURE;
} }
// fill-opacity doesn't affect <image>, so if we're allowed to // fill-opacity doesn't affect <image>, so if we're allowed to
@ -417,7 +417,8 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
// Note: Can't use DrawSingleUnscaledImage for the TYPE_VECTOR case. // Note: Can't use DrawSingleUnscaledImage for the TYPE_VECTOR case.
// That method needs our image to have a fixed native width & height, // That method needs our image to have a fixed native width & height,
// and that's not always true for TYPE_VECTOR images. // and that's not always true for TYPE_VECTOR images.
result = nsLayoutUtils::DrawSingleImage( // FIXME We should use the return value, see bug 1258510.
Unused << nsLayoutUtils::DrawSingleImage(
aContext, aContext,
PresContext(), PresContext(),
mImageContainer, mImageContainer,
@ -427,7 +428,8 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
&context, &context,
drawFlags); drawFlags);
} else { // mImageContainer->GetType() == TYPE_RASTER } else { // mImageContainer->GetType() == TYPE_RASTER
result = nsLayoutUtils::DrawSingleUnscaledImage( // FIXME We should use the return value, see bug 1258510.
Unused << nsLayoutUtils::DrawSingleUnscaledImage(
aContext, aContext,
PresContext(), PresContext(),
mImageContainer, mImageContainer,
@ -443,7 +445,7 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext,
// gfxContextAutoSaveRestore goes out of scope & cleans up our gfxContext // gfxContextAutoSaveRestore goes out of scope & cleans up our gfxContext
} }
return result; return rv;
} }
nsIFrame* nsIFrame*

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

@ -18,7 +18,6 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::dom; using namespace mozilla::dom;
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::image;
nsIFrame* nsIFrame*
NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@ -58,7 +57,7 @@ nsSVGInnerSVGFrame::GetType() const
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// nsISVGChildFrame methods // nsISVGChildFrame methods
DrawResult nsresult
nsSVGInnerSVGFrame::PaintSVG(gfxContext& aContext, nsSVGInnerSVGFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect) const nsIntRect *aDirtyRect)
@ -76,7 +75,7 @@ nsSVGInnerSVGFrame::PaintSVG(gfxContext& aContext,
GetAnimatedLengthValues(&x, &y, &width, &height, nullptr); GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
if (width <= 0 || height <= 0) { if (width <= 0 || height <= 0) {
return DrawResult::SUCCESS; return NS_OK;
} }
autoSR.SetContext(&aContext); autoSR.SetContext(&aContext);

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

@ -52,7 +52,7 @@ public:
int32_t aModType) override; int32_t aModType) override;
// nsISVGChildFrame interface: // nsISVGChildFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext, virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect *aDirtyRect = nullptr) override; const nsIntRect *aDirtyRect = nullptr) override;
virtual nsRect GetCoveredRegion() override; virtual nsRect GetCoveredRegion() override;

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

@ -823,7 +823,7 @@ nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags)
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// nsISVGChildFrame methods: // nsISVGChildFrame methods:
DrawResult nsresult
nsSVGOuterSVGFrame::PaintSVG(gfxContext& aContext, nsSVGOuterSVGFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect) const nsIntRect* aDirtyRect)

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

@ -114,7 +114,7 @@ public:
virtual void NotifyViewportOrTransformChanged(uint32_t aFlags) override; virtual void NotifyViewportOrTransformChanged(uint32_t aFlags) override;
// nsISVGChildFrame methods: // nsISVGChildFrame methods:
virtual DrawResult PaintSVG(gfxContext& aContext, virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override; const nsIntRect* aDirtyRect = nullptr) override;
virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace, virtual SVGBBox GetBBoxContribution(const Matrix &aToBBoxUserspace,

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

@ -31,7 +31,6 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::gfx; using namespace mozilla::gfx;
using namespace mozilla::image;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// Implementation // Implementation
@ -112,10 +111,7 @@ nsDisplaySVGPathGeometry::Paint(nsDisplayListBuilder* aBuilder,
gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(mFrame) * gfxMatrix tm = nsSVGIntegrationUtils::GetCSSPxToDevPxMatrix(mFrame) *
gfxMatrix::Translation(devPixelOffset); gfxMatrix::Translation(devPixelOffset);
DrawResult result =
static_cast<nsSVGPathGeometryFrame*>(mFrame)->PaintSVG(*aCtx->ThebesContext(), tm); static_cast<nsSVGPathGeometryFrame*>(mFrame)->PaintSVG(*aCtx->ThebesContext(), tm);
nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@ -246,19 +242,19 @@ nsSVGPathGeometryFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// nsISVGChildFrame methods // nsISVGChildFrame methods
DrawResult nsresult
nsSVGPathGeometryFrame::PaintSVG(gfxContext& aContext, nsSVGPathGeometryFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect) const nsIntRect* aDirtyRect)
{ {
if (!StyleVisibility()->IsVisible()) if (!StyleVisibility()->IsVisible())
return DrawResult::SUCCESS; return NS_OK;
// Matrix to the geometry's user space: // Matrix to the geometry's user space:
gfxMatrix newMatrix = gfxMatrix newMatrix =
aContext.CurrentMatrix().PreMultiply(aTransform).NudgeToIntegers(); aContext.CurrentMatrix().PreMultiply(aTransform).NudgeToIntegers();
if (newMatrix.IsSingular()) { if (newMatrix.IsSingular()) {
return DrawResult::BAD_ARGS; return NS_OK;
} }
uint32_t paintOrder = StyleSVG()->mPaintOrder; uint32_t paintOrder = StyleSVG()->mPaintOrder;
@ -284,7 +280,7 @@ nsSVGPathGeometryFrame::PaintSVG(gfxContext& aContext,
} }
} }
return DrawResult::SUCCESS; return NS_OK;
} }
nsIFrame* nsIFrame*

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

@ -95,7 +95,7 @@ public:
gfxMatrix GetCanvasTM(); gfxMatrix GetCanvasTM();
protected: protected:
// nsISVGChildFrame interface: // nsISVGChildFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext, virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override; const nsIntRect* aDirtyRect = nullptr) override;
virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override; virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;

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

@ -48,7 +48,7 @@ public:
const nsDisplayListSet& aLists) override; const nsDisplayListSet& aLists) override;
// nsISVGChildFrame interface: // nsISVGChildFrame interface:
virtual DrawResult PaintSVG(gfxContext& aContext, virtual nsresult PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect = nullptr) override; const nsIntRect* aDirtyRect = nullptr) override;
nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override; nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
@ -102,7 +102,7 @@ nsSVGSwitchFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
} }
} }
DrawResult nsresult
nsSVGSwitchFrame::PaintSVG(gfxContext& aContext, nsSVGSwitchFrame::PaintSVG(gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
const nsIntRect* aDirtyRect) const nsIntRect* aDirtyRect)
@ -113,7 +113,7 @@ nsSVGSwitchFrame::PaintSVG(gfxContext& aContext,
"SVG should take this code path"); "SVG should take this code path");
if (StyleEffects()->mOpacity == 0.0) if (StyleEffects()->mOpacity == 0.0)
return DrawResult::SUCCESS; return NS_OK;
nsIFrame *kid = GetActiveChildFrame(); nsIFrame *kid = GetActiveChildFrame();
if (kid) { if (kid) {
@ -124,7 +124,7 @@ nsSVGSwitchFrame::PaintSVG(gfxContext& aContext,
} }
nsSVGUtils::PaintFrameWithEffects(kid, aContext, tm, aDirtyRect); nsSVGUtils::PaintFrameWithEffects(kid, aContext, tm, aDirtyRect);
} }
return DrawResult::SUCCESS; return NS_OK;
} }

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

@ -486,7 +486,7 @@ public:
} }
}; };
DrawResult void
nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame, nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
gfxContext& aContext, gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,
@ -500,16 +500,16 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
nsISVGChildFrame *svgChildFrame = do_QueryFrame(aFrame); nsISVGChildFrame *svgChildFrame = do_QueryFrame(aFrame);
if (!svgChildFrame) if (!svgChildFrame)
return DrawResult::BAD_ARGS; return;
float opacity = aFrame->StyleEffects()->mOpacity; float opacity = aFrame->StyleEffects()->mOpacity;
if (opacity == 0.0f) if (opacity == 0.0f)
return DrawResult::SUCCESS; return;
const nsIContent* content = aFrame->GetContent(); const nsIContent* content = aFrame->GetContent();
if (content->IsSVGElement() && if (content->IsSVGElement() &&
!static_cast<const nsSVGElement*>(content)->HasValidDimensions()) { !static_cast<const nsSVGElement*>(content)->HasValidDimensions()) {
return DrawResult::SUCCESS; return;
} }
/* Properties are added lazily and may have been removed by a restyle, /* Properties are added lazily and may have been removed by a restyle,
@ -541,7 +541,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
HasChildrenOnlyTransform(&childrenOnlyTM)) { HasChildrenOnlyTransform(&childrenOnlyTM)) {
// Undo the children-only transform: // Undo the children-only transform:
if (!childrenOnlyTM.Invert()) { if (!childrenOnlyTM.Invert()) {
return DrawResult::SUCCESS; return;
} }
tm = ThebesMatrix(childrenOnlyTM) * tm; tm = ThebesMatrix(childrenOnlyTM) * tm;
} }
@ -550,7 +550,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
tm, aFrame->PresContext()). tm, aFrame->PresContext()).
ToOutsidePixels(appUnitsPerDevPx); ToOutsidePixels(appUnitsPerDevPx);
if (!aDirtyRect->Intersects(bounds)) { if (!aDirtyRect->Intersects(bounds)) {
return DrawResult::SUCCESS; return;
} }
} }
@ -583,7 +583,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
if (!isOK) { if (!isOK) {
// Some resource is invalid. We shouldn't paint anything. // Some resource is invalid. We shouldn't paint anything.
return DrawResult::SUCCESS; return;
} }
// These are used if we require a temporary surface for a custom blend mode. // These are used if we require a temporary surface for a custom blend mode.
@ -604,7 +604,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
if (maskFrame && !maskSurface) { if (maskFrame && !maskSurface) {
// Entire surface is clipped out. // Entire surface is clipped out.
return DrawResult::SUCCESS; return;
} }
aContext.Save(); aContext.Save();
@ -642,7 +642,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
target = gfxContext::CreateOrNull(targetDT); target = gfxContext::CreateOrNull(targetDT);
if (!target) { if (!target) {
gfxDevCrash(LogReason::InvalidContext) << "SVGPaintWithEffects context problem " << gfx::hexa(targetDT); gfxDevCrash(LogReason::InvalidContext) << "SVGPaintWithEffects context problem " << gfx::hexa(targetDT);
return DrawResult::TEMPORARY_ERROR; return;
} }
target->SetMatrix(aContext.CurrentMatrix() * gfxMatrix::Translation(-drawRect.TopLeft())); target->SetMatrix(aContext.CurrentMatrix() * gfxMatrix::Translation(-drawRect.TopLeft()));
targetOffset = drawRect.TopLeft(); targetOffset = drawRect.TopLeft();
@ -672,8 +672,6 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
clipPathFrame->ApplyClipPath(aContext, aFrame, aTransform); clipPathFrame->ApplyClipPath(aContext, aFrame, aTransform);
} }
DrawResult result = DrawResult::SUCCESS;
/* Paint the child */ /* Paint the child */
if (effectProperties.HasValidFilter()) { if (effectProperties.HasValidFilter()) {
nsRegion* dirtyRegion = nullptr; nsRegion* dirtyRegion = nullptr;
@ -683,7 +681,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
// it in frame space. // it in frame space.
gfxMatrix userToDeviceSpace = GetUserToCanvasTM(aFrame); gfxMatrix userToDeviceSpace = GetUserToCanvasTM(aFrame);
if (userToDeviceSpace.IsSingular()) { if (userToDeviceSpace.IsSingular()) {
return DrawResult::SUCCESS; return;
} }
gfxMatrix deviceToUserSpace = userToDeviceSpace; gfxMatrix deviceToUserSpace = userToDeviceSpace;
deviceToUserSpace.Invert(); deviceToUserSpace.Invert();
@ -701,7 +699,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
aTransform, &paintCallback, aTransform, &paintCallback,
dirtyRegion); dirtyRegion);
} else { } else {
result = svgChildFrame->PaintSVG(*target, aTransform, aDirtyRect); svgChildFrame->PaintSVG(*target, aTransform, aDirtyRect);
} }
if (clipPathFrame && isTrivialClip) { if (clipPathFrame && isTrivialClip) {
@ -710,7 +708,7 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
/* No more effects, we're done. */ /* No more effects, we're done. */
if (!complexEffects) if (!complexEffects)
return result; return;
if (opacity != 1.0f || maskFrame || (clipPathFrame && !isTrivialClip)) { if (opacity != 1.0f || maskFrame || (clipPathFrame && !isTrivialClip)) {
target->PopGroupAndBlend(); target->PopGroupAndBlend();
@ -728,7 +726,6 @@ nsSVGUtils::PaintFrameWithEffects(nsIFrame *aFrame,
} }
aContext.Restore(); aContext.Restore();
return result;
} }
bool bool
@ -1788,8 +1785,8 @@ nsSVGUtils::PaintSVGGlyph(Element* aElement, gfxContext* aContext,
m = static_cast<nsSVGElement*>(frame->GetContent())-> m = static_cast<nsSVGElement*>(frame->GetContent())->
PrependLocalTransformsTo(gfxMatrix(), eUserSpaceToParent); PrependLocalTransformsTo(gfxMatrix(), eUserSpaceToParent);
} }
DrawResult result = svgFrame->PaintSVG(*aContext, m); nsresult rv = svgFrame->PaintSVG(*aContext, m);
return (result == DrawResult::SUCCESS); return NS_SUCCEEDED(rv);
} }
bool bool

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

@ -185,7 +185,6 @@ public:
typedef mozilla::gfx::GeneralPattern GeneralPattern; typedef mozilla::gfx::GeneralPattern GeneralPattern;
typedef mozilla::gfx::Size Size; typedef mozilla::gfx::Size Size;
typedef mozilla::SVGTextContextPaint SVGTextContextPaint; typedef mozilla::SVGTextContextPaint SVGTextContextPaint;
typedef mozilla::image::DrawResult DrawResult;
static void Init(); static void Init();
@ -283,7 +282,7 @@ public:
/* Paint SVG frame with SVG effects - aDirtyRect is the area being /* Paint SVG frame with SVG effects - aDirtyRect is the area being
* redrawn, in device pixel coordinates relative to the outer svg */ * redrawn, in device pixel coordinates relative to the outer svg */
static DrawResult static void
PaintFrameWithEffects(nsIFrame *aFrame, PaintFrameWithEffects(nsIFrame *aFrame,
gfxContext& aContext, gfxContext& aContext,
const gfxMatrix& aTransform, const gfxMatrix& aTransform,