зеркало из https://github.com/mozilla/gecko-dev.git
Bug 746813: Check for context allocation failure before returning inverse transform. r=joedrew
This commit is contained in:
Родитель
cc2025237b
Коммит
f4717752cf
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body onload="document.getElementById('c').getContext('2d').mozCurrentTransformInverse;">
|
||||
<canvas id="c" width="772" height="76441"></canvas>
|
||||
</body>
|
||||
</html>
|
|
@ -6,6 +6,7 @@ load 0px-size-font-667225.html
|
|||
load texImage2D.html
|
||||
load 729116.html
|
||||
load 745699-1.html
|
||||
load 746813-1.html
|
||||
# this test crashes in a bunch places still
|
||||
#load 745818-large-source.html
|
||||
load 743499-negative-size.html
|
||||
|
|
|
@ -1541,6 +1541,9 @@ NS_IMETHODIMP
|
|||
nsCanvasRenderingContext2D::GetMozCurrentTransformInverse(JSContext* cx,
|
||||
jsval* matrix)
|
||||
{
|
||||
if (!EnsureSurface())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
gfxMatrix ctm = mThebes->CurrentMatrix();
|
||||
|
||||
if (!mThebes->CurrentMatrix().IsSingular()) {
|
||||
|
|
|
@ -1535,8 +1535,12 @@ nsCanvasRenderingContext2DAzure::Restore()
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2DAzure::Scale(float x, float y)
|
||||
{
|
||||
if (!FloatValidate(x,y))
|
||||
if (!mTarget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!FloatValidate(x,y)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
TransformWillUpdate();
|
||||
|
||||
|
@ -1548,8 +1552,12 @@ nsCanvasRenderingContext2DAzure::Scale(float x, float y)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2DAzure::Rotate(float angle)
|
||||
{
|
||||
if (!FloatValidate(angle))
|
||||
if (!mTarget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!FloatValidate(angle)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
TransformWillUpdate();
|
||||
|
||||
|
@ -1561,6 +1569,9 @@ nsCanvasRenderingContext2DAzure::Rotate(float angle)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2DAzure::Translate(float x, float y)
|
||||
{
|
||||
if (!mTarget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!FloatValidate(x,y)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1575,6 +1586,9 @@ nsCanvasRenderingContext2DAzure::Translate(float x, float y)
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2DAzure::Transform(float m11, float m12, float m21, float m22, float dx, float dy)
|
||||
{
|
||||
if (!mTarget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!FloatValidate(m11,m12,m21,m22,dx,dy)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1589,6 +1603,9 @@ nsCanvasRenderingContext2DAzure::Transform(float m11, float m12, float m21, floa
|
|||
NS_IMETHODIMP
|
||||
nsCanvasRenderingContext2DAzure::SetTransform(float m11, float m12, float m21, float m22, float dx, float dy)
|
||||
{
|
||||
if (!mTarget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (!FloatValidate(m11,m12,m21,m22,dx,dy)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1605,6 +1622,10 @@ NS_IMETHODIMP
|
|||
nsCanvasRenderingContext2DAzure::SetMozCurrentTransform(JSContext* cx,
|
||||
const jsval& matrix)
|
||||
{
|
||||
if (!mTarget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
Matrix newCTM;
|
||||
|
||||
|
@ -1621,6 +1642,10 @@ NS_IMETHODIMP
|
|||
nsCanvasRenderingContext2DAzure::GetMozCurrentTransform(JSContext* cx,
|
||||
jsval* matrix)
|
||||
{
|
||||
if (!mTarget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return MatrixToJSVal(mTarget->GetTransform(), cx, matrix);
|
||||
}
|
||||
|
||||
|
@ -1628,6 +1653,10 @@ NS_IMETHODIMP
|
|||
nsCanvasRenderingContext2DAzure::SetMozCurrentTransformInverse(JSContext* cx,
|
||||
const jsval& matrix)
|
||||
{
|
||||
if (!mTarget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
Matrix newCTMInverse;
|
||||
|
||||
|
@ -1647,6 +1676,10 @@ NS_IMETHODIMP
|
|||
nsCanvasRenderingContext2DAzure::GetMozCurrentTransformInverse(JSContext* cx,
|
||||
jsval* matrix)
|
||||
{
|
||||
if (!mTarget) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
Matrix ctm = mTarget->GetTransform();
|
||||
|
||||
if (!ctm.Invert()) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче