Commit 96003d84 authored by andresantoso's avatar andresantoso Committed by Commit bot

Mac: Don't relayout tabs if the tab strip's frame didn't change.

When we reshow the find bar after dropping a tab into a new window,
-[BrowserWindowController layoutSubviews] is called which causes a relayout of
the tabs (without animation). In this case, a tab is in the beginning of being
animated to a new position and this relayout interrupted it by calling setFrame
on the tab view, but the tab frame ended up being the animator's target frame
instead of the relayout setFrame. This seems like an AppKit bug because it
behaves as expected on 10.9.

It is undesirable for layoutSubviews to force tabs relayout when the tap strip's
frame did not change, because it will interrupt tab animations in progress.
This change compares the old and new tab strip frame and skips tabs relayout
if the frame did not change.

BUG=415093

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

Cr-Commit-Position: refs/heads/master@{#296479}
parent 7c5b40c1
...@@ -190,7 +190,7 @@ willPositionSheet:(NSWindow*)sheet ...@@ -190,7 +190,7 @@ willPositionSheet:(NSWindow*)sheet
NSView* tabStripView = [self tabStripView]; NSView* tabStripView = [self tabStripView];
CGFloat tabStripHeight = NSHeight([tabStripView frame]); CGFloat tabStripHeight = NSHeight([tabStripView frame]);
maxY -= tabStripHeight; maxY -= tabStripHeight;
[tabStripView setFrame:NSMakeRect(0, maxY, width, tabStripHeight)]; NSRect tabStripFrame = NSMakeRect(0, maxY, width, tabStripHeight);
// In Yosemite fullscreen, manually add the fullscreen controls to the tab // In Yosemite fullscreen, manually add the fullscreen controls to the tab
// strip. // strip.
...@@ -260,8 +260,15 @@ willPositionSheet:(NSWindow*)sheet ...@@ -260,8 +260,15 @@ willPositionSheet:(NSWindow*)sheet
} }
[tabStripController_ setRightIndentForControls:rightIndent]; [tabStripController_ setRightIndentForControls:rightIndent];
// Go ahead and layout the tabs. // It is undesirable to force tabs relayout when the tap strip's frame did
[tabStripController_ layoutTabsWithoutAnimation]; // not change, because it will interrupt tab animations in progress.
// In addition, there appears to be an AppKit bug on <10.9 where interrupting
// a tab animation resulted in the tab frame being the animator's target
// frame instead of the interrupting setFrame. (See http://crbug.com/415093)
if (!NSEqualRects(tabStripFrame, [tabStripView frame])){
[tabStripView setFrame:tabStripFrame];
[tabStripController_ layoutTabsWithoutAnimation];
}
return maxY; return maxY;
} }
......
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