Commit 4405d2a1 authored by isherman@chromium.org's avatar isherman@chromium.org

Fix up bookmarks bar folders to always be scrolled to the top when they are opened.

BUG=101099
TEST=
  1. Enable Full Keyboard Access in System Preferences
  2. Create a folder on the bookmarks bar containing many (20+) bookmarks.
  3. Press the Tab key until this folder is selected in the bookmarks bar.
  4. Press the Space key to open the folder.

  After these steps, the folder should look identical to how it looks when you click on it directly.


Review URL: http://codereview.chromium.org/8789010

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114104 0039d316-1c4b-4281-b951-d872f2087c98
parent a9ea2b53
......@@ -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];
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment