Loading accessible/src/base/nsAccessible.cpp +2 −47 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ #include "nsIForm.h" #include "nsIFormControl.h" #include "nsLayoutUtils.h" #include "nsIPresShell.h" #include "nsPresContext.h" #include "nsIFrame.h" Loading Loading @@ -682,15 +683,7 @@ nsAccessible::IsVisible(PRBool* aIsOffscreen) } // The frame intersects the viewport, but we need to check the parent view chain :( nsIDocument* doc = mContent->GetOwnerDoc(); if (!doc) { return PR_FALSE; } nsIFrame* frameWithView = frame->HasView() ? frame : frame->GetAncestorWithViewExternal(); nsIView* view = frameWithView->GetViewExternal(); PRBool isVisible = CheckVisibilityInParentChain(doc, view); bool isVisible = nsCoreUtils::CheckVisibilityInParentChain(frame); if (isVisible && rectVisibility == nsRectVisibility_kVisible) { *aIsOffscreen = PR_FALSE; } Loading Loading @@ -3251,44 +3244,6 @@ nsAccessible::GetFirstAvailableAccessible(nsINode *aStartNode) const return nsnull; } PRBool nsAccessible::CheckVisibilityInParentChain(nsIDocument* aDocument, nsIView* aView) { nsIDocument* document = aDocument; nsIView* view = aView; // both view chain and widget chain are broken between chrome and content while (document != nsnull) { while (view != nsnull) { if (view->GetVisibility() == nsViewVisibility_kHide) { return PR_FALSE; } view = view->GetParent(); } nsIDocument* parentDoc = document->GetParentDocument(); if (parentDoc != nsnull) { nsIContent* content = parentDoc->FindContentForSubDocument(document); if (content != nsnull) { nsIPresShell* shell = parentDoc->GetShell(); if (!shell) { return PR_FALSE; } nsIFrame* frame = content->GetPrimaryFrame(); while (frame != nsnull && !frame->HasView()) { frame = frame->GetParent(); } if (frame != nsnull) { view = frame->GetViewExternal(); } } } document = parentDoc; } return PR_TRUE; } nsresult nsAccessible::GetAttrValue(nsIAtom *aProperty, double *aValue) { Loading accessible/src/base/nsAccessible.h +0 −3 Original line number Diff line number Diff line Loading @@ -606,9 +606,6 @@ protected: ////////////////////////////////////////////////////////////////////////////// // Helpers // Check the visibility across both parent content and chrome PRBool CheckVisibilityInParentChain(nsIDocument* aDocument, nsIView* aView); /** * Get the container node for an atomic region, defined by aria-atomic="true" * @return the container node Loading accessible/src/base/nsCoreUtils.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ #include "nsPIDOMWindow.h" #include "nsGUIEvent.h" #include "nsIView.h" #include "nsLayoutUtils.h" #include "nsContentCID.h" #include "nsComponentManagerUtils.h" Loading Loading @@ -753,6 +754,30 @@ nsCoreUtils::IsColumnHidden(nsITreeColumn *aColumn) nsAccessibilityAtoms::_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 Loading accessible/src/base/nsCoreUtils.h +6 −0 Original line number Diff line number Diff line Loading @@ -367,6 +367,12 @@ public: return aContent->NodeInfo()->Equals(nsAccessibilityAtoms::th) || aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::scope); } /** * Check the visibility across both parent content and chrome. */ static bool CheckVisibilityInParentChain(nsIFrame* aFrame); }; Loading accessible/src/base/nsDocAccessible.cpp +1 −6 Original line number Diff line number Diff line Loading @@ -313,12 +313,7 @@ nsDocAccessible::NativeState() } nsIFrame* frame = GetFrame(); while (frame != nsnull && !frame->HasView()) { frame = frame->GetParent(); } if (frame == nsnull || !CheckVisibilityInParentChain(mDocument, frame->GetViewExternal())) { if (!frame || !nsCoreUtils::CheckVisibilityInParentChain(frame)) { state |= states::INVISIBLE | states::OFFSCREEN; } Loading Loading
accessible/src/base/nsAccessible.cpp +2 −47 Original line number Diff line number Diff line Loading @@ -75,6 +75,7 @@ #include "nsIForm.h" #include "nsIFormControl.h" #include "nsLayoutUtils.h" #include "nsIPresShell.h" #include "nsPresContext.h" #include "nsIFrame.h" Loading Loading @@ -682,15 +683,7 @@ nsAccessible::IsVisible(PRBool* aIsOffscreen) } // The frame intersects the viewport, but we need to check the parent view chain :( nsIDocument* doc = mContent->GetOwnerDoc(); if (!doc) { return PR_FALSE; } nsIFrame* frameWithView = frame->HasView() ? frame : frame->GetAncestorWithViewExternal(); nsIView* view = frameWithView->GetViewExternal(); PRBool isVisible = CheckVisibilityInParentChain(doc, view); bool isVisible = nsCoreUtils::CheckVisibilityInParentChain(frame); if (isVisible && rectVisibility == nsRectVisibility_kVisible) { *aIsOffscreen = PR_FALSE; } Loading Loading @@ -3251,44 +3244,6 @@ nsAccessible::GetFirstAvailableAccessible(nsINode *aStartNode) const return nsnull; } PRBool nsAccessible::CheckVisibilityInParentChain(nsIDocument* aDocument, nsIView* aView) { nsIDocument* document = aDocument; nsIView* view = aView; // both view chain and widget chain are broken between chrome and content while (document != nsnull) { while (view != nsnull) { if (view->GetVisibility() == nsViewVisibility_kHide) { return PR_FALSE; } view = view->GetParent(); } nsIDocument* parentDoc = document->GetParentDocument(); if (parentDoc != nsnull) { nsIContent* content = parentDoc->FindContentForSubDocument(document); if (content != nsnull) { nsIPresShell* shell = parentDoc->GetShell(); if (!shell) { return PR_FALSE; } nsIFrame* frame = content->GetPrimaryFrame(); while (frame != nsnull && !frame->HasView()) { frame = frame->GetParent(); } if (frame != nsnull) { view = frame->GetViewExternal(); } } } document = parentDoc; } return PR_TRUE; } nsresult nsAccessible::GetAttrValue(nsIAtom *aProperty, double *aValue) { Loading
accessible/src/base/nsAccessible.h +0 −3 Original line number Diff line number Diff line Loading @@ -606,9 +606,6 @@ protected: ////////////////////////////////////////////////////////////////////////////// // Helpers // Check the visibility across both parent content and chrome PRBool CheckVisibilityInParentChain(nsIDocument* aDocument, nsIView* aView); /** * Get the container node for an atomic region, defined by aria-atomic="true" * @return the container node Loading
accessible/src/base/nsCoreUtils.cpp +25 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,7 @@ #include "nsPIDOMWindow.h" #include "nsGUIEvent.h" #include "nsIView.h" #include "nsLayoutUtils.h" #include "nsContentCID.h" #include "nsComponentManagerUtils.h" Loading Loading @@ -753,6 +754,30 @@ nsCoreUtils::IsColumnHidden(nsITreeColumn *aColumn) nsAccessibilityAtoms::_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 Loading
accessible/src/base/nsCoreUtils.h +6 −0 Original line number Diff line number Diff line Loading @@ -367,6 +367,12 @@ public: return aContent->NodeInfo()->Equals(nsAccessibilityAtoms::th) || aContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::scope); } /** * Check the visibility across both parent content and chrome. */ static bool CheckVisibilityInParentChain(nsIFrame* aFrame); }; Loading
accessible/src/base/nsDocAccessible.cpp +1 −6 Original line number Diff line number Diff line Loading @@ -313,12 +313,7 @@ nsDocAccessible::NativeState() } nsIFrame* frame = GetFrame(); while (frame != nsnull && !frame->HasView()) { frame = frame->GetParent(); } if (frame == nsnull || !CheckVisibilityInParentChain(mDocument, frame->GetViewExternal())) { if (!frame || !nsCoreUtils::CheckVisibilityInParentChain(frame)) { state |= states::INVISIBLE | states::OFFSCREEN; } Loading