зеркало из https://github.com/mozilla/gecko-dev.git
Bug 943603 - Don't let doc accessible keep trailing br, r=tbsaunde
This commit is contained in:
Родитель
6eb6edc7d2
Коммит
21484889ae
|
@ -1451,10 +1451,22 @@ DocAccessible::CacheChildren()
|
||||||
if (!rootElm)
|
if (!rootElm)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Ignore last HTML:br, copied from HyperTextAccessible.
|
||||||
TreeWalker walker(this, rootElm);
|
TreeWalker walker(this, rootElm);
|
||||||
|
Accessible* lastChild = nullptr;
|
||||||
|
while (Accessible* child = walker.NextChild()) {
|
||||||
|
if (lastChild)
|
||||||
|
AppendChild(lastChild);
|
||||||
|
|
||||||
Accessible* child = nullptr;
|
lastChild = child;
|
||||||
while ((child = walker.NextChild()) && AppendChild(child));
|
}
|
||||||
|
|
||||||
|
if (lastChild) {
|
||||||
|
if (lastChild->IsHTMLBr())
|
||||||
|
Document()->UnbindFromDocument(lastChild);
|
||||||
|
else
|
||||||
|
AppendChild(lastChild);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -56,7 +56,7 @@ function editableTextTest(aID)
|
||||||
/**
|
/**
|
||||||
* setTextContents test.
|
* setTextContents test.
|
||||||
*/
|
*/
|
||||||
this.setTextContents = function setTextContents(aValue, aTrailChar)
|
this.setTextContents = function setTextContents(aValue)
|
||||||
{
|
{
|
||||||
var testID = "setTextContents '" + aValue + "' for " + prettyName(aID);
|
var testID = "setTextContents '" + aValue + "' for " + prettyName(aID);
|
||||||
|
|
||||||
|
@ -66,8 +66,7 @@ function editableTextTest(aID)
|
||||||
acc.setTextContents(aValue);
|
acc.setTextContents(aValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
var newValue = aValue + (aTrailChar ? aTrailChar : "");
|
var insertTripple = aValue ? [0, aValue.length, aValue] : null;
|
||||||
var insertTripple = newValue ? [0, newValue.length, newValue] : null;
|
|
||||||
var oldValue = getValue(aID);
|
var oldValue = getValue(aID);
|
||||||
var removeTripple = oldValue ? [0, oldValue.length, oldValue] : null;
|
var removeTripple = oldValue ? [0, oldValue.length, oldValue] : null;
|
||||||
|
|
||||||
|
|
|
@ -20,14 +20,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
|
||||||
|
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
|
|
||||||
function addTestEditable(aID, aTestRun, aTrailChar)
|
function addTestEditable(aID, aTestRun)
|
||||||
{
|
{
|
||||||
var et = new editableTextTest(aID);
|
var et = new editableTextTest(aID);
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
// setTextContents
|
// setTextContents
|
||||||
et.scheduleTest(et.setTextContents, "hello");
|
et.scheduleTest(et.setTextContents, "hello");
|
||||||
et.scheduleTest(et.setTextContents, "olleh", aTrailChar); // due to some reason this reports '\n' in the end
|
et.scheduleTest(et.setTextContents, "olleh");
|
||||||
et.scheduleTest(et.setTextContents, "");
|
et.scheduleTest(et.setTextContents, "");
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -80,9 +80,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452161
|
||||||
{
|
{
|
||||||
// Prepare tested elements.
|
// Prepare tested elements.
|
||||||
|
|
||||||
// Design mode on/off trigger document accessible subtree recreation.
|
// Design mode on/off triggers an editable state change event on
|
||||||
|
// the document accessible.
|
||||||
var frame = getNode("frame");
|
var frame = getNode("frame");
|
||||||
waitForEvent(EVENT_REORDER, frame.contentDocument, runTest);
|
waitForEvent(EVENT_STATE_CHANGE, frame.contentDocument, runTest);
|
||||||
frame.contentDocument.designMode = "on";
|
frame.contentDocument.designMode = "on";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче