Bug 741681 - replaced nsAccessNode::GetPresContext() with nsDocAccessible::PresContext() r=hub

This commit is contained in:
Lavina Thong 2012-04-09 22:54:00 -07:00
parent 016ab62757
commit 5d01aa84ac
6 changed files with 20 additions and 35 deletions

View File

@ -209,17 +209,6 @@ 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
{

View File

@ -154,22 +154,20 @@ public:
void Language(nsAString& aLocale);
protected:
nsPresContext* GetPresContext();
void LastRelease();
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

@ -142,6 +142,11 @@ 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.
*/

View File

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

View File

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

View File

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