зеркало из https://github.com/mozilla/gecko-dev.git
Bug 343156 New ATK: expose new action for images, to open long description
in a new tab patch by nian.liu at sun.com r=aaronleventhal sr=neil
This commit is contained in:
Родитель
fc2834f355
Коммит
6950966214
|
@ -47,6 +47,9 @@
|
|||
#include "nsIImageLoadingContent.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
// --- image -----
|
||||
|
||||
|
@ -210,3 +213,26 @@ void nsHTMLImageAccessible::CacheChildren()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLImageAccessible::DoAction(PRUint8 index)
|
||||
{
|
||||
if (index == eAction_ShowLongDescription) {
|
||||
//get the long description uri and open in a new window
|
||||
nsCOMPtr<nsIDOMHTMLImageElement> element(do_QueryInterface(mDOMNode));
|
||||
NS_ENSURE_TRUE(element, NS_ERROR_FAILURE);
|
||||
nsAutoString longDesc;
|
||||
nsresult rv = element->GetLongDesc(longDesc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDOMDocument> domDocument;
|
||||
rv = mDOMNode->GetOwnerDocument(getter_AddRefs(domDocument));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
|
||||
nsCOMPtr<nsPIDOMWindow> piWindow = document->GetWindow();
|
||||
nsCOMPtr<nsIDOMWindowInternal> win(do_QueryInterface(piWindow));
|
||||
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIDOMWindow> tmp;
|
||||
return win->Open(longDesc, NS_LITERAL_STRING(""), NS_LITERAL_STRING(""),
|
||||
getter_AddRefs(tmp));
|
||||
}
|
||||
return nsLinkableAccessible::DoAction(index);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ public:
|
|||
NS_IMETHOD GetName(nsAString& _retval);
|
||||
NS_IMETHOD GetState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetRole(PRUint32 *_retval);
|
||||
NS_IMETHOD DoAction(PRUint8 index);
|
||||
|
||||
protected:
|
||||
virtual void CacheChildren();
|
||||
|
|
Загрузка…
Ссылка в новой задаче