Mac: Optimize tab strip tooltip rects.
commitd6b37a26407bcf266818eacb1f8fb6ac24ce7800
authorandresantoso <andresantoso@chromium.org>
Tue, 10 Feb 2015 20:53:07 +0000 (10 12:53 -0800)
committerCommit bot <commit-bot@chromium.org>
Tue, 10 Feb 2015 20:53:43 +0000 (10 20:53 +0000)
tree61b19448ab9909ed38cc10db41f9e80ebc5d847b
parent2f8c799a371fb7353860bcbcedee8239abffdfbd
Mac: Optimize tab strip tooltip rects.

Currently we reinstall 3 tooltip rects per tab during tab layout, which is
invoked repeatedly during live resize. On my Instruments trace, this
amounts to about 0.6% of the samples.

Unfortunately, simply calling -setTooltip: or -addTooltipRect:owner:userData:
will not show the tooltip if the mouse is already inside the view.

The new implementation uses a transparent subview which position is moved
to follow the hovered tab.

This implementation also tracks the tab's shape more accurately than the
old implementation. The tooltip will always match the tab's hovered state
drawing, unlike the old implementation where the tooltip will only update
when crossing a tooltip rect boundary.

BUG=453996

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

Cr-Commit-Position: refs/heads/master@{#315633}
chrome/browser/ui/cocoa/tabs/tab_controller.mm
chrome/browser/ui/cocoa/tabs/tab_strip_controller.h
chrome/browser/ui/cocoa/tabs/tab_strip_controller.mm
chrome/browser/ui/cocoa/tabs/tab_strip_controller_unittest.mm
chrome/browser/ui/cocoa/tabs/tab_view.h
chrome/browser/ui/cocoa/tabs/tab_view.mm