diff --git a/accessible/src/base/nsAccessibilityUtils.cpp b/accessible/src/base/nsAccessibilityUtils.cpp index 7638ea871e2..0f6cd67fce8 100755 --- a/accessible/src/base/nsAccessibilityUtils.cpp +++ b/accessible/src/base/nsAccessibilityUtils.cpp @@ -52,8 +52,6 @@ #include "nsIDOMDocument.h" #include "nsIDOMDocumentView.h" #include "nsIDOMDocumentXBL.h" -#include "nsIDOMHTMLDocument.h" -#include "nsIDOMHTMLElement.h" #include "nsIDOMNodeList.h" #include "nsIDOMRange.h" #include "nsIDOMXULContainerElement.h" @@ -389,24 +387,15 @@ already_AddRefed nsAccUtils::GetDOMElementFor(nsIDOMNode *aNode) { nsCOMPtr node(do_QueryInterface(aNode)); - nsIDOMElement *element = nsnull; + nsIDOMElement *element = nsnull; if (node->IsNodeOfType(nsINode::eELEMENT)) CallQueryInterface(node, &element); - else if (node->IsNodeOfType(nsINode::eTEXT)) CallQueryInterface(node->GetNodeParent(), &element); - else if (node->IsNodeOfType(nsINode::eDOCUMENT)) { - nsCOMPtr htmlDoc(do_QueryInterface(node)); - if (htmlDoc) { - nsCOMPtr bodyElement; - htmlDoc->GetBody(getter_AddRefs(bodyElement)); - CallQueryInterface(bodyElement, &element); - } else { - nsCOMPtr domDoc(do_QueryInterface(node)); - domDoc->GetDocumentElement(&element); - } + nsCOMPtr domDoc(do_QueryInterface(node)); + domDoc->GetDocumentElement(&element); } return element; diff --git a/accessible/src/base/nsAccessibilityUtils.h b/accessible/src/base/nsAccessibilityUtils.h index 848101a569c..423dad9aa7d 100755 --- a/accessible/src/base/nsAccessibilityUtils.h +++ b/accessible/src/base/nsAccessibilityUtils.h @@ -153,8 +153,7 @@ public: * Return DOM element related with the given node, i.e. * a) itself if it is DOM element * b) parent element if it is text node - * c) body element if it is HTML document node - * d) document element if it is document node. + * c) document element if it is document node. * * @param aNode [in] the given DOM node */ diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index 62ca4615cc0..6e411bc6e81 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -495,17 +495,13 @@ NS_IMETHODIMP nsDocAccessible::GetDocument(nsIDOMDocument **aDOMDoc) NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor) { NS_ENSURE_ARG_POINTER(aEditor); + *aEditor = nsnull; + NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE); - if (!mDocument) - return NS_ERROR_FAILURE; - - nsCOMPtr DOMDocument(do_QueryInterface(mDocument)); - nsCOMPtr DOMElement(nsAccUtils::GetDOMElementFor(DOMDocument)); - nsCOMPtr content(do_QueryInterface(DOMElement)); - - if (!content->HasFlag(NODE_IS_EDITABLE)) + if (!mDocument->HasFlag(NODE_IS_EDITABLE)) { return NS_OK; // Document not editable + } nsCOMPtr container = mDocument->GetContainer(); nsCOMPtr editingSession(do_GetInterface(container)); diff --git a/accessible/tests/mochitest/Makefile.in b/accessible/tests/mochitest/Makefile.in index 4e72eb27a7e..fbb5b5599b1 100644 --- a/accessible/tests/mochitest/Makefile.in +++ b/accessible/tests/mochitest/Makefile.in @@ -54,7 +54,6 @@ _TEST_FILES =\ nsIAccessible_name.js \ nsIAccessible_name.xbl \ nsIAccessible_selects.js \ - nsIAccessible_states.js \ nsIAccessibleEditableText.js \ test_aria_activedescendant.html \ test_aria_role_article.html \ @@ -66,7 +65,6 @@ _TEST_FILES =\ $(warning test_table_indexes.html temporarily disabled) \ test_nsIAccessible_actions.html \ test_nsIAccessible_actions.xul \ - test_nsIAccessible_editablebody.html \ test_nsIAccessible_name.html \ test_nsIAccessible_name.xul \ test_nsIAccessible_selects.html \ diff --git a/accessible/tests/mochitest/common.js b/accessible/tests/mochitest/common.js index 4f1a6f5d9be..d5a74e2af9b 100644 --- a/accessible/tests/mochitest/common.js +++ b/accessible/tests/mochitest/common.js @@ -32,7 +32,6 @@ const nsIDOMNode = Components.interfaces.nsIDOMNode; //////////////////////////////////////////////////////////////////////////////// // Roles - const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX; const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST; const ROLE_COMBOBOX_OPTION = nsIAccessibleRole.ROLE_COMBOBOX_OPTION; @@ -43,7 +42,6 @@ const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF; //////////////////////////////////////////////////////////////////////////////// // States - const STATE_COLLAPSED = nsIAccessibleStates.STATE_COLLAPSED; const STATE_EXPANDED = nsIAccessibleStates.STATE_EXPANDED; const STATE_EXTSELECTABLE = nsIAccessibleStates.STATE_EXTSELECTABLE; @@ -51,12 +49,9 @@ const STATE_FOCUSABLE = nsIAccessibleStates.STATE_FOCUSABLE; const STATE_FOCUSED = nsIAccessibleStates.STATE_FOCUSED; const STATE_HASPOPUP = nsIAccessibleStates.STATE_HASPOPUP; const STATE_MULTISELECTABLE = nsIAccessibleStates.STATE_MULTISELECTABLE; -const STATE_READONLY = nsIAccessibleStates.STATE_READONLY; const STATE_SELECTABLE = nsIAccessibleStates.STATE_SELECTABLE; const STATE_SELECTED = nsIAccessibleStates.STATE_SELECTED; -const EXT_STATE_EDITABLE = nsIAccessibleStates.EXT_STATE_EDITABLE; - //////////////////////////////////////////////////////////////////////////////// // Accessible general diff --git a/accessible/tests/mochitest/nsIAccessible_states.js b/accessible/tests/mochitest/nsIAccessible_states.js deleted file mode 100644 index ff65d62d469..00000000000 --- a/accessible/tests/mochitest/nsIAccessible_states.js +++ /dev/null @@ -1,42 +0,0 @@ -function testStates(aAccOrElmOrID, aState, aExtraState, aAbsentState) -{ - var [state, extraState] = getStates(aAccOrElmOrID); - - is(state & aState, aState, - "wrong state bits for " + aAccOrElmOrID + "!"); - is(extraState & aExtraState, aExtraState, - "wrong extraState bits for " + aAccOrElmOrID + "!"); - - if (aAbsentState) - is(state & aAbsentState, 0, - "state bits should not be present in ID " + aAccOrElmOrID + "!"); - - if (state & STATE_READONLY) - // if state is readonly, ext state must not be ext_state_editable. - is(extraState & EXT_STATE_EDITABLE, 0, - "Read-only " + aAccOrElmOrID + " cannot be editable!"); -} - -function getStringStates(aAccOrElmOrID) -{ - var [state, extraState] = getStates(aAccOrElmOrID); - var list = gAccRetrieval.getStringStates(state, extraState); - - var str = ""; - for (var index = 0; index < list.length; index++) - str += list.item(index) + ", "; - - return str; -} - -function getStates(aAccOrElmOrID) -{ - var acc = getAccessible(aAccOrElmOrID); - if (!acc) - return [0, 0]; - - var state = {}, extraState = {}; - acc.getFinalState(state, extraState); - - return [state.value, extraState.value]; -} diff --git a/accessible/tests/mochitest/test_nsIAccessible_editablebody.html b/accessible/tests/mochitest/test_nsIAccessible_editablebody.html deleted file mode 100644 index 16e44ce7228..00000000000 --- a/accessible/tests/mochitest/test_nsIAccessible_editablebody.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - nsIAccessible states tests of contenteditable body - - - - - - - - - - - - - - Mozilla Bug 454997 -

- -
-  
- -

hello

- -