bug257739 [ATK] Can't read the title name of windows/dialogs

p  = Philip K. Warren (IBM)
r  = aaronleventhal
sr = jst
This commit is contained in:
louie.zhao%sun.com 2005-02-01 08:50:50 +00:00
Родитель fdb1ec2bd5
Коммит 13fd081406
5 изменённых файлов: 45 добавлений и 13 удалений

Просмотреть файл

@ -65,6 +65,11 @@
#include "nsPIDOMWindow.h"
#include "nsReadableUtils.h"
#include "nsRootAccessible.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIBaseWindow.h"
#ifdef MOZ_XUL
#include "nsXULTreeAccessible.h"
#include "nsIXULDocument.h"
@ -108,6 +113,37 @@ nsRootAccessible::~nsRootAccessible()
}
// helpers
/* readonly attribute AString name; */
NS_IMETHODIMP nsRootAccessible::GetName(nsAString& aName)
{
if (!mDocument) {
return NS_ERROR_FAILURE;
}
nsIScriptGlobalObject *globalScript = mDocument->GetScriptGlobalObject();
nsIDocShell *docShell = nsnull;
if (globalScript) {
docShell = globalScript->GetDocShell();
}
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(docShell));
if(!docShellAsItem)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
nsCOMPtr<nsIBaseWindow> baseWindow(do_QueryInterface(treeOwner));
if (baseWindow) {
nsXPIDLString title;
baseWindow->GetTitle(getter_Copies(title));
aName.Assign(title);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/* readonly attribute nsIAccessible accParent; */
NS_IMETHODIMP nsRootAccessible::GetParent(nsIAccessible * *aParent)
{

Просмотреть файл

@ -63,7 +63,7 @@ class nsRootAccessible : public nsDocAccessibleWrap,
nsRootAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell);
virtual ~nsRootAccessible();
/* attribute wstring accName; */
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetParent(nsIAccessible * *aParent);
NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetState(PRUint32 *aState);

Просмотреть файл

@ -596,9 +596,7 @@ NS_IMETHODIMP nsContentTreeOwner::GetTitle(PRUnichar** aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);
//XXX First Check In
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
return NS_OK;
return mXULWindow->GetTitle(aTitle);
}
NS_IMETHODIMP nsContentTreeOwner::SetTitle(const PRUnichar* aTitle)
@ -629,9 +627,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetTitle(const PRUnichar* aTitle)
else
title.Assign(mWindowTitleModifier); // Title will just be plain "Mozilla"
// XXX Don't need to fully qualify this once I remove nsWebShellWindow::SetTitle
// return mXULWindow->SetTitle(title.get());
return mXULWindow->nsXULWindow::SetTitle(title.get());
return mXULWindow->SetTitle(title.get());
}
//*****************************************************************************

Просмотреть файл

@ -821,18 +821,17 @@ NS_IMETHODIMP nsXULWindow::GetTitle(PRUnichar** aTitle)
{
NS_ENSURE_ARG_POINTER(aTitle);
//XXX First Check In
NS_ASSERTION(PR_FALSE, "Not Yet Implemented");
*aTitle = ToNewUnicode(mTitle);
if (!*aTitle)
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
NS_IMETHODIMP nsXULWindow::SetTitle(const PRUnichar* aTitle)
{
NS_ENSURE_STATE(mWindow);
nsAutoString title(aTitle);
NS_ENSURE_SUCCESS(mWindow->SetTitle(title), NS_ERROR_FAILURE);
mTitle.Assign(aTitle);
NS_ENSURE_SUCCESS(mWindow->SetTitle(mTitle), NS_ERROR_FAILURE);
// Tell the window mediator that a title has changed
nsCOMPtr<nsIWindowMediator> windowMediator(do_GetService(kWindowMediatorCID));

Просмотреть файл

@ -154,6 +154,7 @@ protected:
PRUint32 mBlurSuppressionLevel;
PRUint32 mPersistentAttributesDirty; // persistentAttributes
PRUint32 mPersistentAttributesMask;
nsString mTitle;
};
// nsContentShellInfo