summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-09 22:29:44 +0000
committerarv@chromium.org <arv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-09 22:29:44 +0000
commita70a85a9f5e2dfe6c1329843ae4560bf48dd513d (patch)
treea2dc980ef96eb540482e80aa2b9f1ab7632dcc4b /chrome
parent81ee43276c8ad381c139ddf58f2b7e978a09ec1c (diff)
downloadchromium_src-a70a85a9f5e2dfe6c1329843ae4560bf48dd513d.zip
chromium_src-a70a85a9f5e2dfe6c1329843ae4560bf48dd513d.tar.gz
chromium_src-a70a85a9f5e2dfe6c1329843ae4560bf48dd513d.tar.bz2
Bookmarks manager: Fix add page
This should have been part of r73377 which fixes this for "Add page" but I forgot to fix "Add folder" BUG=72476 TEST=Go to bookmarks manager Go to a folder with enough items to show a scrollbar Right click and "Add Folder" The folder should be editable. Review URL: http://codereview.chromium.org/6476003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74350 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/resources/bookmark_manager/main.html28
1 files changed, 18 insertions, 10 deletions
diff --git a/chrome/browser/resources/bookmark_manager/main.html b/chrome/browser/resources/bookmark_manager/main.html
index 404c45d..e1987d8 100644
--- a/chrome/browser/resources/bookmark_manager/main.html
+++ b/chrome/browser/resources/bookmark_manager/main.html
@@ -1520,20 +1520,33 @@ function newFolder() {
if (isTree) {
newItem = bmm.treeLookup[newNode.id];
tree.selectedItem = newItem;
+ newItem.editing = true;
} else {
var index = list.dataModel.findIndexById(newNode.id);
var sm = list.selectionModel;
sm.anchorIndex = sm.leadIndex = sm.selectedIndex = index;
- list.scrollIndexIntoView(index);
- newItem = list.getListItemByIndex(index);
+ scrollIntoViewAndMakeEditable(index);
}
-
- newItem.editing = true;
}, 50);
});
}
/**
+ * Scrolls the list item into view and makes it editable.
+ * @param {number} index The index of the item to make editable.
+ */
+function scrollIntoViewAndMakeEditable(index) {
+ list.scrollIndexIntoView(index);
+ // onscroll is now dispatched asynchronously so we have to postpone
+ // the rest.
+ setTimeout(function() {
+ var item = list.getListItemByIndex(index);
+ if (item)
+ item.editing = true;
+ });
+}
+
+/**
* Adds a page to the current folder. This is called by the
* add-new-bookmark-command handler.
*/
@@ -1551,12 +1564,7 @@ function addPage() {
dataModel.splice(length, 0, fakeNode);
var sm = list.selectionModel;
sm.anchorIndex = sm.leadIndex = sm.selectedIndex = length;
- list.scrollIndexIntoView(length);
- // onscroll is now dispatched asynchronously so we have to postpone the rest.
- setTimeout(function() {
- var li = list.getListItemByIndex(length);
- li.editing = true;
- });
+ scrollIntoViewAndMakeEditable(length);
}
/**