merge after backout of changeset 8fe1cd2d3c66

This commit is contained in:
Marco Zehe 2008-09-28 07:52:33 +02:00
Родитель 0f23b39c85 c6c43a6953
Коммит 71514becf5
7 изменённых файлов: 8 добавлений и 119 удалений

Просмотреть файл

@ -52,8 +52,6 @@
#include "nsIDOMDocument.h" #include "nsIDOMDocument.h"
#include "nsIDOMDocumentView.h" #include "nsIDOMDocumentView.h"
#include "nsIDOMDocumentXBL.h" #include "nsIDOMDocumentXBL.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMNodeList.h" #include "nsIDOMNodeList.h"
#include "nsIDOMRange.h" #include "nsIDOMRange.h"
#include "nsIDOMXULContainerElement.h" #include "nsIDOMXULContainerElement.h"
@ -389,24 +387,15 @@ already_AddRefed<nsIDOMElement>
nsAccUtils::GetDOMElementFor(nsIDOMNode *aNode) nsAccUtils::GetDOMElementFor(nsIDOMNode *aNode)
{ {
nsCOMPtr<nsINode> node(do_QueryInterface(aNode)); nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
nsIDOMElement *element = nsnull;
nsIDOMElement *element = nsnull;
if (node->IsNodeOfType(nsINode::eELEMENT)) if (node->IsNodeOfType(nsINode::eELEMENT))
CallQueryInterface(node, &element); CallQueryInterface(node, &element);
else if (node->IsNodeOfType(nsINode::eTEXT)) else if (node->IsNodeOfType(nsINode::eTEXT))
CallQueryInterface(node->GetNodeParent(), &element); CallQueryInterface(node->GetNodeParent(), &element);
else if (node->IsNodeOfType(nsINode::eDOCUMENT)) { else if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(node)); nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(node));
if (htmlDoc) { domDoc->GetDocumentElement(&element);
nsCOMPtr<nsIDOMHTMLElement> bodyElement;
htmlDoc->GetBody(getter_AddRefs(bodyElement));
CallQueryInterface(bodyElement, &element);
} else {
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(node));
domDoc->GetDocumentElement(&element);
}
} }
return element; return element;

Просмотреть файл

@ -153,8 +153,7 @@ public:
* Return DOM element related with the given node, i.e. * Return DOM element related with the given node, i.e.
* a) itself if it is DOM element * a) itself if it is DOM element
* b) parent element if it is text node * b) parent element if it is text node
* c) body element if it is HTML document node * c) document element if it is document node.
* d) document element if it is document node.
* *
* @param aNode [in] the given DOM node * @param aNode [in] the given DOM node
*/ */

Просмотреть файл

@ -495,17 +495,13 @@ NS_IMETHODIMP nsDocAccessible::GetDocument(nsIDOMDocument **aDOMDoc)
NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor) NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor)
{ {
NS_ENSURE_ARG_POINTER(aEditor); NS_ENSURE_ARG_POINTER(aEditor);
*aEditor = nsnull; *aEditor = nsnull;
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE);
if (!mDocument) if (!mDocument->HasFlag(NODE_IS_EDITABLE)) {
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMNode> DOMDocument(do_QueryInterface(mDocument));
nsCOMPtr<nsIDOMElement> DOMElement(nsAccUtils::GetDOMElementFor(DOMDocument));
nsCOMPtr<nsIContent> content(do_QueryInterface(DOMElement));
if (!content->HasFlag(NODE_IS_EDITABLE))
return NS_OK; // Document not editable return NS_OK; // Document not editable
}
nsCOMPtr<nsISupports> container = mDocument->GetContainer(); nsCOMPtr<nsISupports> container = mDocument->GetContainer();
nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(container)); nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(container));

Просмотреть файл

