Backed out changeset e9d82d8ad687 (bug 675579) for crashes on a CLOSED TREE

This commit is contained in:
Ed Morley 2014-01-17 15:07:23 +00:00
Родитель 9c7dff5e8b
Коммит 3c11bb82ee
3 изменённых файлов: 10 добавлений и 25 удалений

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

@ -392,11 +392,17 @@ nsEditor::GetDesiredSpellCheckState()
}
// Check DOM state
nsCOMPtr<nsIContent> content = GetExposedRoot();
nsCOMPtr<nsIContent> content = GetRoot();
if (!content) {
return false;
}
// For plaintext editors, we just want to check whether the textarea/input
// itself is editable.
if (content->IsRootOfNativeAnonymousSubtree()) {
content = content->GetParent();
}
nsCOMPtr<nsIDOMHTMLElement> element = do_QueryInterface(content);
if (!element) {
return false;
@ -5001,24 +5007,11 @@ nsEditor::GetEditorRoot()
return GetRoot();
}
Element*
nsEditor::GetExposedRoot()
{
Element* rootElement = GetRoot();
// For plaintext editors, we need to ask the input/textarea element directly.
if (rootElement->IsRootOfNativeAnonymousSubtree()) {
rootElement = rootElement->GetParent()->AsElement();
}
return rootElement;
}
nsresult
nsEditor::DetermineCurrentDirection()
{
// Get the current root direction from its frame
nsIContent* rootElement = GetExposedRoot();
dom::Element *rootElement = GetRoot();
// If we don't have an explicit direction, determine our direction
// from the content's direction
@ -5044,8 +5037,7 @@ NS_IMETHODIMP
nsEditor::SwitchTextDirection()
{
// Get the current root direction from its frame
nsIContent* rootElement = GetExposedRoot();
dom::Element *rootElement = GetRoot();
nsresult rv = DetermineCurrentDirection();
NS_ENSURE_SUCCESS(rv, rv);
@ -5071,8 +5063,7 @@ void
nsEditor::SwitchTextDirectionTo(uint32_t aDirection)
{
// Get the current root direction from its frame
nsIContent* rootElement = GetExposedRoot();
dom::Element *rootElement = GetRoot();
nsresult rv = DetermineCurrentDirection();
NS_ENSURE_SUCCESS_VOID(rv);

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

@ -670,10 +670,6 @@ public:
// editors
virtual mozilla::dom::Element* GetEditorRoot();
// Likewise, but gets the text control element instead of the root for
// plaintext editors
mozilla::dom::Element* GetExposedRoot();
// Accessor methods to flags
bool IsPlaintextEditor() const
{

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

@ -55,14 +55,12 @@ SimpleTest.waitForFocus(function() {
"Textarea should appear correctly before switching the direction (" + initialDir + ")");
t.focus();
synthesizeKey("x", {accelKey: true, shiftKey: true});
is(t.getAttribute("dir"), initialDir == "ltr" ? "rtl" : "ltr", "The dir attribute must be correctly updated");
t.blur();
var s2 = snapshotWindow(window);
ok(compareSnapshots(s2, Screenshots.get(initialDir, true), true)[0],
"Textarea should appear correctly after switching the direction (" + initialDir + ")");
t.focus();
synthesizeKey("x", {accelKey: true, shiftKey: true});
is(t.getAttribute("dir"), initialDir == "ltr" ? "ltr" : "rtl", "The dir attribute must be correctly updated");
t.blur();
var s3 = snapshotWindow(window);
ok(compareSnapshots(s3, Screenshots.get(initialDir, false), true)[0],