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

This commit is contained in:
Lavina Thong 2012-04-11 12:42:42 +09:00
parent dd70339941
commit edfd26711c
7 changed files with 24 additions and 37 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

@ -133,6 +133,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

@ -207,11 +207,7 @@ nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 a
&startContentOffsetInFrame, &frame);
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 +1290,10 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
PRUint32 aCoordType, PRInt32 *aOffset)
{
*aOffset = -1;
if (!mDoc)
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 +1312,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

@ -217,8 +217,11 @@ nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32
PRInt32* aWidth, PRInt32* aHeight)
{
*aX = *aY = *aWidth = *aHeight = 0;
nsPresContext *presContext = GetPresContext();
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
if (IsDefunct())
return CO_E_OBJNOTCONNECTED;
nsPresContext* presContext = mDoc->PresContext();
nsIFrame *frame = GetFrame();
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);

View File

@ -802,7 +802,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);