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

Unified Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2743143002: Fix incorrect print preview clipping (Closed)
Patch Set: Created 3 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: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index 4deb1c6ba3876fe687a5581c750d90514e753607..5599470bc5f05510dff883e9f39aa3296175b264 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -285,6 +285,7 @@ class ChromePrintContext : public PrintContext {
virtual void begin(float width, float height) {
DCHECK(!m_printedPageWidth);
m_printedPageWidth = width;
+ m_printedPageHeight = height;
PrintContext::begin(m_printedPageWidth, height);
}
@@ -302,8 +303,10 @@ class ChromePrintContext : public PrintContext {
if (!frame()->document() || frame()->document()->layoutViewItem().isNull())
return 0;
- IntRect pageRect = m_pageRects[pageNumber];
- PaintRecordBuilder builder(pageRect, &canvas->getMetaData());
+ // The page rect gets scaled and translated, so specify the entire
+ // print content area here as the recording rect.
+ IntRect printedPageRect(0, 0, m_printedPageHeight, m_printedPageWidth);
+ PaintRecordBuilder builder(printedPageRect, &canvas->getMetaData());
builder.context().setPrinting(true);
float scale = spoolPage(builder, pageNumber);
@@ -426,6 +429,7 @@ class ChromePrintContext : public PrintContext {
// Set when printing.
float m_printedPageWidth;
+ float m_printedPageHeight;
};
// Simple class to override some of PrintContext behavior. This is used when
« 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