From 3249bb853a34144c31fd58ec9f5c570d629b394e Mon Sep 17 00:00:00 2001 From: "ginn.chen%sun.com" Date: Mon, 4 Jun 2007 08:16:05 +0000 Subject: [PATCH] Bug 382296 reduce compile warnings with gcc in a11y module r=surkov.alexander --- accessible/src/atk/nsMaiInterfaceText.cpp | 24 ++++++++++++------- accessible/src/base/nsAccessible.cpp | 17 +++++++++---- accessible/src/base/nsCaretAccessible.cpp | 4 ++-- .../src/html/nsHTMLFormControlAccessible.cpp | 8 +++++-- accessible/src/html/nsHTMLImageAccessible.cpp | 1 + .../src/html/nsHTMLSelectAccessible.cpp | 10 +++++--- .../src/xul/nsXULFormControlAccessible.cpp | 8 +++++-- accessible/src/xul/nsXULMenuAccessible.cpp | 8 +++++-- 8 files changed, 55 insertions(+), 25 deletions(-) diff --git a/accessible/src/atk/nsMaiInterfaceText.cpp b/accessible/src/atk/nsMaiInterfaceText.cpp index c314012b2b3..3b9ea5ad6bf 100644 --- a/accessible/src/atk/nsMaiInterfaceText.cpp +++ b/accessible/src/atk/nsMaiInterfaceText.cpp @@ -285,9 +285,11 @@ getCharacterExtentsCB(AtkText *aText, gint aOffset, PRInt32 extY = 0, extX = 0; PRInt32 extWidth = 0, extHeight = 0; - PRUint32 geckoCoordType = (aCoords == ATK_XY_SCREEN) ? - nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE : - nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE; + PRUint32 geckoCoordType; + if (aCoords == ATK_XY_SCREEN) + geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE; + else + geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE; nsresult rv = accText->GetCharacterExtents(aOffset, &extX, &extY, &extWidth, &extHeight, @@ -317,9 +319,11 @@ getRangeExtentsCB(AtkText *aText, gint aStartOffset, gint aEndOffset, PRInt32 extY = 0, extX = 0; PRInt32 extWidth = 0, extHeight = 0; - PRUint32 geckoCoordType = (aCoords == ATK_XY_SCREEN) ? - nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE : - nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE; + PRUint32 geckoCoordType; + if (aCoords == ATK_XY_SCREEN) + geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE; + else + geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE; nsresult rv = accText->GetRangeExtents(aStartOffset, aEndOffset, &extX, &extY, @@ -363,9 +367,11 @@ getOffsetAtPointCB(AtkText *aText, NS_ENSURE_TRUE(accText, -1); PRInt32 offset = 0; - PRUint32 geckoCoordType = (aCoords == ATK_XY_SCREEN) ? - nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE : - nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE; + PRUint32 geckoCoordType; + if (aCoords == ATK_XY_SCREEN) + geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE; + else + geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE; accText->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset); return NS_STATIC_CAST(gint, offset); diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index 8842d54a45c..82f9ed20eee 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -1065,9 +1065,12 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState) const nsStyleXUL *xulStyle = frame->GetStyleXUL(); if (xulStyle) { // In XUL all boxes are either vertical or horizontal - *aExtraState |= (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL) ? - nsIAccessibleStates::EXT_STATE_VERTICAL : - nsIAccessibleStates::EXT_STATE_HORIZONTAL; + if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL) { + *aExtraState |= nsIAccessibleStates::EXT_STATE_VERTICAL; + } + else { + *aExtraState |= nsIAccessibleStates::EXT_STATE_HORIZONTAL; + } } } @@ -1076,8 +1079,12 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState) mRoleMapEntry->role == nsIAccessibleRole::ROLE_PASSWORD_TEXT)) { PRBool isEqual = NS_LITERAL_CSTRING("textarea").Equals(mRoleMapEntry->roleString); - *aExtraState = isEqual? nsIAccessibleStates::EXT_STATE_MULTI_LINE : - nsIAccessibleStates::EXT_STATE_SINGLE_LINE; + if (isEqual) { + *aExtraState |= nsIAccessibleStates::EXT_STATE_MULTI_LINE; + } + else { + *aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE; + } } if (!(state & nsIAccessibleStates::STATE_UNAVAILABLE)) { // If not disabled diff --git a/accessible/src/base/nsCaretAccessible.cpp b/accessible/src/base/nsCaretAccessible.cpp index 24f6261d5ae..4f30175b4b2 100644 --- a/accessible/src/base/nsCaretAccessible.cpp +++ b/accessible/src/base/nsCaretAccessible.cpp @@ -56,8 +56,8 @@ NS_IMPL_ISUPPORTS_INHERITED2(nsCaretAccessible, nsLeafAccessible, nsIAccessibleCaret, nsISelectionListener) nsCaretAccessible::nsCaretAccessible(nsIDOMNode* aDocumentNode, nsIWeakReference* aShell, nsRootAccessible *aRootAccessible): -nsLeafAccessible(aDocumentNode, aShell), mLastCaretOffset(-1), mLastNodeWithCaret(nsnull), -mCurrentControl(nsnull), mRootAccessible(aRootAccessible) +nsLeafAccessible(aDocumentNode, aShell), mCurrentControl(nsnull), mLastNodeWithCaret(nsnull), +mLastCaretOffset(-1), mRootAccessible(aRootAccessible) { } diff --git a/accessible/src/html/nsHTMLFormControlAccessible.cpp b/accessible/src/html/nsHTMLFormControlAccessible.cpp index aaae66ff7d2..8dddc6c0a2b 100644 --- a/accessible/src/html/nsHTMLFormControlAccessible.cpp +++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp @@ -452,8 +452,12 @@ nsHTMLTextFieldAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState) nsCOMPtr htmlInput(do_QueryInterface(mDOMNode)); // Is it an or a