Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: webkit/glue/plugins/pepper_plugin_instance.cc

Issue 5774001: Fix a plugin taking a whole iframe from messing with the page's zoom level.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "webkit/glue/plugins/pepper_plugin_instance.h" 5 #include "webkit/glue/plugins/pepper_plugin_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #if defined(OS_MACOSX) 9 #if defined(OS_MACOSX)
10 #include "base/mac_util.h" 10 #include "base/mac_util.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 const PPB_Fullscreen_Dev ppb_fullscreen = { 238 const PPB_Fullscreen_Dev ppb_fullscreen = {
239 &IsFullscreen, 239 &IsFullscreen,
240 &SetFullscreen, 240 &SetFullscreen,
241 }; 241 };
242 242
243 void ZoomChanged(PP_Instance instance_id, double factor) { 243 void ZoomChanged(PP_Instance instance_id, double factor) {
244 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id); 244 PluginInstance* instance = ResourceTracker::Get()->GetInstance(instance_id);
245 if (!instance) 245 if (!instance)
246 return; 246 return;
247
248 // We only want to tell the page to change its zoom if the whole page is the
249 // PDF. If we're in an iframe, then don't do anything.
250 WebFrame* frame = instance->container()->element().document().frame();
251 if (!frame->view()->mainFrame()->document().isPluginDocument())
252 return;
253
247 double zoom_level = WebView::zoomFactorToZoomLevel(factor); 254 double zoom_level = WebView::zoomFactorToZoomLevel(factor);
248 // The conversino from zoom level to factor, and back, can introduce rounding 255 // The conversino from zoom level to factor, and back, can introduce rounding
249 // errors. i.e. WebKit originally tells us 3.0, but by the time we tell the 256 // errors. i.e. WebKit originally tells us 3.0, but by the time we tell the
250 // plugin and it tells us back, the level becomes 3.000000000004. Need to 257 // plugin and it tells us back, the level becomes 3.000000000004. Need to
251 // round or else otherwise if the user zooms out, it will go to 3.0 instead of 258 // round or else otherwise if the user zooms out, it will go to 3.0 instead of
252 // 2.0. 259 // 2.0.
253 int rounded = 260 int rounded =
254 static_cast<int>(zoom_level + (zoom_level > 0 ? 0.001 : -0.001)); 261 static_cast<int>(zoom_level + (zoom_level > 0 ? 0.001 : -0.001));
255 if (abs(rounded - zoom_level) < 0.001) 262 if (abs(rounded - zoom_level) < 0.001)
256 zoom_level = rounded; 263 zoom_level = rounded;
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 } 1170 }
1164 1171
1165 Graphics3D* PluginInstance::bound_graphics_3d() const { 1172 Graphics3D* PluginInstance::bound_graphics_3d() const {
1166 if (bound_graphics_.get() == NULL) 1173 if (bound_graphics_.get() == NULL)
1167 return NULL; 1174 return NULL;
1168 1175
1169 return bound_graphics_->Cast<Graphics3D>(); 1176 return bound_graphics_->Cast<Graphics3D>();
1170 } 1177 }
1171 1178
1172 } // namespace pepper 1179 } // namespace pepper
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698