diff --git a/accessible/src/nsHTMLComboboxAccessible.cpp b/accessible/src/nsHTMLComboboxAccessible.cpp index 65790ab658a3..e744285aba23 100644 --- a/accessible/src/nsHTMLComboboxAccessible.cpp +++ b/accessible/src/nsHTMLComboboxAccessible.cpp @@ -19,7 +19,7 @@ * * Original Author: Eric Vaughan (evaughan@netscape.com) * - * Contributor(s): + * Contributor(s): John Gaunt (jgaunt@netscape.com) */ #include "nsHTMLComboboxAccessible.h" @@ -260,10 +260,10 @@ NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccValue(nsAWritableString& } /** - * Gets the bounds for the AreaFrame around the BlockFrame. + * Gets the bounds for the BlockFrame. * Walks the Frame tree and checks for proper frames. */ -void nsHTMLComboboxTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame) +void nsHTMLComboboxTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame) { // get our first child's frame nsIFrame* frame = nsAccessible::GetBoundsFrame(); @@ -272,18 +272,13 @@ void nsHTMLComboboxTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aR if (!frame || !context) return; + frame->FirstChild(context, nsnull, aBoundingFrame); frame->FirstChild(context, nsnull, &frame); #ifdef DEBUG if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame)) return; #endif - frame->GetParent(aRelativeFrame); -#ifdef DEBUG - if (! nsAccessible::IsCorrectFrameType(*aRelativeFrame, nsLayoutAtoms::areaFrame)) - return; -#endif - frame->GetRect(aBounds); } @@ -413,10 +408,10 @@ NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccNumActions(PRUint8 *_retval) } /** - * Gets the bounds for the AreaFrame around the gfxButtonControlFrame. + * Gets the bounds for the gfxButtonControlFrame. * Walks the Frame tree and checks for proper frames. */ -void nsHTMLComboboxButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame) +void nsHTMLComboboxButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame) { // get our second child's frame nsIFrame* frame = nsAccessible::GetBoundsFrame(); @@ -431,18 +426,13 @@ void nsHTMLComboboxButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRela return; #endif + frame->GetNextSibling(aBoundingFrame); frame->GetNextSibling(&frame); #ifdef DEBUG if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::gfxButtonControlFrame)) return; #endif - frame->GetParent(aRelativeFrame); -#ifdef DEBUG - if (! nsAccessible::IsCorrectFrameType(*aRelativeFrame, nsLayoutAtoms::areaFrame)) - return; -#endif - frame->GetRect(aBounds); } @@ -484,8 +474,8 @@ NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccActionName(PRUint8 index, ns PRBool isOpen = PR_FALSE; nsIFrame *boundsFrame = GetBoundsFrame(); nsIComboboxControlFrame* comboFrame; - nsresult rv = QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); - if (NS_FAILED(rv)) + boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); + if (!comboFrame) return NS_ERROR_FAILURE; comboFrame->IsDroppedDown(&isOpen); if (isOpen) @@ -570,8 +560,8 @@ NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccState(PRUint32 *_retval) PRBool isOpen = PR_FALSE; nsIFrame *boundsFrame = GetBoundsFrame(); nsIComboboxControlFrame* comboFrame; - nsresult rv = QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); - if (NS_FAILED(rv)) + boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); + if (!comboFrame) return NS_ERROR_FAILURE; comboFrame->IsDroppedDown(&isOpen); if (isOpen) @@ -611,9 +601,9 @@ NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccState(PRUint32 *_retval) // we are open or closed PRBool isOpen = PR_FALSE; nsIFrame *boundsFrame = GetBoundsFrame(); - nsIComboboxControlFrame* comboFrame; - nsresult rv = QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); - if (NS_FAILED(rv)) + nsIComboboxControlFrame* comboFrame = nsnull; + boundsFrame->QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame); + if (!comboFrame) return NS_ERROR_FAILURE; comboFrame->IsDroppedDown(&isOpen); if (! isOpen) @@ -702,9 +692,10 @@ NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccChildCount(PRInt32 *_retval) } /** - * Find the bounds of the window, the window may be invisible. + * Gets the bounds for the areaFrame. + * Walks the Frame tree and checks for proper frames. */ -void nsHTMLComboboxWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame) +void nsHTMLComboboxWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame) { // get our first option nsCOMPtr child; @@ -713,7 +704,7 @@ void nsHTMLComboboxWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRela // now get its frame nsCOMPtr shell(do_QueryReferent(mPresShell)); if (!shell) { - *aRelativeFrame = nsnull; + *aBoundingFrame = nsnull; return; } @@ -725,17 +716,12 @@ void nsHTMLComboboxWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRela return; #endif + frame->GetParent(aBoundingFrame); frame->GetParent(&frame); #ifdef DEBUG if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::areaFrame)) return; #endif - frame->GetParent(aRelativeFrame); -#ifdef DEBUG - if (! nsAccessible::IsCorrectFrameType(*aRelativeFrame, nsLayoutAtoms::listControlFrame)) - return; -#endif - frame->GetRect(aBounds); } diff --git a/accessible/src/nsHTMLComboboxAccessible.h b/accessible/src/nsHTMLComboboxAccessible.h index a536c42db435..b6a1a2c79b32 100644 --- a/accessible/src/nsHTMLComboboxAccessible.h +++ b/accessible/src/nsHTMLComboboxAccessible.h @@ -90,7 +90,7 @@ public: NS_IMETHOD GetAccValue(nsAWritableString& _retval); NS_IMETHOD GetAccState(PRUint32 *_retval); - virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame); + virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame); protected: @@ -123,7 +123,7 @@ public: NS_IMETHOD AccDoAction(PRUint8 index); NS_IMETHOD GetAccState(PRUint32 *_retval); - virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame); + virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame); protected: @@ -151,7 +151,7 @@ public: NS_IMETHOD GetAccRole(PRUint32 *_retval); NS_IMETHOD GetAccState(PRUint32 *_retval); - virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame); + virtual void GetBounds(nsRect& aBounds, nsIFrame** aBoundingFrame); protected: