| Index: ui/webui/resources/js/cr/ui/node_utils.js
|
| diff --git a/ui/webui/resources/js/cr/ui/node_utils.js b/ui/webui/resources/js/cr/ui/node_utils.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a380670e4f31d07968325abddf25797016aa8da7
|
| --- /dev/null
|
| +++ b/ui/webui/resources/js/cr/ui/node_utils.js
|
| @@ -0,0 +1,33 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +cr.exportPath('cr.ui');
|
| +
|
| +/**
|
| + * Reverse the child elements of any found button strips if they haven't already
|
| + * been reversed. This is necessary because WebKit does not alter the tab order
|
| + * for elements that are visually reversed using flex-direction: reverse, and
|
| + * the button order is reversed for views. See http://webk.it/62664 for more
|
| + * information.
|
| + * @param {Node=} opt_root Starting point for button strips to reverse.
|
| + */
|
| +cr.ui.reverseButtonStrips = function(opt_root) {
|
| + if (!(cr.isWindows || cr.isChromeOS)) {
|
| + // Only reverse on platforms that need it (differ from the HTML order).
|
| + return;
|
| + }
|
| +
|
| + var root = opt_root || document;
|
| + var buttonStrips = root.querySelectorAll('.button-strip:not([reversed])');
|
| + 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]);
|
| + }
|
| +
|
| + buttonStrip.setAttribute('reversed', '');
|
| + }
|
| +};
|
|
|