Bug 1276562 - Hang when inserting a bulleted or numbered list into a contentEditable, r=yzen

This commit is contained in:
Alexander Surkov 2016-05-31 14:46:31 -04:00
parent 7d48b7906b
commit 80432e7d0a
4 changed files with 40 additions and 2 deletions

View File

@ -92,6 +92,17 @@ HTMLLIAccessible::Bounds() const
return rect;
}
bool
HTMLLIAccessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
{
// Adjust index if there's a bullet.
if (mBullet && aIndex == 0 && aChild != mBullet) {
return HyperTextAccessible::InsertChildAt(aIndex + 1, aChild);
}
return HyperTextAccessible::InsertChildAt(aIndex, aChild);
}
////////////////////////////////////////////////////////////////////////////////
// HTMLLIAccessible: public

View File

@ -53,6 +53,8 @@ public:
virtual a11y::role NativeRole() override;
virtual uint64_t NativeState() override;
virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) override;
// HTMLLIAccessible
HTMLListBulletAccessible* Bullet() const { return mBullet; }
void UpdateBullet(bool aHasBullet);

View File

@ -157,7 +157,7 @@ public:
virtual already_AddRefed<nsIPersistentProperties> NativeAttributes() override;
virtual Relation RelationByType(RelationType aRelationType) override;
bool InsertChildAt(uint32_t aIndex, Accessible* aChild) override;
virtual bool InsertChildAt(uint32_t aIndex, Accessible* aChild) override;
protected:
virtual ~HTMLTableAccessible() {}

View File

@ -82,6 +82,28 @@
this.onProcessed = function showProcessor_onProcessed()
{
testLiAccessibleTree();
gSequence.processNext();
}
};
function textReplaceProcessor()
{
this.liNode = getNode("li");
this.process = function textReplaceProcessor_process()
{
this.liNode.textContent = "hey";
}
this.onProcessed = function textReplaceProcessor_onProcessed()
{
var tree = {
LISTITEM: [
{ STATICTEXT: [] },
{ TEXT_LEAF: [] }
]
};
testAccessibleTree(this.liNode, tree);
SimpleTest.finish();
}
};
@ -89,8 +111,9 @@
////////////////////////////////////////////////////////////////////////////
// Test
var gSequence = null;
//gA11yEventDumpToConsole = true;
var gSequence = null;
function doTest()
{
testLiAccessibleTree();
@ -101,6 +124,8 @@
"hide HTML li");
gSequence.append(new showProcessor(), EVENT_SHOW, getNode("li"),
"show HTML li");
gSequence.append(new textReplaceProcessor(), EVENT_REORDER, getNode("li"),
"change text of HTML li");
gSequence.processNext(); // SimpleTest.finish() will be called in the end
}