Backout changeset 8fe1cd2d3c66 (bug 454997) because of regressions and crashes

This commit is contained in:
Marco Zehe 2008-09-28 07:50:34 +02:00
Родитель 69d2fde3f2
Коммит 5c35912d33
7 изменённых файлов: 8 добавлений и 119 удалений

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

@ -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<nsIDOMElement>
nsAccUtils::GetDOMElementFor(nsIDOMNode *aNode)
{
nsCOMPtr<nsINode> 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<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(node));
if (htmlDoc) {
nsCOMPtr<nsIDOMHTMLElement> bodyElement;
htmlDoc->GetBody(getter_AddRefs(bodyElement));
CallQueryInterface(bodyElement, &element);
} else {
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(node));
domDoc->GetDocumentElement(&element);
}
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(node));
domDoc->GetDocumentElement(&element);
}
return element;

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

@ -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
*/

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

@ -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<nsIDOMNode> DOMDocument(do_QueryInterface(mDocument));
nsCOMPtr<nsIDOMElement> DOMElement(nsAccUtils::GetDOMElementFor(DOMDocument));
nsCOMPtr<nsIContent> content(do_QueryInterface(DOMElement));
if (!content->HasFlag(NODE_IS_EDITABLE))
if (!mDocument->HasFlag(NODE_IS_EDITABLE)) {
return NS_OK; // Document not editable
}
nsCOMPtr<nsISupports> container = mDocument->GetContainer();
nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(container));

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

@ -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 \

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

@ -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

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

@ -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>