From 1f9f16be3d521b1aad7ba82af84c473e16936e0a Mon Sep 17 00:00:00 2001 From: Andre Santoso Date: Wed, 9 Sep 2015 20:27:11 -0700 Subject: [PATCH] Mac: Fix missing focus rings on toolbar, profile, and tab buttons This is a reland of http://crrev.com/1160143010, with some additional tweaks. It was reverted because it tickled an AppKit crash (crbug.com/504808). The hope is that the crash won't reappear now that we link with 10.10 SDK. In 10.7, AppKit introduced new API for drawing focus rings. This automatic focus ring drawing is automatically enabled for applications linking with 10.8 sdk or later. After we link with 10.10 SDK the new style focus ring gets enabled but we get focus rings with double lines. This is because AppKit thinks the buttons are bordered (-isBordered is YES) and draws lines inside and outside the borders that are actually not there due to drawing overrides. 10.6 before: manually drawn, tab close and avatar buttons missing focus rings. 10.6 after: no change. 10.7 before: broken, no focus rings on toolbar, avatar, tab close, new tab buttons. 10.7 after: manually drawn, same as 10.6. 10.8+ before: broken, no focus rings on toolbar, avatar, tab close, new tab buttons. 10.8+ after: drawn by AppKit. Toolbar.xib changes: Change the toolbar buttons (back, forward, reload, home, wrench) Focus Ring from None to Default, to allow the new style focus ring to draw. BUG=459860, 520471 TBR=rsesek@chromium.org Review URL: https://codereview.chromium.org/1310183005 Cr-Commit-Position: refs/heads/master@{#345989} (cherry picked from commit 9c75e3773754cfb242c2819cbfb45bd8b5ddf95f) Review URL: https://codereview.chromium.org/1327203003 . Cr-Commit-Position: refs/branch-heads/2490@{#218} Cr-Branched-From: 7790a3535f2a81a03685eca31a32cf69ae0c114f-refs/heads/master@{#344925} --- chrome/app/nibs/Toolbar.xib | 20 +++++++++---------- .../autofill/down_arrow_popup_menu_cell.mm | 5 +---- .../cocoa/extensions/browser_action_button.mm | 7 +++++++ .../browser/ui/cocoa/gradient_button_cell.mm | 14 +++++++++---- chrome/browser/ui/cocoa/hover_close_button.mm | 14 ++++++------- chrome/browser/ui/cocoa/image_button_cell.mm | 12 +++++++---- chrome/browser/ui/cocoa/new_tab_button.mm | 18 ++++++++++++++--- .../profiles/avatar_button_controller.mm | 7 +++++++ .../ui/cocoa/toolbar/toolbar_button_cocoa.mm | 7 +++++++ 9 files changed, 71 insertions(+), 33 deletions(-) diff --git a/chrome/app/nibs/Toolbar.xib b/chrome/app/nibs/Toolbar.xib index 2f8da15657081..72c3b58a6ab7c 100644 --- a/chrome/app/nibs/Toolbar.xib +++ b/chrome/app/nibs/Toolbar.xib @@ -24,18 +24,18 @@ - - - - -