Chromium Code Reviews| 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/desktop.h" | 17 #include "ui/aura/desktop.h" |
| 17 #include "ui/aura/event.h" | 18 #include "ui/aura/event.h" |
| 18 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
| 19 #include "ui/aura/window_types.h" | 20 #include "ui/aura/window_types.h" |
| 20 #include "ui/base/hit_test.h" | 21 #include "ui/base/hit_test.h" |
| 22 #include "ui/base/ime/input_method.h" | |
| 21 #include "ui/base/ui_base_types.h" | 23 #include "ui/base/ui_base_types.h" |
| 22 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
| 23 #include "ui/gfx/compositor/layer.h" | 25 #include "ui/gfx/compositor/layer.h" |
| 24 #include "ui/gfx/screen.h" | 26 #include "ui/gfx/screen.h" |
| 25 | 27 |
| 26 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 28 #if defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 27 #include "base/bind.h" | 29 #include "base/bind.h" |
| 28 #include "content/browser/renderer_host/accelerated_surface_container_linux.h" | 30 #include "content/browser/renderer_host/accelerated_surface_container_linux.h" |
| 29 #include "ui/gfx/gl/gl_bindings.h" | 31 #include "ui/gfx/gl/gl_bindings.h" |
| 30 #endif | 32 #endif |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 | 88 |
| 87 //////////////////////////////////////////////////////////////////////////////// | 89 //////////////////////////////////////////////////////////////////////////////// |
| 88 // RenderWidgetHostViewAura, public: | 90 // RenderWidgetHostViewAura, public: |
| 89 | 91 |
| 90 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) | 92 RenderWidgetHostViewAura::RenderWidgetHostViewAura(RenderWidgetHost* host) |
| 91 : host_(host), | 93 : host_(host), |
| 92 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), | 94 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), |
| 93 is_fullscreen_(false), | 95 is_fullscreen_(false), |
| 94 popup_parent_host_view_(NULL), | 96 popup_parent_host_view_(NULL), |
| 95 is_loading_(false), | 97 is_loading_(false), |
| 98 text_input_type_(ui::TEXT_INPUT_TYPE_NONE), | |
| 99 has_composition_text_(false), | |
| 96 skip_schedule_paint_(false) { | 100 skip_schedule_paint_(false) { |
| 97 host_->SetView(this); | 101 host_->SetView(this); |
| 98 window_->SetProperty(aura::kTooltipTextKey, &tooltip_); | 102 window_->SetProperty(aura::kTooltipTextKey, &tooltip_); |
| 99 } | 103 } |
| 100 | 104 |
| 101 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { | 105 RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { |
| 102 } | 106 } |
| 103 | 107 |
| 104 void RenderWidgetHostViewAura::InitAsChild() { | 108 void RenderWidgetHostViewAura::InitAsChild() { |
| 105 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); | 109 window_->Init(ui::Layer::LAYER_HAS_TEXTURE); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 } | 224 } |
| 221 | 225 |
| 222 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { | 226 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { |
| 223 is_loading_ = is_loading; | 227 is_loading_ = is_loading; |
| 224 UpdateCursorIfOverSelf(); | 228 UpdateCursorIfOverSelf(); |
| 225 } | 229 } |
| 226 | 230 |
| 227 void RenderWidgetHostViewAura::TextInputStateChanged( | 231 void RenderWidgetHostViewAura::TextInputStateChanged( |
| 228 ui::TextInputType type, | 232 ui::TextInputType type, |
| 229 bool can_compose_inline) { | 233 bool can_compose_inline) { |
| 230 // http://crbug.com/102569 | 234 // TODO(kinaba): currently, can_compose_inline is ignored and always treated |
| 231 NOTIMPLEMENTED(); | 235 // as true. We need to support "can_compose_inline=false" for PPAPI plugins |
| 236 // that may want to avoid drawing composition-text by themselves and pass | |
| 237 // the responsibility to the browser. | |
| 238 if (text_input_type_ != type) { | |
| 239 text_input_type_ = type; | |
| 240 // TODO(yusukes): Should we call ImeCancelComposition() here? | |
|
James Su
2011/11/29 04:25:53
I think the input method implementation should do
Yusuke Sato
2011/11/29 09:06:36
Sure, removed the TODO.
| |
| 241 GetInputMethod()->OnTextInputTypeChanged(this); | |
| 242 } | |
| 232 } | 243 } |
| 233 | 244 |
| 234 void RenderWidgetHostViewAura::ImeCancelComposition() { | 245 void RenderWidgetHostViewAura::ImeCancelComposition() { |
| 235 // http://crbug.com/102569 | 246 GetInputMethod()->CancelComposition(this); |
| 236 NOTIMPLEMENTED(); | 247 has_composition_text_ = false; |
| 237 } | 248 } |
| 238 | 249 |
| 239 void RenderWidgetHostViewAura::DidUpdateBackingStore( | 250 void RenderWidgetHostViewAura::DidUpdateBackingStore( |
| 240 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 251 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
| 241 const std::vector<gfx::Rect>& copy_rects) { | 252 const std::vector<gfx::Rect>& copy_rects) { |
| 242 if (!window_->IsVisible() || skip_schedule_paint_) | 253 if (!window_->IsVisible() || skip_schedule_paint_) |
| 243 return; | 254 return; |
| 244 | 255 |
| 245 if (!scroll_rect.IsEmpty()) | 256 if (!scroll_rect.IsEmpty()) |
| 246 window_->SchedulePaintInRect(scroll_rect); | 257 window_->SchedulePaintInRect(scroll_rect); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 261 } | 272 } |
| 262 | 273 |
| 263 void RenderWidgetHostViewAura::Destroy() { | 274 void RenderWidgetHostViewAura::Destroy() { |
| 264 delete window_; | 275 delete window_; |
| 265 } | 276 } |
| 266 | 277 |
| 267 void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) { | 278 void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) { |
| 268 tooltip_ = tooltip_text; | 279 tooltip_ = tooltip_text; |
| 269 } | 280 } |
| 270 | 281 |
| 282 void RenderWidgetHostViewAura::SelectionBoundsChanged( | |
| 283 const gfx::Rect& start_rect, | |
| 284 const gfx::Rect& end_rect) { | |
| 285 if (selection_start_rect_ == start_rect && selection_end_rect_ == end_rect) | |
| 286 return; | |
| 287 | |
| 288 selection_start_rect_ = start_rect; | |
| 289 selection_end_rect_ = end_rect; | |
| 290 | |
| 291 GetInputMethod()->OnCaretBoundsChanged(this); | |
| 292 } | |
| 293 | |
| 271 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( | 294 BackingStore* RenderWidgetHostViewAura::AllocBackingStore( |
| 272 const gfx::Size& size) { | 295 const gfx::Size& size) { |
| 273 return new BackingStoreSkia(host_, size); | 296 return new BackingStoreSkia(host_, size); |
| 274 } | 297 } |
| 275 | 298 |
| 276 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { | 299 void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { |
| 277 } | 300 } |
| 278 | 301 |
| 279 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( | 302 void RenderWidgetHostViewAura::AcceleratedSurfaceBuffersSwapped( |
| 280 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 303 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 return false; | 444 return false; |
| 422 } | 445 } |
| 423 | 446 |
| 424 void RenderWidgetHostViewAura::UnlockMouse() { | 447 void RenderWidgetHostViewAura::UnlockMouse() { |
| 425 // http://crbug.com/102563 | 448 // http://crbug.com/102563 |
| 426 NOTIMPLEMENTED(); | 449 NOTIMPLEMENTED(); |
| 427 host_->LostMouseLock(); | 450 host_->LostMouseLock(); |
| 428 } | 451 } |
| 429 | 452 |
| 430 //////////////////////////////////////////////////////////////////////////////// | 453 //////////////////////////////////////////////////////////////////////////////// |
| 454 // RenderWidgetHostViewAura, ui::TextInputClient implementation: | |
| 455 void RenderWidgetHostViewAura::SetCompositionText( | |
| 456 const ui::CompositionText& composition) { | |
| 457 if (!host_) | |
| 458 return; | |
| 459 | |
| 460 // ui::CompositionUnderline should be identical to | |
| 461 // WebKit::WebCompositionUnderline, so that we can do reinterpret_cast safely. | |
| 462 COMPILE_ASSERT(sizeof(ui::CompositionUnderline) == | |
| 463 sizeof(WebKit::WebCompositionUnderline), | |
| 464 ui_CompositionUnderline__WebKit_WebCompositionUnderline_diff); | |
| 465 | |
| 466 // TODO(suzhe): convert both renderer_host and renderer to use | |
| 467 // ui::CompositionText. | |
| 468 const std::vector<WebKit::WebCompositionUnderline>& underlines = | |
| 469 reinterpret_cast<const std::vector<WebKit::WebCompositionUnderline>&>( | |
| 470 composition.underlines); | |
| 471 | |
| 472 // TODO(suzhe): due to a bug of webkit, we can't use selection range with | |
| 473 // composition string. See: https://bugs.webkit.org/show_bug.cgi?id=37788 | |
| 474 host_->ImeSetComposition(composition.text, underlines, | |
| 475 composition.selection.end(), | |
| 476 composition.selection.end()); | |
| 477 | |
| 478 has_composition_text_ = !composition.text.empty(); | |
| 479 } | |
| 480 | |
| 481 void RenderWidgetHostViewAura::ConfirmCompositionText() { | |
| 482 if (host_ && has_composition_text_) | |
| 483 host_->ImeConfirmComposition(); | |
| 484 has_composition_text_ = false; | |
| 485 } | |
| 486 | |
| 487 void RenderWidgetHostViewAura::ClearCompositionText() { | |
| 488 if (host_ && has_composition_text_) | |
| 489 host_->ImeCancelComposition(); | |
| 490 has_composition_text_ = false; | |
| 491 } | |
| 492 | |
| 493 void RenderWidgetHostViewAura::InsertText(const string16& text) { | |
| 494 DCHECK(text_input_type_ != ui::TEXT_INPUT_TYPE_NONE); | |
| 495 if (host_) | |
| 496 host_->ImeConfirmComposition(text); | |
| 497 has_composition_text_ = false; | |
| 498 } | |
| 499 | |
| 500 void RenderWidgetHostViewAura::InsertChar(char16 ch, int flags) { | |
| 501 if (host_) { | |
| 502 // Send a WebKit::WebInputEvent::Char event to |host_|. | |
| 503 NativeWebKeyboardEvent webkit_event(ui::ET_KEY_PRESSED, | |
| 504 true /* is_char */, | |
| 505 ch, | |
| 506 flags, | |
| 507 base::Time::Now().ToDoubleT()); | |
| 508 host_->ForwardKeyboardEvent(webkit_event); | |
| 509 } | |
| 510 } | |
| 511 | |
| 512 ui::TextInputType RenderWidgetHostViewAura::GetTextInputType() const { | |
| 513 return text_input_type_; | |
| 514 } | |
| 515 | |
| 516 gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() { | |
| 517 const gfx::Rect rect = selection_start_rect_.Union(selection_end_rect_); | |
| 518 gfx::Point origin = rect.origin(); | |
| 519 gfx::Point end = gfx::Point(rect.right(), rect.bottom()); | |
| 520 | |
| 521 aura::Desktop* desktop = aura::Desktop::GetInstance(); | |
| 522 aura::Window::ConvertPointToWindow(window_, desktop, &origin); | |
| 523 aura::Window::ConvertPointToWindow(window_, desktop, &end); | |
| 524 // TODO(yusukes): Unlike Chrome OS, |desktop| origin might not be the same as | |
| 525 // the system screen origin on Windows and Linux. Probably we should | |
| 526 // (implement and) use something like ConvertPointToScreen(). | |
| 527 | |
| 528 return gfx::Rect(origin.x(), | |
| 529 origin.y(), | |
| 530 end.x() - origin.x(), | |
| 531 end.y() - origin.y()); | |
| 532 } | |
| 533 | |
| 534 bool RenderWidgetHostViewAura::HasCompositionText() { | |
| 535 return has_composition_text_; | |
| 536 } | |
| 537 | |
| 538 bool RenderWidgetHostViewAura::GetTextRange(ui::Range* range) { | |
| 539 range->set_start(selection_text_offset_); | |
| 540 range->set_end(selection_text_offset_ + selection_text_.length()); | |
| 541 return true; | |
| 542 } | |
| 543 | |
| 544 bool RenderWidgetHostViewAura::GetCompositionTextRange(ui::Range* range) { | |
| 545 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | |
| 546 NOTIMPLEMENTED(); | |
| 547 return false; | |
| 548 } | |
| 549 | |
| 550 bool RenderWidgetHostViewAura::GetSelectionRange(ui::Range* range) { | |
| 551 range->set_start(selection_range_.start()); | |
| 552 range->set_end(selection_range_.end()); | |
| 553 return true; | |
| 554 } | |
| 555 | |
| 556 bool RenderWidgetHostViewAura::SetSelectionRange(const ui::Range& range) { | |
| 557 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | |
| 558 NOTIMPLEMENTED(); | |
| 559 return false; | |
| 560 } | |
| 561 | |
| 562 bool RenderWidgetHostViewAura::DeleteRange(const ui::Range& range) { | |
| 563 // TODO(suzhe): implement this method when fixing http://crbug.com/55130. | |
| 564 NOTIMPLEMENTED(); | |
| 565 return false; | |
| 566 } | |
| 567 | |
| 568 bool RenderWidgetHostViewAura::GetTextFromRange( | |
| 569 const ui::Range& range, | |
| 570 string16* text) { | |
| 571 ui::Range selection_text_range(selection_text_offset_, | |
| 572 selection_text_offset_ + selection_text_.length()); | |
| 573 | |
| 574 if (!selection_text_range.Contains(range)) { | |
| 575 text->clear(); | |
| 576 return false; | |
| 577 } | |
| 578 if (selection_text_range.EqualsIgnoringDirection(range)) { | |
| 579 // Avoid calling substr whose performance is low. | |
| 580 *text = selection_text_; | |
| 581 } else { | |
| 582 *text = selection_text_.substr( | |
| 583 range.GetMin() - selection_text_offset_, | |
| 584 range.length()); | |
| 585 } | |
| 586 return true; | |
| 587 } | |
| 588 | |
| 589 void RenderWidgetHostViewAura::OnInputMethodChanged() { | |
| 590 if (!host_) | |
| 591 return; | |
| 592 | |
| 593 host_->SetInputMethodActive(GetInputMethod()->IsActive()); | |
| 594 | |
| 595 // TODO(suzhe): implement the newly added “locale” property of HTML DOM | |
| 596 // TextEvent. | |
| 597 } | |
| 598 | |
| 599 bool RenderWidgetHostViewAura::ChangeTextDirectionAndLayoutAlignment( | |
| 600 base::i18n::TextDirection direction) { | |
| 601 if (!host_) | |
| 602 return false; | |
| 603 host_->UpdateTextDirection( | |
| 604 direction == base::i18n::RIGHT_TO_LEFT ? | |
| 605 WebKit::WebTextDirectionRightToLeft : | |
| 606 WebKit::WebTextDirectionLeftToRight); | |
| 607 host_->NotifyTextDirection(); | |
| 608 return true; | |
| 609 } | |
| 610 | |
| 611 //////////////////////////////////////////////////////////////////////////////// | |
| 431 // RenderWidgetHostViewAura, aura::WindowDelegate implementation: | 612 // RenderWidgetHostViewAura, aura::WindowDelegate implementation: |
| 432 | 613 |
| 433 gfx::Size RenderWidgetHostViewAura::GetMinimumSize() const { | 614 gfx::Size RenderWidgetHostViewAura::GetMinimumSize() const { |
| 434 return gfx::Size(); | 615 return gfx::Size(); |
| 435 } | 616 } |
| 436 | 617 |
| 437 void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, | 618 void RenderWidgetHostViewAura::OnBoundsChanged(const gfx::Rect& old_bounds, |
| 438 const gfx::Rect& new_bounds) { | 619 const gfx::Rect& new_bounds) { |
| 439 // We don't care about this one, we are always sized via SetSize() or | 620 // We don't care about this one, we are always sized via SetSize() or |
| 440 // SetBounds(). | 621 // SetBounds(). |
| 441 } | 622 } |
| 442 | 623 |
| 443 void RenderWidgetHostViewAura::OnFocus() { | 624 void RenderWidgetHostViewAura::OnFocus() { |
| 444 host_->GotFocus(); | 625 host_->GotFocus(); |
| 626 | |
| 627 ui::InputMethod* input_method = GetInputMethod(); | |
| 628 // Ask the system-wide IME to send all TextInputClient messages to |this| | |
| 629 // object. | |
| 630 input_method->SetFocusedTextInputClient(this); | |
| 631 // TODO(yusukes): Should we call ImeCancelComposition() here? Or, can we | |
|
Yusuke Sato
2011/11/29 09:06:36
Removed L631-632 (the TODO).
| |
| 632 // remove the OnTextInputTypeChanged() call below? | |
| 633 input_method->OnTextInputTypeChanged(this); | |
|
James Su
2011/11/29 04:25:53
This should be called automatically. So we don't n
Yusuke Sato
2011/11/29 09:06:36
Let me keep the input_method->OnTextInputTypeChang
James Su
2011/11/30 01:39:23
Then I think ui::InputMethod::SetFocusedTextInputC
Yusuke Sato
2011/11/30 02:25:49
sure, removed input_method->OnTextInputTypeChanged
| |
| 634 | |
| 635 host_->SetInputMethodActive(input_method->IsActive()); | |
| 636 // TODO(yusukes): Support TextInputTypeTracker for TOUCH_UI. | |
|
James Su
2011/11/29 04:25:53
Shouldn't it be added into ui::InputMethodBase?
Yusuke Sato
2011/11/29 09:06:36
Correct. Removed.
| |
| 445 } | 637 } |
| 446 | 638 |
| 447 void RenderWidgetHostViewAura::OnBlur() { | 639 void RenderWidgetHostViewAura::OnBlur() { |
| 448 host_->Blur(); | 640 host_->Blur(); |
| 641 | |
| 642 ui::InputMethod* input_method = GetInputMethod(); | |
| 643 if (input_method->GetTextInputClient() == this) | |
| 644 input_method->SetFocusedTextInputClient(NULL); | |
| 645 host_->SetInputMethodActive(false); | |
| 449 } | 646 } |
| 450 | 647 |
| 451 bool RenderWidgetHostViewAura::OnKeyEvent(aura::KeyEvent* event) { | 648 bool RenderWidgetHostViewAura::OnKeyEvent(aura::KeyEvent* event) { |
| 452 // We need to handle the Escape key for Pepper Flash. | 649 // We need to handle the Escape key for Pepper Flash. |
| 453 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { | 650 if (is_fullscreen_ && event->key_code() == ui::VKEY_ESCAPE) { |
| 454 host_->Shutdown(); | 651 host_->Shutdown(); |
| 455 } else { | 652 } else { |
| 456 NativeWebKeyboardEvent webkit_event(event); | 653 // We don't have to communicate with an input method here. It has already |
| 457 host_->ForwardKeyboardEvent(webkit_event); | 654 // been done by aura/desktop_host_<platform>.cc. |
| 655 #if defined(USE_X11) | |
| 656 if (!event->native_event()) { | |
| 657 // Send a fabricated event, which is usually a VKEY_PROCESSKEY IME event. | |
| 658 NativeWebKeyboardEvent webkit_event(event->type(), | |
| 659 false /* is_char */, | |
| 660 event->GetCharacter(), | |
| 661 event->flags(), | |
| 662 base::Time::Now().ToDoubleT()); | |
| 663 host_->ForwardKeyboardEvent(webkit_event); | |
| 664 } else | |
| 665 #endif | |
| 666 { | |
| 667 NativeWebKeyboardEvent webkit_event(event); | |
| 668 host_->ForwardKeyboardEvent(webkit_event); | |
| 669 } | |
| 458 } | 670 } |
| 459 return true; | 671 return true; |
| 460 } | 672 } |
| 461 | 673 |
| 462 gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { | 674 gfx::NativeCursor RenderWidgetHostViewAura::GetCursor(const gfx::Point& point) { |
| 463 return current_cursor_.GetNativeCursor(); | 675 return current_cursor_.GetNativeCursor(); |
| 464 } | 676 } |
| 465 | 677 |
| 466 int RenderWidgetHostViewAura::GetNonClientComponent( | 678 int RenderWidgetHostViewAura::GetNonClientComponent( |
| 467 const gfx::Point& point) const { | 679 const gfx::Point& point) const { |
| 468 return HTCLIENT; | 680 return HTCLIENT; |
| 469 } | 681 } |
| 470 | 682 |
| 471 bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { | 683 bool RenderWidgetHostViewAura::OnMouseEvent(aura::MouseEvent* event) { |
| 472 if (event->type() == ui::ET_MOUSEWHEEL) | 684 if (event->type() == ui::ET_MOUSEWHEEL) |
| 473 host_->ForwardWheelEvent(content::MakeWebMouseWheelEvent(event)); | 685 host_->ForwardWheelEvent(content::MakeWebMouseWheelEvent(event)); |
| 474 else if (CanRendererHandleEvent(event->native_event())) | 686 else if (CanRendererHandleEvent(event->native_event())) |
| 475 host_->ForwardMouseEvent(content::MakeWebMouseEvent(event)); | 687 host_->ForwardMouseEvent(content::MakeWebMouseEvent(event)); |
| 476 | 688 |
| 689 // TODO(yusukes): Confirm existing composition text on mouse click events. | |
| 690 | |
| 477 // Return true so that we receive released/drag events. | 691 // Return true so that we receive released/drag events. |
| 478 return true; | 692 return true; |
| 479 } | 693 } |
| 480 | 694 |
| 481 ui::TouchStatus RenderWidgetHostViewAura::OnTouchEvent( | 695 ui::TouchStatus RenderWidgetHostViewAura::OnTouchEvent( |
| 482 aura::TouchEvent* event) { | 696 aura::TouchEvent* event) { |
| 483 // Update the touch event first. | 697 // Update the touch event first. |
| 484 WebKit::WebTouchPoint* point = content::UpdateWebTouchEvent(event, | 698 WebKit::WebTouchPoint* point = content::UpdateWebTouchEvent(event, |
| 485 &touch_event_); | 699 &touch_event_); |
| 486 | 700 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 570 // static | 784 // static |
| 571 void RenderWidgetHostView::GetDefaultScreenInfo( | 785 void RenderWidgetHostView::GetDefaultScreenInfo( |
| 572 WebKit::WebScreenInfo* results) { | 786 WebKit::WebScreenInfo* results) { |
| 573 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); | 787 const gfx::Size size = gfx::Screen::GetPrimaryMonitorSize(); |
| 574 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); | 788 results->rect = WebKit::WebRect(0, 0, size.width(), size.height()); |
| 575 results->availableRect = results->rect; | 789 results->availableRect = results->rect; |
| 576 // TODO(derat): Don't hardcode this? | 790 // TODO(derat): Don't hardcode this? |
| 577 results->depth = 24; | 791 results->depth = 24; |
| 578 results->depthPerComponent = 8; | 792 results->depthPerComponent = 8; |
| 579 } | 793 } |
| 794 | |
| 795 ui::InputMethod* RenderWidgetHostViewAura::GetInputMethod() { | |
| 796 aura::Desktop* desktop = aura::Desktop::GetInstance(); | |
| 797 return desktop->GetInputMethod(); | |
| 798 } | |
| OLD | NEW |