Commit 333c2298 authored by gajendra.n's avatar gajendra.n Committed by Commit bot

Move bookmark's folder menu upwards only when its parent button is moved.

On dragging and dropping an item on a folder that is
currently showing its folder menu; the menu moves upwards
by an offset, regardless of its parent button moved or not.
This CL fixes the issue that the folder menu is moved only
when its parent button is moved. Also, the offset value
should be kBookmarkFolderButtonHeight.

BUG=311155
R=asvitkine@chromium.org

TEST=
1) Launch chrome and add a bookmark folder(folder1) to Bookmarks Bar
2) Add two folders(folder2 and folder3) within folder1.
3) Open folder1, now drag folder3 and hover it on folder2,
   wait until folder2 opens its folder menu, now drop the
   folder i.e release the mouse, and observe.
4) folder2's folder menu should not shift upwards, it
   should horizontally align with its button's frame.

Review URL: https://codereview.chromium.org/606593002

Cr-Commit-Position: refs/heads/master@{#299037}
parent 0b077e3f
...@@ -1939,11 +1939,16 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) { ...@@ -1939,11 +1939,16 @@ static BOOL ValueInRangeInclusive(CGFloat low, CGFloat value, CGFloat high) {
NSInteger buttonCount = [buttons_ count]; NSInteger buttonCount = [buttons_ count];
if (buttonCount) { if (buttonCount) {
BookmarkButton* subButton = [folderController_ parentButton]; BookmarkButton* subButton = [folderController_ parentButton];
NSInteger targetIndex = 0;
for (NSButton* aButton in buttons_.get()) { for (NSButton* aButton in buttons_.get()) {
// If this button is showing its menu then we need to move the menu, too. targetIndex++;
if (aButton == subButton) // If this button is showing its menu and is below the removed button,
[folderController_ // i.e its index is greater, then we need to move the menu too.
offsetFolderMenuWindow:NSMakeSize(0.0, chrome::kBookmarkBarHeight)]; if (aButton == subButton && targetIndex > buttonIndex) {
[folderController_ offsetFolderMenuWindow:NSMakeSize(0.0,
bookmarks::kBookmarkFolderButtonHeight)];
break;
}
} }
} else if (parentButton_ != [barController_ otherBookmarksButton]) { } else if (parentButton_ != [barController_ otherBookmarksButton]) {
// If all nodes have been removed from this folder then add in the // If all nodes have been removed from this folder then add in the
......
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