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

Side by Side Diff: chrome/browser/resources/print_preview/header_footer_settings.js

Issue 10083060: [Print Preview]: Added code to support pdf fit to page functionality. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Creates a HeaderFooterSettings object. This object encapsulates all 9 * Creates a HeaderFooterSettings object. This object encapsulates all
10 * settings and logic related to the headers and footers checkbox. 10 * settings and logic related to the headers and footers checkbox.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 var pageHeight = pageLayout.marginTop + pageLayout.marginBottom + 69 var pageHeight = pageLayout.marginTop + pageLayout.marginBottom +
70 pageLayout.contentHeight; 70 pageLayout.contentHeight;
71 headerFooterApplies = 71 headerFooterApplies =
72 (pageLayout.marginTop > pageLayout.printableAreaY) || 72 (pageLayout.marginTop > pageLayout.printableAreaY) ||
73 (pageLayout.marginBottom > 73 (pageLayout.marginBottom >
74 (pageHeight - pageLayout.printableAreaY - 74 (pageHeight - pageLayout.printableAreaY -
75 pageLayout.printableAreaHeight)); 75 pageLayout.printableAreaHeight));
76 } 76 }
77 } 77 }
78 this.setVisible_(headerFooterApplies); 78 this.setVisible_(headerFooterApplies);
79 var headerFooterEvent = new cr.Event(
80 customEvents.HEADER_FOOTER_VISIBILITY_CHANGED);
81 headerFooterEvent.headerFooterApplies = headerFooterApplies;
82 document.dispatchEvent(headerFooterEvent);
79 }, 83 },
80 84
81 /** 85 /**
82 * Adding listeners to header footer related controls. 86 * Adding listeners to header footer related controls.
83 * @private 87 * @private
84 */ 88 */
85 addEventListeners_: function() { 89 addEventListeners_: function() {
86 this.headerFooterCheckbox_.onclick = 90 this.headerFooterCheckbox_.onclick =
87 this.onHeaderFooterChanged_.bind(this); 91 this.onHeaderFooterChanged_.bind(this);
88 document.addEventListener(customEvents.PDF_LOADED, 92 document.addEventListener(customEvents.PDF_LOADED,
(...skipping 12 matching lines...) Expand all
101 /** 105 /**
102 * Listener executing when a |customEvents.PDF_LOADED| event occurs. 106 * Listener executing when a |customEvents.PDF_LOADED| event occurs.
103 * @private 107 * @private
104 */ 108 */
105 onPDFLoaded_: function() { 109 onPDFLoaded_: function() {
106 if (!previewModifiable) 110 if (!previewModifiable)
107 this.setVisible_(false); 111 this.setVisible_(false);
108 }, 112 },
109 113
110 /** 114 /**
111 * Hides or shows |this.headerFooterOption|. 115 * Hides or shows |this.headerFooterOption_|.
112 * @param {boolean} visible True if |this.headerFooterOption| should be 116 * @param {boolean} visible True if |this.headerFooterOption_| should be
113 * shown. 117 * shown.
114 * @private 118 * @private
115 */ 119 */
116 setVisible_: function(visible) { 120 setVisible_: function(visible) {
117 if (visible) 121 this.headerFooterOption_.style.display = visible ? 'block' : 'none';
118 fadeInOption(this.headerFooterOption_); 122 },
119 else
120 fadeOutOption(this.headerFooterOption_);
121 }
122 }; 123 };
123 124
124 return { 125 return {
125 HeaderFooterSettings: HeaderFooterSettings 126 HeaderFooterSettings: HeaderFooterSettings
126 }; 127 };
127 }); 128 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698