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 { |