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

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

Issue 8619009: Fix print preview control button order for views. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 PrintHeader object. This object encapsulates all the elements 9 * Creates a PrintHeader object. This object encapsulates all the elements
10 * and logic related to the top part of the left pane in print_preview.html. 10 * and logic related to the top part of the left pane in print_preview.html.
11 * @constructor 11 * @constructor
12 */ 12 */
13 function PrintHeader() { 13 function PrintHeader() {
14 // Reverse the button strip for views. See the documentation of
15 // reverseButtonStrip_() for an explanation of why this is necessary.
16 // Do this early so the reversal is not visible.
17 if (cr.isViews)
18 this.reverseButtonStrip_();
19
14 this.printButton_ = $('print-button'); 20 this.printButton_ = $('print-button');
15 this.cancelButton_ = $('cancel-button'); 21 this.cancelButton_ = $('cancel-button');
16 this.summary_ = $('print-summary'); 22 this.summary_ = $('print-summary');
17 this.printButton_.focus(); 23 this.printButton_.focus();
18 this.addEventListeners_(); 24 this.addEventListeners_();
19 } 25 }
20 26
21 cr.addSingletonGetter(PrintHeader); 27 cr.addSingletonGetter(PrintHeader);
22 28
23 PrintHeader.prototype = { 29 PrintHeader.prototype = {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } else { 161 } else {
156 html = localStrings.getStringF('printPreviewSummaryFormatShort', 162 html = localStrings.getStringF('printPreviewSummaryFormatShort',
157 '<b>' + numOfSheets + '</b>', 163 '<b>' + numOfSheets + '</b>',
158 '<b>' + summaryLabel + '</b>'); 164 '<b>' + summaryLabel + '</b>');
159 } 165 }
160 166
161 // Removing extra spaces from within the string. 167 // Removing extra spaces from within the string.
162 html = html.replace(/\s{2,}/g, ' '); 168 html = html.replace(/\s{2,}/g, ' ');
163 this.summary_.innerHTML = html; 169 this.summary_.innerHTML = html;
164 }, 170 },
171
172 /**
173 * Reverses the child elements of a button strip. This is necessary because
174 * WebKit does not alter the tab order for elements that are visually
175 * reversed using -webkit-box-direction: reverse, and the button order is
176 * reversed for views. See https://bugs.webkit.org/show_bug.cgi?id=62664
177 * for more information.
178 * @private
179 */
180 reverseButtonStrip_: function() {
181 var buttonStrips = document.querySelectorAll('.button-strip');
182
183 // Reverse all button-strips in the overlay.
184 for (var j = 0; j < buttonStrips.length; j++) {
185 var buttonStrip = buttonStrips[j];
186
187 var childNodes = buttonStrip.childNodes;
188 for (var i = childNodes.length - 1; i >= 0; i--)
189 buttonStrip.appendChild(childNodes[i]);
190 }
191 },
165 }; 192 };
166 193
167 return { 194 return {
168 PrintHeader: PrintHeader, 195 PrintHeader: PrintHeader,
169 }; 196 };
170 }); 197 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698