diff --git a/mozilla/accessible/public/Makefile.in b/mozilla/accessible/public/Makefile.in index 614f00f6ed0..3a03a40a3f2 100644 --- a/mozilla/accessible/public/Makefile.in +++ b/mozilla/accessible/public/Makefile.in @@ -36,7 +36,6 @@ XPIDLSRCS = \ nsIAccessibleEventReceiver.idl \ nsIAccessibleEventListener.idl \ nsIAccessibleSelectable.idl \ - nsIAccessibleProvider.idl \ $(NULL) EXPORTS = \ diff --git a/mozilla/accessible/public/makefile.win b/mozilla/accessible/public/makefile.win index 5f939366785..0ee73dd6f71 100644 --- a/mozilla/accessible/public/makefile.win +++ b/mozilla/accessible/public/makefile.win @@ -30,7 +30,6 @@ XPIDLSRCS = \ .\nsIAccessibleEventReceiver.idl \ .\nsIAccessibleEventListener.idl \ .\nsIAccessibleSelectable.idl \ - .\nsIAccessibleProvider.idl \ $(NULL) EXPORTS = \ diff --git a/mozilla/accessible/public/nsIAccessibilityService.idl b/mozilla/accessible/public/nsIAccessibilityService.idl index 45d7e030628..31b2ddc6c2d 100644 --- a/mozilla/accessible/public/nsIAccessibilityService.idl +++ b/mozilla/accessible/public/nsIAccessibilityService.idl @@ -38,7 +38,6 @@ interface nsIAccessibilityService : nsISupports nsIAccessible createHTMLListboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell); nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsISupports aPresShell); nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame); - nsIAccessible createXULCheckboxAccessible(in nsIDOMNode aNode); nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame); nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame); nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame); diff --git a/mozilla/accessible/public/nsIAccessibleProvider.idl b/mozilla/accessible/public/nsIAccessibleProvider.idl deleted file mode 100644 index e7732504894..00000000000 --- a/mozilla/accessible/public/nsIAccessibleProvider.idl +++ /dev/null @@ -1,33 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Mozilla Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is the Mozilla browser. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1999 Netscape Communications Corporation. All - * Rights Reserved. - * - * Original Author: John Gaunt (jgaunt@netscape.com) - * - * Contributor(s): - * John Gaunt - */ - -#include "nsISupports.idl" -#include "nsIAccessible.idl" - -[scriptable, uuid(3f0e3eb0-1dd2-11b2-9605-be5b8e76cf4b)] -interface nsIAccessibleProvider : nsISupports -{ - readonly attribute nsIAccessible accessible; -}; diff --git a/mozilla/accessible/src/base/nsAccessibilityService.cpp b/mozilla/accessible/src/base/nsAccessibilityService.cpp index c8c77c81b5f..e3d1c034ad3 100644 --- a/mozilla/accessible/src/base/nsAccessibilityService.cpp +++ b/mozilla/accessible/src/base/nsAccessibilityService.cpp @@ -45,12 +45,10 @@ #include "nsHTMLListboxAccessible.h" #include "nsIDOMHTMLAreaElement.h" #include "nsHTMLFormControlAccessible.h" -#include "nsIAccessibleProvider.h" #include "nsILink.h" #include "nsIDocShellTreeItem.h" #include "nsIDOMDocument.h" #include "nsIDOMHTMLOptionElement.h" -#include "nsIDOMXULCheckboxElement.h" // IFrame #include "nsIDocShell.h" @@ -177,19 +175,6 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports * return NS_OK; } -NS_IMETHODIMP nsAccessibilityService::CreateXULCheckboxAccessible(nsIDOMNode *aNode, nsIAccessible **_retval) -{ - nsCOMPtr weakShell; - GetShellFromNode(aNode, getter_AddRefs(weakShell)); - - *_retval = new nsHTMLCheckboxAccessible(aNode, weakShell); - if (! *_retval) - return NS_ERROR_OUT_OF_MEMORY; - - NS_ADDREF(*_retval); - return NS_OK; -} - /* nsIAccessible createHTMRadioButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */ NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval) { @@ -355,28 +340,6 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextFieldAccessible(nsISupports return NS_OK; } -NS_IMETHODIMP nsAccessibilityService::GetShellFromNode(nsIDOMNode *aNode, nsIWeakReference **aWeakShell) -{ - nsCOMPtr domDoc; - aNode->GetOwnerDocument(getter_AddRefs(domDoc)); - nsCOMPtr doc(do_QueryInterface(domDoc)); - if (!doc) - return NS_ERROR_INVALID_ARG; - - // ---- Get the pres shell ---- - nsCOMPtr shell; - doc->GetShellAt(0, getter_AddRefs(shell)); - if (!shell) - return NS_ERROR_FAILURE; - - nsCOMPtr weakRef(do_GetWeakReference(shell)); - - *aWeakShell = weakRef; - NS_IF_ADDREF(*aWeakShell); - - return NS_OK; -} - NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode) { NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!"); @@ -661,12 +624,9 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode, nsCOMPtr newAcc; frame->GetAccessible(getter_AddRefs(newAcc)); - // ---- Is it a XUL element? -- they impl nsIAccessibleProvider via XBL - if (!newAcc) { - nsCOMPtr accProv(do_QueryInterface(aNode)); - if (accProv) - accProv->GetAccessible(getter_AddRefs(newAcc)); - } + // ---- Try QI'ing node to get nsIAccessible ---- + if (!newAcc) + newAcc = do_QueryInterface(aNode); // ---- If link, create link accessible ---- if (!newAcc) { diff --git a/mozilla/accessible/src/base/nsAccessibilityService.h b/mozilla/accessible/src/base/nsAccessibilityService.h index 47efd845153..5450fe88de2 100644 --- a/mozilla/accessible/src/base/nsAccessibilityService.h +++ b/mozilla/accessible/src/base/nsAccessibilityService.h @@ -51,7 +51,6 @@ public: private: NS_IMETHOD GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aContent); - NS_IMETHOD GetShellFromNode(nsIDOMNode *aNode, nsIWeakReference **weakShell); void GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent); nsIContent* FindContentForDocShell(nsIPresShell* aPresShell, nsIContent* aContent, nsIDocShell* aDocShell); diff --git a/mozilla/accessible/src/base/nsAccessible.cpp b/mozilla/accessible/src/base/nsAccessible.cpp index 6a159804e09..1958599ce2d 100644 --- a/mozilla/accessible/src/base/nsAccessible.cpp +++ b/mozilla/accessible/src/base/nsAccessible.cpp @@ -623,49 +623,6 @@ NS_IMETHODIMP nsAccessible::GetAccState(PRUint32 *aAccState) } } - nsCOMPtr content(do_QueryInterface(mDOMNode)); - if (content) { - nsCOMPtr shell(do_QueryReferent(mPresShell)); - if (shell) { - nsIFrame *frame = nsnull; - shell->GetPrimaryFrameFor(content, &frame); - if (frame) { - /* - PRBool isVisible = PR_FALSE, isFinishedLooking = PR_FALSE; - nsCOMPtr presContext; - shell->GetPresContext(getter_AddRefs(presContext)); - nsRect twipsRect, pixelsRect; - GetAbsoluteFramePosition(presContext, frame, twipsRect, pixelsRect); - - - //frame->IsVisibleForPainting(presContext, presContext, PR_TRUE, &isVisible); // 3rd param = bool to check css visibility - //frame->CheckVisibility(presContext, 0,1, PR_TRUE, &isFinishedLooking, &isVisible); - if (twipsRect.y < 0) - *aAccState |= STATE_OFFSCREEN; - */ - nsSize frameSize; - frame->GetSize(frameSize); - if (frameSize.width == 0) - *aAccState |= STATE_INVISIBLE; - - } - } - } - - - /** - * called to see if the children of the frame are visible from indexstart to index end. - * this does not change any state. returns PR_TRUE only if the indexes are valid and any of - * the children are visible. for textframes this index is the character index. - * if aStart = aEnd result will be PR_FALSE - * @param aStart start index of first child from 0-N (number of children) - * @param aEnd end index of last child from 0-N - * @param aRecurse should this frame talk to siblings to get to the contents other children? - * @param aFinished did this frame have the aEndIndex? or is there more work to do - * @param _retval return value true or false. false = range is not rendered. - */ - //NS_IMETHOD CheckVisibility(nsIPresContext* aContext, PRInt32 aStartIndex, PRInt32 aEndIndex, PRBool aRecurse, PRBool *aFinished, PRBool *_retval)=0; - return rv; } diff --git a/mozilla/accessible/src/base/nsGenericAccessible.cpp b/mozilla/accessible/src/base/nsGenericAccessible.cpp index 2ae05b790b7..9a815144d5a 100644 --- a/mozilla/accessible/src/base/nsGenericAccessible.cpp +++ b/mozilla/accessible/src/base/nsGenericAccessible.cpp @@ -25,6 +25,7 @@ #include "nsIFrame.h" #include "nsCOMPtr.h" #include "nsIWeakReference.h" +#include "nsISelectionController.h" #include "nsReadableUtils.h" #include "nsIContent.h" diff --git a/mozilla/accessible/src/html/nsHTMLAreaAccessible.cpp b/mozilla/accessible/src/html/nsHTMLAreaAccessible.cpp index 7df379d5449..b87d133fad4 100644 --- a/mozilla/accessible/src/html/nsHTMLAreaAccessible.cpp +++ b/mozilla/accessible/src/html/nsHTMLAreaAccessible.cpp @@ -30,6 +30,7 @@ #include "nsIServiceManager.h" #include "nsIDOMElement.h" #include "nsIDOMHTMLAreaElement.h" +#include "nsGUIEvent.h" // --- area ----- diff --git a/mozilla/accessible/src/html/nsHTMLFormControlAccessible.cpp b/mozilla/accessible/src/html/nsHTMLFormControlAccessible.cpp index 36c39d2d15f..4ecc9554195 100644 --- a/mozilla/accessible/src/html/nsHTMLFormControlAccessible.cpp +++ b/mozilla/accessible/src/html/nsHTMLFormControlAccessible.cpp @@ -29,12 +29,12 @@ #include "nsHTMLAtoms.h" #include "nsIDOMHTMLButtonElement.h" #include "nsReadableUtils.h" +#include "nsString.h" #include "nsAccessible.h" #include "nsIFrame.h" #include "nsIDOMHTMLLabelElement.h" #include "nsIDOMHTMLFormElement.h" #include "nsISelectionController.h" -#include "nsIDOMXULCheckboxElement.h" nsHTMLFormControlAccessible::nsHTMLFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): nsLeafAccessible(aNode, aShell) @@ -117,29 +117,25 @@ NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccName(nsAWritableString& _retval NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccState(PRUint32 *_retval) { // can be - // focusable, focused, protected, unavailable - nsCOMPtr htmlFormElement(do_QueryInterface(mDOMNode)); + // focusable, focused, checked, protected, unavailable + nsCOMPtr element(do_QueryInterface(mDOMNode)); nsAccessible::GetAccState(_retval); + *_retval |= STATE_FOCUSABLE; + + PRBool checked = PR_FALSE; + element->GetChecked(&checked); + if (checked) *_retval |= STATE_CHECKED; PRBool disabled = PR_FALSE; - if (htmlFormElement) { - htmlFormElement->GetDisabled(&disabled); - nsAutoString typeString; - htmlFormElement->GetType(typeString); - if (typeString.EqualsIgnoreCase("password")) - *_retval |= STATE_PROTECTED; - } - else { - nsCOMPtr xulFormElement(do_QueryInterface(mDOMNode)); - if (xulFormElement) - xulFormElement->GetDisabled(&disabled); - } - + element->GetDisabled(&disabled); if (disabled) *_retval |= STATE_UNAVAILABLE; - else - *_retval |= STATE_FOCUSABLE; + + nsAutoString typeString; + element->GetType(typeString); + if (typeString.EqualsIgnoreCase("password")) + *_retval |= STATE_PROTECTED; return NS_OK; } @@ -168,12 +164,15 @@ NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccNumActions(PRUint8 *_retval) /* wstring getAccActionName (in PRUint8 index); */ NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval) { - if (index == 0) { // 0 is the magic value for default action + if (index == 0) { // check or uncheck - PRUint32 state; - GetAccState(&state); + nsCOMPtr element(do_QueryInterface(mDOMNode)); - if (state & STATE_CHECKED) + PRBool checked = PR_FALSE; + if (element) + element->GetChecked(&checked); + + if (checked) _retval = NS_LITERAL_STRING("uncheck"); else _retval = NS_LITERAL_STRING("check"); @@ -187,43 +186,15 @@ NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAWrita NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoAction(PRUint8 index) { if (index == 0) { // 0 is the magic value for default action - nsCOMPtr htmlCheckboxElement(do_QueryInterface(mDOMNode)); + nsCOMPtr element(do_QueryInterface(mDOMNode)); PRBool checked = PR_FALSE; - if (htmlCheckboxElement) { - htmlCheckboxElement->GetChecked(&checked); - htmlCheckboxElement->SetChecked(!checked); - } - else { - nsCOMPtr xulCheckboxElement(do_QueryInterface(mDOMNode)); - if (xulCheckboxElement) { - xulCheckboxElement->GetChecked(&checked); - xulCheckboxElement->SetChecked(!checked); - } - } + element->GetChecked(&checked); + element->SetChecked(checked ? PR_FALSE : PR_TRUE); return NS_OK; } return NS_ERROR_INVALID_ARG; } -NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccState(PRUint32 *_retval) -{ - nsHTMLFormControlAccessible::GetAccState(_retval); - PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked - - nsCOMPtr htmlCheckboxElement(do_QueryInterface(mDOMNode)); - if (htmlCheckboxElement) - htmlCheckboxElement->GetChecked(&checked); - else { - nsCOMPtr xulCheckboxElement(do_QueryInterface(mDOMNode)); - if (xulCheckboxElement) - xulCheckboxElement->GetChecked(&checked); - } - - if (checked) - *_retval |= STATE_CHECKED; - - return NS_OK; -} //------ Radio button ------- @@ -269,28 +240,6 @@ NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccRole(PRUint32 *_retval) return NS_OK; } -NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccState(PRUint32 *_retval) -{ - nsHTMLFormControlAccessible::GetAccState(_retval); - PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked - - nsCOMPtr htmlRadioElement(do_QueryInterface(mDOMNode)); - if (htmlRadioElement) - htmlRadioElement->GetChecked(&checked); - - /* ----- Need to add this code soon - - nsCOMPtr xulRadioElement(do_QueryInteface(mDOMNode)); - if (xulRadioElement) - xulRadioElement->GetChecked(&checked); - */ - - if (checked) - *_retval |= STATE_CHECKED; - - return NS_OK; -} - // ----- Button ----- nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): @@ -438,11 +387,6 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccRole(PRUint32 *_retval) /* wstring getAccValue (); */ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccValue(nsAWritableString& _retval) { - PRUint32 state; - GetAccState(&state); - if (state & STATE_PROTECTED) // Don't return password text! - return NS_ERROR_FAILURE; - nsCOMPtr textArea(do_QueryInterface(mDOMNode)); if (textArea) { textArea->GetValue(_retval); diff --git a/mozilla/accessible/src/html/nsHTMLFormControlAccessible.h b/mozilla/accessible/src/html/nsHTMLFormControlAccessible.h index 2b5bc7df41a..c83ed2981e0 100644 --- a/mozilla/accessible/src/html/nsHTMLFormControlAccessible.h +++ b/mozilla/accessible/src/html/nsHTMLFormControlAccessible.h @@ -54,7 +54,6 @@ public: NS_IMETHOD GetAccNumActions(PRUint8 *_retval); NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval); NS_IMETHOD AccDoAction(PRUint8 index); - NS_IMETHOD GetAccState(PRUint32 *_retval); }; class nsHTMLRadioButtonAccessible : public nsHTMLFormControlAccessible @@ -66,7 +65,6 @@ public: NS_IMETHOD GetAccNumActions(PRUint8 *_retval); NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval); NS_IMETHOD AccDoAction(PRUint8 index); - NS_IMETHOD GetAccState(PRUint32 *_retval); }; class nsHTMLButtonAccessible : public nsHTMLFormControlAccessible diff --git a/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp b/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp index 04055b05269..3490eaa3a5e 100644 --- a/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp +++ b/mozilla/accessible/src/html/nsHTMLTextAccessible.cpp @@ -24,6 +24,7 @@ #include "nsHTMLTextAccessible.h" #include "nsWeakReference.h" #include "nsIFrame.h" +#include "nsString.h" #include "nsILink.h" #include "nsILinkHandler.h" #include "nsISelection.h" diff --git a/mozilla/accessible/src/nsAccessibilityService.cpp b/mozilla/accessible/src/nsAccessibilityService.cpp index c8c77c81b5f..e3d1c034ad3 100644 --- a/mozilla/accessible/src/nsAccessibilityService.cpp +++ b/mozilla/accessible/src/nsAccessibilityService.cpp @@ -45,12 +45,10 @@ #include "nsHTMLListboxAccessible.h" #include "nsIDOMHTMLAreaElement.h" #include "nsHTMLFormControlAccessible.h" -#include "nsIAccessibleProvider.h" #include "nsILink.h" #include "nsIDocShellTreeItem.h" #include "nsIDOMDocument.h" #include "nsIDOMHTMLOptionElement.h" -#include "nsIDOMXULCheckboxElement.h" // IFrame #include "nsIDocShell.h" @@ -177,19 +175,6 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports * return NS_OK; } -NS_IMETHODIMP nsAccessibilityService::CreateXULCheckboxAccessible(nsIDOMNode *aNode, nsIAccessible **_retval) -{ - nsCOMPtr weakShell; - GetShellFromNode(aNode, getter_AddRefs(weakShell)); - - *_retval = new nsHTMLCheckboxAccessible(aNode, weakShell); - if (! *_retval) - return NS_ERROR_OUT_OF_MEMORY; - - NS_ADDREF(*_retval); - return NS_OK; -} - /* nsIAccessible createHTMRadioButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */ NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupports *aFrame, nsIAccessible **_retval) { @@ -355,28 +340,6 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextFieldAccessible(nsISupports return NS_OK; } -NS_IMETHODIMP nsAccessibilityService::GetShellFromNode(nsIDOMNode *aNode, nsIWeakReference **aWeakShell) -{ - nsCOMPtr domDoc; - aNode->GetOwnerDocument(getter_AddRefs(domDoc)); - nsCOMPtr doc(do_QueryInterface(domDoc)); - if (!doc) - return NS_ERROR_INVALID_ARG; - - // ---- Get the pres shell ---- - nsCOMPtr shell; - doc->GetShellAt(0, getter_AddRefs(shell)); - if (!shell) - return NS_ERROR_FAILURE; - - nsCOMPtr weakRef(do_GetWeakReference(shell)); - - *aWeakShell = weakRef; - NS_IF_ADDREF(*aWeakShell); - - return NS_OK; -} - NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode) { NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!"); @@ -661,12 +624,9 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode, nsCOMPtr newAcc; frame->GetAccessible(getter_AddRefs(newAcc)); - // ---- Is it a XUL element? -- they impl nsIAccessibleProvider via XBL - if (!newAcc) { - nsCOMPtr accProv(do_QueryInterface(aNode)); - if (accProv) - accProv->GetAccessible(getter_AddRefs(newAcc)); - } + // ---- Try QI'ing node to get nsIAccessible ---- + if (!newAcc) + newAcc = do_QueryInterface(aNode); // ---- If link, create link accessible ---- if (!newAcc) { diff --git a/mozilla/accessible/src/nsAccessibilityService.h b/mozilla/accessible/src/nsAccessibilityService.h index 47efd845153..5450fe88de2 100644 --- a/mozilla/accessible/src/nsAccessibilityService.h +++ b/mozilla/accessible/src/nsAccessibilityService.h @@ -51,7 +51,6 @@ public: private: NS_IMETHOD GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aContent); - NS_IMETHOD GetShellFromNode(nsIDOMNode *aNode, nsIWeakReference **weakShell); void GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent); nsIContent* FindContentForDocShell(nsIPresShell* aPresShell, nsIContent* aContent, nsIDocShell* aDocShell); diff --git a/mozilla/accessible/src/nsAccessible.cpp b/mozilla/accessible/src/nsAccessible.cpp index 6a159804e09..1958599ce2d 100644 --- a/mozilla/accessible/src/nsAccessible.cpp +++ b/mozilla/accessible/src/nsAccessible.cpp @@ -623,49 +623,6 @@ NS_IMETHODIMP nsAccessible::GetAccState(PRUint32 *aAccState) } } - nsCOMPtr content(do_QueryInterface(mDOMNode)); - if (content) { - nsCOMPtr shell(do_QueryReferent(mPresShell)); - if (shell) { - nsIFrame *frame = nsnull; - shell->GetPrimaryFrameFor(content, &frame); - if (frame) { - /* - PRBool isVisible = PR_FALSE, isFinishedLooking = PR_FALSE; - nsCOMPtr presContext; - shell->GetPresContext(getter_AddRefs(presContext)); - nsRect twipsRect, pixelsRect; - GetAbsoluteFramePosition(presContext, frame, twipsRect, pixelsRect); - - - //frame->IsVisibleForPainting(presContext, presContext, PR_TRUE, &isVisible); // 3rd param = bool to check css visibility - //frame->CheckVisibility(presContext, 0,1, PR_TRUE, &isFinishedLooking, &isVisible); - if (twipsRect.y < 0) - *aAccState |= STATE_OFFSCREEN; - */ - nsSize frameSize; - frame->GetSize(frameSize); - if (frameSize.width == 0) - *aAccState |= STATE_INVISIBLE; - - } - } - } - - - /** - * called to see if the children of the frame are visible from indexstart to index end. - * this does not change any state. returns PR_TRUE only if the indexes are valid and any of - * the children are visible. for textframes this index is the character index. - * if aStart = aEnd result will be PR_FALSE - * @param aStart start index of first child from 0-N (number of children) - * @param aEnd end index of last child from 0-N - * @param aRecurse should this frame talk to siblings to get to the contents other children? - * @param aFinished did this frame have the aEndIndex? or is there more work to do - * @param _retval return value true or false. false = range is not rendered. - */ - //NS_IMETHOD CheckVisibility(nsIPresContext* aContext, PRInt32 aStartIndex, PRInt32 aEndIndex, PRBool aRecurse, PRBool *aFinished, PRBool *_retval)=0; - return rv; } diff --git a/mozilla/accessible/src/nsGenericAccessible.cpp b/mozilla/accessible/src/nsGenericAccessible.cpp index 2ae05b790b7..9a815144d5a 100644 --- a/mozilla/accessible/src/nsGenericAccessible.cpp +++ b/mozilla/accessible/src/nsGenericAccessible.cpp @@ -25,6 +25,7 @@ #include "nsIFrame.h" #include "nsCOMPtr.h" #include "nsIWeakReference.h" +#include "nsISelectionController.h" #include "nsReadableUtils.h" #include "nsIContent.h" diff --git a/mozilla/accessible/src/nsHTMLAreaAccessible.cpp b/mozilla/accessible/src/nsHTMLAreaAccessible.cpp index 7df379d5449..b87d133fad4 100644 --- a/mozilla/accessible/src/nsHTMLAreaAccessible.cpp +++ b/mozilla/accessible/src/nsHTMLAreaAccessible.cpp @@ -30,6 +30,7 @@ #include "nsIServiceManager.h" #include "nsIDOMElement.h" #include "nsIDOMHTMLAreaElement.h" +#include "nsGUIEvent.h" // --- area ----- diff --git a/mozilla/accessible/src/nsHTMLFormControlAccessible.cpp b/mozilla/accessible/src/nsHTMLFormControlAccessible.cpp index 36c39d2d15f..4ecc9554195 100644 --- a/mozilla/accessible/src/nsHTMLFormControlAccessible.cpp +++ b/mozilla/accessible/src/nsHTMLFormControlAccessible.cpp @@ -29,12 +29,12 @@ #include "nsHTMLAtoms.h" #include "nsIDOMHTMLButtonElement.h" #include "nsReadableUtils.h" +#include "nsString.h" #include "nsAccessible.h" #include "nsIFrame.h" #include "nsIDOMHTMLLabelElement.h" #include "nsIDOMHTMLFormElement.h" #include "nsISelectionController.h" -#include "nsIDOMXULCheckboxElement.h" nsHTMLFormControlAccessible::nsHTMLFormControlAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): nsLeafAccessible(aNode, aShell) @@ -117,29 +117,25 @@ NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccName(nsAWritableString& _retval NS_IMETHODIMP nsHTMLFormControlAccessible::GetAccState(PRUint32 *_retval) { // can be - // focusable, focused, protected, unavailable - nsCOMPtr htmlFormElement(do_QueryInterface(mDOMNode)); + // focusable, focused, checked, protected, unavailable + nsCOMPtr element(do_QueryInterface(mDOMNode)); nsAccessible::GetAccState(_retval); + *_retval |= STATE_FOCUSABLE; + + PRBool checked = PR_FALSE; + element->GetChecked(&checked); + if (checked) *_retval |= STATE_CHECKED; PRBool disabled = PR_FALSE; - if (htmlFormElement) { - htmlFormElement->GetDisabled(&disabled); - nsAutoString typeString; - htmlFormElement->GetType(typeString); - if (typeString.EqualsIgnoreCase("password")) - *_retval |= STATE_PROTECTED; - } - else { - nsCOMPtr xulFormElement(do_QueryInterface(mDOMNode)); - if (xulFormElement) - xulFormElement->GetDisabled(&disabled); - } - + element->GetDisabled(&disabled); if (disabled) *_retval |= STATE_UNAVAILABLE; - else - *_retval |= STATE_FOCUSABLE; + + nsAutoString typeString; + element->GetType(typeString); + if (typeString.EqualsIgnoreCase("password")) + *_retval |= STATE_PROTECTED; return NS_OK; } @@ -168,12 +164,15 @@ NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccNumActions(PRUint8 *_retval) /* wstring getAccActionName (in PRUint8 index); */ NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval) { - if (index == 0) { // 0 is the magic value for default action + if (index == 0) { // check or uncheck - PRUint32 state; - GetAccState(&state); + nsCOMPtr element(do_QueryInterface(mDOMNode)); - if (state & STATE_CHECKED) + PRBool checked = PR_FALSE; + if (element) + element->GetChecked(&checked); + + if (checked) _retval = NS_LITERAL_STRING("uncheck"); else _retval = NS_LITERAL_STRING("check"); @@ -187,43 +186,15 @@ NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccActionName(PRUint8 index, nsAWrita NS_IMETHODIMP nsHTMLCheckboxAccessible::AccDoAction(PRUint8 index) { if (index == 0) { // 0 is the magic value for default action - nsCOMPtr htmlCheckboxElement(do_QueryInterface(mDOMNode)); + nsCOMPtr element(do_QueryInterface(mDOMNode)); PRBool checked = PR_FALSE; - if (htmlCheckboxElement) { - htmlCheckboxElement->GetChecked(&checked); - htmlCheckboxElement->SetChecked(!checked); - } - else { - nsCOMPtr xulCheckboxElement(do_QueryInterface(mDOMNode)); - if (xulCheckboxElement) { - xulCheckboxElement->GetChecked(&checked); - xulCheckboxElement->SetChecked(!checked); - } - } + element->GetChecked(&checked); + element->SetChecked(checked ? PR_FALSE : PR_TRUE); return NS_OK; } return NS_ERROR_INVALID_ARG; } -NS_IMETHODIMP nsHTMLCheckboxAccessible::GetAccState(PRUint32 *_retval) -{ - nsHTMLFormControlAccessible::GetAccState(_retval); - PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked - - nsCOMPtr htmlCheckboxElement(do_QueryInterface(mDOMNode)); - if (htmlCheckboxElement) - htmlCheckboxElement->GetChecked(&checked); - else { - nsCOMPtr xulCheckboxElement(do_QueryInterface(mDOMNode)); - if (xulCheckboxElement) - xulCheckboxElement->GetChecked(&checked); - } - - if (checked) - *_retval |= STATE_CHECKED; - - return NS_OK; -} //------ Radio button ------- @@ -269,28 +240,6 @@ NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccRole(PRUint32 *_retval) return NS_OK; } -NS_IMETHODIMP nsHTMLRadioButtonAccessible::GetAccState(PRUint32 *_retval) -{ - nsHTMLFormControlAccessible::GetAccState(_retval); - PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked - - nsCOMPtr htmlRadioElement(do_QueryInterface(mDOMNode)); - if (htmlRadioElement) - htmlRadioElement->GetChecked(&checked); - - /* ----- Need to add this code soon - - nsCOMPtr xulRadioElement(do_QueryInteface(mDOMNode)); - if (xulRadioElement) - xulRadioElement->GetChecked(&checked); - */ - - if (checked) - *_retval |= STATE_CHECKED; - - return NS_OK; -} - // ----- Button ----- nsHTMLButtonAccessible::nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell): @@ -438,11 +387,6 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccRole(PRUint32 *_retval) /* wstring getAccValue (); */ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccValue(nsAWritableString& _retval) { - PRUint32 state; - GetAccState(&state); - if (state & STATE_PROTECTED) // Don't return password text! - return NS_ERROR_FAILURE; - nsCOMPtr textArea(do_QueryInterface(mDOMNode)); if (textArea) { textArea->GetValue(_retval); diff --git a/mozilla/accessible/src/nsHTMLFormControlAccessible.h b/mozilla/accessible/src/nsHTMLFormControlAccessible.h index 2b5bc7df41a..c83ed2981e0 100644 --- a/mozilla/accessible/src/nsHTMLFormControlAccessible.h +++ b/mozilla/accessible/src/nsHTMLFormControlAccessible.h @@ -54,7 +54,6 @@ public: NS_IMETHOD GetAccNumActions(PRUint8 *_retval); NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval); NS_IMETHOD AccDoAction(PRUint8 index); - NS_IMETHOD GetAccState(PRUint32 *_retval); }; class nsHTMLRadioButtonAccessible : public nsHTMLFormControlAccessible @@ -66,7 +65,6 @@ public: NS_IMETHOD GetAccNumActions(PRUint8 *_retval); NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval); NS_IMETHOD AccDoAction(PRUint8 index); - NS_IMETHOD GetAccState(PRUint32 *_retval); }; class nsHTMLButtonAccessible : public nsHTMLFormControlAccessible diff --git a/mozilla/accessible/src/nsHTMLTextAccessible.cpp b/mozilla/accessible/src/nsHTMLTextAccessible.cpp index 04055b05269..3490eaa3a5e 100644 --- a/mozilla/accessible/src/nsHTMLTextAccessible.cpp +++ b/mozilla/accessible/src/nsHTMLTextAccessible.cpp @@ -24,6 +24,7 @@ #include "nsHTMLTextAccessible.h" #include "nsWeakReference.h" #include "nsIFrame.h" +#include "nsString.h" #include "nsILink.h" #include "nsILinkHandler.h" #include "nsISelection.h" diff --git a/mozilla/dom/public/idl/xul/MANIFEST_IDL b/mozilla/dom/public/idl/xul/MANIFEST_IDL index e1e8f1c719a..5f8d104c229 100644 --- a/mozilla/dom/public/idl/xul/MANIFEST_IDL +++ b/mozilla/dom/public/idl/xul/MANIFEST_IDL @@ -2,6 +2,3 @@ nsIDOMXULCommandDispatcher.idl nsIDOMXULDocument.idl nsIDOMXULElement.idl nsIDOMXULTreeElement.idl -nsIDOMXULCheckboxElement.idl -nsIDOMXULControlElement.idl -nsIDOMXULLabeledControlElement.idl diff --git a/mozilla/dom/public/idl/xul/Makefile.in b/mozilla/dom/public/idl/xul/Makefile.in index 792fe2422ab..2ac3af0c1e5 100644 --- a/mozilla/dom/public/idl/xul/Makefile.in +++ b/mozilla/dom/public/idl/xul/Makefile.in @@ -34,9 +34,6 @@ XPIDLSRCS = \ nsIDOMXULDocument.idl \ nsIDOMXULElement.idl \ nsIDOMXULTreeElement.idl \ - nsIDOMXULCheckboxElement.idl \ - nsIDOMXULControlElement.idl \ - nsIDOMXULLabeledControlElement.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/dom/public/idl/xul/makefile.win b/mozilla/dom/public/idl/xul/makefile.win index 62cd22369a6..cf8811cc9af 100644 --- a/mozilla/dom/public/idl/xul/makefile.win +++ b/mozilla/dom/public/idl/xul/makefile.win @@ -30,9 +30,6 @@ XPIDLSRCS = \ .\nsIDOMXULDocument.idl \ .\nsIDOMXULElement.idl \ .\nsIDOMXULTreeElement.idl \ - .\nsIDOMXULCheckboxElement.idl \ - .\nsIDOMXULControlElement.idl \ - .\nsIDOMXULLabeledControlElement.idl \ $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/dom/public/idl/xul/nsIDOMXULCheckboxElement.idl b/mozilla/dom/public/idl/xul/nsIDOMXULCheckboxElement.idl deleted file mode 100644 index c48da845a6f..00000000000 --- a/mozilla/dom/public/idl/xul/nsIDOMXULCheckboxElement.idl +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 2000 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * David Hyatt (original author) - * Johnny Stenback - */ - -#include "nsIDOMElement.idl" -#include "nsIDOMXULLabeledControlElement.idl" - -[scriptable, uuid(5afaba88-1dd2-11b2-9249-dd65a129d0e4)] -interface nsIDOMXULCheckboxElement : nsIDOMXULLabeledControlElement { - attribute boolean checked; - attribute long checkState; - attribute boolean autoCheck; -}; - - - - diff --git a/mozilla/dom/public/idl/xul/nsIDOMXULControlElement.idl b/mozilla/dom/public/idl/xul/nsIDOMXULControlElement.idl deleted file mode 100644 index 2f9f30e4cc7..00000000000 --- a/mozilla/dom/public/idl/xul/nsIDOMXULControlElement.idl +++ /dev/null @@ -1,41 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 2000 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * David Hyatt (original author) - * Johnny Stenback - */ - -#include "nsIDOMElement.idl" -#include "nsIDOMXULElement.idl" - -interface nsIControllers; - -[scriptable, uuid(007b8358-1dd2-11b2-8924-d209efc3f124)] -interface nsIDOMXULControlElement : nsIDOMXULElement { - attribute boolean disabled; - attribute long tabIndex; - -// readonly attribute nsIControllers controllers; - -// void focus(); -// void blur(); -}; - - diff --git a/mozilla/dom/public/idl/xul/nsIDOMXULLabeledControlElement.idl b/mozilla/dom/public/idl/xul/nsIDOMXULLabeledControlElement.idl deleted file mode 100644 index 485d27d8017..00000000000 --- a/mozilla/dom/public/idl/xul/nsIDOMXULLabeledControlElement.idl +++ /dev/null @@ -1,38 +0,0 @@ -/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 2000 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - * David Hyatt (original author) - * Johnny Stenback - */ - -#include "nsIDOMElement.idl" -#include "nsIDOMXULControlElement.idl" - -[scriptable, uuid(a457ea70-1dd1-11b2-9089-8fd894122084)] -interface nsIDOMXULLabeledControlElement : nsIDOMXULControlElement { - attribute DOMString crop; - attribute DOMString image; - attribute DOMString label; - attribute DOMString accessKey; - attribute DOMString command; - -// void doCommand(); -}; - diff --git a/mozilla/xpfe/global/resources/content/bindings/checkbox.xml b/mozilla/xpfe/global/resources/content/bindings/checkbox.xml index 458dafe288b..588325362c2 100644 --- a/mozilla/xpfe/global/resources/content/bindings/checkbox.xml +++ b/mozilla/xpfe/global/resources/content/bindings/checkbox.xml @@ -21,15 +21,7 @@ - - - - - - +