| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> | 3 * Copyright (C) 2008 Matt Lilek <webkit@mattlilek.com> |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 */ | 624 */ |
| 625 supportsRegexSearch() { | 625 supportsRegexSearch() { |
| 626 return false; | 626 return false; |
| 627 } | 627 } |
| 628 | 628 |
| 629 _highlightCurrentSearchResult() { | 629 _highlightCurrentSearchResult() { |
| 630 var index = this._currentSearchResultIndex; | 630 var index = this._currentSearchResultIndex; |
| 631 var searchResults = this._searchResults; | 631 var searchResults = this._searchResults; |
| 632 var searchResult = searchResults[index]; | 632 var searchResult = searchResults[index]; |
| 633 | 633 |
| 634 if (searchResult.node === null) { | 634 this._searchableView.updateCurrentMatchIndex(index); |
| 635 this._searchableView.updateCurrentMatchIndex(index); | 635 if (searchResult.node === null) |
| 636 return; | 636 return; |
| 637 } | |
| 638 | 637 |
| 639 /** | 638 /** |
| 640 * @param {?SDK.DOMNode} node | 639 * @param {?SDK.DOMNode} node |
| 641 * @this {Elements.ElementsPanel} | 640 * @this {Elements.ElementsPanel} |
| 642 */ | 641 */ |
| 643 function searchCallback(node) { | 642 function searchCallback(node) { |
| 644 searchResult.node = node; | 643 searchResult.node = node; |
| 645 this._highlightCurrentSearchResult(); | 644 this._highlightCurrentSearchResult(); |
| 646 } | 645 } |
| 647 | 646 |
| 648 if (typeof searchResult.node === 'undefined') { | 647 if (typeof searchResult.node === 'undefined') { |
| 649 // No data for slot, request it. | 648 // No data for slot, request it. |
| 650 searchResult.domModel.searchResult(searchResult.index, searchCallback.bind
(this)); | 649 searchResult.domModel.searchResult(searchResult.index, searchCallback.bind
(this)); |
| 651 return; | 650 return; |
| 652 } | 651 } |
| 653 | 652 |
| 654 this._searchableView.updateCurrentMatchIndex(index); | |
| 655 | |
| 656 var treeElement = this._treeElementForNode(searchResult.node); | 653 var treeElement = this._treeElementForNode(searchResult.node); |
| 657 if (treeElement) { | 654 if (treeElement) { |
| 658 treeElement.highlightSearchResults(this._searchConfig.query); | 655 treeElement.highlightSearchResults(this._searchConfig.query); |
| 659 treeElement.reveal(); | 656 treeElement.reveal(); |
| 660 var matches = treeElement.listItemElement.getElementsByClassName(UI.highli
ghtedSearchResultClassName); | 657 var matches = treeElement.listItemElement.getElementsByClassName(UI.highli
ghtedSearchResultClassName); |
| 661 if (matches.length) | 658 if (matches.length) |
| 662 matches[0].scrollIntoViewIfNeeded(false); | 659 matches[0].scrollIntoViewIfNeeded(false); |
| 663 } | 660 } |
| 664 } | 661 } |
| 665 | 662 |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 * @param {!SDK.DOMNode} node | 1090 * @param {!SDK.DOMNode} node |
| 1094 * @return {?{title: string, color: string}} | 1091 * @return {?{title: string, color: string}} |
| 1095 */ | 1092 */ |
| 1096 decorate(node) { | 1093 decorate(node) { |
| 1097 return { | 1094 return { |
| 1098 color: 'orange', | 1095 color: 'orange', |
| 1099 title: Common.UIString('Element state: %s', ':' + node.domModel().cssModel
().pseudoState(node).join(', :')) | 1096 title: Common.UIString('Element state: %s', ':' + node.domModel().cssModel
().pseudoState(node).join(', :')) |
| 1100 }; | 1097 }; |
| 1101 } | 1098 } |
| 1102 }; | 1099 }; |
| OLD | NEW |