| 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/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 texture_size_in_layer_); | 501 texture_size_in_layer_); |
| 502 ImageTransportFactoryAndroid::GetInstance()->WaitSyncPoint( | 502 ImageTransportFactoryAndroid::GetInstance()->WaitSyncPoint( |
| 503 frame->gl_frame_data->sync_point); | 503 frame->gl_frame_data->sync_point); |
| 504 const gfx::Size& texture_size = frame->gl_frame_data->size; | 504 const gfx::Size& texture_size = frame->gl_frame_data->size; |
| 505 | 505 |
| 506 // Calculate the content size. This should be 0 if the texture_size is 0. | 506 // Calculate the content size. This should be 0 if the texture_size is 0. |
| 507 float dp2px = frame->metadata.device_scale_factor; | 507 float dp2px = frame->metadata.device_scale_factor; |
| 508 gfx::Vector2dF offset; | 508 gfx::Vector2dF offset; |
| 509 if (texture_size.GetArea() > 0) | 509 if (texture_size.GetArea() > 0) |
| 510 offset = frame->metadata.location_bar_content_translation; | 510 offset = frame->metadata.location_bar_content_translation; |
| 511 offset.set_y(offset.y() + frame->metadata.overdraw_bottom_height); |
| 511 gfx::SizeF content_size(texture_size.width() - offset.x() * dp2px, | 512 gfx::SizeF content_size(texture_size.width() - offset.x() * dp2px, |
| 512 texture_size.height() - offset.y() * dp2px); | 513 texture_size.height() - offset.y() * dp2px); |
| 513 | |
| 514 BuffersSwapped(frame->gl_frame_data->mailbox, | 514 BuffersSwapped(frame->gl_frame_data->mailbox, |
| 515 texture_size, | 515 texture_size, |
| 516 content_size, | 516 content_size, |
| 517 callback); | 517 callback); |
| 518 | 518 |
| 519 } | 519 } |
| 520 | 520 |
| 521 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( | 521 void RenderWidgetHostViewAndroid::AcceleratedSurfaceBuffersSwapped( |
| 522 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 522 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 523 int gpu_host_id) { | 523 int gpu_host_id) { |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 return cached_background_color_; | 730 return cached_background_color_; |
| 731 } | 731 } |
| 732 | 732 |
| 733 void RenderWidgetHostViewAndroid::UpdateFrameInfo( | 733 void RenderWidgetHostViewAndroid::UpdateFrameInfo( |
| 734 const gfx::Vector2dF& scroll_offset, | 734 const gfx::Vector2dF& scroll_offset, |
| 735 float page_scale_factor, | 735 float page_scale_factor, |
| 736 const gfx::Vector2dF& page_scale_factor_limits, | 736 const gfx::Vector2dF& page_scale_factor_limits, |
| 737 const gfx::SizeF& content_size, | 737 const gfx::SizeF& content_size, |
| 738 const gfx::SizeF& viewport_size, | 738 const gfx::SizeF& viewport_size, |
| 739 const gfx::Vector2dF& controls_offset, | 739 const gfx::Vector2dF& controls_offset, |
| 740 const gfx::Vector2dF& content_offset) { | 740 const gfx::Vector2dF& content_offset, |
| 741 float overdraw_bottom_height) { |
| 741 if (content_view_core_) { | 742 if (content_view_core_) { |
| 742 // All offsets and sizes are in CSS pixels. | 743 // All offsets and sizes are in CSS pixels. |
| 743 content_view_core_->UpdateFrameInfo( | 744 content_view_core_->UpdateFrameInfo( |
| 744 scroll_offset, page_scale_factor, page_scale_factor_limits, | 745 scroll_offset, page_scale_factor, page_scale_factor_limits, |
| 745 content_size, viewport_size, controls_offset, content_offset); | 746 content_size, viewport_size, controls_offset, content_offset, |
| 747 overdraw_bottom_height); |
| 746 } | 748 } |
| 747 } | 749 } |
| 748 | 750 |
| 749 void RenderWidgetHostViewAndroid::SetContentViewCore( | 751 void RenderWidgetHostViewAndroid::SetContentViewCore( |
| 750 ContentViewCoreImpl* content_view_core) { | 752 ContentViewCoreImpl* content_view_core) { |
| 751 if (content_view_core_ && is_layer_attached_) | 753 if (content_view_core_ && is_layer_attached_) |
| 752 content_view_core_->RemoveLayer(layer_); | 754 content_view_core_->RemoveLayer(layer_); |
| 753 | 755 |
| 754 content_view_core_ = content_view_core; | 756 content_view_core_ = content_view_core; |
| 755 if (content_view_core_ && is_layer_attached_) | 757 if (content_view_core_ && is_layer_attached_) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 781 // RenderWidgetHostView, public: | 783 // RenderWidgetHostView, public: |
| 782 | 784 |
| 783 // static | 785 // static |
| 784 RenderWidgetHostView* | 786 RenderWidgetHostView* |
| 785 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { | 787 RenderWidgetHostView::CreateViewForWidget(RenderWidgetHost* widget) { |
| 786 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); | 788 RenderWidgetHostImpl* rwhi = RenderWidgetHostImpl::From(widget); |
| 787 return new RenderWidgetHostViewAndroid(rwhi, NULL); | 789 return new RenderWidgetHostViewAndroid(rwhi, NULL); |
| 788 } | 790 } |
| 789 | 791 |
| 790 } // namespace content | 792 } // namespace content |
| OLD | NEW |