From 0c9a982c2d6abdc9afc2f93a6aba419943a04065 Mon Sep 17 00:00:00 2001 From: "aaronleventhal%moonset.net" Date: Fri, 8 Sep 2006 14:42:25 +0000 Subject: [PATCH] Bug 346833. Content for :before and :after no longer exposed. r=ginn.chen, sr=roc --- .../src/base/nsAccessibleTreeWalker.cpp | 24 +++++++++++++---- accessible/src/html/nsHTMLTextAccessible.cpp | 27 +++++-------------- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/accessible/src/base/nsAccessibleTreeWalker.cpp b/accessible/src/base/nsAccessibleTreeWalker.cpp index a0ef62be93e8..37d1e7ee121f 100755 --- a/accessible/src/base/nsAccessibleTreeWalker.cpp +++ b/accessible/src/base/nsAccessibleTreeWalker.cpp @@ -272,15 +272,29 @@ NS_IMETHODIMP nsAccessibleTreeWalker::GetFirstChild() void nsAccessibleTreeWalker::UpdateFrame(PRBool aTryFirstChild) { - if (mState.frame) { - mState.frame = aTryFirstChild? mState.frame->GetFirstChild(nsnull) : - mState.frame->GetNextSibling(); - if (mState.frame && mState.siblingIndex < 0 && - mState.frame->GetContent()->IsNativeAnonymous()) { + if (!mState.frame) { + return; + } + if (aTryFirstChild) { + nsIFrame *parentFrame = mState.frame; + mState.frame = mState.frame->GetFirstChild(nsnull); + if (mState.frame && mState.siblingIndex < 0) { + // Container frames can contain generated content frames from + // :before and :after style rules, so we walk their frame trees + // instead of content trees mState.domNode = do_QueryInterface(mState.frame->GetContent()); mState.siblingIndex = eSiblingsWalkFrames; } } + else { + nsIContent *currentContent = mState.frame->GetContent(); + while (PR_TRUE) { // Get next sibling with different content + mState.frame = mState.frame->GetNextSibling(); + if (!mState.frame || mState.frame->GetContent() != currentContent) { + break; + } + } + } } /** diff --git a/accessible/src/html/nsHTMLTextAccessible.cpp b/accessible/src/html/nsHTMLTextAccessible.cpp index c15e39c6912c..7addae2f5618 100644 --- a/accessible/src/html/nsHTMLTextAccessible.cpp +++ b/accessible/src/html/nsHTMLTextAccessible.cpp @@ -254,30 +254,17 @@ NS_IMETHODIMP nsHTMLLIAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *wid void nsHTMLLIAccessible::CacheChildren() { - if (!mBulletAccessible || !mWeakShell) { - nsAccessibleWrap::CacheChildren(); + if (!mWeakShell || mAccChildCount != eChildCountUninitialized) { return; } - if (mAccChildCount == eChildCountUninitialized) { - SetFirstChild(mBulletAccessible); - mBulletAccessible->SetParent(this); // Set weak parent; - PRInt32 childCount = 1; - PRBool allowsAnonChildren = PR_FALSE; - GetAllowsAnonChildAccessibles(&allowsAnonChildren); - nsAccessibleTreeWalker walker(mWeakShell, mDOMNode, allowsAnonChildren); - walker.mState.frame = GetFrame(); - walker.GetFirstChild(); + nsAccessibleWrap::CacheChildren(); - nsCOMPtr privatePrevAccessible = mBulletAccessible.get(); - while (walker.mState.accessible) { - ++ childCount; - privatePrevAccessible->SetNextSibling(walker.mState.accessible); - privatePrevAccessible = do_QueryInterface(walker.mState.accessible); - privatePrevAccessible->SetParent(this); - walker.GetNextSibling(); - } - mAccChildCount = childCount; + if (mBulletAccessible) { + mBulletAccessible->SetNextSibling(mFirstChild); + mBulletAccessible->SetParent(this); // Set weak parent; + SetFirstChild(mBulletAccessible); + ++ mAccChildCount; } }