| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.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 3478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3489 // be put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| | 3489 // be put in that mode by getting a |ViewMsg_EnablePreferredSizeChangedMode| |
| 3490 // message. | 3490 // message. |
| 3491 if (!send_preferred_size_changes_ || !webview()) | 3491 if (!send_preferred_size_changes_ || !webview()) |
| 3492 return; | 3492 return; |
| 3493 | 3493 |
| 3494 // WebCore likes to tell us things have changed even when they haven't, so | 3494 // WebCore likes to tell us things have changed even when they haven't, so |
| 3495 // cache the width and height and only send the IPC message when we're sure | 3495 // cache the width and height and only send the IPC message when we're sure |
| 3496 // they're different. | 3496 // they're different. |
| 3497 gfx::Size size(webview()->mainFrame()->contentsPreferredWidth(), | 3497 gfx::Size size(webview()->mainFrame()->contentsPreferredWidth(), |
| 3498 webview()->mainFrame()->documentElementScrollHeight()); | 3498 webview()->mainFrame()->documentElementScrollHeight()); |
| 3499 // In the presence of zoom, these sizes are still reported as if unzoomed, |
| 3500 // so we need to adjust. |
| 3501 double zoom_factor = WebView::zoomLevelToZoomFactor(webview()->zoomLevel()); |
| 3502 size.set_width(static_cast<int>(size.width() * zoom_factor)); |
| 3503 size.set_height(static_cast<int>(size.height() * zoom_factor)); |
| 3504 |
| 3499 if (size == preferred_size_) | 3505 if (size == preferred_size_) |
| 3500 return; | 3506 return; |
| 3501 | 3507 |
| 3502 preferred_size_ = size; | 3508 preferred_size_ = size; |
| 3503 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, | 3509 Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, |
| 3504 preferred_size_)); | 3510 preferred_size_)); |
| 3505 } | 3511 } |
| 3506 | 3512 |
| 3507 void RenderView::didChangeScrollOffset(WebFrame* frame) { | 3513 void RenderView::didChangeScrollOffset(WebFrame* frame) { |
| 3508 StartNavStateSyncTimerIfNecessary(); | 3514 StartNavStateSyncTimerIfNecessary(); |
| (...skipping 2477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5986 } | 5992 } |
| 5987 | 5993 |
| 5988 void RenderView::OnAsyncFileOpened(base::PlatformFileError error_code, | 5994 void RenderView::OnAsyncFileOpened(base::PlatformFileError error_code, |
| 5989 IPC::PlatformFileForTransit file_for_transit, | 5995 IPC::PlatformFileForTransit file_for_transit, |
| 5990 int message_id) { | 5996 int message_id) { |
| 5991 pepper_delegate_.OnAsyncFileOpened( | 5997 pepper_delegate_.OnAsyncFileOpened( |
| 5992 error_code, | 5998 error_code, |
| 5993 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), | 5999 IPC::PlatformFileForTransitToPlatformFile(file_for_transit), |
| 5994 message_id); | 6000 message_id); |
| 5995 } | 6001 } |
| OLD | NEW |