| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |