| 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/renderer/render_view_impl.h" | 5 #include "content/renderer/render_view_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 3574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3585 if (!new_total_scale || zoom_rect.IsEmpty()) | 3585 if (!new_total_scale || zoom_rect.IsEmpty()) |
| 3586 return false; | 3586 return false; |
| 3587 | 3587 |
| 3588 bool handled = false; | 3588 bool handled = false; |
| 3589 switch (renderer_preferences_.tap_multiple_targets_strategy) { | 3589 switch (renderer_preferences_.tap_multiple_targets_strategy) { |
| 3590 case TAP_MULTIPLE_TARGETS_STRATEGY_ZOOM: | 3590 case TAP_MULTIPLE_TARGETS_STRATEGY_ZOOM: |
| 3591 handled = webview()->zoomToMultipleTargetsRect(zoom_rect); | 3591 handled = webview()->zoomToMultipleTargetsRect(zoom_rect); |
| 3592 break; | 3592 break; |
| 3593 case TAP_MULTIPLE_TARGETS_STRATEGY_POPUP: { | 3593 case TAP_MULTIPLE_TARGETS_STRATEGY_POPUP: { |
| 3594 gfx::Size canvas_size = | 3594 gfx::Size canvas_size = |
| 3595 gfx::ToCeiledSize(gfx::ScaleSize(zoom_rect.size(), new_total_scale)); | 3595 gfx::ScaleToCeiledSize(zoom_rect.size(), new_total_scale); |
| 3596 cc::SharedBitmapManager* manager = | 3596 cc::SharedBitmapManager* manager = |
| 3597 RenderThreadImpl::current()->shared_bitmap_manager(); | 3597 RenderThreadImpl::current()->shared_bitmap_manager(); |
| 3598 scoped_ptr<cc::SharedBitmap> shared_bitmap = | 3598 scoped_ptr<cc::SharedBitmap> shared_bitmap = |
| 3599 manager->AllocateSharedBitmap(canvas_size); | 3599 manager->AllocateSharedBitmap(canvas_size); |
| 3600 CHECK(!!shared_bitmap); | 3600 CHECK(!!shared_bitmap); |
| 3601 { | 3601 { |
| 3602 SkBitmap bitmap; | 3602 SkBitmap bitmap; |
| 3603 SkImageInfo info = SkImageInfo::MakeN32Premul(canvas_size.width(), | 3603 SkImageInfo info = SkImageInfo::MakeN32Premul(canvas_size.width(), |
| 3604 canvas_size.height()); | 3604 canvas_size.height()); |
| 3605 bitmap.installPixels(info, shared_bitmap->pixels(), info.minRowBytes()); | 3605 bitmap.installPixels(info, shared_bitmap->pixels(), info.minRowBytes()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 OnSetActive(false); | 3662 OnSetActive(false); |
| 3663 } | 3663 } |
| 3664 } | 3664 } |
| 3665 | 3665 |
| 3666 void RenderViewImpl::SetDeviceScaleFactorForTesting(float factor) { | 3666 void RenderViewImpl::SetDeviceScaleFactorForTesting(float factor) { |
| 3667 ViewMsg_Resize_Params params; | 3667 ViewMsg_Resize_Params params; |
| 3668 params.screen_info = screen_info_; | 3668 params.screen_info = screen_info_; |
| 3669 params.screen_info.deviceScaleFactor = factor; | 3669 params.screen_info.deviceScaleFactor = factor; |
| 3670 params.new_size = size(); | 3670 params.new_size = size(); |
| 3671 params.visible_viewport_size = visible_viewport_size_; | 3671 params.visible_viewport_size = visible_viewport_size_; |
| 3672 params.physical_backing_size = | 3672 params.physical_backing_size = gfx::ScaleToCeiledSize(size(), factor); |
| 3673 gfx::ToCeiledSize(gfx::ScaleSize(size(), factor)); | |
| 3674 params.top_controls_shrink_blink_size = false; | 3673 params.top_controls_shrink_blink_size = false; |
| 3675 params.top_controls_height = 0.f; | 3674 params.top_controls_height = 0.f; |
| 3676 params.resizer_rect = WebRect(); | 3675 params.resizer_rect = WebRect(); |
| 3677 params.is_fullscreen_granted = is_fullscreen_granted(); | 3676 params.is_fullscreen_granted = is_fullscreen_granted(); |
| 3678 params.display_mode = display_mode_; | 3677 params.display_mode = display_mode_; |
| 3679 OnResize(params); | 3678 OnResize(params); |
| 3680 } | 3679 } |
| 3681 | 3680 |
| 3682 void RenderViewImpl::SetDeviceColorProfileForTesting( | 3681 void RenderViewImpl::SetDeviceColorProfileForTesting( |
| 3683 const std::vector<char>& color_profile) { | 3682 const std::vector<char>& color_profile) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3741 std::vector<gfx::Size> sizes; | 3740 std::vector<gfx::Size> sizes; |
| 3742 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3741 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3743 if (!url.isEmpty()) | 3742 if (!url.isEmpty()) |
| 3744 urls.push_back( | 3743 urls.push_back( |
| 3745 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3744 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3746 } | 3745 } |
| 3747 SendUpdateFaviconURL(urls); | 3746 SendUpdateFaviconURL(urls); |
| 3748 } | 3747 } |
| 3749 | 3748 |
| 3750 } // namespace content | 3749 } // namespace content |
| OLD | NEW |