Bug 748113; fallback to an Azure canvas with different backend, rather than Thebes canvas. r=Bas

--HG--
extra : rebase_source : c6f0b9cc0c8ebd3963ec44283d55bcaba1097e08
This commit is contained in:
Nicholas Cameron 2012-04-26 10:04:36 +12:00
parent 76eb10e75c
commit eba282b1d5
2 changed files with 4 additions and 17 deletions

View File

@ -168,7 +168,6 @@ protected:
const nsAString& aType,
nsIDOMFile** aResult);
nsresult GetContextHelper(const nsAString& aContextId,
bool aForceThebes,
nsICanvasRenderingContextInternal **aContext);
void CallPrintCallback();

View File

@ -601,7 +601,6 @@ nsHTMLCanvasElement::MozGetAsFileImpl(const nsAString& aName,
nsresult
nsHTMLCanvasElement::GetContextHelper(const nsAString& aContextId,
bool aForceThebes,
nsICanvasRenderingContextInternal **aContext)
{
NS_ENSURE_ARG(aContext);
@ -624,10 +623,6 @@ nsHTMLCanvasElement::GetContextHelper(const nsAString& aContextId,
nsCString ctxString("@mozilla.org/content/canvas-rendering-context;1?id=");
ctxString.Append(ctxId);
if (aForceThebes && ctxId.EqualsASCII("2d")) {
ctxString.AssignASCII("@mozilla.org/content/2dthebes-canvas-rendering-context;1");
}
nsresult rv;
nsCOMPtr<nsICanvasRenderingContextInternal> ctx =
do_CreateInstance(ctxString.get(), &rv);
@ -653,10 +648,8 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
{
nsresult rv;
bool forceThebes = false;
while (mCurrentContextId.IsEmpty()) {
rv = GetContextHelper(aContextId, forceThebes, getter_AddRefs(mCurrentContext));
if (mCurrentContextId.IsEmpty()) {
rv = GetContextHelper(aContextId, getter_AddRefs(mCurrentContext));
NS_ENSURE_SUCCESS(rv, rv);
if (!mCurrentContext) {
return NS_OK;
@ -720,17 +713,12 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
rv = UpdateContext(contextProps);
if (NS_FAILED(rv)) {
if (!forceThebes) {
// Try again with a Thebes context
forceThebes = true;
continue;
}
return rv;
}
mCurrentContextId.Assign(aContextId);
break;
}
if (!mCurrentContextId.Equals(aContextId)) {
//XXX eventually allow for more than one active context on a given canvas
return NS_OK;
@ -754,7 +742,7 @@ nsHTMLCanvasElement::MozGetIPCContext(const nsAString& aContextId,
return NS_ERROR_INVALID_ARG;
if (mCurrentContextId.IsEmpty()) {
nsresult rv = GetContextHelper(aContextId, false, getter_AddRefs(mCurrentContext));
nsresult rv = GetContextHelper(aContextId, getter_AddRefs(mCurrentContext));
NS_ENSURE_SUCCESS(rv, rv);
if (!mCurrentContext) {
return NS_OK;