Bug 1342197 part 2. Use nsITextControlElement::GetRootEditorNode to get the root editor node in nsTextControlFrame::GetSelectionRange. r=ehsan

MozReview-Commit-ID: 7ncJVNVGF78
This commit is contained in:
Boris Zbarsky 2017-02-28 12:41:37 -05:00
Родитель 12dc2641c8
Коммит 5649e18813
2 изменённых файлов: 7 добавлений и 12 удалений

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

@ -803,15 +803,6 @@ nsTextControlFrame::ScrollSelectionIntoView()
return NS_ERROR_FAILURE;
}
mozilla::dom::Element*
nsTextControlFrame::GetRootNodeAndInitializeEditor()
{
nsCOMPtr<nsIDOMElement> root;
GetRootNodeAndInitializeEditor(getter_AddRefs(root));
nsCOMPtr<mozilla::dom::Element> rootElem = do_QueryInterface(root);
return rootElem;
}
nsresult
nsTextControlFrame::GetRootNodeAndInitializeEditor(nsIDOMElement **aRootElement)
{
@ -1062,7 +1053,7 @@ nsTextControlFrame::GetSelectionRange(int32_t* aSelectionStart,
return NS_OK;
}
mozilla::dom::Element* root = GetRootNodeAndInitializeEditor();
mozilla::dom::Element* root = txtCtrl->GetRootEditorNode();
NS_ENSURE_STATE(root);
nsContentUtils::GetSelectionInTextControl(sel, root,
*aSelectionStart, *aSelectionEnd);

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

@ -321,9 +321,13 @@ private:
SelectionDirection aDirection = eNone);
/**
* Return the root DOM element, and implicitly initialize the editor if needed.
* Return the root DOM element, and implicitly initialize the editor if
* needed.
*
* XXXbz This function is slow. Very slow. Consider using
* EnsureEditorInitialized() if you need that, and
* nsITextControlElement::GetRootEditorNode on our content if you need that.
*/
mozilla::dom::Element* GetRootNodeAndInitializeEditor();
nsresult GetRootNodeAndInitializeEditor(nsIDOMElement **aRootElement);
void FinishedInitializer() {