cef/patch/patches/print_header_footer_1478.patch

126 lines
5.7 KiB
Diff
Raw Normal View History

diff --git printing/renderer/print_web_view_helper.cc printing/renderer/print_web_view_helper.cc
index 313d12d..558052c 100644
--- printing/renderer/print_web_view_helper.cc
+++ printing/renderer/print_web_view_helper.cc
@@ -75,6 +75,7 @@ const double kMinDpi = 1.0;
bool g_is_preview_enabled_ = false;
#else
bool g_is_preview_enabled_ = true;
+#endif // !defined(ENABLE_PRINT_PREVIEW)
const char kPageLoadScriptFormat[] =
"document.open(); document.write(%s); document.close();";
@@ -89,7 +90,6 @@ void ExecuteScript(blink::WebFrame* frame,
std::string script = base::StringPrintf(script_format, json.c_str());
frame->executeScript(blink::WebString(base::UTF8ToUTF16(script)));
}
-#endif // !defined(ENABLE_PRINT_PREVIEW)
int GetDPI(const PrintMsg_Print_Params* print_params) {
#if defined(OS_MACOSX)
@@ -474,7 +474,6 @@ blink::WebView* FrameReference::view() {
return view_;
}
-#if defined(ENABLE_PRINT_PREVIEW)
// static - Not anonymous so that platform implementations can use it.
void PrintWebViewHelper::PrintHeaderAndFooter(
blink::WebCanvas* canvas,
@@ -532,7 +531,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter(
web_view->close();
frame->close();
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
// static - Not anonymous so that platform implementations can use it.
float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame,
diff --git printing/renderer/print_web_view_helper.h printing/renderer/print_web_view_helper.h
index 341ec8e..47777b8 100644
--- printing/renderer/print_web_view_helper.h
+++ printing/renderer/print_web_view_helper.h
@@ -309,7 +309,6 @@ class PrintWebViewHelper
double* scale_factor,
PageSizeMargins* page_layout_in_points);
-#if defined(ENABLE_PRINT_PREVIEW)
// Given the |device| and |canvas| to draw on, prints the appropriate headers
// and footers using strings from |header_footer_info| on to the canvas.
static void PrintHeaderAndFooter(blink::WebCanvas* canvas,
@@ -319,7 +318,6 @@ class PrintWebViewHelper
float webkit_scale_factor,
const PageSizeMargins& page_layout_in_points,
const PrintMsg_Print_Params& params);
-#endif // defined(ENABLE_PRINT_PREVIEW)
bool GetPrintFrame(blink::WebLocalFrame** frame);
diff --git printing/renderer/print_web_view_helper_linux.cc printing/renderer/print_web_view_helper_linux.cc
index 79b82e9..8d1f6f4 100644
--- printing/renderer/print_web_view_helper_linux.cc
+++ printing/renderer/print_web_view_helper_linux.cc
@@ -169,7 +169,6 @@ void PrintWebViewHelper::PrintPageInternal(
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
-#if defined(ENABLE_PRINT_PREVIEW)
if (params.params.display_header_footer) {
// |page_number| is 0-based, so 1 is added.
// TODO(vitalybuka) : why does it work only with 1.25?
@@ -178,7 +177,6 @@ void PrintWebViewHelper::PrintPageInternal(
scale_factor / 1.25, page_layout_in_points,
params.params);
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
RenderPageContent(frame, params.page_number, canvas_area, content_area,
scale_factor, canvas);
diff --git printing/renderer/print_web_view_helper_mac.mm printing/renderer/print_web_view_helper_mac.mm
index 7aa503c..a6413be 100644
--- printing/renderer/print_web_view_helper_mac.mm
+++ printing/renderer/print_web_view_helper_mac.mm
@@ -125,14 +125,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
skia::SetIsPreviewMetafile(*canvas, is_preview);
-#if defined(ENABLE_PRINT_PREVIEW)
if (params.display_header_footer) {
PrintHeaderAndFooter(static_cast<blink::WebCanvas*>(canvas),
page_number + 1,
print_preview_context_.total_page_count(), *frame,
scale_factor, page_layout_in_points, params);
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
RenderPageContent(frame, page_number, canvas_area, content_area,
scale_factor, static_cast<blink::WebCanvas*>(canvas));
}
diff --git printing/renderer/print_web_view_helper_pdf_win.cc printing/renderer/print_web_view_helper_pdf_win.cc
index a121448..f2a1a0a 100644
--- printing/renderer/print_web_view_helper_pdf_win.cc
+++ printing/renderer/print_web_view_helper_pdf_win.cc
@@ -185,14 +185,12 @@ void PrintWebViewHelper::PrintPageInternal(
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
skia::SetIsDraftMode(*canvas, is_print_ready_metafile_sent_);
-#if defined(ENABLE_PRINT_PREVIEW)
if (params.params.display_header_footer) {
// |page_number| is 0-based, so 1 is added.
PrintHeaderAndFooter(canvas, params.page_number + 1,
print_preview_context_.total_page_count(), *frame,
scale_factor, page_layout_in_points, params.params);
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
float webkit_scale_factor =
RenderPageContent(frame, params.page_number, canvas_area, content_area,
diff --git resources/printing_resources.grdp resources/printing_resources.grdp
index 7213746..32b8b1e 100644
--- resources/printing_resources.grdp
+++ resources/printing_resources.grdp
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<grit-part>
- <if expr="enable_print_preview">
<include name="IDR_PRINT_PREVIEW_PAGE" file="../printing/resources/print_preview_page.html" flattenhtml="true" allowexternalscript="false" type="BINDATA" />
- </if>
</grit-part>