Index: third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js |
index 85d2040e550fe29dcce988460ea7f8ff9ecbb32a..f75151c7d556d54b6124bbb209e9bff3610378dc 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js |
+++ b/third_party/WebKit/Source/devtools/front_end/sources/SourcesNavigator.js |
@@ -143,6 +143,10 @@ WebInspector.SourcesNavigatorView = function() |
{ |
WebInspector.NavigatorView.call(this); |
WebInspector.targetManager.addEventListener(WebInspector.TargetManager.Events.InspectedURLChanged, this._inspectedURLChanged, this); |
+ this.element.addEventListener("blur", this._handleBlur.bind(this), true); |
+ this.element.addEventListener("click", this._handleClick.bind(this), true); |
+ |
+ this._scriptsTree.addEventListener(TreeOutline.Events.FilterChanged, this._handleFilterChange.bind(this)); |
} |
WebInspector.SourcesNavigatorView.prototype = { |
@@ -159,6 +163,74 @@ WebInspector.SourcesNavigatorView.prototype = { |
}, |
/** |
+ * @param {!Event} event |
+ */ |
+ _handleClick: function (event){ |
+ // remove filter |
lushnikov
2016/03/14 20:56:38
we usually don't put comments in the code unless i
|
+ this._scriptsTree.setCurrentSelectionFilterString(''); |
+ }, |
+ |
+ /** |
+ * @param {!Event} event |
+ */ |
+ _handleBlur: function (event) { |
+ // remove filter |
+ this._scriptsTree.setCurrentSelectionFilterString(''); |
+ }, |
+ |
+ /** |
+ * Does the highlighting for for when the filter changes |
lushnikov
2016/03/14 20:56:37
ditto
|
+ * @param {!WebInspector.Event} event |
+ */ |
+ _handleFilterChange: function (event){ |
lushnikov
2016/03/14 20:56:37
style: no space after "function"
style: the { shou
|
+ var node = this._rootNode.treeNode(); |
+ |
+ if (node){ |
lushnikov
2016/03/14 20:56:38
style: space before {
|
+ var treeOutline = event.data.treeOutline; |
+ if (!treeOutline.selectedTreeElement.selectable) { |
+ treeOutline.selectNext() || treeOutline.selectPrevious(); |
lushnikov
2016/03/14 20:56:37
Style: we don't use {} for a one-line statements.
|
+ } |
+ |
+ do { |
+ if (node.titleText !== null) { |
+ let titleText = node.titleText; |
lushnikov
2016/03/14 20:56:37
we haven't been using LET and don't have a policy
|
+ if (typeof titleText !== 'string'){ |
+ titleText = titleText.textContent; |
+ } |
+ if (event.data.changeTo === null) { |
lushnikov
2016/03/14 20:56:38
let's extract event.data and typecast it to the co
|
+ node.title = titleText; |
+ } else { |
+ let newExp = new RegExp(event.data.changeTo.source, 'gi'); |
+ if (node.title) { |
+ let parentSpan = createElementWithClass("span", "tree-element-title"); |
+ let match; |
+ let offsetStart = 0; |
+ while((match = newExp.exec(titleText)) !== null){ |
+ let leftSpan = createElementWithClass("span"), |
+ midSpan = createElementWithClass("span", "navigator-tree-item-highlight"); |
+ |
+ leftSpan.textContent = titleText.substring(offsetStart, match.index); |
+ parentSpan.appendChild(leftSpan); |
+ midSpan.textContent = titleText.substr(match.index, match[0].length); |
+ parentSpan.appendChild(midSpan); |
+ |
+ offsetStart = match.index + match[0].length; |
+ } |
+ if (offsetStart !== titleText.length) { |
+ let rightSpan = createElementWithClass("span"); |
+ rightSpan.textContent = titleText.substr(offsetStart); |
+ parentSpan.appendChild(rightSpan); |
+ } |
+ node.title = parentSpan; |
+ } |
+ } |
+ } |
+ node = node.traverseNextTreeElement(true, null, true); |
+ }while(node); |
+ } |
+ }, |
+ |
+ /** |
* @param {!WebInspector.Event} event |
*/ |
_inspectedURLChanged: function(event) |