Bug 658005. Part 3. Make accessibility use the new frame visibility API and remove code is obsoletes. r=roc,surkov

This commit is contained in:
Timothy Nikkel 2011-10-26 18:57:55 -05:00
parent 09778341dc
commit d6d9f5d4ac
4 changed files with 3 additions and 32 deletions

View File

@ -654,7 +654,7 @@ nsAccessible::IsVisible(bool* aIsOffscreen)
} }
// The frame intersects the viewport, but we need to check the parent view chain :( // The frame intersects the viewport, but we need to check the parent view chain :(
bool isVisible = nsCoreUtils::CheckVisibilityInParentChain(frame); bool isVisible = frame->IsVisibleConsideringAncestors(nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY);
if (isVisible && rectVisibility == nsRectVisibility_kVisible) { if (isVisible && rectVisibility == nsRectVisibility_kVisible) {
*aIsOffscreen = false; *aIsOffscreen = false;
} }

View File

@ -758,31 +758,6 @@ nsCoreUtils::IsColumnHidden(nsITreeColumn *aColumn)
nsGkAtoms::_true, eCaseMatters); nsGkAtoms::_true, eCaseMatters);
} }
bool
nsCoreUtils::CheckVisibilityInParentChain(nsIFrame* aFrame)
{
nsIView* view = aFrame->GetClosestView();
if (view && !view->IsEffectivelyVisible())
return false;
nsIPresShell* presShell = aFrame->PresContext()->GetPresShell();
while (presShell) {
if (!presShell->IsActive()) {
return false;
}
nsIFrame* rootFrame = presShell->GetRootFrame();
presShell = nsnull;
if (rootFrame) {
nsIFrame* frame = nsLayoutUtils::GetCrossDocParentFrame(rootFrame);
if (frame) {
presShell = frame->PresContext()->GetPresShell();
}
}
}
return true;
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// nsAccessibleDOMStringList // nsAccessibleDOMStringList
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -370,11 +370,6 @@ public:
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::scope); aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::scope);
} }
/**
* Check the visibility across both parent content and chrome.
*/
static bool CheckVisibilityInParentChain(nsIFrame* aFrame);
}; };

View File

@ -311,7 +311,8 @@ nsDocAccessible::NativeState()
state |= states::BUSY; state |= states::BUSY;
nsIFrame* frame = GetFrame(); nsIFrame* frame = GetFrame();
if (!frame || !nsCoreUtils::CheckVisibilityInParentChain(frame)) { if (!frame ||
!frame->IsVisibleConsideringAncestors(nsIFrame::VISIBILITY_CROSS_CHROME_CONTENT_BOUNDARY)) {
state |= states::INVISIBLE | states::OFFSCREEN; state |= states::INVISIBLE | states::OFFSCREEN;
} }