diff options
author | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-13 00:02:35 +0000 |
---|---|---|
committer | csilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-13 00:02:35 +0000 |
commit | 4b51ff399f18b376ab33e37cc4ce22a5f76c5eda (patch) | |
tree | 251436f69aa650704f1a8e9d0ccd1bc66c96d714 | |
parent | bc065abe8e22eb604915d9e48d8983142a51d0c3 (diff) | |
download | chromium_src-4b51ff399f18b376ab33e37cc4ce22a5f76c5eda.zip chromium_src-4b51ff399f18b376ab33e37cc4ce22a5f76c5eda.tar.gz chromium_src-4b51ff399f18b376ab33e37cc4ce22a5f76c5eda.tar.bz2 |
Merge 113923 - Fix page zoom for plug-in documents (PDF, etc.)
BUG=106013, 106228
TEST=Verify zoom-in/zoom-out work correctly on PDF documents.
Review URL: http://http://codereview.chromium.org/8896009/
TBR=csilv@chromium.org
Review URL: http://codereview.chromium.org/8918026
git-svn-id: svn://svn.chromium.org/chrome/branches/963/src@114120 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/renderer_preferences_util.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/tab_contents/tab_contents_wrapper.cc | 6 | ||||
-rw-r--r-- | content/common/view_messages.h | 1 | ||||
-rw-r--r-- | content/public/common/renderer_preferences.cc | 3 | ||||
-rw-r--r-- | content/public/common/renderer_preferences.h | 3 | ||||
-rw-r--r-- | content/renderer/render_view_impl.cc | 13 |
6 files changed, 18 insertions, 10 deletions
diff --git a/chrome/browser/renderer_preferences_util.cc b/chrome/browser/renderer_preferences_util.cc index 4339473..fe6359b 100644 --- a/chrome/browser/renderer_preferences_util.cc +++ b/chrome/browser/renderer_preferences_util.cc @@ -48,6 +48,8 @@ void UpdateFromSystemSettings( prefs->enable_referrers = profile->GetPrefs()->GetBoolean(prefs::kEnableReferrers); + prefs->default_zoom_level = + profile->GetPrefs()->GetDouble(prefs::kDefaultZoomLevel); } } // renderer_preferences_util diff --git a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc index 2df3a27..1ade6f9 100644 --- a/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc +++ b/chrome/browser/ui/tab_contents/tab_contents_wrapper.cc @@ -640,10 +640,8 @@ void TabContentsWrapper::Observe(int type, } else if ((*pref_name_in == prefs::kDefaultCharset) || StartsWithASCII(*pref_name_in, "webkit.webprefs.", true)) { UpdateWebPreferences(); - } else if (*pref_name_in == prefs::kDefaultZoomLevel) { - tab_contents()->render_view_host()->SetZoomLevel( - tab_contents()->GetZoomLevel()); - } else if (*pref_name_in == prefs::kEnableReferrers) { + } else if (*pref_name_in == prefs::kDefaultZoomLevel || + *pref_name_in == prefs::kEnableReferrers) { UpdateRendererPreferences(); } else if (*pref_name_in == prefs::kSafeBrowsingEnabled) { UpdateSafebrowsingDetectionHost(); diff --git a/content/common/view_messages.h b/content/common/view_messages.h index d818295..558d705 100644 --- a/content/common/view_messages.h +++ b/content/common/view_messages.h @@ -284,6 +284,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::RendererPreferences) IPC_STRUCT_TRAITS_MEMBER(browser_handles_top_level_requests) IPC_STRUCT_TRAITS_MEMBER(caret_blink_interval) IPC_STRUCT_TRAITS_MEMBER(enable_referrers) + IPC_STRUCT_TRAITS_MEMBER(default_zoom_level) IPC_STRUCT_TRAITS_END() IPC_STRUCT_TRAITS_BEGIN(webkit_glue::CustomContextMenuContext) diff --git a/content/public/common/renderer_preferences.cc b/content/public/common/renderer_preferences.cc index d117657..2a1bbea 100644 --- a/content/public/common/renderer_preferences.cc +++ b/content/public/common/renderer_preferences.cc @@ -22,7 +22,8 @@ RendererPreferences::RendererPreferences() inactive_selection_fg_color(0), browser_handles_top_level_requests(false), caret_blink_interval(0), - enable_referrers(true) { + enable_referrers(true), + default_zoom_level(0) { } } // namespace content diff --git a/content/public/common/renderer_preferences.h b/content/public/common/renderer_preferences.h index 7275e72..8a07fe2 100644 --- a/content/public/common/renderer_preferences.h +++ b/content/public/common/renderer_preferences.h @@ -79,6 +79,9 @@ struct CONTENT_EXPORT RendererPreferences { // Set to false to not send referrers. bool enable_referrers; + + // Default page zoom level. + double default_zoom_level; }; } // namespace content diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc index c2aeec4..a09574d 100644 --- a/content/renderer/render_view_impl.cc +++ b/content/renderer/render_view_impl.cc @@ -3709,11 +3709,6 @@ void RenderViewImpl::ZoomFactorHelper(content::PageZoom zoom, } void RenderViewImpl::OnSetZoomLevel(double zoom_level) { - // Don't set zoom level for full-page plugin since they don't use the same - // zoom settings. - if (webview()->mainFrame()->document().isPluginDocument()) - return; - webview()->hidePopups(); webview()->setZoomLevel(false, zoom_level); zoomLevelChanged(); @@ -3923,6 +3918,7 @@ void RenderViewImpl::OnDisableScrollbarsForSmallWindows( void RenderViewImpl::OnSetRendererPrefs( const content::RendererPreferences& renderer_prefs) { + double old_zoom_level = renderer_preferences_.default_zoom_level; renderer_preferences_ = renderer_prefs; UpdateFontRenderingFromRendererPrefs(); #if defined(TOOLKIT_USES_GTK) @@ -3947,6 +3943,13 @@ void RenderViewImpl::OnSetRendererPrefs( webview()->themeChanged(); } #endif + // If the zoom level for this page matches the old zoom default, and this + // is not a plugin, update the zoom level to match the new default. + if (webview() && !webview()->mainFrame()->document().isPluginDocument() && + content::ZoomValuesEqual(webview()->zoomLevel(), old_zoom_level)) { + webview()->setZoomLevel(false, renderer_preferences_.default_zoom_level); + zoomLevelChanged(); + } } void RenderViewImpl::OnMediaPlayerActionAt(const gfx::Point& location, |