mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Backed out changeset 4916251eb389 (bug 1255009) for breaking AWSY.
--HG-- extra : rebase_source : 3c018d36597e8e4becc06b744bead086796d2e63 extra : histedit_source : 2c99af1f289f0d0ddd8df6c207492c547315ce7d
This commit is contained in:
parent
706d97900d
commit
e93eed0ec2
@ -16,7 +16,6 @@
|
||||
#include "nsEventShell.h"
|
||||
#include "nsTextEquivUtils.h"
|
||||
#include "DocAccessibleChild.h"
|
||||
#include "Logging.h"
|
||||
#include "Relation.h"
|
||||
#include "Role.h"
|
||||
#include "RootAccessible.h"
|
||||
@ -1960,18 +1959,7 @@ Accessible::BindToParent(Accessible* aParent, uint32_t aIndexInParent)
|
||||
|
||||
if (mParent) {
|
||||
if (mParent != aParent) {
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eTree)) {
|
||||
logging::MsgBegin("TREE", "BindToParent: stealing accessible");
|
||||
logging::AccessibleInfo("old parent", mParent);
|
||||
logging::AccessibleInfo("new parent", aParent);
|
||||
logging::AccessibleInfo("child", this);
|
||||
logging::MsgEnd();
|
||||
}
|
||||
#endif
|
||||
// XXX: legalize adoption. As long as we don't invalidate the children,
|
||||
// the accessibles start to steal them.
|
||||
|
||||
NS_ERROR("Adopting child!");
|
||||
mParent->InvalidateChildrenGroupInfo();
|
||||
mParent->RemoveChild(this);
|
||||
} else {
|
||||
|
@ -394,14 +394,6 @@ public:
|
||||
bool AppendChild(Accessible* aChild)
|
||||
{ return InsertChildAt(mChildren.Length(), aChild); }
|
||||
virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild);
|
||||
|
||||
bool InsertAfter(Accessible* aNewChild, Accessible* aRefChild)
|
||||
{
|
||||
MOZ_ASSERT(aNewChild, "No new child to insert");
|
||||
return InsertChildAt(aRefChild ? aRefChild->IndexInParent() + 1 : 0,
|
||||
aNewChild);
|
||||
}
|
||||
|
||||
virtual bool RemoveChild(Accessible* aChild);
|
||||
|
||||
/**
|
||||
|
@ -1670,187 +1670,45 @@ DocAccessible::UpdateAccessibleOnAttrChange(dom::Element* aElement,
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Content insertion helper.
|
||||
*/
|
||||
class InsertIterator final
|
||||
{
|
||||
public:
|
||||
InsertIterator(Accessible* aContext,
|
||||
const nsTArray<nsCOMPtr<nsIContent> >* aNodes) :
|
||||
mChild(nullptr), mChildBefore(nullptr), mWalker(aContext),
|
||||
mStopNode(nullptr), mNodes(aNodes), mNodesIdx(0)
|
||||
{
|
||||
MOZ_ASSERT(aContext, "No context");
|
||||
MOZ_ASSERT(aNodes, "No nodes to search for accessible elements");
|
||||
MOZ_COUNT_CTOR(InsertIterator);
|
||||
}
|
||||
~InsertIterator() { MOZ_COUNT_DTOR(InsertIterator); }
|
||||
|
||||
Accessible* Context() const { return mWalker.Context(); }
|
||||
Accessible* Child() const { return mChild; }
|
||||
Accessible* ChildBefore() const { return mChildBefore; }
|
||||
DocAccessible* Document() const { return mWalker.Document(); }
|
||||
|
||||
/**
|
||||
* Iterates to a next accessible within the inserted content.
|
||||
*/
|
||||
bool Next();
|
||||
|
||||
private:
|
||||
Accessible* mChild;
|
||||
Accessible* mChildBefore;
|
||||
TreeWalker mWalker;
|
||||
nsIContent* mStopNode;
|
||||
|
||||
const nsTArray<nsCOMPtr<nsIContent> >* mNodes;
|
||||
uint32_t mNodesIdx;
|
||||
};
|
||||
|
||||
bool
|
||||
InsertIterator::Next()
|
||||
{
|
||||
if (mNodesIdx > 0) {
|
||||
Accessible* nextChild = mWalker.Next(mStopNode);
|
||||
if (nextChild) {
|
||||
mChildBefore = mChild;
|
||||
mChild = nextChild;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
while (mNodesIdx < mNodes->Length()) {
|
||||
// Ignore nodes that are not contained by the container anymore.
|
||||
|
||||
// The container might be changed, for example, because of the subsequent
|
||||
// overlapping content insertion (i.e. other content was inserted between
|
||||
// this inserted content and its container or the content was reinserted
|
||||
// into different container of unrelated part of tree). To avoid a double
|
||||
// processing of the content insertion ignore this insertion notification.
|
||||
// Note, the inserted content might be not in tree at all at this point
|
||||
// what means there's no container. Ignore the insertion too.
|
||||
nsIContent* prevNode = mNodes->SafeElementAt(mNodesIdx - 1);
|
||||
nsIContent* node = mNodes->ElementAt(mNodesIdx++);
|
||||
Accessible* container = Document()->GetContainerAccessible(node);
|
||||
if (container != Context() || !container->IsAcceptableChild(node)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
logging::TreeInfo("traversing an inserted node", logging::eVerbose,
|
||||
"container", container, "node", node);
|
||||
#endif
|
||||
|
||||
// If inserted nodes are siblings then just move the walker next.
|
||||
if (prevNode && prevNode->GetNextSibling() == node) {
|
||||
mStopNode = node;
|
||||
Accessible* nextChild = mWalker.Next(mStopNode);
|
||||
if (nextChild) {
|
||||
mChildBefore = mChild;
|
||||
mChild = nextChild;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (mWalker.Seek(node)) {
|
||||
mStopNode = node;
|
||||
mChildBefore = mWalker.Prev();
|
||||
mChild = mWalker.Next(mStopNode);
|
||||
if (mChild) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
DocAccessible::ProcessContentInserted(Accessible* aContainer,
|
||||
const nsTArray<nsCOMPtr<nsIContent> >* aNodes)
|
||||
const nsTArray<nsCOMPtr<nsIContent> >* aInsertedContent)
|
||||
{
|
||||
// Process insertions if the container accessible is still in tree.
|
||||
if (!HasAccessible(aContainer->GetNode()))
|
||||
return;
|
||||
|
||||
// If new root content has been inserted then update it.
|
||||
if (aContainer == this) {
|
||||
UpdateRootElIfNeeded();
|
||||
}
|
||||
for (uint32_t idx = 0; idx < aInsertedContent->Length(); idx++) {
|
||||
// The container might be changed, for example, because of the subsequent
|
||||
// overlapping content insertion (i.e. other content was inserted between
|
||||
// this inserted content and its container or the content was reinserted
|
||||
// into different container of unrelated part of tree). To avoid a double
|
||||
// processing of the content insertion ignore this insertion notification.
|
||||
// Note, the inserted content might be not in tree at all at this point what
|
||||
// means there's no container. Ignore the insertion too.
|
||||
|
||||
uint32_t updateFlags = 0;
|
||||
AutoTreeMutation mut(aContainer);
|
||||
RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(aContainer);
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
logging::TreeInfo("children before insertion", logging::eVerbose,
|
||||
aContainer);
|
||||
#endif
|
||||
|
||||
InsertIterator iter(aContainer, aNodes);
|
||||
while (iter.Next()) {
|
||||
#ifdef A11Y_LOG
|
||||
logging::TreeInfo("accessible is found", logging::eVerbose,
|
||||
"container", aContainer, "child", iter.Child(), nullptr);
|
||||
#endif
|
||||
|
||||
Accessible* parent = iter.Child()->Parent();
|
||||
if (parent) {
|
||||
if (parent != aContainer) {
|
||||
#ifdef A11Y_LOG
|
||||
logging::TreeInfo("stealing accessible", 0,
|
||||
"old parent", parent, "new parent",
|
||||
aContainer, "child", iter.Child(), nullptr);
|
||||
#endif
|
||||
MOZ_ASSERT_UNREACHABLE("stealing accessible");
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
logging::TreeInfo("binding to same parent", logging::eVerbose,
|
||||
"parent", aContainer, "child", iter.Child(), nullptr);
|
||||
#endif
|
||||
Accessible* container =
|
||||
GetContainerAccessible(aInsertedContent->ElementAt(idx));
|
||||
if (container != aContainer)
|
||||
continue;
|
||||
|
||||
if (container == this) {
|
||||
// If new root content has been inserted then update it.
|
||||
UpdateRootElIfNeeded();
|
||||
|
||||
// Continue to update the tree even if we don't have root content.
|
||||
// For example, elements may be inserted under the document element while
|
||||
// there is no HTML body element.
|
||||
}
|
||||
|
||||
if (aContainer->InsertAfter(iter.Child(), iter.ChildBefore())) {
|
||||
#ifdef A11Y_LOG
|
||||
logging::TreeInfo("accessible was accepted", 0,
|
||||
"container", aContainer, "child", iter.Child(), nullptr);
|
||||
#endif
|
||||
|
||||
updateFlags |= UpdateTreeInternal(iter.Child(), true, reorderEvent);
|
||||
continue;
|
||||
}
|
||||
|
||||
MOZ_ASSERT_UNREACHABLE("accessible was rejected");
|
||||
// We have a DOM/layout change under the container accessible, and its tree
|
||||
// might need an update. Since DOM/layout change of the element may affect
|
||||
// on the accessibleness of adjacent elements (for example, insertion of
|
||||
// extra HTML:body make the old body accessible) then we have to recache
|
||||
// children of the container, and then fire show/hide events for a change.
|
||||
UpdateTreeOnInsertion(container);
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
logging::TreeInfo("children after insertion", logging::eVerbose,
|
||||
aContainer);
|
||||
#endif
|
||||
|
||||
// Content insertion did not cause an accessible tree change.
|
||||
if (updateFlags == eNoAccessible) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check to see if change occurred inside an alert, and fire an EVENT_ALERT
|
||||
// if it did.
|
||||
if (!(updateFlags & eAlertAccessible) &&
|
||||
(aContainer->IsAlert() || aContainer->IsInsideAlert())) {
|
||||
Accessible* ancestor = aContainer;
|
||||
do {
|
||||
if (ancestor->IsAlert()) {
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor);
|
||||
break;
|
||||
}
|
||||
}
|
||||
while ((ancestor = ancestor->Parent()));
|
||||
}
|
||||
|
||||
MaybeNotifyOfValueChange(aContainer);
|
||||
FireDelayedEvent(reorderEvent);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2398,3 +2256,4 @@ DocAccessible::IsLoadEventTarget() const
|
||||
// It's content (not chrome) root document.
|
||||
return (treeItem->ItemType() == nsIDocShellTreeItem::typeContent);
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,6 @@
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
//gA11yEventDumpToConsole = true;
|
||||
//enableLogging("tree,verbose"); // debug
|
||||
|
||||
if (navigator.platform.startsWith("Mac")) {
|
||||
SimpleTest.expectAssertions(0, 1);
|
||||
} else {
|
||||
|
@ -55,8 +55,7 @@
|
||||
}
|
||||
|
||||
//gA11yEventDumpID = "eventdump"; // debug stuff
|
||||
//gA11yEventDumpToConsole = true;
|
||||
//enableLogging("tree");
|
||||
gA11yEventDumpToConsole = true;
|
||||
|
||||
function doTest()
|
||||
{
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
<script type="application/javascript">
|
||||
//gA11yEventDumpToConsole = true;
|
||||
//enableLogging("tree,verbose");
|
||||
function doPreTest()
|
||||
{
|
||||
var tabDocument = currentTabDocument();
|
||||
|
@ -296,8 +296,6 @@ function editableTextTest(aID)
|
||||
invoke: aInvokeFunc,
|
||||
finalCheck: function finalCheck()
|
||||
{
|
||||
//dumpTree(aID, `'${aID}' tree:`);
|
||||
|
||||
aChecker.check();
|
||||
et.unwrapNextTest(); // replace dummy invoker on real invoker object.
|
||||
},
|
||||
|
@ -19,8 +19,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
|
||||
src="editabletext.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
//gA11yEventDumpToConsole = true;
|
||||
//enableLogging("tree,verbose"); // debug
|
||||
|
||||
function addTestEditable(aID, aTestRun, aBeforeContent, aAfterContent)
|
||||
{
|
||||
|
@ -328,7 +328,6 @@
|
||||
|
||||
var gQueue = null;
|
||||
//gA11yEventDumpToConsole = true; // debug stuff
|
||||
//enableLogging("tree");
|
||||
|
||||
function doTests()
|
||||
{
|
||||
|
@ -414,13 +414,11 @@
|
||||
return aNode.parentNode;
|
||||
}
|
||||
|
||||
//gA11yEventDumpToConsole = true; // debug stuff
|
||||
//enableLogging("tree,verbose");
|
||||
|
||||
/**
|
||||
* Do tests.
|
||||
*/
|
||||
var gQueue = null;
|
||||
//gA11yEventDumpToConsole = true; // debug stuff
|
||||
|
||||
function doTests()
|
||||
{
|
||||
@ -571,5 +569,6 @@
|
||||
<div style="visibility:hidden" id="c4_middle">
|
||||
<div style="visibility:visible" id="c4_child"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -28,8 +28,8 @@
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Tests
|
||||
|
||||
//gA11yEventDumpID = "eventdump"; // debug stuff
|
||||
//gA11yEventDumpToConsole = true; // debug
|
||||
//enableLogging("tree,verbose");
|
||||
|
||||
var gQueue = null;
|
||||
function doTests()
|
||||
@ -55,7 +55,7 @@
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=723833"
|
||||
title="IAccessibleText::setCaretOffset on location or search bar causes focus to jump">
|
||||
Bug 723833
|
||||
Mozilla Bug 723833
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
@ -63,5 +63,7 @@
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<vbox id="eventdump"></vbox>
|
||||
</vbox>
|
||||
</window>
|
||||
|
@ -16,8 +16,6 @@
|
||||
src="../states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
//gA11yEventDumpToConsole = true;
|
||||
//enableLogging("tree,verbose");
|
||||
function doTest()
|
||||
{
|
||||
var tree =
|
||||
|
@ -201,9 +201,6 @@
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
//gA11yEventDumpToConsole = true;
|
||||
//enableLogging("tree,verbose,stack");
|
||||
|
||||
var gQueue = null;
|
||||
function doTest()
|
||||
{
|
||||
|
@ -18,9 +18,6 @@
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
//gA11yEventDumpToConsole = true;
|
||||
//enableLogging("tree,verbose"); // debug stuff
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Test
|
||||
|
||||
@ -163,7 +160,6 @@
|
||||
SimpleTest.ok(true, "Testing (New) Toolkit autocomplete widget.");
|
||||
|
||||
// Dumb access to trigger popup lazy creation.
|
||||
dump("Trigget popup lazy creation");
|
||||
waitForEvent(EVENT_REORDER, txc, test_AutocompleteControl);
|
||||
txc.popup;
|
||||
|
||||
|
@ -72,7 +72,6 @@
|
||||
|
||||
function doTest()
|
||||
{
|
||||
//enableLogging("tree");
|
||||
gQueue = new eventQueue();
|
||||
|
||||
// make the accessible an inaccessible
|
||||
|
@ -194,8 +194,8 @@
|
||||
// newly inserted child.
|
||||
var tree =
|
||||
{ SECTION: [
|
||||
{ CHECKBUTTON: [ ] }, // existing explicit, t1_checkbox
|
||||
{ RADIOBUTTON: [ ] }, // new explicit, t1_child3
|
||||
{ CHECKBUTTON: [ ] },
|
||||
{ RADIOBUTTON: [ ] },
|
||||
{ PUSHBUTTON: [ ] }, // ARIA owned, t1_button
|
||||
{ SECTION: [ ] }, // ARIA owned, t1_subdiv
|
||||
{ GROUPING: [ ] } // ARIA owned, t1_group
|
||||
@ -228,8 +228,8 @@
|
||||
// subdiv should go away
|
||||
var tree =
|
||||
{ SECTION: [
|
||||
{ CHECKBUTTON: [ ] }, // explicit, t1_checkbox
|
||||
{ RADIOBUTTON: [ ] }, // explicit, t1_child3
|
||||
{ CHECKBUTTON: [ ] },
|
||||
{ RADIOBUTTON: [ ] },
|
||||
{ PUSHBUTTON: [ ] }, // ARIA owned, t1_button
|
||||
{ GROUPING: [ ] } // ARIA owned, t1_group
|
||||
] };
|
||||
|
@ -117,8 +117,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
//gA11yEventDumpID = "eventdump";
|
||||
//gA11yEventDumpToConsole = true;
|
||||
//enableLogging("tree,verbose");
|
||||
|
||||
var gQueue = null;
|
||||
var gContextTree = {};
|
||||
@ -312,6 +312,8 @@
|
||||
</menupopup>
|
||||
|
||||
<button context="context" id="button">btn</button>
|
||||
|
||||
<vbox id="eventdump" role="log"/>
|
||||
</vbox>
|
||||
</hbox>
|
||||
</window>
|
||||
|
Loading…
Reference in New Issue
Block a user