Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: ui/views/cocoa/tooltip_manager_mac.mm

Issue 1777653002: Prepare ui/ module for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More compile errors. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | ui/views/cocoa/widget_owner_nswindow_adapter.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/cocoa/tooltip_manager_mac.h" 5 #include "ui/views/cocoa/tooltip_manager_mac.h"
6 6
7 #include "ui/base/cocoa/cocoa_base_utils.h"
7 #include "ui/gfx/font_list.h" 8 #include "ui/gfx/font_list.h"
8 #import "ui/gfx/mac/coordinate_conversion.h" 9 #import "ui/gfx/mac/coordinate_conversion.h"
9 #import "ui/views/cocoa/bridged_content_view.h" 10 #import "ui/views/cocoa/bridged_content_view.h"
10 #import "ui/views/cocoa/bridged_native_widget.h" 11 #import "ui/views/cocoa/bridged_native_widget.h"
11 12
12 namespace { 13 namespace {
13 14
14 // Max visual tooltip width in DIPs. Beyond this, Cocoa will wrap text. 15 // Max visual tooltip width in DIPs. Beyond this, Cocoa will wrap text.
15 const int kTooltipMaxWidthPixels = 250; 16 const int kTooltipMaxWidthPixels = 250;
16 17
(...skipping 15 matching lines...) Expand all
32 const gfx::FontList& TooltipManagerMac::GetFontList() const { 33 const gfx::FontList& TooltipManagerMac::GetFontList() const {
33 CR_DEFINE_STATIC_LOCAL(gfx::FontList, font_list, 34 CR_DEFINE_STATIC_LOCAL(gfx::FontList, font_list,
34 (gfx::Font([NSFont toolTipsFontOfSize:0]))); 35 (gfx::Font([NSFont toolTipsFontOfSize:0])));
35 return font_list; 36 return font_list;
36 } 37 }
37 38
38 void TooltipManagerMac::UpdateTooltip() { 39 void TooltipManagerMac::UpdateTooltip() {
39 NSWindow* window = widget_->ns_window(); 40 NSWindow* window = widget_->ns_window();
40 BridgedContentView* view = widget_->ns_view(); 41 BridgedContentView* view = widget_->ns_view();
41 42
42 NSPoint nspoint = [window convertScreenToBase:[NSEvent mouseLocation]]; 43 NSPoint nspoint =
44 ui::ConvertPointFromScreenToWindow(window, [NSEvent mouseLocation]);
43 // Note: flip in the view's frame, which matches the window's contentRect. 45 // Note: flip in the view's frame, which matches the window's contentRect.
44 gfx::Point point(nspoint.x, NSHeight([view frame]) - nspoint.y); 46 gfx::Point point(nspoint.x, NSHeight([view frame]) - nspoint.y);
45 [view updateTooltipIfRequiredAt:point]; 47 [view updateTooltipIfRequiredAt:point];
46 } 48 }
47 49
48 void TooltipManagerMac::TooltipTextChanged(View* view) { 50 void TooltipManagerMac::TooltipTextChanged(View* view) {
49 // The intensive part is View::GetTooltipHandlerForPoint(), which will be done 51 // The intensive part is View::GetTooltipHandlerForPoint(), which will be done
50 // in [BridgedContentView updateTooltipIfRequiredAt:]. Don't do it here as 52 // in [BridgedContentView updateTooltipIfRequiredAt:]. Don't do it here as
51 // well. 53 // well.
52 UpdateTooltip(); 54 UpdateTooltip();
53 } 55 }
54 56
55 } // namespace views 57 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/cocoa/bridged_content_view.mm ('k') | ui/views/cocoa/widget_owner_nswindow_adapter.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698