@ -54,7 +54,6 @@ _TEST_FILES =\
nsIAccessible_name.js \ nsIAccessible_name.js \
nsIAccessible_name.xbl \ nsIAccessible_name.xbl \
nsIAccessible_selects.js \ nsIAccessible_selects.js \
nsIAccessible_states.js \
nsIAccessibleEditableText.js \ nsIAccessibleEditableText.js \
test_aria_activedescendant.html \ test_aria_activedescendant.html \
test_aria_role_article.html \ test_aria_role_article.html \
@ -66,7 +65,6 @@ _TEST_FILES =\
$(warning test_table_indexes.html temporarily disabled) \ $(warning test_table_indexes.html temporarily disabled) \
test_nsIAccessible_actions.html \ test_nsIAccessible_actions.html \
test_nsIAccessible_actions.xul \ test_nsIAccessible_actions.xul \
test_nsIAccessible_editablebody.html \
test_nsIAccessible_name.html \ test_nsIAccessible_name.html \
test_nsIAccessible_name.xul \ test_nsIAccessible_name.xul \
test_nsIAccessible_selects.html \ test_nsIAccessible_selects.html \

Просмотреть файл

@ -32,7 +32,6 @@ const nsIDOMNode = Components.interfaces.nsIDOMNode;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Roles // Roles
const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX; const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX;
const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST; const ROLE_COMBOBOX_LIST = nsIAccessibleRole.ROLE_COMBOBOX_LIST;
const ROLE_COMBOBOX_OPTION = nsIAccessibleRole.ROLE_COMBOBOX_OPTION; const ROLE_COMBOBOX_OPTION = nsIAccessibleRole.ROLE_COMBOBOX_OPTION;
@ -43,7 +42,6 @@ const ROLE_TEXT_LEAF = nsIAccessibleRole.ROLE_TEXT_LEAF;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// States // States
const STATE_COLLAPSED = nsIAccessibleStates.STATE_COLLAPSED; const STATE_COLLAPSED = nsIAccessibleStates.STATE_COLLAPSED;
const STATE_EXPANDED = nsIAccessibleStates.STATE_EXPANDED; const STATE_EXPANDED = nsIAccessibleStates.STATE_EXPANDED;
const STATE_EXTSELECTABLE = nsIAccessibleStates.STATE_EXTSELECTABLE; const STATE_EXTSELECTABLE = nsIAccessibleStates.STATE_EXTSELECTABLE;
@ -51,12 +49,9 @@ const STATE_FOCUSABLE = nsIAccessibleStates.STATE_FOCUSABLE;
const STATE_FOCUSED = nsIAccessibleStates.STATE_FOCUSED; const STATE_FOCUSED = nsIAccessibleStates.STATE_FOCUSED;
const STATE_HASPOPUP = nsIAccessibleStates.STATE_HASPOPUP; const STATE_HASPOPUP = nsIAccessibleStates.STATE_HASPOPUP;
const STATE_MULTISELECTABLE = nsIAccessibleStates.STATE_MULTISELECTABLE; const STATE_MULTISELECTABLE = nsIAccessibleStates.STATE_MULTISELECTABLE;
const STATE_READONLY = nsIAccessibleStates.STATE_READONLY;
const STATE_SELECTABLE = nsIAccessibleStates.STATE_SELECTABLE; const STATE_SELECTABLE = nsIAccessibleStates.STATE_SELECTABLE;
const STATE_SELECTED = nsIAccessibleStates.STATE_SELECTED; const STATE_SELECTED = nsIAccessibleStates.STATE_SELECTED;
const EXT_STATE_EDITABLE = nsIAccessibleStates.EXT_STATE_EDITABLE;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Accessible general // Accessible general

Просмотреть файл

@ -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];
}

Просмотреть файл

@ -1,46 +0,0 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=454997
-->
<head>
<title>nsIAccessible states tests of contenteditable body</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
<script type="application/javascript">
function doTest()
{
testStates(document, 0, EXT_STATE_EDITABLE);
testStates("p", 0, EXT_STATE_EDITABLE);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
</head>
<body id="body" contentEditable="true">
<a target="_blank"
title="nsIAccessible states tests of contenteditable body"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=454997">Mozilla Bug 454997</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<p id="p">hello</p>
</body>
</html>