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

Unified Diff: chrome/renderer/print_web_view_helper.cc

Issue 6539011: Fix for Issue 73274: Printing causes view to scroll (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: Created 9 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
« no previous file with comments | « chrome/renderer/print_web_view_helper.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/print_web_view_helper.cc
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc
index c46a383165995a6e00ffcc8c042480b9cb26b5f5..1389cd729cf9141c071ea9b41fd43bec0f216020 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -71,6 +71,8 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
print_layout_size.set_height(static_cast<int>(
static_cast<double>(print_layout_size.height()) * 1.25));
+ if (WebFrame* web_frame = web_view_->mainFrame())
+ prev_scroll_offset_ = web_frame->scrollOffset();
prev_view_size_ = web_view->size();
web_view->resize(print_layout_size);
@@ -86,6 +88,8 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
PrepareFrameAndViewForPrint::~PrepareFrameAndViewForPrint() {
frame_->printEnd();
web_view_->resize(prev_view_size_);
+ if (WebFrame* web_frame = web_view_->mainFrame())
+ web_frame->setScrollOffset(prev_scroll_offset_);
}
« no previous file with comments | « chrome/renderer/print_web_view_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698