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

Unified Diff: third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js

Issue 2200893003: DevTools: Add autocomplete for ARIA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: skip_compilation Created 4 years, 4 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/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js b/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js
index 0a6a22ab7fd1fd3efbc906ca4b538fff10f1f488..d740036c7e4d72f06de3663c4b2e5a092dfcce0a 100644
--- a/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js
+++ b/third_party/WebKit/Source/devtools/front_end/accessibility/ARIAAttributesView.js
@@ -134,7 +134,7 @@ WebInspector.ARIAAttributesTreeElement.prototype = {
this._editingCommitted(text, previousContent);
}
- this._prompt = new WebInspector.ARIAAttributesPane.ARIAAttributePrompt(this);
+ this._prompt = new WebInspector.ARIAAttributesPane.ARIAAttributePrompt(WebInspector.ariaMetadata().valuesForProperty(this._nameElement.textContent), this);
this._prompt.setAutocompletionTimeout(0);
var proxyElement = this._prompt.attachAndStartEditing(valueElement, blurListener.bind(this, previousContent));
@@ -209,14 +209,17 @@ WebInspector.ARIAAttributesTreeElement.createARIAValueElement = function(value)
/**
* @constructor
- * TODO: completions; see StylesSidebarPane.js
* @extends {WebInspector.TextPrompt}
+ * @param {!Array<string>} ariaCompletions
* @param {!WebInspector.ARIAAttributesTreeElement} treeElement
*/
-WebInspector.ARIAAttributesPane.ARIAAttributePrompt = function(treeElement)
+WebInspector.ARIAAttributesPane.ARIAAttributePrompt = function(ariaCompletions, treeElement)
{
WebInspector.TextPrompt.call(this, this._buildPropertyCompletions.bind(this));
+ this.setSuggestBoxEnabled(true);
+
+ this._ariaCompletions = ariaCompletions;
this._treeElement = treeElement;
};
@@ -229,8 +232,15 @@ WebInspector.ARIAAttributesPane.ARIAAttributePrompt.prototype = {
*/
_buildPropertyCompletions: function(proxyElement, wordRange, force, completionsReadyCallback)
{
- // TODO(aboxhall): replace placeholder implementation with real implementation
- completionsReadyCallback([], 0);
+ var prefix = wordRange.toString().toLowerCase();
+ if (!prefix && !force && (this._isEditingName || proxyElement.textContent.length)) {
+ completionsReadyCallback([]);
+ return;
+ }
+
+ var results = this._ariaCompletions.filter((value) => value.startsWith(prefix));
+
+ completionsReadyCallback(results, 0);
},
__proto__: WebInspector.TextPrompt.prototype

Powered by Google App Engine
This is Rietveld 408576698