Back out bug 741707, bug 741681, bug 741683 due to bustage

This commit is contained in:
Hub Figuière 2012-04-10 12:41:26 -07:00
parent 59ddedc5e4
commit bffd00f42a
17 changed files with 130 additions and 44 deletions

View File

@ -209,6 +209,17 @@ void nsAccessNode::ShutdownXPAccessibility()
NotifyA11yInitOrShutdown(false);
}
// nsAccessNode protected
nsPresContext* nsAccessNode::GetPresContext()
{
if (!mDoc)
return nsnull;
nsIPresShell* presShell(mDoc->PresShell());
return presShell ? presShell->GetPresContext() : nsnull;
}
nsRootAccessible*
nsAccessNode::RootAccessible() const
{
@ -241,6 +252,31 @@ nsAccessNode::IsPrimaryForNode() const
return true;
}
////////////////////////////////////////////////////////////////////////////////
void
nsAccessNode::ScrollTo(PRUint32 aScrollType)
{
if (!mDoc)
return;
nsIPresShell* shell = mDoc->PresShell();
if (!shell)
return;
nsIFrame *frame = GetFrame();
if (!frame)
return;
nsIContent* content = frame->GetContent();
if (!content)
return;
nsIPresShell::ScrollAxis vertical, horizontal;
nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
shell->ScrollContentIntoView(content, vertical, horizontal,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}
void
nsAccessNode::Language(nsAString& aLanguage)
{

View File

@ -152,22 +152,25 @@ public:
* Interface methods on nsIAccessible shared with ISimpleDOM.
*/
void Language(nsAString& aLocale);
void ScrollTo(PRUint32 aType);
protected:
void LastRelease();
nsPresContext* GetPresContext();
void LastRelease();
nsCOMPtr<nsIContent> mContent;
nsDocAccessible* mDoc;
/**
* Notify global nsIObserver's that a11y is getting init'd or shutdown
*/
static void NotifyA11yInitOrShutdown(bool aIsInit);
/**
* Notify global nsIObserver's that a11y is getting init'd or shutdown
*/
static void NotifyA11yInitOrShutdown(bool aIsInit);
// Static data, we do our own refcounting for our static data
static nsIStringBundle* gStringBundle;
// Static data, we do our own refcounting for our static data
static nsIStringBundle *gStringBundle;
static bool gIsFormFillEnabled;
static bool gIsFormFillEnabled;
private:
nsAccessNode() MOZ_DELETE;

View File

@ -2240,7 +2240,7 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex)
NS_IMETHODIMP
nsAccessible::ScrollTo(PRUint32 aHow)
{
nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aHow);
nsAccessNode::ScrollTo(aHow);
return NS_OK;
}

View File

@ -726,17 +726,6 @@ nsCoreUtils::IsColumnHidden(nsITreeColumn *aColumn)
nsGkAtoms::_true, eCaseMatters);
}
void
nsCoreUtils::ScrollTo(nsIPresShell* aPresShell, nsIContent* aContent,
PRUint32 aScrollType)
{
nsIPresShell::ScrollAxis vertical, horizontal;
ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
aPresShell->ScrollContentIntoView(aContent, vertical, horizontal,
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessibleDOMStringList
////////////////////////////////////////////////////////////////////////////////

View File

@ -335,12 +335,6 @@ public:
*/
static bool IsColumnHidden(nsITreeColumn *aColumn);
/**
* Scroll content into view.
*/
static void ScrollTo(nsIPresShell* aPresShell, nsIContent* aContent,
PRUint32 aScrollType);
/**
* Return true if the given node is table header element.
*/

View File

@ -175,6 +175,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDocAccessible)
NS_INTERFACE_MAP_STATIC_AMBIGUOUS(nsDocAccessible)
NS_INTERFACE_MAP_ENTRY(nsIAccessibleDocument)
NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver)
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)

View File

