mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1465875 part 3. Eliminate C++ use of nsIDOMNSEditableElement. r=qdot
This commit is contained in:
parent
0cf65db1d3
commit
ddf179a7a7
@ -16,7 +16,6 @@
|
||||
#include "TreeWalker.h"
|
||||
#include "XULMenuAccessible.h"
|
||||
|
||||
#include "nsIDOMNSEditableElement.h"
|
||||
#include "nsIDOMXULButtonElement.h"
|
||||
#include "nsIDOMXULCheckboxElement.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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<nsINode> node = returnRange->GetStartContainer();
|
||||
while (node) {
|
||||
nsCOMPtr<nsIDOMNSEditableElement> editable = do_QueryInterface(node);
|
||||
if (editable) {
|
||||
nsCOMPtr<nsIEditor> 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;
|
||||
}
|
||||
|
||||
// Inside an editable element. Get the correct selection
|
||||
// controller and selection.
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
editable->GetEditor(getter_AddRefs(editor));
|
||||
NS_ASSERTION(editor, "Editable element has no editor!");
|
||||
if (!editor) {
|
||||
break;
|
||||
}
|
||||
editor->GetSelectionController(
|
||||
getter_AddRefs(selectionController));
|
||||
editor->GetSelectionController(getter_AddRefs(selectionController));
|
||||
if (selectionController) {
|
||||
selection = selectionController->GetSelection(
|
||||
nsISelectionController::SELECTION_NORMAL);
|
||||
}
|
||||
mFoundEditable = do_QueryInterface(node);
|
||||
mFoundEditable = node->AsElement();
|
||||
|
||||
if (!shouldFocusEditableElement)
|
||||
break;
|
||||
|
||||
// Otherwise move focus/caret to editable element
|
||||
if (fm)
|
||||
fm->SetFocus(mFoundEditable, 0);
|
||||
if (!shouldFocusEditableElement) {
|
||||
break;
|
||||
}
|
||||
node = node->GetParentNode();
|
||||
|
||||
// Otherwise move focus/caret to editable element
|
||||
if (fm) {
|
||||
fm->SetFocus(mFoundEditable, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// If we reach here without setting mFoundEditable, then something
|
||||
|
Loading…
Reference in New Issue
Block a user