Bug 185852. Active Accessibility: add ISimpleDOMText::get_fontFamily() to return single font name. Rev'd ISimpleDOMText IID. r=pkw, sr=roc

This commit is contained in:
aaronleventhal%moonset.net 2004-08-02 12:28:50 +00:00
Родитель 5d8f8fea9a
Коммит 603ab51c34
5 изменённых файлов: 66 добавлений и 5 удалений

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

@ -47,7 +47,7 @@ cpp_quote("// An interface that extends MSAA's IAccessible to provide important
cpp_quote("//")
cpp_quote("// @STATUS UNDER_REVIEW")
cpp_quote("//")
cpp_quote("// get_domText(/* out */ BSTR *domText")
cpp_quote("// [propget] domText(/* out,retval */ BSTR *domText")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Similar to IAccessible::get_accName, but does not strip out whitespace characters.")
cpp_quote("// Important for retrieving the correct start/end substring indices to use with other")
@ -76,11 +76,16 @@ cpp_quote("// The in parameters for start and end indices refer to the string re
cpp_quote("// by ISimpleDOMText::get_domText().")
cpp_quote("//")
cpp_quote("//")
cpp_quote("// [propget] fontFamily(/* out,retval */ BSTR *fontFamily);")
cpp_quote("// ---------------------------------------------------------------------------------------------------=")
cpp_quote("// Return a single computed font family name, which is better than the comma delineated list")
cpp_quote("// that is returned by the ISimpleDOMNode computed style methods for font-family.")
cpp_quote("// In other words, return something like 'Arial' instead of 'Arial, Helvetica, Sans-serif'.")
cpp_quote("///////////////////////////////////////////////////////////////////////////////////////////////////////")
cpp_quote("")
cpp_quote("")
[object, uuid(aa24e510-a4e6-4112-a258-0ba7f12e85a9)]
[object, uuid(4e747be5-2052-4265-8af0-8ecad7aad1c0)]
interface ISimpleDOMText: IUnknown
{
// Includes whitespace in DOM
@ -102,5 +107,7 @@ interface ISimpleDOMText: IUnknown
HRESULT scrollToSubstring([in] unsigned int startIndex,
[in] unsigned int endIndex);
[propget] HRESULT fontFamily([out, retval] BSTR *fontFamily);
};

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

@ -242,7 +242,9 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireToolkitEvent(PRUint32 aEvent, nsIAccessib
GUITHREADINFO guiInfo;
guiInfo.cbSize = sizeof(GUITHREADINFO);
if (gmGetGUIThreadInfo(NULL, &guiInfo)) {
hWnd = guiInfo.hwndFocus;
if (hWnd != guiInfo.hwndFocus) {
hWnd = guiInfo.hwndFocus;
}
}
}

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

@ -43,6 +43,7 @@
#include "nsContentCID.h"
#include "nsIAccessibleDocument.h"
#include "nsIDOMRange.h"
#include "nsIFontMetrics.h"
#include "nsIFrame.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
@ -265,3 +266,51 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32
return NS_OK;
}
STDMETHODIMP nsTextAccessibleWrap::get_fontFamily(
/* [retval][out] */ BSTR __RPC_FAR *aFontFamily)
{
nsIFrame *frame = GetFrame();
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
if (!frame || !presShell) {
return E_FAIL;
}
nsCOMPtr<nsIRenderingContext> rc;
presShell->CreateRenderingContext(frame, getter_AddRefs(rc));
if (!rc) {
return E_FAIL;
}
const nsStyleFont *font = frame->GetStyleFont();
const nsStyleVisibility *visibility = frame->GetStyleVisibility();
if (NS_FAILED(rc->SetFont(font->mFont, visibility->mLangGroup))) {
return E_FAIL;
}
nsCOMPtr<nsIDeviceContext> deviceContext;
rc->GetDeviceContext(*getter_AddRefs(deviceContext));
if (!deviceContext) {
return E_FAIL;
}
nsIFontMetrics *fm;
rc->GetFontMetrics(fm);
if (!fm) {
return E_FAIL;
}
const nsFont *actualFont = nsnull;
fm->GetFont(actualFont);
if (!actualFont) {
return E_FAIL;
}
nsAutoString fontFamily;
deviceContext->FirstExistingFont(*actualFont, fontFamily);
*aFontFamily = ::SysAllocString(fontFamily.get());
return S_OK;
}

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

@ -83,6 +83,9 @@ class nsTextAccessibleWrap : public nsTextAccessible,
/* [in] */ unsigned int startIndex,
/* [in] */ unsigned int endIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_fontFamily(
/* [retval][out] */ BSTR __RPC_FAR *fontFamily);
protected:
nsresult GetCharacterExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
PRInt32* aX, PRInt32* aY,

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

@ -465,10 +465,10 @@ NS_IMETHODIMP nsXULTreeitemAccessible::GetRole(PRUint32 *_retval)
// Possible states: focused, focusable, selected, expanded/collapsed
NS_IMETHODIMP nsXULTreeitemAccessible::GetState(PRUint32 *_retval)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
*_retval = STATE_FOCUSABLE | STATE_SELECTABLE;
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
// get expanded/collapsed state
PRBool isContainer, isContainerOpen, isContainerEmpty;
mTreeView->IsContainer(mRow, &isContainer);