Index: chrome/browser/resources/print_preview/print_preview_page.html |
diff --git a/chrome/browser/resources/print_preview/print_preview_page.html b/chrome/browser/resources/print_preview/print_preview_page.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3d9636f8e4f1f322370d24eb7c50838838d41084 |
--- /dev/null |
+++ b/chrome/browser/resources/print_preview/print_preview_page.html |
@@ -0,0 +1,118 @@ |
+<!DOCTYPE html> |
+<style> |
Toscano
2012/11/02 19:30:42
Can you wrap the <style> and <script> elements in
Toscano
2012/11/02 19:30:42
Can you alpha sort all of the CSS properties withi
Vitaly Buka (NO REVIEWS)
2012/11/02 21:28:14
Done.
Vitaly Buka (NO REVIEWS)
2012/11/02 21:28:14
Done.
|
+ body { |
+ margin: 0px; |
+ height: 50.0000px; |
Toscano
2012/11/02 19:30:42
Why all the extra 0s after the decimal?
Vitaly Buka (NO REVIEWS)
2012/11/02 21:28:14
Done.
|
+ width: 50.0000px; |
+ } |
+ .row { |
+ display: table-row; |
+ vertical-align: inherit; |
+ } |
+ #header, #footer { |
+ display: table; |
+ table-layout:fixed; |
+ width: inherit; |
+ } |
+ #header { |
+ height: 5%; |
+ vertical-align: top; |
+ } |
+ #content { |
+ height: 3%; |
+ } |
+ #footer { |
+ height: 92%; |
+ vertical-align: bottom; |
+ } |
+ .text { |
+ !border-style: solid; |
+ display: table-cell; |
+ vertical-align: inherit; |
+ font-size: 14px; |
+ font-family: Sans; |
+ white-space: nowrap; |
+ padding-right: 0.5cm; |
+ padding-left: 0.5cm; |
+ } |
+ #page_number { |
+ text-align: right; |
+ } |
+ #title { |
+ text-align: center; |
+ } |
+ #title, #url { |
+ text-overflow: ellipsis; |
+ overflow: hidden; |
+ } |
+ #title, #date { |
+ padding-top: 0.5cm; |
+ padding-bottom: 0cm; |
+ } |
+ #page_number, #url { |
+ padding-bottom: 0.5cm; |
+ padding-top: 0cm; |
+ } |
+</style> |
+<script> |
Toscano
2012/11/02 19:30:42
Java script should use single quotes, please be co
Vitaly Buka (NO REVIEWS)
2012/11/02 21:28:14
Done.
|
+ |
+function $(o) {return document.getElementById(o);} |
Toscano
2012/11/02 19:30:42
Instead of using this, plz use document.querySelec
Vitaly Buka (NO REVIEWS)
2012/11/02 21:28:14
Done.
|
+ |
+function getTextSpan(id) { |
+ var element = $(id); |
+ if (element.getElementsByTagName("span").length == 0) { |
+ span = document.createElement('span'); |
+ element.appendChild(span); |
+ } |
+ return element.getElementsByTagName("span")[0]; |
+} |
+ |
+function pixels(value) { |
+ return value + "px"; |
+} |
+ |
+function setup(options) { |
+ texts = document.getElementsByClassName("text"); |
+ for (var i = 0; i < texts.length; ++i) |
+ texts[i].style.fontSize = pixels(options["fontSize"]); |
Toscano
2012/11/02 19:30:42
Instead of iterating over all of the text elements
Vitaly Buka (NO REVIEWS)
2012/11/02 21:28:14
Done.
|
+ document["body"].style.height = pixels(options["height"]); |
Toscano
2012/11/02 19:30:42
I believe you can set offsetHeight and offsetWidth
Vitaly Buka (NO REVIEWS)
2012/11/02 21:28:14
Does not work.
On 2012/11/02 19:30:42, Toscano wro
|
+ document["body"].style.width = pixels(options["width"]); |
+ $("header").style.height = pixels(options["topMargin"]); |
+ var content_height = |
+ options["height"] - options["topMargin"] - options["bottomMargin"]; |
+ $("content").style.height = pixels(content_height); |
+ $("footer").style.height = pixels(options["bottomMargin"]); |
+ |
+ getTextSpan("date").innerText = options["date"]; |
Toscano
2012/11/02 19:30:42
Please use querySelector instead of this method.
Vitaly Buka (NO REVIEWS)
2012/11/02 21:28:14
Done.
|
+ getTextSpan("title").innerText = options["title"]; |
+ $("date").style.width = pixels(getTextSpan("date").offsetWidth); |
+ |
+ getTextSpan("url").innerText = options["url"]; |
+ getTextSpan("page_number").innerText = options["pageNumber"]; |
+ $("page_number").style.width = pixels(getTextSpan("page_number").offsetWidth); |
+ |
+ // Hide text if it didn't fit into expected margins. |
+ if ($("header").offsetHeight > options["topMargin"] + 1 || |
+ $("footer").offsetHeight > options["bottomMargin"] + 1) { |
+ $("header").style.display = "none"; |
+ $("footer").style.display = "none"; |
+ } |
+} |
+</script> |
+<body> |
+ <div id="header"> |
+ <div class="row"> |
+ <div id="date" class="text"></div> |
+ <div id="title" class="text"></div> |
+ </div> |
+ </div> |
+ <div id="content"> |
+ </div> |
+ <div id="footer"> |
+ <div class="row"> |
+ <div id="url" class="text"></div> |
+ <div id="page_number" class="text"></div> |
+ </div> |
+ </div> |
+</body> |
+</html> |