diff --git a/mozilla/layout/style/nsComputedDOMStyle.cpp b/mozilla/layout/style/nsComputedDOMStyle.cpp index 312a53601bd..2769bafeee2 100644 --- a/mozilla/layout/style/nsComputedDOMStyle.cpp +++ b/mozilla/layout/style/nsComputedDOMStyle.cpp @@ -2012,43 +2012,53 @@ nsresult nsComputedDOMStyle::GetCursor(nsIFrame *aFrame, nsIDOMCSSValue** aValue) { - nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); - NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY); + nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE); + NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY); const nsStyleUserInterface *ui = nsnull; GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)ui, aFrame); if (ui) { - PRBool found = PR_FALSE; PRInt32 count = ui->mCursorArray.Count(); for (PRInt32 i = 0; i < count; i++) { - PRUint32 status; - nsresult rv = ui->mCursorArray[i]->GetImageStatus(&status); - if (NS_SUCCEEDED(rv) && (status & imgIRequest::STATUS_FRAME_COMPLETE)) { - // This is the one we want - nsCOMPtr uri; - ui->mCursorArray[i]->GetURI(getter_AddRefs(uri)); - if (uri) { - val->SetURI(uri); - found = PR_TRUE; - break; - } + nsCOMPtr uri; + ui->mCursorArray[i]->GetURI(getter_AddRefs(uri)); + + nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); + if (!val) { + delete valueList; + return NS_ERROR_OUT_OF_MEMORY; + } + val->SetURI(uri); + if (!valueList->AppendCSSValue(val)) { + delete valueList; + delete val; + return NS_ERROR_OUT_OF_MEMORY; } } - if (!found) { - if (ui->mCursor == NS_STYLE_CURSOR_AUTO) { - val->SetIdent(nsLayoutAtoms::autoAtom); - } else { - const nsAFlatCString& cursor = - nsCSSProps::ValueToKeyword(ui->mCursor, - nsCSSProps::kCursorKTable); - val->SetIdent(cursor); - } + nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue(); + if (!val) { + delete valueList; + return NS_ERROR_OUT_OF_MEMORY; + } + + if (ui->mCursor == NS_STYLE_CURSOR_AUTO) { + val->SetIdent(nsLayoutAtoms::autoAtom); + } else { + const nsAFlatCString& cursor = + nsCSSProps::ValueToKeyword(ui->mCursor, + nsCSSProps::kCursorKTable); + val->SetIdent(cursor); + } + if (!valueList->AppendCSSValue(val)) { + delete valueList; + delete val; + return NS_ERROR_OUT_OF_MEMORY; } } - return CallQueryInterface(val, aValue); + return CallQueryInterface(valueList, aValue); } nsresult diff --git a/mozilla/layout/style/nsDOMCSSValueList.h b/mozilla/layout/style/nsDOMCSSValueList.h index 968a4df8c16..1e7315b5eee 100644 --- a/mozilla/layout/style/nsDOMCSSValueList.h +++ b/mozilla/layout/style/nsDOMCSSValueList.h @@ -59,6 +59,11 @@ public: nsDOMCSSValueList(PRBool aCommaDelimited, PRBool aReadonly); virtual ~nsDOMCSSValueList(); + /** + * Adds a value to this list. + * @retval PR_TRUE Adding the value succeeded + * @retval PR_FALSE The value could not be added (Out of memory) + */ PRBool AppendCSSValue(nsIDOMCSSValue* aValue); private: