summaryrefslogtreecommitdiff
path: root/chromium/printing
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2017-11-20 15:06:40 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2017-11-22 11:48:58 +0000
commitdaa093eea7c773db06799a13bd7e4e2e2a9f8f14 (patch)
tree96cc5e7b9194c1b29eab927730bfa419e7111c25 /chromium/printing
parentbe59a35641616a4cf23c4a13fa0632624b021c1b (diff)
downloadqtwebengine-chromium-daa093eea7c773db06799a13bd7e4e2e2a9f8f14.tar.gz
BASELINE: Update Chromium to 63.0.3239.58
Change-Id: Ia93b322a00ba4dd4004f3bcf1254063ba90e1605 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/printing')
-rw-r--r--chromium/printing/BUILD.gn2
-rw-r--r--chromium/printing/OWNERS5
-rw-r--r--chromium/printing/backend/print_backend.h4
-rw-r--r--chromium/printing/backend/print_backend_chromeos.cc4
-rw-r--r--chromium/printing/metafile.h8
-rw-r--r--chromium/printing/native_drawing_context.h7
-rw-r--r--chromium/printing/pdf_metafile_cg_mac.cc7
-rw-r--r--chromium/printing/pdf_metafile_cg_mac.h2
-rw-r--r--chromium/printing/pdf_metafile_skia.cc6
-rw-r--r--chromium/printing/pdf_metafile_skia.h8
-rw-r--r--chromium/printing/print_settings.h2
-rw-r--r--chromium/printing/printed_document.cc21
-rw-r--r--chromium/printing/printed_document.h17
-rw-r--r--chromium/printing/printed_document_mac.cc2
-rw-r--r--chromium/printing/printed_document_win.cc3
-rw-r--r--chromium/printing/printed_pages_source.h24
-rw-r--r--chromium/printing/printing_context.h2
-rw-r--r--chromium/printing/printing_context_android.cc2
-rw-r--r--chromium/printing/printing_context_android.h2
-rw-r--r--chromium/printing/printing_context_chromeos.cc2
-rw-r--r--chromium/printing/printing_context_chromeos.h2
-rw-r--r--chromium/printing/printing_context_linux.cc2
-rw-r--r--chromium/printing/printing_context_linux.h2
-rw-r--r--chromium/printing/printing_context_mac.h2
-rw-r--r--chromium/printing/printing_context_mac.mm2
-rw-r--r--chromium/printing/printing_context_no_system_dialog.cc2
-rw-r--r--chromium/printing/printing_context_no_system_dialog.h2
-rw-r--r--chromium/printing/printing_context_win.cc19
-rw-r--r--chromium/printing/printing_context_win.h2
-rw-r--r--chromium/printing/pwg_raster_settings.h6
30 files changed, 63 insertions, 108 deletions
diff --git a/chromium/printing/BUILD.gn b/chromium/printing/BUILD.gn
index eb1fb5abfa7..e03e46a30ed 100644
--- a/chromium/printing/BUILD.gn
+++ b/chromium/printing/BUILD.gn
@@ -73,7 +73,6 @@ component("printing") {
"printed_document_win.cc",
"printed_page.cc",
"printed_page.h",
- "printed_pages_source.h",
"printing_context.cc",
"printing_context.h",
"printing_export.h",
@@ -88,6 +87,7 @@ component("printing") {
defines = [ "PRINTING_IMPLEMENTATION" ]
public_deps = [
+ "//build/config/linux/pangocairo:features",
"//printing/features",
]
deps = [
diff --git a/chromium/printing/OWNERS b/chromium/printing/OWNERS
index db535f8b460..d941f7e0488 100644
--- a/chromium/printing/OWNERS
+++ b/chromium/printing/OWNERS
@@ -1,9 +1,6 @@
dpapad@chromium.org
-gene@chromium.org
-scottbyer@chromium.org
+rbpotter@chromium.org
thestig@chromium.org
-vandebo@chromium.org
-vitalybuka@chromium.org
per-file printing_context_android*=avayvod@chromium.org
per-file printing_context_android*=dgn@chromium.org
diff --git a/chromium/printing/backend/print_backend.h b/chromium/printing/backend/print_backend.h
index 40759a96d2a..239e9972787 100644
--- a/chromium/printing/backend/print_backend.h
+++ b/chromium/printing/backend/print_backend.h
@@ -22,8 +22,8 @@ class DictionaryValue;
namespace printing {
// Note: There are raw values. The |printer_name| and |printer_description|
-// require further interpretation on Mac and Chrome OS. See existing callers for
-// examples.
+// require further interpretation on Windows, Mac and Chrome OS. See existing
+// callers for examples.
struct PRINTING_EXPORT PrinterBasicInfo {
PrinterBasicInfo();
PrinterBasicInfo(const PrinterBasicInfo& other);
diff --git a/chromium/printing/backend/print_backend_chromeos.cc b/chromium/printing/backend/print_backend_chromeos.cc
index 02b082db553..96e44573817 100644
--- a/chromium/printing/backend/print_backend_chromeos.cc
+++ b/chromium/printing/backend/print_backend_chromeos.cc
@@ -107,10 +107,10 @@ bool PrintBackendChromeOS::IsValidPrinter(const std::string& printer_name) {
scoped_refptr<PrintBackend> PrintBackend::CreateInstanceImpl(
const base::DictionaryValue* print_backend_settings) {
#if defined(USE_CUPS)
- return make_scoped_refptr(
+ return base::WrapRefCounted(
new PrintBackendCupsIpp(CreateConnection(print_backend_settings)));
#else
- return make_scoped_refptr(new PrintBackendChromeOS());
+ return base::MakeRefCounted<PrintBackendChromeOS>();
#endif // defined(USE_CUPS)
}
diff --git a/chromium/printing/metafile.h b/chromium/printing/metafile.h
index 2f208edc267..01be9abdc71 100644
--- a/chromium/printing/metafile.h
+++ b/chromium/printing/metafile.h
@@ -74,14 +74,14 @@ class PRINTING_EXPORT MetafilePlayer {
// back in the HDC. The trick is that it skip over the records known to have
// issue with some printers. See Emf::Record::SafePlayback implementation for
// details.
- virtual bool SafePlayback(skia::NativeDrawingContext hdc) const = 0;
+ virtual bool SafePlayback(printing::NativeDrawingContext hdc) const = 0;
#elif defined(OS_MACOSX)
// Renders the given page into |rect| in the given context.
// Pages use a 1-based index. The rendering uses the arguments in
// |params| to determine scaling, translation, and rotation.
virtual bool RenderPage(unsigned int page_number,
- skia::NativeDrawingContext context,
+ printing::NativeDrawingContext context,
const CGRect rect,
const MacRenderPageParams& params) const = 0;
#endif // if defined(OS_WIN)
@@ -144,7 +144,7 @@ class PRINTING_EXPORT Metafile : public MetafilePlayer {
virtual gfx::Rect GetPageBounds(unsigned int page_number) const = 0;
virtual unsigned int GetPageCount() const = 0;
- virtual skia::NativeDrawingContext context() const = 0;
+ virtual printing::NativeDrawingContext context() const = 0;
#if defined(OS_WIN)
// "Plays" the EMF buffer in a HDC. It is the same effect as calling the
@@ -155,7 +155,7 @@ class PRINTING_EXPORT Metafile : public MetafilePlayer {
// functions, whether used directly or indirectly through precompiled EMF
// data. We have to accept the risk here. Since it is used only for printing,
// it requires user intervention.
- virtual bool Playback(skia::NativeDrawingContext hdc,
+ virtual bool Playback(printing::NativeDrawingContext hdc,
const RECT* rect) const = 0;
#endif // OS_WIN
diff --git a/chromium/printing/native_drawing_context.h b/chromium/printing/native_drawing_context.h
index 41a20c806b2..c072bcbfe96 100644
--- a/chromium/printing/native_drawing_context.h
+++ b/chromium/printing/native_drawing_context.h
@@ -6,20 +6,21 @@
#define PRINTING_NATIVE_DRAWING_CONTEXT_H_
#include "build/build_config.h"
+#include "build/config/linux/pangocairo/features.h"
#if defined(OS_WIN)
#include <windows.h>
-#elif defined(USE_CAIRO)
+#elif BUILDFLAG(USE_PANGOCAIRO)
typedef struct _cairo cairo_t;
#elif defined(OS_MACOSX)
typedef struct CGContext* CGContextRef;
#endif
-namespace skia {
+namespace printing {
#if defined(OS_WIN)
typedef HDC NativeDrawingContext;
-#elif defined(USE_CAIRO)
+#elif BUILDFLAG(USE_PANGOCAIRO)
typedef cairo_t* NativeDrawingContext;
#elif defined(OS_MACOSX)
typedef CGContextRef NativeDrawingContext;
diff --git a/chromium/printing/pdf_metafile_cg_mac.cc b/chromium/printing/pdf_metafile_cg_mac.cc
index 16744bfde6c..968c47cecaa 100644
--- a/chromium/printing/pdf_metafile_cg_mac.cc
+++ b/chromium/printing/pdf_metafile_cg_mac.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
+#include "base/numerics/math_constants.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/sys_string_conversions.h"
#include "ui/gfx/geometry/rect.h"
@@ -30,7 +31,7 @@ void RotatePage(CGContextRef context, const CGRect rect, int num_rotations) {
// content is now "off screen". Shift it right to move it back on screen.
CGContextTranslateCTM(context, rect.size.width, 0);
// Rotates counter-clockwise by 90 degrees.
- CGContextRotateCTM(context, M_PI_2);
+ CGContextRotateCTM(context, base::kPiDouble / 2);
break;
case 2:
// After rotating by 180 degrees with the axis at the origin, the page
@@ -38,14 +39,14 @@ void RotatePage(CGContextRef context, const CGRect rect, int num_rotations) {
// screen.
CGContextTranslateCTM(context, rect.size.width, rect.size.height);
// Rotates counter-clockwise by 90 degrees.
- CGContextRotateCTM(context, M_PI);
+ CGContextRotateCTM(context, base::kPiDouble);
break;
case 3:
// After rotating by 270 degrees with the axis at the origin, the page
// content is now "off screen". Shift it right to move it back on screen.
CGContextTranslateCTM(context, 0, rect.size.height);
// Rotates counter-clockwise by 90 degrees.
- CGContextRotateCTM(context, -M_PI_2);
+ CGContextRotateCTM(context, -base::kPiDouble / 2);
break;
default:
NOTREACHED();
diff --git a/chromium/printing/pdf_metafile_cg_mac.h b/chromium/printing/pdf_metafile_cg_mac.h
index f68ac4fa3a0..a49a3895564 100644
--- a/chromium/printing/pdf_metafile_cg_mac.h
+++ b/chromium/printing/pdf_metafile_cg_mac.h
@@ -46,7 +46,7 @@ class PRINTING_EXPORT PdfMetafileCg : public Metafile {
CGContextRef context() const override;
bool RenderPage(unsigned int page_number,
- skia::NativeDrawingContext context,
+ printing::NativeDrawingContext context,
const CGRect rect,
const MacRenderPageParams& params) const override;
diff --git a/chromium/printing/pdf_metafile_skia.cc b/chromium/printing/pdf_metafile_skia.cc
index 0bcb3cdb50b..d5b59a7d315 100644
--- a/chromium/printing/pdf_metafile_skia.cc
+++ b/chromium/printing/pdf_metafile_skia.cc
@@ -208,20 +208,20 @@ unsigned int PdfMetafileSkia::GetPageCount() const {
return base::checked_cast<unsigned int>(data_->pages_.size());
}
-skia::NativeDrawingContext PdfMetafileSkia::context() const {
+printing::NativeDrawingContext PdfMetafileSkia::context() const {
NOTREACHED();
return nullptr;
}
#if defined(OS_WIN)
-bool PdfMetafileSkia::Playback(skia::NativeDrawingContext hdc,
+bool PdfMetafileSkia::Playback(printing::NativeDrawingContext hdc,
const RECT* rect) const {
NOTREACHED();
return false;
}
-bool PdfMetafileSkia::SafePlayback(skia::NativeDrawingContext hdc) const {
+bool PdfMetafileSkia::SafePlayback(printing::NativeDrawingContext hdc) const {
NOTREACHED();
return false;
}
diff --git a/chromium/printing/pdf_metafile_skia.h b/chromium/printing/pdf_metafile_skia.h
index dacd1a74cb0..e5898c807c4 100644
--- a/chromium/printing/pdf_metafile_skia.h
+++ b/chromium/printing/pdf_metafile_skia.h
@@ -46,15 +46,15 @@ class PRINTING_EXPORT PdfMetafileSkia : public Metafile {
gfx::Rect GetPageBounds(unsigned int page_number) const override;
unsigned int GetPageCount() const override;
- skia::NativeDrawingContext context() const override;
+ printing::NativeDrawingContext context() const override;
#if defined(OS_WIN)
- bool Playback(skia::NativeDrawingContext hdc,
+ bool Playback(printing::NativeDrawingContext hdc,
const RECT* rect) const override;
- bool SafePlayback(skia::NativeDrawingContext hdc) const override;
+ bool SafePlayback(printing::NativeDrawingContext hdc) const override;
#elif defined(OS_MACOSX)
bool RenderPage(unsigned int page_number,
- skia::NativeDrawingContext context,
+ printing::NativeDrawingContext context,
const CGRect rect,
const MacRenderPageParams& params) const override;
#endif
diff --git a/chromium/printing/print_settings.h b/chromium/printing/print_settings.h
index f55efc4fc30..98f2e092f68 100644
--- a/chromium/printing/print_settings.h
+++ b/chromium/printing/print_settings.h
@@ -108,7 +108,7 @@ class PRINTING_EXPORT PrintSettings {
dpi_[0] = dpi_horizontal;
dpi_[1] = dpi_vertical;
}
- int dpi() const { return std::min(dpi_[0], dpi_[1]); }
+ int dpi() const { return std::max(dpi_[0], dpi_[1]); }
int dpi_horizontal() const { return dpi_[0]; }
int dpi_vertical() const { return dpi_[1]; }
diff --git a/chromium/printing/printed_document.cc b/chromium/printing/printed_document.cc
index 89428491a06..557d9b6f41f 100644
--- a/chromium/printing/printed_document.cc
+++ b/chromium/printing/printed_document.cc
@@ -30,7 +30,6 @@
#include "printing/page_number.h"
#include "printing/print_settings_conversion.h"
#include "printing/printed_page.h"
-#include "printing/printed_pages_source.h"
#include "printing/units.h"
#include "ui/gfx/font.h"
#include "ui/gfx/text_elider.h"
@@ -95,9 +94,9 @@ void DebugDumpSettings(const base::string16& doc_name,
} // namespace
PrintedDocument::PrintedDocument(const PrintSettings& settings,
- PrintedPagesSource* source,
+ const base::string16& name,
int cookie)
- : mutable_(source), immutable_(settings, source, cookie) {
+ : immutable_(settings, name, cookie) {
// Records the expected page count if a range is setup.
if (!settings.ranges().empty()) {
// If there is a range, set the number of page
@@ -108,7 +107,7 @@ PrintedDocument::PrintedDocument(const PrintSettings& settings,
}
if (!g_debug_dump_info.Get().empty())
- DebugDumpSettings(name(), settings);
+ DebugDumpSettings(name, settings);
}
PrintedDocument::~PrintedDocument() {
@@ -179,11 +178,6 @@ bool PrintedDocument::IsComplete() const {
return true;
}
-void PrintedDocument::DisconnectSource() {
- base::AutoLock lock(lock_);
- mutable_.source_ = NULL;
-}
-
void PrintedDocument::set_page_count(int max_page) {
base::AutoLock lock(lock_);
DCHECK_EQ(0, mutable_.page_count_);
@@ -245,10 +239,7 @@ void PrintedDocument::DebugDumpData(
base::RetainedRef(data)));
}
-PrintedDocument::Mutable::Mutable(PrintedPagesSource* source)
- : source_(source),
- expected_page_count_(0),
- page_count_(0) {
+PrintedDocument::Mutable::Mutable() : expected_page_count_(0), page_count_(0) {
#if defined(OS_POSIX) && !defined(OS_MACOSX)
first_page = INT_MAX;
#endif
@@ -258,9 +249,9 @@ PrintedDocument::Mutable::~Mutable() {
}
PrintedDocument::Immutable::Immutable(const PrintSettings& settings,
- PrintedPagesSource* source,
+ const base::string16& name,
int cookie)
- : settings_(settings), name_(source->RenderSourceName()), cookie_(cookie) {}
+ : settings_(settings), name_(name), cookie_(cookie) {}
PrintedDocument::Immutable::~Immutable() {}
diff --git a/chromium/printing/printed_document.h b/chromium/printing/printed_document.h
index 77b19840e21..4858376d926 100644
--- a/chromium/printing/printed_document.h
+++ b/chromium/printing/printed_document.h
@@ -24,7 +24,6 @@ namespace printing {
class MetafilePlayer;
class PrintedPage;
-class PrintedPagesSource;
class PrintingContext;
// A collection of rendered pages. The settings are immutable. If the print
@@ -39,7 +38,7 @@ class PRINTING_EXPORT PrintedDocument
// The cookie shall be unique and has a specific relationship with its
// originating source and settings.
PrintedDocument(const PrintSettings& settings,
- PrintedPagesSource* source,
+ const base::string16& name,
int cookie);
// Sets a page's data. 0-based. Takes metafile ownership.
@@ -61,7 +60,7 @@ class PRINTING_EXPORT PrintedDocument
// Note: locks for a short amount of time in debug only.
#if defined(OS_WIN) || defined(OS_MACOSX) && !defined(USE_AURA)
void RenderPrintedPage(const PrintedPage& page,
- skia::NativeDrawingContext context) const;
+ printing::NativeDrawingContext context) const;
#elif defined(OS_POSIX)
void RenderPrintedPage(const PrintedPage& page,
PrintingContext* context) const;
@@ -72,10 +71,6 @@ class PRINTING_EXPORT PrintedDocument
// Note: locks while parsing the whole tree.
bool IsComplete() const;
- // Disconnects the PrintedPage source (PrintedPagesSource). It is done when
- // the source is being destroyed.
- void DisconnectSource();
-
// Sets the number of pages in the document to be rendered. Can only be set
// once.
// Note: locks for a short amount of time.
@@ -122,13 +117,9 @@ class PRINTING_EXPORT PrintedDocument
// Contains all the mutable stuff. All this stuff MUST be accessed with the
// lock held.
struct Mutable {
- explicit Mutable(PrintedPagesSource* source);
+ Mutable();
~Mutable();
- // Source that generates the PrintedPage's (i.e. a TabContents). It will be
- // set back to NULL if the source is deleted before this object.
- PrintedPagesSource* source_;
-
// Contains the pages' representation. This is a collection of PrintedPage.
// Warning: Lock must be held when accessing this member.
PrintedPages pages_;
@@ -151,7 +142,7 @@ class PRINTING_EXPORT PrintedDocument
// construction.
struct Immutable {
Immutable(const PrintSettings& settings,
- PrintedPagesSource* source,
+ const base::string16& name,
int cookie);
~Immutable();
diff --git a/chromium/printing/printed_document_mac.cc b/chromium/printing/printed_document_mac.cc
index 73286966f99..737f52a3d56 100644
--- a/chromium/printing/printed_document_mac.cc
+++ b/chromium/printing/printed_document_mac.cc
@@ -15,7 +15,7 @@ namespace printing {
void PrintedDocument::RenderPrintedPage(
const PrintedPage& page,
- skia::NativeDrawingContext context) const {
+ printing::NativeDrawingContext context) const {
#ifndef NDEBUG
{
// Make sure the page is from our list.
diff --git a/chromium/printing/printed_document_win.cc b/chromium/printing/printed_document_win.cc
index 95a9d1b53dd..ef1f896e343 100644
--- a/chromium/printing/printed_document_win.cc
+++ b/chromium/printing/printed_document_win.cc
@@ -6,7 +6,6 @@
#include "base/logging.h"
#include "printing/page_number.h"
-#include "printing/printed_pages_source.h"
#include "printing/printed_page.h"
#include "printing/units.h"
#include "skia/ext/skia_utils_win.h"
@@ -31,7 +30,7 @@ namespace printing {
void PrintedDocument::RenderPrintedPage(
const PrintedPage& page,
- skia::NativeDrawingContext context) const {
+ printing::NativeDrawingContext context) const {
#ifndef NDEBUG
{
// Make sure the page is from our list.
diff --git a/chromium/printing/printed_pages_source.h b/chromium/printing/printed_pages_source.h
deleted file mode 100644
index 689ff044fb7..00000000000
--- a/chromium/printing/printed_pages_source.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PRINTING_PRINTED_PAGES_SOURCE_H_
-#define PRINTING_PRINTED_PAGES_SOURCE_H_
-
-#include "base/strings/string16.h"
-
-namespace printing {
-
-// Source of printed pages.
-class PrintedPagesSource {
- public:
- // Returns the document title.
- virtual base::string16 RenderSourceName() = 0;
-
- protected:
- virtual ~PrintedPagesSource() {}
-};
-
-} // namespace printing
-
-#endif // PRINTING_PRINTED_PAGES_SOURCE_H_
diff --git a/chromium/printing/printing_context.h b/chromium/printing/printing_context.h
index 7054654260a..03f940ca468 100644
--- a/chromium/printing/printing_context.h
+++ b/chromium/printing/printing_context.h
@@ -112,7 +112,7 @@ class PRINTING_EXPORT PrintingContext {
virtual void ReleaseContext() = 0;
// Returns the native context used to print.
- virtual skia::NativeDrawingContext context() const = 0;
+ virtual printing::NativeDrawingContext context() const = 0;
// Creates an instance of this object. Implementers of this interface should
// implement this method to create an object of their implementation.
diff --git a/chromium/printing/printing_context_android.cc b/chromium/printing/printing_context_android.cc
index 9a2b337101c..8957481a294 100644
--- a/chromium/printing/printing_context_android.cc
+++ b/chromium/printing/printing_context_android.cc
@@ -239,7 +239,7 @@ void PrintingContextAndroid::ReleaseContext() {
// Intentional No-op.
}
-skia::NativeDrawingContext PrintingContextAndroid::context() const {
+printing::NativeDrawingContext PrintingContextAndroid::context() const {
// Intentional No-op.
return nullptr;
}
diff --git a/chromium/printing/printing_context_android.h b/chromium/printing/printing_context_android.h
index 862ee75397b..78aa762309c 100644
--- a/chromium/printing/printing_context_android.h
+++ b/chromium/printing/printing_context_android.h
@@ -52,7 +52,7 @@ class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
- skia::NativeDrawingContext context() const override;
+ printing::NativeDrawingContext context() const override;
private:
base::android::ScopedJavaGlobalRef<jobject> j_printing_context_;
diff --git a/chromium/printing/printing_context_chromeos.cc b/chromium/printing/printing_context_chromeos.cc
index 794ee0103bd..4dab9d517fa 100644
--- a/chromium/printing/printing_context_chromeos.cc
+++ b/chromium/printing/printing_context_chromeos.cc
@@ -370,7 +370,7 @@ void PrintingContextChromeos::ReleaseContext() {
printer_.reset();
}
-skia::NativeDrawingContext PrintingContextChromeos::context() const {
+printing::NativeDrawingContext PrintingContextChromeos::context() const {
// Intentional No-op.
return nullptr;
}
diff --git a/chromium/printing/printing_context_chromeos.h b/chromium/printing/printing_context_chromeos.h
index eec0e38a23d..34e48b31581 100644
--- a/chromium/printing/printing_context_chromeos.h
+++ b/chromium/printing/printing_context_chromeos.h
@@ -37,7 +37,7 @@ class PRINTING_EXPORT PrintingContextChromeos : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
- skia::NativeDrawingContext context() const override;
+ printing::NativeDrawingContext context() const override;
Result StreamData(const std::vector<char>& buffer);
diff --git a/chromium/printing/printing_context_linux.cc b/chromium/printing/printing_context_linux.cc
index 58ee3096e3c..dadafb4bf46 100644
--- a/chromium/printing/printing_context_linux.cc
+++ b/chromium/printing/printing_context_linux.cc
@@ -182,7 +182,7 @@ void PrintingContextLinux::ReleaseContext() {
// Intentional No-op.
}
-skia::NativeDrawingContext PrintingContextLinux::context() const {
+printing::NativeDrawingContext PrintingContextLinux::context() const {
// Intentional No-op.
return NULL;
}
diff --git a/chromium/printing/printing_context_linux.h b/chromium/printing/printing_context_linux.h
index 2ca0fe66067..6df120493e8 100644
--- a/chromium/printing/printing_context_linux.h
+++ b/chromium/printing/printing_context_linux.h
@@ -52,7 +52,7 @@ class PRINTING_EXPORT PrintingContextLinux : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
- skia::NativeDrawingContext context() const override;
+ printing::NativeDrawingContext context() const override;
private:
base::string16 document_name_;
diff --git a/chromium/printing/printing_context_mac.h b/chromium/printing/printing_context_mac.h
index df82379a5fd..5cfb9e6aece 100644
--- a/chromium/printing/printing_context_mac.h
+++ b/chromium/printing/printing_context_mac.h
@@ -38,7 +38,7 @@ class PRINTING_EXPORT PrintingContextMac : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
- skia::NativeDrawingContext context() const override;
+ printing::NativeDrawingContext context() const override;
private:
// Initializes PrintSettings from |print_info_|. This must be called
diff --git a/chromium/printing/printing_context_mac.mm b/chromium/printing/printing_context_mac.mm
index e544210ce04..fc30adaea80 100644
--- a/chromium/printing/printing_context_mac.mm
+++ b/chromium/printing/printing_context_mac.mm
@@ -505,7 +505,7 @@ void PrintingContextMac::ReleaseContext() {
context_ = NULL;
}
-skia::NativeDrawingContext PrintingContextMac::context() const {
+printing::NativeDrawingContext PrintingContextMac::context() const {
return context_;
}
diff --git a/chromium/printing/printing_context_no_system_dialog.cc b/chromium/printing/printing_context_no_system_dialog.cc
index 6340c3e3625..b67c68ef4de 100644
--- a/chromium/printing/printing_context_no_system_dialog.cc
+++ b/chromium/printing/printing_context_no_system_dialog.cc
@@ -138,7 +138,7 @@ void PrintingContextNoSystemDialog::ReleaseContext() {
// Intentional No-op.
}
-skia::NativeDrawingContext PrintingContextNoSystemDialog::context() const {
+printing::NativeDrawingContext PrintingContextNoSystemDialog::context() const {
// Intentional No-op.
return nullptr;
}
diff --git a/chromium/printing/printing_context_no_system_dialog.h b/chromium/printing/printing_context_no_system_dialog.h
index 6ce0639cd30..2bd91c50010 100644
--- a/chromium/printing/printing_context_no_system_dialog.h
+++ b/chromium/printing/printing_context_no_system_dialog.h
@@ -33,7 +33,7 @@ class PRINTING_EXPORT PrintingContextNoSystemDialog : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
- skia::NativeDrawingContext context() const override;
+ printing::NativeDrawingContext context() const override;
private:
DISALLOW_COPY_AND_ASSIGN(PrintingContextNoSystemDialog);
diff --git a/chromium/printing/printing_context_win.cc b/chromium/printing/printing_context_win.cc
index cc48c782634..402d55f5036 100644
--- a/chromium/printing/printing_context_win.cc
+++ b/chromium/printing/printing_context_win.cc
@@ -200,18 +200,17 @@ PrintingContext::Result PrintingContextWin::UpdatePrinterSettings(
const PrintSettings::RequestedMedia& requested_media =
settings_.requested_media();
- static const int kFromUm = 100; // Windows uses 0.1mm.
- int width = requested_media.size_microns.width() / kFromUm;
- int height = requested_media.size_microns.height() / kFromUm;
unsigned id = 0;
- if (base::StringToUint(requested_media.vendor_id, &id) && id) {
+ // If the paper size is a custom user size, setting by ID may not work.
+ if (base::StringToUint(requested_media.vendor_id, &id) && id &&
+ id < DMPAPER_USER) {
dev_mode->dmFields |= DM_PAPERSIZE;
dev_mode->dmPaperSize = static_cast<short>(id);
- } else if (width > 0 && height > 0) {
- dev_mode->dmFields |= DM_PAPERWIDTH;
- dev_mode->dmPaperWidth = width;
- dev_mode->dmFields |= DM_PAPERLENGTH;
- dev_mode->dmPaperLength = height;
+ } else if (!requested_media.size_microns.IsEmpty()) {
+ static constexpr int kFromUm = 100; // Windows uses 0.1mm.
+ dev_mode->dmFields |= DM_PAPERWIDTH | DM_PAPERLENGTH;
+ dev_mode->dmPaperWidth = requested_media.size_microns.width() / kFromUm;
+ dev_mode->dmPaperLength = requested_media.size_microns.height() / kFromUm;
}
}
@@ -334,7 +333,7 @@ void PrintingContextWin::ReleaseContext() {
}
}
-skia::NativeDrawingContext PrintingContextWin::context() const {
+printing::NativeDrawingContext PrintingContextWin::context() const {
return context_;
}
diff --git a/chromium/printing/printing_context_win.h b/chromium/printing/printing_context_win.h
index e6f4ad0f0c3..f41dcbaecc0 100644
--- a/chromium/printing/printing_context_win.h
+++ b/chromium/printing/printing_context_win.h
@@ -41,7 +41,7 @@ class PRINTING_EXPORT PrintingContextWin : public PrintingContext {
Result DocumentDone() override;
void Cancel() override;
void ReleaseContext() override;
- skia::NativeDrawingContext context() const override;
+ printing::NativeDrawingContext context() const override;
protected:
static HWND GetRootWindow(gfx::NativeView view);
diff --git a/chromium/printing/pwg_raster_settings.h b/chromium/printing/pwg_raster_settings.h
index 9ae2baa33a0..46f0b550f68 100644
--- a/chromium/printing/pwg_raster_settings.h
+++ b/chromium/printing/pwg_raster_settings.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef PRINTING_BITMAP_TRANSFORM_SETTINGS_H_
-#define PRINTING_BITMAP_TRANSFORM_SETTINGS_H_
+#ifndef PRINTING_PWG_RASTER_SETTINGS_H_
+#define PRINTING_PWG_RASTER_SETTINGS_H_
namespace printing {
@@ -26,4 +26,4 @@ struct PwgRasterSettings {
} // namespace printing
-#endif // PRINTING_BITMAP_TRANSFORM_SETTINGS_H_
+#endif // PRINTING_PWG_RASTER_SETTINGS_H_