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/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 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2864 | 2864 |
2865 gfx::Size size(webview()->mainFrame()->contentsPreferredWidth(), | 2865 gfx::Size size(webview()->mainFrame()->contentsPreferredWidth(), |
2866 webview()->mainFrame()->documentElementScrollHeight()); | 2866 webview()->mainFrame()->documentElementScrollHeight()); |
2867 | 2867 |
2868 // In the presence of zoom, these sizes are still reported as if unzoomed, | 2868 // In the presence of zoom, these sizes are still reported as if unzoomed, |
2869 // so we need to adjust. | 2869 // so we need to adjust. |
2870 double zoom_factor = WebView::zoomLevelToZoomFactor(webview()->zoomLevel()); | 2870 double zoom_factor = WebView::zoomLevelToZoomFactor(webview()->zoomLevel()); |
2871 size.set_width(static_cast<int>(size.width() * zoom_factor)); | 2871 size.set_width(static_cast<int>(size.width() * zoom_factor)); |
2872 size.set_height(static_cast<int>(size.height() * zoom_factor)); | 2872 size.set_height(static_cast<int>(size.height() * zoom_factor)); |
2873 | 2873 |
| 2874 if (!size.height()) |
| 2875 size.set_height(preferred_size_.height()); |
| 2876 |
2874 if (size == preferred_size_) | 2877 if (size == preferred_size_) |
2875 return; | 2878 return; |
2876 | 2879 |
2877 preferred_size_ = size; | 2880 preferred_size_ = size; |
2878 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, | 2881 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, |
2879 preferred_size_)); | 2882 preferred_size_)); |
2880 } | 2883 } |
2881 | 2884 |
2882 void RenderViewImpl::didChangeContentsSize(WebFrame* frame, | 2885 void RenderViewImpl::didChangeContentsSize(WebFrame* frame, |
2883 const WebSize& size) { | 2886 const WebSize& size) { |
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4728 return !!RenderThreadImpl::current()->compositor_thread(); | 4731 return !!RenderThreadImpl::current()->compositor_thread(); |
4729 } | 4732 } |
4730 | 4733 |
4731 void RenderViewImpl::OnJavaBridgeInit( | 4734 void RenderViewImpl::OnJavaBridgeInit( |
4732 const IPC::ChannelHandle& channel_handle) { | 4735 const IPC::ChannelHandle& channel_handle) { |
4733 DCHECK(!java_bridge_dispatcher_.get()); | 4736 DCHECK(!java_bridge_dispatcher_.get()); |
4734 #if defined(ENABLE_JAVA_BRIDGE) | 4737 #if defined(ENABLE_JAVA_BRIDGE) |
4735 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); | 4738 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this, channel_handle)); |
4736 #endif | 4739 #endif |
4737 } | 4740 } |
OLD | NEW |