зеркало из https://github.com/mozilla/pjs.git
Bug 242594. Expose list and list item objects, and bullet text. r=Louie.Zhao, sr=jst/dbaron
This commit is contained in:
Родитель
60c0074729
Коммит
f452943730
|
@ -55,6 +55,8 @@ interface nsIAccessibilityService : nsIAccessibleRetrieval
|
|||
nsIAccessible createHTMLBlockAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLButtonAccessibleXBL(in nsIDOMNode aNode);
|
||||
nsIAccessible createHTMLAccessibleByMarkup(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLLIAccessible(in nsISupports aFrame, in nsISupports aBulletFrame, in AString aBulletText);
|
||||
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
|
||||
nsIAccessible createHTMLCheckboxAccessibleXBL(in nsIDOMNode aNode);
|
||||
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
|
||||
|
|
|
@ -60,3 +60,11 @@ ACCESSIBILITY_ATOM(blockFrame, "BlockFrame")
|
|||
ACCESSIBILITY_ATOM(inlineFrame, "InlineFrame")
|
||||
ACCESSIBILITY_ATOM(objectFrame, "ObjectFrame")
|
||||
ACCESSIBILITY_ATOM(textFrame, "TextFrame")
|
||||
|
||||
// Alphabetical list of tag names
|
||||
ACCESSIBILITY_ATOM(a, "a")
|
||||
ACCESSIBILITY_ATOM(ol, "ol")
|
||||
ACCESSIBILITY_ATOM(optgroup, "optgroup")
|
||||
ACCESSIBILITY_ATOM(option, "option")
|
||||
ACCESSIBILITY_ATOM(ul, "ul")
|
||||
|
||||
|
|
|
@ -416,6 +416,69 @@ nsAccessibilityService::CreateHTMLButtonAccessibleXBL(nsIDOMNode *aNode, nsIAcce
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsISupports *aFrame,
|
||||
nsIAccessible **aAccessible)
|
||||
{
|
||||
// Frame type was generic, we'll use the DOM to decide
|
||||
// if and what kind of accessible object is needed.
|
||||
// This method assumes we're in an HTML namespace.
|
||||
*aAccessible = nsnull;
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsIContent *content = frame->GetContent();
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
|
||||
|
||||
nsIAtom *tag = content->Tag();
|
||||
if (tag == nsAccessibilityAtoms::option) {
|
||||
*aAccessible = new nsHTMLSelectOptionAccessible(node, weakShell);
|
||||
}
|
||||
else if (tag == nsAccessibilityAtoms::optgroup) {
|
||||
*aAccessible = new nsHTMLSelectOptGroupAccessible(node, weakShell);
|
||||
}
|
||||
#ifndef MOZ_ACCESSIBILITY_ATK
|
||||
else if (tag == nsAccessibilityAtoms::ul || tag == nsAccessibilityAtoms::ol) {
|
||||
*aAccessible = new nsHTMLListAccessible(node, weakShell);
|
||||
}
|
||||
else if (tag == nsAccessibilityAtoms::a) {
|
||||
*aAccessible = new nsHTMLLinkAccessible(node, weakShell, frame);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(aAccessible, NS_ERROR_OUT_OF_MEMORY);
|
||||
NS_ADDREF(*aAccessible);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLLIAccessible(nsISupports *aFrame,
|
||||
nsISupports *aBulletFrame,
|
||||
const nsAString& aBulletText,
|
||||
nsIAccessible **_retval)
|
||||
{
|
||||
nsIFrame* frame;
|
||||
nsCOMPtr<nsIDOMNode> node;
|
||||
nsCOMPtr<nsIWeakReference> weakShell;
|
||||
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsIFrame *bulletFrame = NS_STATIC_CAST(nsIFrame*, aBulletFrame);
|
||||
NS_ASSERTION(bulletFrame, "bullet frame argument not a frame");
|
||||
|
||||
*_retval = new nsHTMLLIAccessible(node, weakShell, bulletFrame, aBulletText);
|
||||
if (! *_retval)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(*_retval);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAccessible **_retval)
|
||||
{
|
||||
|
@ -1566,7 +1629,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
// Please leave this in for now, it's a convenient debugging method
|
||||
nsAutoString name;
|
||||
aNode->GetLocalName(name);
|
||||
if (name.EqualsIgnoreCase("browser"))
|
||||
if (name.EqualsIgnoreCase("ol"))
|
||||
printf("## aaronl debugging tag name\n");
|
||||
|
||||
nsAutoString attrib;
|
||||
|
@ -1653,6 +1716,13 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
printf("* "); // Aaron's break point
|
||||
}
|
||||
#endif
|
||||
if (frame->GetContent() != content) {
|
||||
// Not the main content for this frame!
|
||||
// For example, this happens because <area> elements return the
|
||||
// image frame as their primary frame. The main content for the
|
||||
// image frame is the image content.
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
*aFrameHint = frame;
|
||||
}
|
||||
}
|
||||
|
@ -1665,17 +1735,20 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to create an accessible based on what we know
|
||||
*/
|
||||
if (content->IsContentOfType(nsIContent::eTEXT)) {
|
||||
// ---- Try using frame to get nsIAccessible ----
|
||||
// --- Create HTML for visible text frames ---
|
||||
nsSize frameSize = frame->GetSize();
|
||||
if (frameSize.height == 0 || frameSize.width == 0) {
|
||||
*aIsHidden = true;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
frame->GetAccessible(getter_AddRefs(newAcc));
|
||||
return InitAccessible(newAcc, aAccessible);
|
||||
}
|
||||
else if (!content->IsContentOfType(nsIContent::eHTML)) {
|
||||
// --- Try creating accessible non-HTML (XUL, etc.) ---
|
||||
// XUL elements may implement nsIAccessibleProvider via XBL
|
||||
// This allows them to say what kind of accessible to create
|
||||
nsCOMPtr<nsIAccessibleProvider> accProv(do_QueryInterface(aNode));
|
||||
|
@ -1684,42 +1757,14 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
if (!accProv)
|
||||
return NS_ERROR_FAILURE;
|
||||
accProv->GetAccessible(getter_AddRefs(newAcc));
|
||||
return InitAccessible(newAcc, aAccessible);
|
||||
}
|
||||
|
||||
// ---- Check if area node ----
|
||||
nsCOMPtr<nsIDOMHTMLAreaElement> areaContent(do_QueryInterface(aNode));
|
||||
if (areaContent) // Area elements are implemented in nsHTMLImageAccessible as children of the image
|
||||
return NS_ERROR_FAILURE; // Return, otherwise the image frame looks like an accessible object in the wrong place
|
||||
|
||||
// ---- Try using frame to get nsIAccessible ----
|
||||
frame->GetAccessible(getter_AddRefs(newAcc));
|
||||
|
||||
#ifndef MOZ_ACCESSIBILITY_ATK
|
||||
// ---- If link, create link accessible ----
|
||||
if (!newAcc) {
|
||||
// is it a link?
|
||||
nsCOMPtr<nsILink> link(do_QueryInterface(aNode));
|
||||
if (link) {
|
||||
newAcc = new nsHTMLLinkAccessible(aNode, aWeakShell, frame);
|
||||
}
|
||||
}
|
||||
#endif //MOZ_ACCESSIBILITY_ATK
|
||||
|
||||
// ---- If <select> <option>, create select option accessible
|
||||
|
||||
if (!newAcc) {
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement(do_QueryInterface(aNode));
|
||||
if (optionElement) {
|
||||
newAcc = new nsHTMLSelectOptionAccessible(aNode, aWeakShell);
|
||||
}
|
||||
}
|
||||
// See if this is an <optgroup>,
|
||||
// create the accessible for the optgroup.
|
||||
if (!newAcc) {
|
||||
nsCOMPtr<nsIDOMHTMLOptGroupElement> optGroupElement(do_QueryInterface(aNode));
|
||||
if (optGroupElement) {
|
||||
newAcc = new nsHTMLSelectOptGroupAccessible(aNode, aWeakShell);
|
||||
else {
|
||||
// --- Try creating accessible for HTML ---
|
||||
frame->GetAccessible(getter_AddRefs(newAcc)); // Try using frame to do it
|
||||
if (!newAcc) {
|
||||
// Use markup (mostly tag name, perhaps attributes) to
|
||||
// decide if and what kind of accessible to create.
|
||||
CreateHTMLAccessibleByMarkup(frame, getter_AddRefs(newAcc));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -259,7 +259,8 @@ NS_IMETHODIMP nsAccessible::GetParent(nsIAccessible ** aParent)
|
|||
// Last argument of PR_TRUE indicates to walk anonymous content
|
||||
nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, PR_TRUE);
|
||||
if (NS_SUCCEEDED(walker.GetParent())) {
|
||||
*aParent = mParent = walker.mState.accessible;
|
||||
*aParent = walker.mState.accessible;
|
||||
SetParent(*aParent); // Cache it, unless perhaps accessible class overrides SetParent
|
||||
NS_ADDREF(*aParent);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ protected:
|
|||
void GetScrollOffset(nsRect *aRect);
|
||||
void GetScreenOrigin(nsIPresContext *aPresContext, nsIFrame *aFrame, nsRect *aRect);
|
||||
nsresult AppendFlatStringFromSubtreeRecurse(nsIContent *aContent, nsAString *aFlatString);
|
||||
virtual void CacheChildren(PRBool aWalkNormalDOM);
|
||||
virtual void CacheChildren(PRBool aWalkAnonContent);
|
||||
|
||||
// Data Members
|
||||
nsCOMPtr<nsIAccessible> mParent;
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsHTMLTextAccessible.h"
|
||||
#include "nsAccessibleTreeWalker.h"
|
||||
#include "nsBulletFrame.h"
|
||||
#include "nsIAccessibleDocument.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -62,10 +64,13 @@ NS_IMETHODIMP nsHTMLTextAccessible::GetName(nsAString& aName)
|
|||
|
||||
nsIFrame* nsHTMLTextAccessible::GetFrame()
|
||||
{
|
||||
if (mWeakShell) {
|
||||
return mFrame? mFrame : nsTextAccessible::GetFrame();
|
||||
if (!mWeakShell) {
|
||||
return nsnull;
|
||||
}
|
||||
return nsnull;
|
||||
if (!mFrame) {
|
||||
mFrame = nsTextAccessible::GetFrame();
|
||||
}
|
||||
return mFrame;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextAccessible::GetState(PRUint32 *aState)
|
||||
|
@ -186,3 +191,67 @@ NS_IMETHODIMP nsHTMLLabelAccessible::GetChildCount(PRInt32 *aAccChildCount)
|
|||
// A <label> is not necessarily a leaf!
|
||||
return nsAccessible::GetChildCount(aAccChildCount);
|
||||
}
|
||||
|
||||
nsHTMLLIAccessible::nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
|
||||
nsIFrame *aBulletFrame, const nsAString& aBulletText):
|
||||
nsAccessibleWrap(aDOMNode, aShell),
|
||||
mBulletAccessible(aBulletText.IsEmpty() ? nsnull :
|
||||
new nsHTMLListBulletAccessible(mDOMNode, mWeakShell,
|
||||
aBulletFrame, aBulletText))
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLLIAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
|
||||
{
|
||||
nsresult rv = nsAccessibleWrap::GetBounds(x, y, width, height);
|
||||
if (NS_FAILED(rv) || !mBulletAccessible) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
PRInt32 bulletX, bulletY, bulletWidth, bulletHeight;
|
||||
rv = mBulletAccessible->GetBounds(&bulletX, &bulletY, &bulletWidth, &bulletHeight);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*x = bulletX; // Move x coordinate of list item over to cover bullet as well
|
||||
*width += bulletWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void nsHTMLLIAccessible::CacheChildren(PRBool aWalkAnonContent)
|
||||
{
|
||||
if (!mBulletAccessible || !mWeakShell) {
|
||||
nsAccessibleWrap::CacheChildren(aWalkAnonContent);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAccChildCount == eChildCountUninitialized) {
|
||||
SetFirstChild(mBulletAccessible);
|
||||
mAccChildCount = 1;
|
||||
nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, aWalkAnonContent);
|
||||
walker.mState.frameHint = GetFrame();
|
||||
walker.GetFirstChild();
|
||||
|
||||
nsCOMPtr<nsPIAccessible> privatePrevAccessible = do_QueryInterface(mBulletAccessible);
|
||||
while (walker.mState.accessible) {
|
||||
++mAccChildCount;
|
||||
privatePrevAccessible->SetNextSibling(walker.mState.accessible);
|
||||
privatePrevAccessible = do_QueryInterface(walker.mState.accessible);
|
||||
privatePrevAccessible->SetParent(this);
|
||||
walker.GetNextSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nsHTMLListBulletAccessible::nsHTMLListBulletAccessible(nsIDOMNode* aDomNode,
|
||||
nsIWeakReference* aShell, nsIFrame *aFrame, const nsAString& aBulletText):
|
||||
nsHTMLTextAccessible(aDomNode, aShell, aFrame), mBulletText(aBulletText)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLListBulletAccessible::GetName(nsAString &aName)
|
||||
{
|
||||
aName = mBulletText;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ class nsIWeakReference;
|
|||
|
||||
class nsHTMLTextAccessible : public nsTextAccessibleWrap
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell, nsIFrame *aFrame);
|
||||
nsIFrame* GetFrame();
|
||||
|
@ -58,7 +57,6 @@ private:
|
|||
|
||||
class nsHTMLHRAccessible : public nsLeafAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLHRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
|
@ -67,7 +65,6 @@ public:
|
|||
|
||||
class nsHTMLLabelAccessible : public nsTextAccessible
|
||||
{
|
||||
|
||||
public:
|
||||
nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetName(nsAString& _retval);
|
||||
|
@ -78,4 +75,49 @@ public:
|
|||
NS_IMETHOD GetChildCount(PRInt32 *aAccChildCount);
|
||||
};
|
||||
|
||||
class nsHTMLListAccessible : public nsAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLListAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell):
|
||||
nsAccessibleWrap(aDOMNode, aShell) { }
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = ROLE_LIST; return NS_OK; }
|
||||
NS_IMETHOD GetState(PRUint32 *aState) { nsAccessibleWrap::GetState(aState); *aState &= ~(STATE_FOCUSABLE | STATE_READONLY); return NS_OK; }
|
||||
};
|
||||
|
||||
class nsHTMLLIAccessible : public nsAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
|
||||
nsIFrame *aBulletFrame, const nsAString& aBulletText);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole) {* aRole = ROLE_LISTITEM; return NS_OK; }
|
||||
NS_IMETHOD GetState(PRUint32 *aState) { nsAccessibleWrap::GetState(aState); *aState &= ~(STATE_FOCUSABLE | STATE_READONLY); return NS_OK; }
|
||||
NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||
void CacheChildren(PRBool aWalkAnonContent); // Include bullet accessible
|
||||
protected:
|
||||
nsCOMPtr<nsIAccessible> mBulletAccessible;
|
||||
};
|
||||
|
||||
class nsHTMLListBulletAccessible : public nsHTMLTextAccessible
|
||||
{
|
||||
public:
|
||||
nsHTMLListBulletAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
|
||||
nsIFrame *aFrame, const nsAString& aBulletText);
|
||||
NS_IMETHOD GetName(nsAString& aName);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = ROLE_STATICTEXT; return NS_OK; }
|
||||
NS_IMETHOD GetState(PRUint32 *aState) { nsHTMLTextAccessible::GetState(aState); *aState &= ~(STATE_FOCUSABLE | STATE_READONLY); return NS_OK; }
|
||||
// Don't cache via unique ID -- bullet accessible shares the same dom node as this LI accessible.
|
||||
// Also, don't cache via mParent/SetParent(), prevent circular reference since li holds onto us.
|
||||
NS_IMETHOD SetParent(nsIAccessible *aParentAccessible) { mParent = nsnull; return NS_OK; }
|
||||
protected:
|
||||
// XXX Ideally we'd get the bullet text directly from the bullet frame via
|
||||
// nsBulletFrame::GetListItemText(), but we'd need an interface
|
||||
// for getting text from contentless anonymous frames.
|
||||
// Perhaps something like nsIAnonymousFrame::GetText() ?
|
||||
// However, in practice storing the bullet text here should not be a
|
||||
// problem if we invalidate the right parts of the accessibility cache
|
||||
// when mutation events occur. We'll also need to watch for mere style
|
||||
// changes -- perhaps we need to look for reflows and their reasons.
|
||||
nsString mBulletText;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -677,14 +677,14 @@ nsAccessibleWrap::Next(ULONG aNumElementsRequested, VARIANT FAR* pvar, ULONG FAR
|
|||
msaaAccessible->nsAccessNode::Release(); // this accessible will not be received by the caller
|
||||
}
|
||||
|
||||
mEnumVARIANTPosition += *aNumElementsFetched;
|
||||
mEnumVARIANTPosition += NS_STATIC_CAST(PRUint16, *aNumElementsFetched);
|
||||
return NOERROR;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
nsAccessibleWrap::Skip(ULONG aNumElements)
|
||||
{
|
||||
mEnumVARIANTPosition += aNumElements;
|
||||
mEnumVARIANTPosition += NS_STATIC_CAST(PRUint16, aNumElements);
|
||||
|
||||
PRInt32 numChildren;
|
||||
GetChildCount(&numChildren);
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
nsXULTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
|
||||
NS_IMETHOD GetName(nsAString& _retval);
|
||||
NS_IMETHOD GetState(PRUint32 *_retval);
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = ROLE_STATICTEXT; return NS_OK; }
|
||||
};
|
||||
|
||||
class nsXULTooltipAccessible : public nsLeafAccessible
|
||||
|
|
|
@ -74,10 +74,8 @@
|
|||
#include "nsGUIEvent.h"
|
||||
#include "nsLayoutErrors.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#endif
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
@ -5710,6 +5708,37 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
NS_IMETHODIMP nsBlockFrame::GetAccessible(nsIAccessible** aAccessible)
|
||||
{
|
||||
*aAccessible = nsnull;
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
|
||||
nsIPresContext *aPresContext = GetPresContext();
|
||||
if (!mBullet || !aPresContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
const nsStyleList* myList = GetStyleList();
|
||||
nsAutoString bulletText;
|
||||
if (myList->mListStyleImage || myList->mListStyleType == NS_STYLE_LIST_STYLE_DISC ||
|
||||
myList->mListStyleType == NS_STYLE_LIST_STYLE_CIRCLE ||
|
||||
myList->mListStyleType == NS_STYLE_LIST_STYLE_SQUARE) {
|
||||
bulletText.Assign(PRUnichar(0x2022));; // Unicode bullet character
|
||||
}
|
||||
else if (myList->mListStyleType != NS_STYLE_LIST_STYLE_NONE) {
|
||||
mBullet->GetListItemText(aPresContext, *myList, bulletText);
|
||||
}
|
||||
|
||||
return accService->CreateHTMLLIAccessible(NS_STATIC_CAST(nsIFrame*, this),
|
||||
NS_STATIC_CAST(nsIFrame*, mBullet),
|
||||
bulletText,
|
||||
aAccessible);
|
||||
}
|
||||
#endif
|
||||
|
||||
void nsBlockFrame::ClearLineCursor() {
|
||||
if (!(GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR)) {
|
||||
return;
|
||||
|
|
|
@ -139,6 +139,10 @@ public:
|
|||
NS_IMETHOD VerifyTree() const;
|
||||
#endif
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
||||
#endif
|
||||
|
||||
// line cursor methods to speed up searching for the line(s)
|
||||
// containing a point. The basic idea is that we set the cursor
|
||||
// property if the lines' combinedArea.ys and combinedArea.yMosts
|
||||
|
|
|
@ -91,15 +91,16 @@ public:
|
|||
gfxIImageFrame *aNewframe,
|
||||
nsRect *aDirtyRect);
|
||||
|
||||
PRBool GetListItemText(nsIPresContext* aCX,
|
||||
const nsStyleList& aStyleList,
|
||||
nsString& aResult);
|
||||
|
||||
|
||||
protected:
|
||||
void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aMetrics);
|
||||
|
||||
PRBool GetListItemText(nsIPresContext* aCX,
|
||||
const nsStyleList& aStyleList,
|
||||
nsString& aResult);
|
||||
|
||||
void GetLoadGroup(nsIPresContext *aPresContext, nsILoadGroup **aLoadGroup);
|
||||
|
||||
PRInt32 mOrdinal;
|
||||
|
|
|
@ -74,10 +74,8 @@
|
|||
#include "nsGUIEvent.h"
|
||||
#include "nsLayoutErrors.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
#include "nsIAccessibilityService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#endif
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
@ -5710,6 +5708,37 @@ nsBlockFrame::HandleEvent(nsIPresContext* aPresContext,
|
|||
return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
|
||||
}
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
NS_IMETHODIMP nsBlockFrame::GetAccessible(nsIAccessible** aAccessible)
|
||||
{
|
||||
*aAccessible = nsnull;
|
||||
nsCOMPtr<nsIAccessibilityService> accService =
|
||||
do_GetService("@mozilla.org/accessibilityService;1");
|
||||
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
|
||||
|
||||
nsIPresContext *aPresContext = GetPresContext();
|
||||
if (!mBullet || !aPresContext) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
const nsStyleList* myList = GetStyleList();
|
||||
nsAutoString bulletText;
|
||||
if (myList->mListStyleImage || myList->mListStyleType == NS_STYLE_LIST_STYLE_DISC ||
|
||||
myList->mListStyleType == NS_STYLE_LIST_STYLE_CIRCLE ||
|
||||
myList->mListStyleType == NS_STYLE_LIST_STYLE_SQUARE) {
|
||||
bulletText.Assign(PRUnichar(0x2022));; // Unicode bullet character
|
||||
}
|
||||
else if (myList->mListStyleType != NS_STYLE_LIST_STYLE_NONE) {
|
||||
mBullet->GetListItemText(aPresContext, *myList, bulletText);
|
||||
}
|
||||
|
||||
return accService->CreateHTMLLIAccessible(NS_STATIC_CAST(nsIFrame*, this),
|
||||
NS_STATIC_CAST(nsIFrame*, mBullet),
|
||||
bulletText,
|
||||
aAccessible);
|
||||
}
|
||||
#endif
|
||||
|
||||
void nsBlockFrame::ClearLineCursor() {
|
||||
if (!(GetStateBits() & NS_BLOCK_HAS_LINE_CURSOR)) {
|
||||
return;
|
||||
|
|
|
@ -139,6 +139,10 @@ public:
|
|||
NS_IMETHOD VerifyTree() const;
|
||||
#endif
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
||||
#endif
|
||||
|
||||
// line cursor methods to speed up searching for the line(s)
|
||||
// containing a point. The basic idea is that we set the cursor
|
||||
// property if the lines' combinedArea.ys and combinedArea.yMosts
|
||||
|
|
|
@ -91,15 +91,16 @@ public:
|
|||
gfxIImageFrame *aNewframe,
|
||||
nsRect *aDirtyRect);
|
||||
|
||||
PRBool GetListItemText(nsIPresContext* aCX,
|
||||
const nsStyleList& aStyleList,
|
||||
nsString& aResult);
|
||||
|
||||
|
||||
protected:
|
||||
void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aMetrics);
|
||||
|
||||
PRBool GetListItemText(nsIPresContext* aCX,
|
||||
const nsStyleList& aStyleList,
|
||||
nsString& aResult);
|
||||
|
||||
void GetLoadGroup(nsIPresContext *aPresContext, nsILoadGroup **aLoadGroup);
|
||||
|
||||
PRInt32 mOrdinal;
|
||||
|
|
Загрузка…
Ссылка в новой задаче