@ -64,6 +64,14 @@ class nsAccessiblePivot;
const PRUint32 kDefaultCacheSize = 256;
#define NS_DOCACCESSIBLE_IMPL_CID \
{ /* 5641921c-a093-4292-9dca-0b51813db57d */ \
0x5641921c, \
0xa093, \
0x4292, \
{ 0x9d, 0xca, 0x0b, 0x51, 0x81, 0x3d, 0xb5, 0x7d } \
}
class nsDocAccessible : public nsHyperTextAccessibleWrap,
public nsIAccessibleDocument,
public nsIDocumentObserver,
@ -77,6 +85,7 @@ class nsDocAccessible : public nsHyperTextAccessibleWrap,
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDocAccessible, nsAccessible)
NS_DECL_NSIACCESSIBLEDOCUMENT
NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOCACCESSIBLE_IMPL_CID)
NS_DECL_NSIOBSERVER
@ -133,11 +142,6 @@ public:
*/
nsIPresShell* PresShell() const { return mPresShell; }
/**
* Return the presentation shell's context.
*/
nsPresContext* PresContext() const { return mPresShell->GetPresContext(); }
/**
* Return true if associated DOM document was loaded and isn't unloading.
*/
@ -662,6 +666,9 @@ private:
nsIPresShell* mPresShell;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsDocAccessible,
NS_DOCACCESSIBLE_IMPL_CID)
inline nsDocAccessible*
nsAccessible::AsDoc()
{

View File

@ -92,7 +92,17 @@ using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED1(nsRootAccessible, nsDocAccessible, nsIAccessibleDocument)
// Expanded version of NS_IMPL_ISUPPORTS_INHERITED2
// so we can QI directly to concrete nsRootAccessible
NS_IMPL_QUERY_HEAD(nsRootAccessible)
NS_IMPL_QUERY_BODY(nsIDOMEventListener)
if (aIID.Equals(NS_GET_IID(nsRootAccessible)))
foundInterface = reinterpret_cast<nsISupports*>(this);
else
NS_IMPL_QUERY_TAIL_INHERITING(nsDocAccessible)
NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsDocAccessible)
NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsDocAccessible)
////////////////////////////////////////////////////////////////////////////////
// Constructor/desctructor

View File

@ -50,6 +50,14 @@
class nsXULTreeAccessible;
class Relation;
#define NS_ROOTACCESSIBLE_IMPL_CID \
{ /* eaba2cf0-21b1-4e2b-b711-d3a89dcd5e1a */ \
0xeaba2cf0, \
0x21b1, \
0x4e2b, \
{ 0xb7, 0x11, 0xd3, 0xa8, 0x9d, 0xcd, 0x5e, 0x1a } \
}
const PRInt32 SCROLL_HASH_START_SIZE = 6;
class nsRootAccessible : public nsDocAccessibleWrap,
@ -77,7 +85,9 @@ public:
virtual PRUint64 NativeState();
// nsRootAccessible
nsCaretAccessible* GetCaretAccessible();
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID)
nsCaretAccessible *GetCaretAccessible();
/**
* Notify that the sub document presshell was activated.
@ -119,6 +129,8 @@ protected:
nsRefPtr<nsCaretAccessible> mCaretAccessible;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsRootAccessible, NS_ROOTACCESSIBLE_IMPL_CID)
inline nsRootAccessible*
nsAccessible::AsRoot()
{

View File

@ -443,8 +443,8 @@ nsHTMLTableAccessible::
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableAccessible: nsISupports implementation
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableAccessible, nsAccessible,
nsIAccessibleTable)
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTableAccessible, nsAccessible,
nsHTMLTableAccessible, nsIAccessibleTable)
////////////////////////////////////////////////////////////////////////////////
//nsAccessNode

View File

@ -114,6 +114,14 @@ public:
// data vs. layout heuristic
// #define SHOW_LAYOUT_HEURISTIC
#define NS_TABLEACCESSIBLE_IMPL_CID \
{ /* 8d6d9c40-74bd-47ac-88dc-4a23516aa23d */ \
0x8d6d9c40, \
0x74bd, \
0x47ac, \
{ 0x88, 0xdc, 0x4a, 0x23, 0x51, 0x6a, 0xa2, 0x3d } \
}
class nsHTMLTableAccessible : public nsAccessibleWrap,
public xpcAccessibleTable,
public nsIAccessibleTable,
@ -123,6 +131,7 @@ public:
nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
NS_DECL_ISUPPORTS_INHERITED
NS_DECLARE_STATIC_IID_ACCESSOR(NS_TABLEACCESSIBLE_IMPL_CID)
// nsIAccessible Table
NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
@ -199,6 +208,10 @@ protected:
#endif
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsHTMLTableAccessible,
NS_TABLEACCESSIBLE_IMPL_CID)
/**
* HTML caption accessible (html:caption).
*/

