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); NotifyA11yInitOrShutdown(false);
} }
// nsAccessNode protected
nsPresContext* nsAccessNode::GetPresContext()
{
if (!mDoc)
return nsnull;
nsIPresShell* presShell(mDoc->PresShell());
return presShell ? presShell->GetPresContext() : nsnull;
}
nsRootAccessible* nsRootAccessible*
nsAccessNode::RootAccessible() const nsAccessNode::RootAccessible() const
{ {

View File

@ -154,22 +154,20 @@ public:
void Language(nsAString& aLocale); void Language(nsAString& aLocale);
protected: protected:
nsPresContext* GetPresContext(); void LastRelease();
void LastRelease();
nsCOMPtr<nsIContent> mContent; nsCOMPtr<nsIContent> mContent;
nsDocAccessible* mDoc; nsDocAccessible* mDoc;
/** /**
* Notify global nsIObserver's that a11y is getting init'd or shutdown * Notify global nsIObserver's that a11y is getting init'd or shutdown
*/ */
static void NotifyA11yInitOrShutdown(bool aIsInit); static void NotifyA11yInitOrShutdown(bool aIsInit);
// Static data, we do our own refcounting for our static data // Static data, we do our own refcounting for our static data
static nsIStringBundle *gStringBundle; static nsIStringBundle* gStringBundle;
static bool gIsFormFillEnabled; static bool gIsFormFillEnabled;
private: private:
nsAccessNode() MOZ_DELETE; nsAccessNode() MOZ_DELETE;

View File

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

View File

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

View File

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