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

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

Issue 1034803002: Fixed the sizing bug for PDFs opened from links with target=_blank. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Took out unrelated files. Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 eefe4bb0758b900fe5187bc7e3100c6a92049011..9d9cb9891357c9c826917905edbbb089f9172999 100644
--- a/extensions/browser/guest_view/guest_view_base.cc
+++ b/extensions/browser/guest_view/guest_view_base.cc
@@ -12,6 +12,7 @@
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_zoom.h"
#include "content/public/common/url_constants.h"
@@ -782,26 +783,36 @@ void GuestViewBase::SetUpSizing(const base::DictionaryValue& params) {
params.GetInteger(guestview::kAttributeMinHeight, &min_height);
params.GetInteger(guestview::kAttributeMinWidth, &min_width);
- // Set the normal size to the element size so that the guestview will fit the
- // element initially if autosize is disabled.
- double element_height = 0.0;
- double element_width = 0.0;
- params.GetDouble(guestview::kElementHeight, &element_height);
- params.GetDouble(guestview::kElementWidth, &element_width);
-
- // If the element size was provided in logical units (versus physical), then
- // it will be converted to physical units.
- bool element_size_is_logical = false;
- params.GetBoolean(guestview::kElementSizeIsLogical, &element_size_is_logical);
int normal_height = 0;
int normal_width = 0;
- if (element_size_is_logical) {
- // Convert the element size from logical pixels to physical pixels.
- normal_height = LogicalPixelsToPhysicalPixels(element_height);
- normal_width = LogicalPixelsToPhysicalPixels(element_width);
+ if (is_full_page_plugin()) {
+ // The initial size of a full page plugin should be set to fill the
+ // owner's visible viewport.
+ auto owner_size = owner_web_contents()->GetRenderWidgetHostView()->
+ GetVisibleViewportSize();
+ normal_height = owner_size.height();
+ normal_width = owner_size.width();
} else {
- normal_height = lround(element_height);
- normal_width = lround(element_width);
+ // Set the normal size to the element size so that the guestview will fit
+ // the element initially if autosize is disabled.
+ double element_height = 0.0;
+ double element_width = 0.0;
+ params.GetDouble(guestview::kElementHeight, &element_height);
+ params.GetDouble(guestview::kElementWidth, &element_width);
+
+ // If the element size was provided in logical units (versus physical), then
+ // it will be converted to physical units.
+ bool element_size_is_logical = false;
+ params.GetBoolean(guestview::kElementSizeIsLogical,
+ &element_size_is_logical);
+ if (element_size_is_logical) {
+ // Convert the element size from logical pixels to physical pixels.
+ normal_height = LogicalPixelsToPhysicalPixels(element_height);
+ normal_width = LogicalPixelsToPhysicalPixels(element_width);
+ } else {
+ normal_height = lround(element_height);
+ normal_width = lround(element_width);
+ }
}
SetSizeParams set_size_params;
« 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