View File

@ -208,7 +208,10 @@ nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 a
NS_ENSURE_SUCCESS(rv, screenRect);
NS_ENSURE_TRUE(mDoc, screenRect);
nsPresContext* context = mDoc->PresContext();
nsIPresShell* shell = mDoc->PresShell();
NS_ENSURE_TRUE(shell, screenRect);
nsPresContext *context = shell->GetPresContext();
while (frame && startContentOffset < endContentOffset) {
// Start with this frame's screen rect, which we will
@ -1291,10 +1294,13 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
PRUint32 aCoordType, PRInt32 *aOffset)
{
*aOffset = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
if (!mDoc)
return NS_ERROR_FAILURE;
nsIPresShell* shell = mDoc->PresShell();
if (!shell) {
return NS_ERROR_FAILURE;
}
nsIFrame *hyperFrame = GetFrame();
if (!hyperFrame) {
return NS_ERROR_FAILURE;
@ -1313,7 +1319,8 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
}
nsIntPoint pxInHyperText(coords.x - frameScreenRect.x,
coords.y - frameScreenRect.y);
nsPresContext* context = mDoc->PresContext();
nsPresContext *context = GetPresContext();
NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
nsPoint pointInHyperText(context->DevPixelsToAppUnits(pxInHyperText.x),
context->DevPixelsToAppUnits(pxInHyperText.y));

View File

@ -397,7 +397,7 @@ __try {
aScrollTopLeft ? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT :
nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT;
nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, scrollType);
ScrollTo(scrollType);
return S_OK;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

View File

@ -1229,7 +1229,7 @@ __try {
if (IsDefunct())
return CO_E_OBJNOTCONNECTED;
nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aScrollType);
nsAccessNode::ScrollTo(aScrollType);
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

View File

@ -107,6 +107,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeAccessible,
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXULTreeAccessible)
NS_INTERFACE_MAP_STATIC_AMBIGUOUS(nsXULTreeAccessible)
NS_INTERFACE_MAP_END_INHERITING(nsAccessible)
NS_IMPL_ADDREF_INHERITED(nsXULTreeAccessible, nsAccessible)
@ -802,7 +803,7 @@ nsXULTreeItemAccessibleBase::GetBounds(PRInt32 *aX, PRInt32 *aY,
x = tcX;
y += tcY;
nsPresContext* presContext = mDoc->PresContext();
nsPresContext *presContext = GetPresContext();
*aX = presContext->CSSPixelsToDevPixels(x);
*aY = presContext->CSSPixelsToDevPixels(y);
*aWidth = presContext->CSSPixelsToDevPixels(width);

View File

@ -53,6 +53,14 @@ const PRUint32 kDefaultTreeCacheSize = 256;
* Accessible class for XUL tree element.
*/
#define NS_XULTREEACCESSIBLE_IMPL_CID \
{ /* 2692e149-6176-42ee-b8e1-2c44b04185e3 */ \
0x2692e149, \
0x6176, \
0x42ee, \
{ 0xb8, 0xe1, 0x2c, 0x44, 0xb0, 0x41, 0x85, 0xe3 } \
}
class nsXULTreeAccessible : public nsAccessibleWrap
{
public:
@ -101,6 +109,8 @@ public:
// nsXULTreeAccessible
NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEACCESSIBLE_IMPL_CID)
/**
* Return tree item accessible at the givem row. If accessible doesn't exist
* in the cache then create and cache it.
@ -147,6 +157,9 @@ protected:
nsAccessibleHashtable mAccessibleCache;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeAccessible,
NS_XULTREEACCESSIBLE_IMPL_CID)
/**
* Base class for tree item accessibles.
*/

View File

@ -924,7 +924,7 @@ nsXULTreeGridCellAccessible::GetBounds(PRInt32 *aX, PRInt32 *aY,
x += tcX;
y += tcY;
nsPresContext* presContext = mDoc->PresContext();
nsPresContext *presContext = GetPresContext();
*aX = presContext->CSSPixelsToDevPixels(x);
*aY = presContext->CSSPixelsToDevPixels(y);
*aWidth = presContext->CSSPixelsToDevPixels(width);