OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_android.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 | 8 |
9 #include "base/android/sys_utils.h" | 9 #include "base/android/sys_utils.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 ime_adapter_android_(this), | 182 ime_adapter_android_(this), |
183 cached_background_color_(SK_ColorWHITE), | 183 cached_background_color_(SK_ColorWHITE), |
184 last_output_surface_id_(kUndefinedOutputSurfaceId), | 184 last_output_surface_id_(kUndefinedOutputSurfaceId), |
185 weak_ptr_factory_(this), | 185 weak_ptr_factory_(this), |
186 overscroll_effect_enabled_(!CommandLine::ForCurrentProcess()->HasSwitch( | 186 overscroll_effect_enabled_(!CommandLine::ForCurrentProcess()->HasSwitch( |
187 switches::kDisableOverscrollEdgeEffect)), | 187 switches::kDisableOverscrollEdgeEffect)), |
188 overscroll_effect_(OverscrollGlow::Create(overscroll_effect_enabled_)), | 188 overscroll_effect_(OverscrollGlow::Create(overscroll_effect_enabled_)), |
189 gesture_provider_(CreateGestureProviderConfig(), this), | 189 gesture_provider_(CreateGestureProviderConfig(), this), |
190 flush_input_requested_(false), | 190 flush_input_requested_(false), |
191 accelerated_surface_route_id_(0), | 191 accelerated_surface_route_id_(0), |
| 192 cached_selection_anchor_visible_(false), |
| 193 cached_selection_focus_visible_(false), |
192 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( | 194 using_synchronous_compositor_(SynchronousCompositorImpl::FromID( |
193 widget_host->GetProcess()->GetID(), | 195 widget_host->GetProcess()->GetID(), |
194 widget_host->GetRoutingID()) != NULL), | 196 widget_host->GetRoutingID()) != NULL), |
195 frame_evictor_(new DelegatedFrameEvictor(this)), | 197 frame_evictor_(new DelegatedFrameEvictor(this)), |
196 locks_on_frame_count_(0), | 198 locks_on_frame_count_(0), |
197 observing_root_window_(false) { | 199 observing_root_window_(false) { |
198 host_->SetView(this); | 200 host_->SetView(this); |
199 SetContentViewCore(content_view_core); | 201 SetContentViewCore(content_view_core); |
200 ImageTransportFactoryAndroid::AddObserver(this); | 202 ImageTransportFactoryAndroid::AddObserver(this); |
201 } | 203 } |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 return; | 630 return; |
629 } | 631 } |
630 | 632 |
631 std::string utf8_selection = base::UTF16ToUTF8(text.substr(pos, n)); | 633 std::string utf8_selection = base::UTF16ToUTF8(text.substr(pos, n)); |
632 | 634 |
633 content_view_core_->OnSelectionChanged(utf8_selection); | 635 content_view_core_->OnSelectionChanged(utf8_selection); |
634 } | 636 } |
635 | 637 |
636 void RenderWidgetHostViewAndroid::SelectionBoundsChanged( | 638 void RenderWidgetHostViewAndroid::SelectionBoundsChanged( |
637 const ViewHostMsg_SelectionBounds_Params& params) { | 639 const ViewHostMsg_SelectionBounds_Params& params) { |
638 if (content_view_core_) { | 640 if (!content_view_core_) |
639 content_view_core_->OnSelectionBoundsChanged(params); | 641 return; |
640 } | 642 |
| 643 const gfx::PointF anchor = params.anchor_rect.bottom_left(); |
| 644 const gfx::PointF focus = params.focus_rect.bottom_left(); |
| 645 |
| 646 if (cached_selection_anchor_ == anchor && cached_selection_focus_ == focus && |
| 647 cached_selection_anchor_visible_ == params.is_anchor_visible && |
| 648 cached_selection_focus_visible_ == params.is_focus_visible) |
| 649 return; |
| 650 |
| 651 cached_selection_anchor_ = anchor; |
| 652 cached_selection_focus_ = focus; |
| 653 cached_selection_anchor_visible_ = params.is_anchor_visible; |
| 654 cached_selection_focus_visible_ = params.is_focus_visible; |
| 655 |
| 656 content_view_core_->OnSelectionBoundsChanged(anchor, |
| 657 focus, |
| 658 params.anchor_dir, |
| 659 params.focus_dir, |
| 660 params.is_anchor_first, |
| 661 params.is_anchor_visible, |
| 662 params.is_focus_visible); |
641 } | 663 } |
642 | 664 |
643 void RenderWidgetHostViewAndroid::ScrollOffsetChanged() { | 665 void RenderWidgetHostViewAndroid::ScrollOffsetChanged() { |
644 } | 666 } |
645 | 667 |
646 void RenderWidgetHostViewAndroid::SetBackgroundOpaque(bool opaque) { | 668 void RenderWidgetHostViewAndroid::SetBackgroundOpaque(bool opaque) { |
647 RenderWidgetHostViewBase::SetBackgroundOpaque(opaque); | 669 RenderWidgetHostViewBase::SetBackgroundOpaque(opaque); |
648 host_->SetBackgroundOpaque(opaque); | 670 host_->SetBackgroundOpaque(opaque); |
649 } | 671 } |
650 | 672 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 content_view_core_->UpdateFrameInfo( | 1000 content_view_core_->UpdateFrameInfo( |
979 frame_metadata.root_scroll_offset, | 1001 frame_metadata.root_scroll_offset, |
980 frame_metadata.page_scale_factor, | 1002 frame_metadata.page_scale_factor, |
981 gfx::Vector2dF(frame_metadata.min_page_scale_factor, | 1003 gfx::Vector2dF(frame_metadata.min_page_scale_factor, |
982 frame_metadata.max_page_scale_factor), | 1004 frame_metadata.max_page_scale_factor), |
983 frame_metadata.root_layer_size, | 1005 frame_metadata.root_layer_size, |
984 frame_metadata.viewport_size, | 1006 frame_metadata.viewport_size, |
985 frame_metadata.location_bar_offset, | 1007 frame_metadata.location_bar_offset, |
986 frame_metadata.location_bar_content_translation, | 1008 frame_metadata.location_bar_content_translation, |
987 frame_metadata.overdraw_bottom_height); | 1009 frame_metadata.overdraw_bottom_height); |
| 1010 |
988 #if defined(VIDEO_HOLE) | 1011 #if defined(VIDEO_HOLE) |
989 if (host_ && host_->IsRenderView()) { | 1012 if (host_ && host_->IsRenderView()) { |
990 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( | 1013 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
991 RenderViewHost::From(host_)); | 1014 RenderViewHost::From(host_)); |
992 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); | 1015 rvhi->media_web_contents_observer()->OnFrameInfoUpdated(); |
993 } | 1016 } |
994 #endif // defined(VIDEO_HOLE) | 1017 #endif // defined(VIDEO_HOLE) |
995 } | 1018 } |
996 | 1019 |
997 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int host_id, | 1020 void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int host_id, |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 results->availableRect = display.work_area(); | 1467 results->availableRect = display.work_area(); |
1445 results->deviceScaleFactor = display.device_scale_factor(); | 1468 results->deviceScaleFactor = display.device_scale_factor(); |
1446 results->orientationAngle = display.RotationAsDegree(); | 1469 results->orientationAngle = display.RotationAsDegree(); |
1447 gfx::DeviceDisplayInfo info; | 1470 gfx::DeviceDisplayInfo info; |
1448 results->depth = info.GetBitsPerPixel(); | 1471 results->depth = info.GetBitsPerPixel(); |
1449 results->depthPerComponent = info.GetBitsPerComponent(); | 1472 results->depthPerComponent = info.GetBitsPerComponent(); |
1450 results->isMonochrome = (results->depthPerComponent == 0); | 1473 results->isMonochrome = (results->depthPerComponent == 0); |
1451 } | 1474 } |
1452 | 1475 |
1453 } // namespace content | 1476 } // namespace content |
OLD | NEW |