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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/print_preview/print_header.js
===================================================================
--- chrome/browser/resources/print_preview/print_header.js (revision 110971)
+++ chrome/browser/resources/print_preview/print_header.js (working copy)
@@ -11,6 +11,12 @@
* @constructor
*/
function PrintHeader() {
+ // Reverse the button strip for views. See the documentation of
+ // reverseButtonStrip_() for an explanation of why this is necessary.
+ // Do this early so the reversal is not visible.
+ if (cr.isViews)
+ this.reverseButtonStrip_();
+
this.printButton_ = $('print-button');
this.cancelButton_ = $('cancel-button');
this.summary_ = $('print-summary');
@@ -162,6 +168,27 @@
html = html.replace(/\s{2,}/g, ' ');
this.summary_.innerHTML = html;
},
+
+ /**
+ * Reverses the child elements of a button strip. This is necessary because
+ * WebKit does not alter the tab order for elements that are visually
+ * reversed using -webkit-box-direction: reverse, and the button order is
+ * reversed for views. See https://bugs.webkit.org/show_bug.cgi?id=62664
+ * for more information.
+ * @private
+ */
+ reverseButtonStrip_: function() {
+ var buttonStrips = document.querySelectorAll('.button-strip');
+
+ // Reverse all button-strips in the overlay.
+ for (var j = 0; j < buttonStrips.length; j++) {
+ var buttonStrip = buttonStrips[j];
+
+ var childNodes = buttonStrip.childNodes;
+ for (var i = childNodes.length - 1; i >= 0; i--)
+ buttonStrip.appendChild(childNodes[i]);
+ }
+ },
};
return {

Powered by Google App Engine
This is Rietveld 408576698