Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2183)

Unified Diff: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm

Issue 8789010: Fix up bookmarks bar folders to always be scrolled to the top when they are opened. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments, style cleanup Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
index b59b0e7829d0be9250136344ea6851260b6a3afb..d210b5870c2acf13397f0f62f4fc5ed36ede4d42 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
@@ -787,6 +787,7 @@ struct LayoutMetrics {
CGFloat windowWidth = buttonWidth + padding_;
NSPoint newWindowTopLeft = [self windowTopLeftForWidth:windowWidth
height:height];
+
// Make sure as much of a submenu is exposed (which otherwise would be a
// problem if the parent button is close to the bottom of the screen).
if ([parentController_ isKindOfClass:[self class]]) {
@@ -795,16 +796,26 @@ struct LayoutMetrics {
height;
newWindowTopLeft.y = MAX(newWindowTopLeft.y, minimumY);
}
+
NSWindow* window = [self window];
NSRect windowFrame = NSMakeRect(newWindowTopLeft.x,
newWindowTopLeft.y - height,
windowWidth, height);
[window setFrame:windowFrame display:NO];
+
NSRect folderFrame = NSMakeRect(0, 0, windowWidth, height);
[folderView_ setFrame:folderFrame];
+
+ // For some reason, when opening a "large" bookmark folder (containing 12 or
+ // more items) using the keyboard, the scroll view seems to want to be
+ // offset by default: [ http://crbug.com/101099 ]. Explicitly reseting the
+ // scroll position here is a bit hacky, but it does seem to work.
+ [[scrollView_ contentView] scrollToPoint:NSMakePoint(0, 0)];
+
NSSize newSize = NSMakeSize(windowWidth, 0.0);
[self adjustWindowLeft:newWindowTopLeft.x size:newSize scrollingBy:0.0];
[self configureWindowLevel];
+
[window display];
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698