mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-10 17:24:29 +00:00
Backout Bug 578309 due to mochitest failures
This commit is contained in:
parent
03cd1f62f1
commit
d8318c4a74
@ -104,6 +104,21 @@ NS_IMETHODIMP nsSVGForeignObjectElement::GetHeight(nsIDOMSVGAnimatedLength * *aH
|
||||
return mLengthAttributes[HEIGHT].ToDOMAnimatedLength(aHeight, this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
/* virtual */ gfxMatrix
|
||||
nsSVGForeignObjectElement::PrependLocalTransformTo(const gfxMatrix &aMatrix)
|
||||
{
|
||||
// 'transform' attribute:
|
||||
gfxMatrix matrix = nsSVGForeignObjectElementBase::PrependLocalTransformTo(aMatrix);
|
||||
|
||||
// now translate by our 'x' and 'y':
|
||||
float x, y;
|
||||
GetAnimatedLengthValues(&x, &y, nsnull);
|
||||
return gfxMatrix().Translate(gfxPoint(x, y)) * matrix;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
|
@ -66,6 +66,9 @@ public:
|
||||
NS_FORWARD_NSIDOMELEMENT(nsSVGForeignObjectElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGForeignObjectElementBase::)
|
||||
|
||||
// nsSVGElement specializations:
|
||||
virtual gfxMatrix PrependLocalTransformTo(const gfxMatrix &aMatrix);
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHOD_(PRBool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
|
@ -26,7 +26,6 @@ include svg-integration/reftest.list
|
||||
== clipPath-basic-02.svg pass.svg
|
||||
== clipPath-basic-03.svg pass.svg
|
||||
== clipPath-basic-04.svg pass.svg
|
||||
== clipPath-basic-05.svg pass.svg
|
||||
== clipPath-winding-01.svg pass.svg
|
||||
== clip-surface-clone-01.svg clip-surface-clone-01-ref.svg
|
||||
== conditions-01.svg pass.svg
|
||||
|
@ -206,11 +206,12 @@ nsSVGForeignObjectFrame::PaintSVG(nsSVGRenderState *aContext,
|
||||
if (!kid)
|
||||
return NS_OK;
|
||||
|
||||
gfxMatrix matrix = GetCanvasTMWithTranslation();
|
||||
gfxMatrix matrixForChildren = GetCanvasTMForChildren();
|
||||
gfxMatrix matrix = GetCanvasTM();
|
||||
|
||||
nsIRenderingContext *ctx = aContext->GetRenderingContext(this);
|
||||
|
||||
if (!ctx || matrix.IsSingular()) {
|
||||
if (!ctx || matrixForChildren.IsSingular()) {
|
||||
NS_WARNING("Can't render foreignObject element!");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
@ -236,7 +237,7 @@ nsSVGForeignObjectFrame::PaintSVG(nsSVGRenderState *aContext,
|
||||
nsSVGUtils::SetClipRect(gfx, matrix, clipRect);
|
||||
}
|
||||
|
||||
gfx->Multiply(GetScaledMatrixForChildren(matrix));
|
||||
gfx->Multiply(matrixForChildren);
|
||||
|
||||
// Transform the dirty rect into the rectangle containing the
|
||||
// transformed dirty rect.
|
||||
@ -276,7 +277,7 @@ nsSVGForeignObjectFrame::GetTransformMatrix(nsIFrame **aOutAncestor)
|
||||
NS_ASSERTION(*aOutAncestor, "How did we end up without an outer frame?");
|
||||
|
||||
/* Return the matrix back to the root, factoring in the x and y offsets. */
|
||||
return GetScaledMatrixForChildren(GetCanvasTMWithTranslation());
|
||||
return GetCanvasTMForChildren();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsIFrame*)
|
||||
@ -289,7 +290,11 @@ nsSVGForeignObjectFrame::GetFrameForPoint(const nsPoint &aPoint)
|
||||
if (!kid)
|
||||
return nsnull;
|
||||
|
||||
gfxMatrix tm = GetCanvasTMWithTranslation().Invert();
|
||||
float x, y, width, height;
|
||||
static_cast<nsSVGElement*>(mContent)->
|
||||
GetAnimatedLengthValues(&x, &y, &width, &height, nsnull);
|
||||
|
||||
gfxMatrix tm = GetCanvasTM().Invert();
|
||||
if (tm.IsSingular())
|
||||
return nsnull;
|
||||
|
||||
@ -298,10 +303,6 @@ nsSVGForeignObjectFrame::GetFrameForPoint(const nsPoint &aPoint)
|
||||
gfxPoint pt = gfxPoint(aPoint.x, aPoint.y) / PresContext()->AppUnitsPerDevPixel();
|
||||
pt = tm.Transform(pt);
|
||||
|
||||
float x, y, width, height;
|
||||
static_cast<nsSVGElement*>(mContent)->
|
||||
GetAnimatedLengthValues(&x, &y, &width, &height, nsnull);
|
||||
|
||||
if (!gfxRect(0.0f, 0.0f, width, height).Contains(pt))
|
||||
return nsnull;
|
||||
|
||||
@ -337,8 +338,8 @@ nsSVGForeignObjectFrame::UpdateCoveredRegion()
|
||||
if (w < 0.0f) w = 0.0f;
|
||||
if (h < 0.0f) h = 0.0f;
|
||||
|
||||
mRect = ToCanvasBounds(gfxRect(0.0, 0.0, w, h), GetCanvasTMWithTranslation(),
|
||||
PresContext());
|
||||
// GetCanvasTM includes the x,y translation
|
||||
mRect = ToCanvasBounds(gfxRect(0.0, 0.0, w, h), GetCanvasTM(), PresContext());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -452,9 +453,11 @@ nsSVGForeignObjectFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace)
|
||||
NS_ASSERTION(!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
|
||||
"Should not be calling this on a non-display child");
|
||||
|
||||
nsSVGForeignObjectElement *content =
|
||||
static_cast<nsSVGForeignObjectElement*>(mContent);
|
||||
|
||||
float x, y, w, h;
|
||||
static_cast<nsSVGForeignObjectElement*>(mContent)->
|
||||
GetAnimatedLengthValues(&x, &y, &w, &h, nsnull);
|
||||
content->GetAnimatedLengthValues(&x, &y, &w, &h, nsnull);
|
||||
|
||||
if (w < 0.0f) w = 0.0f;
|
||||
if (h < 0.0f) h = 0.0f;
|
||||
@ -489,22 +492,12 @@ nsSVGForeignObjectFrame::GetCanvasTM()
|
||||
// Implementation helpers
|
||||
|
||||
gfxMatrix
|
||||
nsSVGForeignObjectFrame::GetCanvasTMWithTranslation()
|
||||
{
|
||||
float x, y;
|
||||
static_cast<nsSVGElement*>(mContent)->
|
||||
GetAnimatedLengthValues(&x, &y, nsnull);
|
||||
|
||||
return (gfxMatrix().Translate(gfxPoint(x, y)) * GetCanvasTM());
|
||||
}
|
||||
|
||||
gfxMatrix
|
||||
nsSVGForeignObjectFrame::GetScaledMatrixForChildren(gfxMatrix canvasTMWithTranslation) const
|
||||
nsSVGForeignObjectFrame::GetCanvasTMForChildren()
|
||||
{
|
||||
float cssPxPerDevPx = PresContext()->
|
||||
AppUnitsToFloatCSSPixels(PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
return canvasTMWithTranslation.Scale(cssPxPerDevPx, cssPxPerDevPx);
|
||||
return GetCanvasTM().Scale(cssPxPerDevPx, cssPxPerDevPx);
|
||||
}
|
||||
|
||||
void nsSVGForeignObjectFrame::RequestReflow(nsIPresShell::IntrinsicDirty aType)
|
||||
@ -637,7 +630,7 @@ nsSVGForeignObjectFrame::InvalidateDirtyRect(nsSVGOuterSVGFrame* aOuter,
|
||||
gfxRect r(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
r.Scale(1.0 / nsPresContext::AppUnitsPerCSSPixel());
|
||||
|
||||
nsRect rect = ToCanvasBounds(r, GetCanvasTMWithTranslation(), PresContext());
|
||||
nsRect rect = ToCanvasBounds(r, GetCanvasTM(), PresContext());
|
||||
|
||||
// Don't invalidate areas outside our bounds:
|
||||
rect.IntersectRect(rect, mRect);
|
||||
|
@ -145,10 +145,9 @@ protected:
|
||||
void RequestReflow(nsIPresShell::IntrinsicDirty aType);
|
||||
void UpdateGraphic();
|
||||
|
||||
gfxMatrix GetCanvasTMWithTranslation();
|
||||
// Scale TM from CSS px to Dev px. Used for painting, because children
|
||||
// expect to paint to device space, not userspace.
|
||||
gfxMatrix GetScaledMatrixForChildren(gfxMatrix canvasTMWithTranslation) const;
|
||||
// Returns GetCanvasTM followed by a scale from CSS px to Dev px. Used for
|
||||
// painting, because children expect to paint to device space, not userspace.
|
||||
gfxMatrix GetCanvasTMForChildren();
|
||||
void InvalidateDirtyRect(nsSVGOuterSVGFrame* aOuter,
|
||||
const nsRect& aRect, PRUint32 aFlags);
|
||||
void FlushDirtyRegion();
|
||||
|
Loading…
x
Reference in New Issue
Block a user