| 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 3559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3570 if (!new_total_scale || zoom_rect.IsEmpty()) | 3570 if (!new_total_scale || zoom_rect.IsEmpty()) |
| 3571 return false; | 3571 return false; |
| 3572 | 3572 |
| 3573 bool handled = false; | 3573 bool handled = false; |
| 3574 switch (renderer_preferences_.tap_multiple_targets_strategy) { | 3574 switch (renderer_preferences_.tap_multiple_targets_strategy) { |
| 3575 case TAP_MULTIPLE_TARGETS_STRATEGY_ZOOM: | 3575 case TAP_MULTIPLE_TARGETS_STRATEGY_ZOOM: |
| 3576 handled = webview()->zoomToMultipleTargetsRect(zoom_rect); | 3576 handled = webview()->zoomToMultipleTargetsRect(zoom_rect); |
| 3577 break; | 3577 break; |
| 3578 case TAP_MULTIPLE_TARGETS_STRATEGY_POPUP: { | 3578 case TAP_MULTIPLE_TARGETS_STRATEGY_POPUP: { |
| 3579 gfx::Size canvas_size = | 3579 gfx::Size canvas_size = |
| 3580 gfx::ToCeiledSize(gfx::ScaleSize(zoom_rect.size(), new_total_scale)); | 3580 gfx::ScaleToCeiledSize(zoom_rect.size(), new_total_scale); |
| 3581 cc::SharedBitmapManager* manager = | 3581 cc::SharedBitmapManager* manager = |
| 3582 RenderThreadImpl::current()->shared_bitmap_manager(); | 3582 RenderThreadImpl::current()->shared_bitmap_manager(); |
| 3583 scoped_ptr<cc::SharedBitmap> shared_bitmap = | 3583 scoped_ptr<cc::SharedBitmap> shared_bitmap = |
| 3584 manager->AllocateSharedBitmap(canvas_size); | 3584 manager->AllocateSharedBitmap(canvas_size); |
| 3585 CHECK(!!shared_bitmap); | 3585 CHECK(!!shared_bitmap); |
| 3586 { | 3586 { |
| 3587 SkBitmap bitmap; | 3587 SkBitmap bitmap; |
| 3588 SkImageInfo info = SkImageInfo::MakeN32Premul(canvas_size.width(), | 3588 SkImageInfo info = SkImageInfo::MakeN32Premul(canvas_size.width(), |
| 3589 canvas_size.height()); | 3589 canvas_size.height()); |
| 3590 bitmap.installPixels(info, shared_bitmap->pixels(), info.minRowBytes()); | 3590 bitmap.installPixels(info, shared_bitmap->pixels(), info.minRowBytes()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3647 OnSetActive(false); | 3647 OnSetActive(false); |
| 3648 } | 3648 } |
| 3649 } | 3649 } |
| 3650 | 3650 |
| 3651 void RenderViewImpl::SetDeviceScaleFactorForTesting(float factor) { | 3651 void RenderViewImpl::SetDeviceScaleFactorForTesting(float factor) { |
| 3652 ViewMsg_Resize_Params params; | 3652 ViewMsg_Resize_Params params; |
| 3653 params.screen_info = screen_info_; | 3653 params.screen_info = screen_info_; |
| 3654 params.screen_info.deviceScaleFactor = factor; | 3654 params.screen_info.deviceScaleFactor = factor; |
| 3655 params.new_size = size(); | 3655 params.new_size = size(); |
| 3656 params.visible_viewport_size = visible_viewport_size_; | 3656 params.visible_viewport_size = visible_viewport_size_; |
| 3657 params.physical_backing_size = | 3657 params.physical_backing_size = gfx::ScaleToCeiledSize(size(), factor); |
| 3658 gfx::ToCeiledSize(gfx::ScaleSize(size(), factor)); | |
| 3659 params.top_controls_shrink_blink_size = false; | 3658 params.top_controls_shrink_blink_size = false; |
| 3660 params.top_controls_height = 0.f; | 3659 params.top_controls_height = 0.f; |
| 3661 params.resizer_rect = WebRect(); | 3660 params.resizer_rect = WebRect(); |
| 3662 params.is_fullscreen_granted = is_fullscreen_granted(); | 3661 params.is_fullscreen_granted = is_fullscreen_granted(); |
| 3663 params.display_mode = display_mode_; | 3662 params.display_mode = display_mode_; |
| 3664 OnResize(params); | 3663 OnResize(params); |
| 3665 } | 3664 } |
| 3666 | 3665 |
| 3667 void RenderViewImpl::SetDeviceColorProfileForTesting( | 3666 void RenderViewImpl::SetDeviceColorProfileForTesting( |
| 3668 const std::vector<char>& color_profile) { | 3667 const std::vector<char>& color_profile) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3726 std::vector<gfx::Size> sizes; | 3725 std::vector<gfx::Size> sizes; |
| 3727 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); | 3726 ConvertToFaviconSizes(icon_urls[i].sizes(), &sizes); |
| 3728 if (!url.isEmpty()) | 3727 if (!url.isEmpty()) |
| 3729 urls.push_back( | 3728 urls.push_back( |
| 3730 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); | 3729 FaviconURL(url, ToFaviconType(icon_urls[i].iconType()), sizes)); |
| 3731 } | 3730 } |
| 3732 SendUpdateFaviconURL(urls); | 3731 SendUpdateFaviconURL(urls); |
| 3733 } | 3732 } |
| 3734 | 3733 |
| 3735 } // namespace content | 3734 } // namespace content |
| OLD | NEW |