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

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

Issue 1161933007: ui: Introduce CanvasPainter, remove PaintContext(gfx::Canvas*). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: canvaspainter: . Created 5 years, 6 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/button_drag_utils.cc ('k') | ui/views/controls/label_unittest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ui/views/cocoa/bridged_content_view.h" 5 #import "ui/views/cocoa/bridged_content_view.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "base/mac/scoped_nsobject.h" 8 #import "base/mac/scoped_nsobject.h"
9 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
10 #include "ui/base/ime/text_input_client.h" 10 #include "ui/base/ime/text_input_client.h"
11 #include "ui/compositor/paint_context.h" 11 #include "ui/compositor/canvas_painter.h"
12 #import "ui/events/cocoa/cocoa_event_utils.h" 12 #import "ui/events/cocoa/cocoa_event_utils.h"
13 #include "ui/events/keycodes/dom/dom_code.h" 13 #include "ui/events/keycodes/dom/dom_code.h"
14 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" 14 #import "ui/events/keycodes/keyboard_code_conversion_mac.h"
15 #include "ui/gfx/canvas_paint_mac.h" 15 #include "ui/gfx/canvas_paint_mac.h"
16 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
17 #include "ui/strings/grit/ui_strings.h" 17 #include "ui/strings/grit/ui_strings.h"
18 #include "ui/views/controls/menu/menu_controller.h" 18 #include "ui/views/controls/menu/menu_controller.h"
19 #include "ui/views/ime/input_method.h" 19 #include "ui/views/ime/input_method.h"
20 #include "ui/views/view.h" 20 #include "ui/views/view.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 // Note that BridgedNativeWidget uses -[NSWindow setAutodisplay:NO] to 305 // Note that BridgedNativeWidget uses -[NSWindow setAutodisplay:NO] to
306 // suppress calls to this when the window is known to be hidden. 306 // suppress calls to this when the window is known to be hidden.
307 if (!hostedView_) 307 if (!hostedView_)
308 return; 308 return;
309 309
310 // If there's a layer, painting occurs in BridgedNativeWidget::OnPaintLayer(). 310 // If there's a layer, painting occurs in BridgedNativeWidget::OnPaintLayer().
311 if (hostedView_->GetWidget()->GetLayer()) 311 if (hostedView_->GetWidget()->GetLayer())
312 return; 312 return;
313 313
314 gfx::CanvasSkiaPaint canvas(dirtyRect, false /* opaque */); 314 gfx::CanvasSkiaPaint canvas(dirtyRect, false /* opaque */);
315 hostedView_->GetWidget()->OnNativeWidgetPaint(ui::PaintContext(&canvas)); 315 hostedView_->GetWidget()->OnNativeWidgetPaint(
316 ui::CanvasPainter(&canvas, 1.f).context());
316 } 317 }
317 318
318 - (NSTextInputContext*)inputContext { 319 - (NSTextInputContext*)inputContext {
319 if (!hostedView_) 320 if (!hostedView_)
320 return [super inputContext]; 321 return [super inputContext];
321 322
322 // If a menu is active, and -[NSView interpretKeyEvents:] asks for the 323 // If a menu is active, and -[NSView interpretKeyEvents:] asks for the
323 // input context, return nil. This ensures the action message is sent to 324 // input context, return nil. This ensures the action message is sent to
324 // the view, rather than any NSTextInputClient a subview has installed. 325 // the view, rather than any NSTextInputClient a subview has installed.
325 MenuController* menuController = MenuController::GetActiveInstance(); 326 MenuController* menuController = MenuController::GetActiveInstance();
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 } 706 }
706 707
707 return [super accessibilityAttributeValue:attribute]; 708 return [super accessibilityAttributeValue:attribute];
708 } 709 }
709 710
710 - (id)accessibilityHitTest:(NSPoint)point { 711 - (id)accessibilityHitTest:(NSPoint)point {
711 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point]; 712 return [hostedView_->GetNativeViewAccessible() accessibilityHitTest:point];
712 } 713 }
713 714
714 @end 715 @end
OLDNEW
« no previous file with comments | « ui/views/button_drag_utils.cc ('k') | ui/views/controls/label_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698