OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/renderer_host/render_widget_host_view_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/renderer_host/backing_store_skia.h" | 8 #include "content/browser/renderer_host/backing_store_skia.h" |
9 #include "content/browser/renderer_host/render_widget_host.h" | 9 #include "content/browser/renderer_host/render_widget_host.h" |
10 #include "content/browser/renderer_host/web_input_event_aura.h" | 10 #include "content/browser/renderer_host/web_input_event_aura.h" |
11 #include "content/public/browser/native_web_keyboard_event.h" | 11 #include "content/public/browser/native_web_keyboard_event.h" |
12 #include "content/common/gpu/gpu_messages.h" | 12 #include "content/common/gpu/gpu_messages.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositionUnderli
ne.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" |
15 #include "ui/aura/client/aura_constants.h" | 16 #include "ui/aura/client/aura_constants.h" |
16 #include "ui/aura/client/tooltip_client.h" | 17 #include "ui/aura/client/tooltip_client.h" |
17 #include "ui/aura/client/window_types.h" | 18 #include "ui/aura/client/window_types.h" |
18 #include "ui/aura/event.h" | 19 #include "ui/aura/event.h" |
19 #include "ui/aura/root_window.h" | 20 #include "ui/aura/root_window.h" |
20 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
21 #include "ui/base/hit_test.h" | 22 #include "ui/base/hit_test.h" |
| 23 #include "ui/base/ime/input_method.h" |
22 #include "ui/base/ui_base_types.h" | 24 #include "ui/base/ui_base_types.h" |
23 #include "ui/gfx/canvas.h" | 25 #include "ui/gfx/canvas.h" |
24 #include "ui/gfx/compositor/layer.h" | 26 #include "ui/gfx/compositor/layer.h" |
25 #include "ui/gfx/screen.h" | 27 #include "ui/gfx/screen.h" |
26 | 28 |
27 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 29 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
28 #include "base/bind.h" | 30 #include "base/bind.h" |
29 #include "content/browser/renderer_host/accelerated_surface_container_linux.h" | 31 #include "content/browser/renderer_host/accelerated_surface_container_linux.h" |
30 #include "ui/gfx/gl/gl_bindings.h" | 32 #include "ui/gfx/gl/gl_bindings.h" |
31 #endif | 33 #endif |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 89 |
88 //////////////////////////////////////////////////////////////////////////////// | 90 //////////////////////////////////////////////////////////////////////////////// |
89 // RenderWidgetHostViewAura, public: | 91 // RenderWidgetHostViewAura, public: |
90 | 92 |
91 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) | 93 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) |
92 : host_(host), | 94 : host_(host), |
93 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), | 95 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), |
94 is_fullscreen_(false), | 96 is_fullscreen_(false), |
95 popup_parent_host_view_(NULL), | 97 popup_parent_host_view_(NULL), |
96 is_loading_(false), | 98 is_loading_(false), |
| 99 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), |
| 100 has_composition_text_(false), |
97 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 101 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
98 current_surface_(gfx::kNullPluginWindow), | 102 current_surface_(gfx::kNullPluginWindow), |
99 #endif | 103 #endif |
100 skip_schedule_paint_(false) { | 104 skip_schedule_paint_(false) { |
101 host_->SetView(this); | 105 host_->SetView(this); |
102 aura::client::SetTooltipText(window_, &tooltip_); | 106 aura::client::SetTooltipText(window_, &tooltip_); |
103 aura::client::SetActivationDelegate(window_, this); | 107 aura::client::SetActivationDelegate(window_, this); |
104 } | 108 } |
105 | 109 |
106 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 110 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 234 } |
231 | 235 |
232 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { | 236 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { |
233 is_loading_ = is_loading; | 237 is_loading_ = is_loading; |
234 UpdateCursorIfOverSelf(); | 238 UpdateCursorIfOverSelf(); |
235 } | 239 } |
236 | 240 |
237 void RenderWidgetHostViewAura::TextInputStateChanged( | 241 void RenderWidgetHostViewAura::TextInputStateChanged( |
238 ui::TextInputType type, | 242 ui::TextInputType type, |
239 bool can_compose_inline) { | 243 bool can_compose_inline) { |
240 // http://crbug.com/102569 | 244 // TODO(kinaba): currently, can_compose_inline is ignored and always treated |
241 NOTIMPLEMENTED(); | 245 // as true. We need to support "can_compose_inline=false" for PPAPI plugins |
| 246 // that may want to avoid drawing composition-text by themselves and pass |
| 247 // the responsibility to the browser. |
| 248 if (text_input_type_ != type) { |
| 249 text_input_type_ = type; |
| 250 GetInputMethod()->OnTextInputTypeChanged(this); |
| 251 } |
242 } | 252 } |
243 | 253 |
244 void RenderWidgetHostViewAura::ImeCancelComposition() { | 254 void RenderWidgetHostViewAura::ImeCancelComposition() { |
245 // http://crbug.com/102569 | 255 GetInputMethod()->CancelComposition(this); |
246 NOTIMPLEMENTED(); | 256 has_composition_text_ = false; |
247 } | 257 } |
248 | 258 |
249 void RenderWidgetHostViewAura::DidUpdateBackingStore( | 259 void RenderWidgetHostViewAura::DidUpdateBackingStore( |
250 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 260 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
251 const std::vector<gfx::Rect>& copy_rects) { | 261 const std::vector<gfx::Rect>& copy_rects) { |
252 if (!window_->IsVisible() || skip_schedule_paint_) | 262 if (!window_->IsVisible() || skip_schedule_paint_) |
253 return; | 263 return; |
254 | 264 |
255 if (!scroll_rect.IsEmpty()) | 265 if (!scroll_rect.IsEmpty()) |
256 window_->SchedulePaintInRect(scroll_rect); | 266 window_->SchedulePaintInRect(scroll_rect); |
(...skipping 16 matching lines...) Expand all Loading... |
273 void RenderWidgetHostViewAura::Destroy() { | 283 void RenderWidgetHostViewAura::Destroy() { |
274 delete window_; | 284 delete window_; |
275 } | 285 } |
276 | 286 |
277 void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) { | 287 void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) { |
278 tooltip_ = tooltip_text; | 288 tooltip_ = tooltip_text; |
279 if (aura::client::GetTooltipClient()) | 289 if (aura::client::GetTooltipClient()) |
280 aura::client::GetTooltipClient()->UpdateTooltip(window_); | 290 aura::client::GetTooltipClient()->UpdateTooltip(window_); |
281 } | 291 } |
282 | 292 |
| 293 void RenderWidgetHostViewAura::SelectionBoundsChanged( |
| 294 const gfx::Rect& start_rect, |
| 295 const gfx::Rect& end_rect) { |
| 296 if (selection_start_rect_ == start_rect && selection_end_rect_ == end_rect) |
| 297 return; |
| 298 |
| 299 selection_start_rect_ = start_rect; |
| 300 selection_end_rect_ = end_rect; |
| 301 |
| 302 GetInputMethod()->OnCaretBoundsChanged(this); |
| 303 } |
| 304 |
283 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( | 305 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( |
284 const gfx::Size& size) { | 306 const gfx::Size& size) { |
285 return new BackingStoreSkia(host_, size); | 307 return new BackingStoreSkia(host_, size); |
286 } | 308 } |
287 | 309 |
288 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { | 310 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { |
289 UpdateExternalTexture(); | 311 UpdateExternalTexture(); |
290 } | 312 } |
291 | 313 |
292 void RenderWidgetHostViewAura::UpdateExternalTexture() { | 314 void RenderWidgetHostViewAura::UpdateExternalTexture() { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 return false; | 476 return false; |
455 } | 477 } |
456 | 478 |
457 void RenderWidgetHostViewAura::UnlockMouse() { | 479 void RenderWidgetHostViewAura::UnlockMouse() { |
458 // http://crbug.com/102563 | 480 // http://crbug.com/102563 |
459 NOTIMPLEMENTED(); | 481 NOTIMPLEMENTED(); |
460 host_->LostMouseLock(); | 482 host_->LostMouseLock(); |
461 } | 483 } |
462 | 484 |
463 //////////////////////////////////////////////////////////////////////////////// | 485 //////////////////////////////////////////////////////////////////////////////// |
| 486 // RenderWidgetHostViewAura, ui::TextInputClient implementation: |
| 487 void RenderWidgetHostViewAura::SetCompositionText( |
| 488 const ui::CompositionText& composition) { |
| 489 if (!host_) |
| 490 return; |
| 491 |
| 492 // ui::CompositionUnderline should be identical to |
| 493 // WebKit::WebCompositionUnderline, so that we can do reinterpret_cast safely. |
| 494 COMPILE_ASSERT(sizeof(ui::CompositionUnderline) == |
| 495 sizeof(WebKit::WebCompositionUnderline), |
| 496 ui_CompositionUnderline__WebKit_WebCompositionUnderline_diff); |
| 497 |
| 498 // TODO(suzhe): convert both renderer_host and renderer to use |
| 499 // ui::CompositionText. |
| 500 const std::vector<WebKit::WebCompositionUnderline>& underlines = |
| 501 reinterpret_cast<const std::vector<WebKit::WebCompositionUnderline>&>( |
| 502 composition.underlines); |
| 503 |
| 504 // TODO(suzhe): due to a bug of webkit, we can't use selection range with |
| 505 // composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788 |
| 506 host_->ImeSetComposition(composition.text, underlines, |
| 507 composition.selection.end(), |
| 508 composition.selection.end()); |
| 509 |
| 510 has_composition_text_ = !composition.text.empty(); |
| 511 } |
| 512 |
| 513 void RenderWidgetHostViewAura::ConfirmCompositionText() { |
| 514 if (host_ && has_composition_text_) |
| 515 host_->ImeConfirmComposition(); |
| 516 has_composition_text_ = false; |
| 517 } |
| 518 |
| 519 void RenderWidgetHostViewAura::ClearCompositionText() { |
| 520 if (host_ && has_composition_text_) |
| 521 host_->ImeCancelComposition(); |
| 522 has_composition_text_ = false; |
| 523 } |
| 524 |
| 525 void RenderWidgetHostViewAura::InsertText(const string16& text) { |
| 526 DCHECK(text_input_type_ != ui::TEXT_INPUT_TYPE_NONE); |
| 527 if (host_) |
| 528 host_->ImeConfirmComposition(text); |
| 529 has_composition_text_ = false; |
| 530 } |
| 531 |
| 532 void RenderWidgetHostViewAura::InsertChar(char16 ch, int flags) { |
| 533 if (host_) { |
| 534 // Send a WebKit::WebInputEvent::Char event to |host_|. |
| 535 NativeWebKeyboardEvent webkit_event(ui::ET_KEY_PRESSED, |
| 536 true /* is_char */, |
| 537 ch, |
| 538 flags, |
| 539 base::Time::Now().ToDoubleT()); |
| 540 host_->ForwardKeyboardEvent(webkit_event); |
| 541 } |
| 542 } |
| 543 |
| 544 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { |
| 545 return text_input_type_; |
| 546 } |
| 547 |
| 548 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() { |
| 549 const gfx::Rect rect = selection_start_rect_.Union(selection_end_rect_); |
| 550 gfx::Point origin = rect.origin(); |
| 551 gfx::Point end = gfx::Point(rect.right(), rect.bottom()); |
| 552 |
| 553 aura::RootWindow* root_window = aura::RootWindow::GetInstance(); |
| 554 aura::Window::ConvertPointToWindow(window_, root_window, &origin); |
| 555 aura::Window::ConvertPointToWindow(window_, root_window, &end); |
| 556 // TODO(yusukes): Unlike Chrome OS, |root_window| origin might not be the |
| 557 // same as the system screen origin on Windows and Linux. Probably we should |
| 558 // (implement and) use something like ConvertPointToScreen(). |
| 559 |
| 560 return gfx::Rect(origin.x(), |
| 561 origin.y(), |
| 562 end.x() - origin.x(), |
| 563 end.y() - origin.y()); |
| 564 } |
| 565 |
| 566 bool RenderWidgetHostViewAura::HasCompositionText() { |
| 567 return has_composition_text_; |
| 568 } |
| 569 |
| 570 bool RenderWidgetHostViewAura::GetTextRange(ui::Range* range) { |
| 571 range->set_start(selection_text_offset_); |
| 572 range->set_end(selection_text_offset_ + selection_text_.length()); |
| 573 return true; |
| 574 } |
| 575 |
| 576 bool RenderWidgetHostViewAura::GetCompositionTextRange(ui::Range* range) { |
| 577 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 578 NOTIMPLEMENTED(); |
| 579 return false; |
| 580 } |
| 581 |
| 582 bool RenderWidgetHostViewAura::GetSelectionRange(ui::Range* range) { |
| 583 range->set_start(selection_range_.start()); |
| 584 range->set_end(selection_range_.end()); |
| 585 return true; |
| 586 } |
| 587 |
| 588 bool RenderWidgetHostViewAura::SetSelectionRange(const ui::Range& range) { |
| 589 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 590 NOTIMPLEMENTED(); |
| 591 return false; |
| 592 } |
| 593 |
| 594 bool RenderWidgetHostViewAura::DeleteRange(const ui::Range& range) { |
| 595 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. |
| 596 NOTIMPLEMENTED(); |
| 597 return false; |
| 598 } |
| 599 |
| 600 bool RenderWidgetHostViewAura::GetTextFromRange( |
| 601 const ui::Range& range, |
| 602 string16* text) { |
| 603 ui::Range selection_text_range(selection_text_offset_, |
| 604 selection_text_offset_ + selection_text_.length()); |
| 605 |
| 606 if (!selection_text_range.Contains(range)) { |
| 607 text->clear(); |
| 608 return false; |
| 609 } |
| 610 if (selection_text_range.EqualsIgnoringDirection(range)) { |
| 611 // Avoid calling substr whose performance is low. |
| 612 *text = selection_text_; |
| 613 } else { |
| 614 *text = selection_text_.substr( |
| 615 range.GetMin() - selection_text_offset_, |
| 616 range.length()); |
| 617 } |
| 618 return true; |
| 619 } |
| 620 |
| 621 void RenderWidgetHostViewAura::OnInputMethodChanged() { |
| 622 if (!host_) |
| 623 return; |
| 624 |
| 625 host_->SetInputMethodActive(GetInputMethod()->IsActive()); |
| 626 |
| 627 // TODO(suzhe): implement the newly added “locale” property of HTML DOM |
| 628 // TextEvent. |
| 629 } |
| 630 |
| 631 bool RenderWidgetHostViewAura::ChangeTextDirectionAndLayoutAlignment( |
| 632 base::i18n::TextDirection direction) { |
| 633 if (!host_) |
| 634 return false; |
| 635 host_->UpdateTextDirection( |
| 636 direction == base::i18n::RIGHT_TO_LEFT ? |
| 637 WebKit::WebTextDirectionRightToLeft : |
| 638 WebKit::WebTextDirectionLeftToRight); |
| 639 host_->NotifyTextDirection(); |
| 640 return true; |
| 641 } |
| 642 |
| 643 //////////////////////////////////////////////////////////////////////////////// |
464 // RenderWidgetHostViewAura, aura::WindowDelegate implementation: | 644 // RenderWidgetHostViewAura, aura::WindowDelegate implementation: |
465 | 645 |
466 gfx::Size RenderWidgetHostViewAura::GetMinimumSize() const { | 646 gfx::Size RenderWidgetHostViewAura::GetMinimumSize() const { |
467 return gfx::Size(); | 647 return gfx::Size(); |
468 } | 648 } |
469 | 649 |
470 void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 650 void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
471 const gfx::Rect& new_bounds) { | 651 const gfx::Rect& new_bounds) { |
472 // We don't care about this one, we are always sized via SetSize() or | 652 // We don't care about this one, we are always sized via SetSize() or |
473 // SetBounds(). | 653 // SetBounds(). |
474 } | 654 } |
475 | 655 |
476 void RenderWidgetHostViewAura::OnFocus() { | 656 void RenderWidgetHostViewAura::OnFocus() { |
477 host_->GotFocus(); | 657 host_->GotFocus(); |
478 host_->SetActive(true); | 658 host_->SetActive(true); |
| 659 |
| 660 ui::InputMethod* input_method = GetInputMethod(); |
| 661 if (input_method) { |
| 662 // Ask the system-wide IME to send all TextInputClient messages to |this| |
| 663 // object. |
| 664 input_method->SetFocusedTextInputClient(this); |
| 665 host_->SetInputMethodActive(input_method->IsActive()); |
| 666 } else { |
| 667 host_->SetInputMethodActive(false); |
| 668 } |
479 } | 669 } |
480 | 670 |
481 void RenderWidgetHostViewAura::OnBlur() { | 671 void RenderWidgetHostViewAura::OnBlur() { |
482 host_->SetActive(false); | 672 host_->SetActive(false); |
483 host_->Blur(); | 673 host_->Blur(); |
| 674 |
| 675 ui::InputMethod* input_method = GetInputMethod(); |
| 676 if (input_method) { |
| 677 if (input_method->GetTextInputClient() == this) |
| 678 input_method->SetFocusedTextInputClient(NULL); |
| 679 } |
| 680 host_->SetInputMethodActive(false); |
484 } | 681 } |
485 | 682 |
486 bool RenderWidgetHostViewAura::OnKeyEvent(aura::KeyEvent* event) { | 683 bool RenderWidgetHostViewAura::OnKeyEvent(aura::KeyEvent* event) { |
487 // We need to handle the Escape key for Pepper Flash. | 684 // We need to handle the Escape key for Pepper Flash. |
488 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 685 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
489 host_->Shutdown(); | 686 host_->Shutdown(); |
490 } else { | 687 } else { |
491 NativeWebKeyboardEvent webkit_event(event); | 688 // We don't have to communicate with an input method here. |
492 host_->ForwardKeyboardEvent(webkit_event); | 689 if (!event->HasNativeEvent()) { |
| 690 // Send a fabricated event, which is usually a VKEY_PROCESSKEY IME event. |
| 691 NativeWebKeyboardEvent webkit_event(event->type(), |
| 692 false /* is_char */, |
| 693 event->GetCharacter(), |
| 694 event->flags(), |
| 695 base::Time::Now().ToDoubleT()); |
| 696 host_->ForwardKeyboardEvent(webkit_event); |
| 697 } else { |
| 698 NativeWebKeyboardEvent webkit_event(event); |
| 699 host_->ForwardKeyboardEvent(webkit_event); |
| 700 } |
493 } | 701 } |
494 return true; | 702 return true; |
495 } | 703 } |
496 | 704 |
497 gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { | 705 gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { |
498 return current_cursor_.GetNativeCursor(); | 706 return current_cursor_.GetNativeCursor(); |
499 } | 707 } |
500 | 708 |
501 int RenderWidgetHostViewAura::GetNonClientComponent( | 709 int RenderWidgetHostViewAura::GetNonClientComponent( |
502 const gfx::Point& point) const { | 710 const gfx::Point& point) const { |
503 return HTCLIENT; | 711 return HTCLIENT; |
504 } | 712 } |
505 | 713 |
506 bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { | 714 bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { |
507 if (event->type() == ui::ET_MOUSEWHEEL) | 715 if (event->type() == ui::ET_MOUSEWHEEL) |
508 host_->ForwardWheelEvent(content::MakeWebMouseWheelEvent(event)); | 716 host_->ForwardWheelEvent(content::MakeWebMouseWheelEvent(event)); |
509 else if (event->type() == ui::ET_SCROLL) | 717 else if (event->type() == ui::ET_SCROLL) |
510 host_->ForwardWheelEvent( | 718 host_->ForwardWheelEvent( |
511 content::MakeWebMouseWheelEvent( | 719 content::MakeWebMouseWheelEvent( |
512 static_cast<aura::ScrollEvent*>(event))); | 720 static_cast<aura::ScrollEvent*>(event))); |
513 else if (CanRendererHandleEvent(event->native_event())) | 721 else if (CanRendererHandleEvent(event->native_event())) |
514 host_->ForwardMouseEvent(content::MakeWebMouseEvent(event)); | 722 host_->ForwardMouseEvent(content::MakeWebMouseEvent(event)); |
515 | 723 |
516 switch (event->type()) { | 724 switch (event->type()) { |
517 case ui::ET_MOUSE_PRESSED: | 725 case ui::ET_MOUSE_PRESSED: |
518 window_->SetCapture(); | 726 window_->SetCapture(); |
| 727 // Confirm existing composition text on mouse click events, to make sure |
| 728 // the input caret won't be moved with an ongoing composition text. |
| 729 FinishImeCompositionSession(); |
519 break; | 730 break; |
520 case ui::ET_MOUSE_RELEASED: | 731 case ui::ET_MOUSE_RELEASED: |
521 window_->ReleaseCapture(); | 732 window_->ReleaseCapture(); |
522 break; | 733 break; |
523 default: | 734 default: |
524 break; | 735 break; |
525 } | 736 } |
526 | 737 |
527 // Needed to propagate mouse event to native_tab_contents_view_aura. | 738 // Needed to propagate mouse event to native_tab_contents_view_aura. |
528 // TODO(pkotwicz): Find a better way of doing this. | 739 // TODO(pkotwicz): Find a better way of doing this. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 if (root_window->GetEventHandlerForPoint(screen_point) != window_) | 830 if (root_window->GetEventHandlerForPoint(screen_point) != window_) |
620 return; | 831 return; |
621 | 832 |
622 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); | 833 gfx::NativeCursor cursor = current_cursor_.GetNativeCursor(); |
623 if (is_loading_ && cursor == aura::kCursorPointer) | 834 if (is_loading_ && cursor == aura::kCursorPointer) |
624 cursor = aura::kCursorProgress; | 835 cursor = aura::kCursorProgress; |
625 | 836 |
626 aura::RootWindow::GetInstance()->SetCursor(cursor); | 837 aura::RootWindow::GetInstance()->SetCursor(cursor); |
627 } | 838 } |
628 | 839 |
| 840 ui::InputMethod* RenderWidgetHostViewAura::GetInputMethod() const { |
| 841 aura::RootWindow* root_window = aura::RootWindow::GetInstance(); |
| 842 return reinterpret_cast<ui::InputMethod*>( |
| 843 root_window->GetProperty(aura::client::kRootWindowInputMethod)); |
| 844 } |
| 845 |
| 846 void RenderWidgetHostViewAura::FinishImeCompositionSession() { |
| 847 if (!has_composition_text_) |
| 848 return; |
| 849 if (host_) |
| 850 host_->ImeConfirmComposition(); |
| 851 ImeCancelComposition(); |
| 852 } |
| 853 |
629 //////////////////////////////////////////////////////////////////////////////// | 854 //////////////////////////////////////////////////////////////////////////////// |
630 // RenderWidgetHostView, public: | 855 // RenderWidgetHostView, public: |
631 | 856 |
632 // static | 857 // static |
633 void RenderWidgetHostView::GetDefaultScreenInfo( | 858 void RenderWidgetHostView::GetDefaultScreenInfo( |
634 WebKit::WebScreenInfo* results) { | 859 WebKit::WebScreenInfo* results) { |
635 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); | 860 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
636 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 861 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
637 results->availableRect = results->rect; | 862 results->availableRect = results->rect; |
638 // TODO(derat): Don't hardcode this? | 863 // TODO(derat): Don't hardcode this? |
639 results->depth = 24; | 864 results->depth = 24; |
640 results->depthPerComponent = 8; | 865 results->depthPerComponent = 8; |
641 } | 866 } |
OLD | NEW |