diff --git a/accessible/xul/XULFormControlAccessible.cpp b/accessible/xul/XULFormControlAccessible.cpp index 7005287553ce..c68c8a455a00 100644 --- a/accessible/xul/XULFormControlAccessible.cpp +++ b/accessible/xul/XULFormControlAccessible.cpp @@ -16,7 +16,6 @@ #include "TreeWalker.h" #include "XULMenuAccessible.h" -#include "nsIDOMNSEditableElement.h" #include "nsIDOMXULButtonElement.h" #include "nsIDOMXULCheckboxElement.h" #include "nsIDOMXULMenuListElement.h" diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index a99563875c8f..d65dd301d03e 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -229,7 +229,6 @@ #include "nsViewportInfo.h" #include "mozilla/StaticPtr.h" #include "nsITextControlElement.h" -#include "nsIDOMNSEditableElement.h" #include "nsIEditor.h" #include "nsIHttpChannelInternal.h" #include "nsISecurityConsoleMessage.h" diff --git a/toolkit/components/satchel/nsFormFillController.cpp b/toolkit/components/satchel/nsFormFillController.cpp index 4ad428b20a6e..a9d2c08c908e 100644 --- a/toolkit/components/satchel/nsFormFillController.cpp +++ b/toolkit/components/satchel/nsFormFillController.cpp @@ -37,7 +37,6 @@ #include "mozilla/ModuleUtils.h" #include "nsToolkitCompsCID.h" #include "nsEmbedCID.h" -#include "nsIDOMNSEditableElement.h" #include "nsContentUtils.h" #include "nsGenericHTMLElement.h" #include "nsILoadContext.h" diff --git a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp index 0aa2429bbdf8..e01ca28ac5cf 100644 --- a/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp +++ b/toolkit/components/typeaheadfind/nsTypeAheadFind.cpp @@ -31,7 +31,6 @@ #include "nsIDocument.h" #include "nsIContent.h" #include "nsTextFragment.h" -#include "nsIDOMNSEditableElement.h" #include "nsIEditor.h" #include "nsIDocShellTreeItem.h" @@ -47,6 +46,8 @@ #include "nsIObserverService.h" #include "nsFocusManager.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/HTMLInputElement.h" +#include "mozilla/dom/HTMLTextAreaElement.h" #include "mozilla/dom/Link.h" #include "mozilla/dom/RangeBinding.h" #include "mozilla/dom/Selection.h" @@ -576,33 +577,38 @@ nsTypeAheadFind::FindItNow(nsIPresShell *aPresShell, bool aIsLinksOnly, // chain of parent nodes to see if we find one. nsCOMPtr node = returnRange->GetStartContainer(); while (node) { - nsCOMPtr editable = do_QueryInterface(node); - if (editable) { - // Inside an editable element. Get the correct selection - // controller and selection. - nsCOMPtr editor; - editable->GetEditor(getter_AddRefs(editor)); - NS_ASSERTION(editor, "Editable element has no editor!"); - if (!editor) { - break; - } - editor->GetSelectionController( - getter_AddRefs(selectionController)); - if (selectionController) { - selection = selectionController->GetSelection( - nsISelectionController::SELECTION_NORMAL); - } - mFoundEditable = do_QueryInterface(node); + nsCOMPtr editor; + if (auto input = HTMLInputElement::FromNode(node)) { + editor = input->GetEditor(); + } else if (auto textarea = HTMLTextAreaElement::FromNode(node)) { + editor = textarea->GetEditor(); + } else { + node = node->GetParentNode(); + continue; + } - if (!shouldFocusEditableElement) - break; - - // Otherwise move focus/caret to editable element - if (fm) - fm->SetFocus(mFoundEditable, 0); + // Inside an editable element. Get the correct selection + // controller and selection. + NS_ASSERTION(editor, "Editable element has no editor!"); + if (!editor) { break; } - node = node->GetParentNode(); + editor->GetSelectionController(getter_AddRefs(selectionController)); + if (selectionController) { + selection = selectionController->GetSelection( + nsISelectionController::SELECTION_NORMAL); + } + mFoundEditable = node->AsElement(); + + if (!shouldFocusEditableElement) { + break; + } + + // Otherwise move focus/caret to editable element + if (fm) { + fm->SetFocus(mFoundEditable, 0); + } + break; } // If we reach here without setting mFoundEditable, then something