Index: third_party/polymer/v0_8/components-chromium/paper-toolbar/paper-toolbar-extracted.js |
diff --git a/third_party/polymer/v0_8/components-chromium/paper-toolbar/paper-toolbar-extracted.js b/third_party/polymer/v0_8/components-chromium/paper-toolbar/paper-toolbar-extracted.js |
index 55efea9d8a1673ee4399262b2fb693ec340fb26c..1dc94c5d431d63c608958c4f967e634585c91d2e 100644 |
--- a/third_party/polymer/v0_8/components-chromium/paper-toolbar/paper-toolbar-extracted.js |
+++ b/third_party/polymer/v0_8/components-chromium/paper-toolbar/paper-toolbar-extracted.js |
@@ -19,7 +19,9 @@ |
is: 'paper-toolbar', |
- enableCustomStyleProperties: true, |
+ hostAttributes: { |
+ 'role': 'toolbar' |
+ }, |
properties: { |
@@ -66,6 +68,50 @@ |
}, |
+ attached: function() { |
+ this._observer = this._observe(this); |
+ this._updateAriaLabelledBy(); |
+ }, |
+ |
+ detached: function() { |
+ if (this._observer) { |
+ this._observer.disconnect(); |
+ } |
+ }, |
+ |
+ _observe: function(node) { |
+ var observer = new MutationObserver(function() { |
+ this._updateAriaLabelledBy(); |
+ }.bind(this)); |
+ observer.observe(node, { |
+ childList: true, |
+ subtree: true |
+ }); |
+ return observer; |
+ }, |
+ |
+ _updateAriaLabelledBy: function() { |
+ var labelledBy = []; |
+ var contents = Polymer.dom(this.root).querySelectorAll('content'); |
+ for (var content, index = 0; content = contents[index]; index++) { |
+ var nodes = Polymer.dom(content).getDistributedNodes(); |
+ for (var node, jndex = 0; node = nodes[jndex]; jndex++) { |
+ if (node.hasAttribute && node.hasAttribute('title')) { |
+ if (node.id) { |
+ labelledBy.push(node.id); |
+ } else { |
+ var id = 'paper-toolbar-label-' + Math.floor(Math.random() * 10000); |
+ node.id = id; |
+ labelledBy.push(id); |
+ } |
+ } |
+ } |
+ } |
+ if (labelledBy.length > 0) { |
+ this.setAttribute('aria-labelledby', labelledBy.join(' ')); |
+ } |
+ }, |
+ |
_computeBarClassName: function(barJustify) { |
var classObj = { |
center: true, |