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

Unified Diff: extensions/browser/guest_view/guest_view_base.cc

Issue 934303003: Fixed the bug that caused extension options not to fit their overlays properly when zoomed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/guest_view/guest_view_base.cc
diff --git a/extensions/browser/guest_view/guest_view_base.cc b/extensions/browser/guest_view/guest_view_base.cc
index 0f81f272927e0cd4de15f7291fd2666ff8ae6c1d..386cba4615ec576b8db9574eac98ace39da259e3 100644
--- a/extensions/browser/guest_view/guest_view_base.cc
+++ b/extensions/browser/guest_view/guest_view_base.cc
@@ -510,6 +510,18 @@ void GuestViewBase::WillAttach(content::WebContents* embedder_web_contents,
WillAttachToEmbedder();
}
+int GuestViewBase::LogicalPixelsToPhysicalPixels(double logical_pixels) {
+ DCHECK(logical_pixels >= 0);
+ double zoom_factor = GetEmbedderZoomFactor();
+ return static_cast<int>(logical_pixels * zoom_factor + 0.5);
+}
+
+double GuestViewBase::PhysicalPixelsToLogicalPixels(int physical_pixels) {
+ DCHECK(physical_pixels >= 0);
+ double zoom_factor = GetEmbedderZoomFactor();
+ return static_cast<int>(physical_pixels / zoom_factor + 0.5);
Fady Samuel 2015/02/18 18:27:31 Why are you casting to int here and then returning
paulmeyer 2015/02/19 18:42:58 Done.
+}
+
void GuestViewBase::DidStopLoading(content::RenderViewHost* render_view_host) {
if (IsPreferredSizeModeEnabled()) {
render_view_host->EnablePreferredSizeMode();
@@ -731,18 +743,6 @@ double GuestViewBase::GetEmbedderZoomFactor() {
return zoom_factor;
}
-int GuestViewBase::LogicalPixelsToPhysicalPixels(double logical_pixels) {
- DCHECK(logical_pixels >= 0);
- double zoom_factor = GetEmbedderZoomFactor();
- return static_cast<int>(logical_pixels * zoom_factor + 0.5);
-}
-
-double GuestViewBase::PhysicalPixelsToLogicalPixels(int physical_pixels) {
- DCHECK(physical_pixels >= 0);
- double zoom_factor = GetEmbedderZoomFactor();
- return physical_pixels * zoom_factor;
-}
-
void GuestViewBase::SetUpSizing(const base::DictionaryValue& params) {
// Read the autosize parameters passed in from the embedder.
bool auto_size_enabled = false;

Powered by Google App Engine
This is Rietveld 408576698