summaryrefslogtreecommitdiffstats
path: root/printing/print_settings_initializer.cc
diff options
context:
space:
mode:
authorvitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-13 06:21:54 +0000
committervitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-13 06:21:54 +0000
commit0205b685e499c28df47b665464f65fd03af1e335 (patch)
treefd9c8c1ffa82ce355fc48022a8d6726294dcc964 /printing/print_settings_initializer.cc
parente86b609fb7cae0b0b4bdf77e47db015ba8cffd58 (diff)
downloadchromium_src-0205b685e499c28df47b665464f65fd03af1e335.zip
chromium_src-0205b685e499c28df47b665464f65fd03af1e335.tar.gz
chromium_src-0205b685e499c28df47b665464f65fd03af1e335.tar.bz2
Print headers and footers with WebKit.
Old implementation with gfx::RenderText had issues with fallback fonts. Sandbox does not allow to read required information from registry. Also WebKit inplementation is smaller and more readable. BUG=152893, 108599, 133548 TEST=manual: make sure that main content with or without headers is in the same place (default margin is exception). Make sure that any custom margins and paper layout produce reasonable result. If margins are to small, header and footer should be hidden. Review URL: https://chromiumcodereview.appspot.com/11359020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167311 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/print_settings_initializer.cc')
-rw-r--r--printing/print_settings_initializer.cc25
1 files changed, 3 insertions, 22 deletions
diff --git a/printing/print_settings_initializer.cc b/printing/print_settings_initializer.cc
index e82bbfc..c49a556 100644
--- a/printing/print_settings_initializer.cc
+++ b/printing/print_settings_initializer.cc
@@ -35,34 +35,15 @@ void PrintSettingsInitializer::InitHeaderFooterStrings(
string16 date = base::TimeFormatShortDateNumeric(base::Time::Now());
string16 title;
- std::string url;
+ string16 url;
if (!job_settings.GetString(kSettingHeaderFooterTitle, &title) ||
!job_settings.GetString(kSettingHeaderFooterURL, &url)) {
NOTREACHED();
}
- gfx::Font font(
- kSettingHeaderFooterFontName,
- ceil(ConvertPointsToPixelDouble(kSettingHeaderFooterFontSize)));
- double segment_width = GetHeaderFooterSegmentWidth(ConvertUnitDouble(
- print_settings->page_setup_device_units().physical_size().width(),
- print_settings->device_units_per_inch(), kPixelsPerInch));
- date = ui::ElideText(date, font, segment_width, ui::ELIDE_AT_END);
print_settings->date = date;
-
- // Calculate the available title width. If the date string is not long
- // enough, increase the available space for the title.
- // Assumes there is no header text to RIGHT of title.
- double date_width = font.GetStringWidth(date);
- double max_title_width = std::min(2 * segment_width,
- 2 * (segment_width - date_width) +
- segment_width);
- print_settings->title =
- ui::ElideText(title, font, max_title_width, ui::ELIDE_AT_END);
-
- double max_url_width = 2 * segment_width;
- GURL gurl(url);
- print_settings->url = ui::ElideUrl(gurl, font, max_url_width, std::string());
+ print_settings->title = title;
+ print_settings->url = ui::ElideUrl(GURL(url), gfx::Font(), 0, std::string());
}
} // namespace printing