Bug 717371 - Don't use nsINode::GetChildAt in PresShell::GoToAnchor; r=bz
authorMs2ger <ms2ger@gmail.com>
Sun, 15 Jan 2012 09:13:12 +0100
changeset 84485 fb8cb96c2282a2299a761a5f8d8c8f49357178cd
parent 84484 fb524533a4777d964ce81dc5bb19c2038152ec73
child 84486 c1577ea56e1725960cf2622c8013f263aabee7ce
push id21852
push userMs2ger@gmail.com
push dateSun, 15 Jan 2012 08:23:22 +0000
treeherdermozilla-central@d7984d345c24 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs717371
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 717371 - Don't use nsINode::GetChildAt in PresShell::GoToAnchor; r=bz
layout/base/nsPresShell.cpp
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -3149,18 +3149,18 @@ PresShell::GoToAnchor(const nsAString& a
     // Should we select the target? This action is controlled by a
     // preference: the default is to not select.
     bool selectAnchor = Preferences::GetBool("layout.selectanchor");
 
     // Even if select anchor pref is false, we must still move the
     // caret there. That way tabbing will start from the new
     // location
     nsRefPtr<nsIDOMRange> jumpToRange = new nsRange();
-    while (content && content->GetChildCount() > 0) {
-      content = content->GetChildAt(0);
+    while (content && content->GetFirstChild()) {
+      content = content->GetFirstChild();
     }
     nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
     NS_ASSERTION(node, "No nsIDOMNode for descendant of anchor");
     jumpToRange->SelectNodeContents(node);
     // Select the anchor
     nsISelection* sel = mSelection->
       GetSelection(nsISelectionController::SELECTION_NORMAL);
     if (sel) {