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

Unified Diff: third_party/polymer/v0_8/components-chromium/paper-toolbar/paper-toolbar-extracted.js

Issue 1162563004: Upgrade to 1.0 and switch clients to dom-repeat where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a layout import and remove the gzipped webanimation in reproduce.sh Created 5 years, 7 months 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: 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,

Powered by Google App Engine
This is Rietveld 408576698