Bug 1425440 - Get rid of GetChildAt_Deprecated in nsTextControlFrame, r=catalinb

This commit is contained in:
Andrea Marchesini
2018-01-03 16:29:44 +01:00
parent 55b2d448ac
commit a6cb817b65

View File

@@ -947,13 +947,15 @@ nsTextControlFrame::SelectAllOrCollapseToEndOfText(bool aSelect)
if (numChildren > 0) {
// We never want to place the selection after the last
// br under the root node!
nsIContent *child = rootContent->GetChildAt_Deprecated(numChildren - 1);
nsIContent *child = rootContent->GetLastChild();
if (child) {
if (child->IsHTMLElement(nsGkAtoms::br))
if (child->IsHTMLElement(nsGkAtoms::br)) {
child = child->GetPreviousSibling();
--numChildren;
}
}
if (!aSelect && numChildren) {
child = rootContent->GetChildAt_Deprecated(numChildren - 1);
child = child->GetPreviousSibling();
if (child && child->IsNodeOfType(nsINode::eTEXT)) {
rootNode = do_QueryInterface(child);
const nsTextFragment* fragment = child->GetText();
@@ -1270,7 +1272,7 @@ nsTextControlFrame::UpdateValueDisplay(bool aNotify,
NS_PRECONDITION(!mEditorHasBeenInitialized,
"Do not call this after editor has been initialized");
nsIContent* textContent = mRootNode->GetChildAt_Deprecated(0);
nsIContent* textContent = mRootNode->GetFirstChild();
if (!textContent) {
// Set up a textnode with our value
RefPtr<nsTextNode> textNode =