Changeset 98339 in webkit
- Timestamp:
- Oct 25, 2011 6:49:24 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r98338 r98339 1 2011-10-25 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: Resources panel: display the current search match index in the toolbar. 4 https://bugs.webkit.org/show_bug.cgi?id=66050 5 6 Reviewed by Pavel Feldman. 7 8 * http/tests/inspector/search/resources-search-match-index-expected.txt: Added. 9 * http/tests/inspector/search/resources-search-match-index.html: Added. 10 1 11 2011-10-25 Csaba Osztrogonác <ossy@webkit.org> 2 12 -
trunk/Source/WebCore/ChangeLog
r98333 r98339 1 2011-10-25 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: Resources panel: display the current search match index in the toolbar. 4 https://bugs.webkit.org/show_bug.cgi?id=66050 5 6 Reviewed by Pavel Feldman. 7 8 Test: http/tests/inspector/search/resources-search-match-index.html 9 10 * inspector/front-end/ResourcesPanel.js: 11 (WebInspector.ResourcesPanel.prototype.performSearch.callback): 12 (WebInspector.ResourcesPanel.prototype.performSearch): 13 (WebInspector.ResourcesPanel.prototype._showSearchResult.callback): 14 (WebInspector.ResourcesPanel.prototype._showSearchResult): 15 (WebInspector.BaseStorageTreeElement.prototype.get searchMatchesCount): 16 (WebInspector.ResourcesSearchController): 17 (WebInspector.ResourcesSearchController.prototype.nextSearchResult): 18 (WebInspector.ResourcesSearchController.prototype.previousSearchResult): 19 (WebInspector.ResourcesSearchController.prototype._searchResult): 20 (WebInspector.SearchResultsTreeElementsTraverser.prototype.next): 21 (WebInspector.SearchResultsTreeElementsTraverser.prototype.previous): 22 (WebInspector.SearchResultsTreeElementsTraverser.prototype.matchIndex): 23 (WebInspector.SearchResultsTreeElementsTraverser.prototype._elementSearchMatchesCount): 24 (WebInspector.SearchResultsTreeElementsTraverser.prototype._traverseNext): 25 (WebInspector.SearchResultsTreeElementsTraverser.prototype._traversePrevious): 26 * inspector/front-end/treeoutline.js: 27 1 28 2011-10-25 Andrey Kosyakov <caseq@chromium.org> 2 29 -
trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js
r98228 r98339 647 647 648 648 WebInspector.searchController.updateSearchMatchesCount(totalMatchesCount, this); 649 this._searchController = new WebInspector.ResourcesSearchController(this.resourcesListTreeElement );649 this._searchController = new WebInspector.ResourcesSearchController(this.resourcesListTreeElement, totalMatchesCount); 650 650 651 651 if (this.sidebarTree.selectedTreeElement && this.sidebarTree.selectedTreeElement.searchMatchesCount) … … 695 695 if (this._lastSearchResultIndex != -1) 696 696 this.visibleView.jumpToSearchResult(this._lastSearchResultIndex); 697 WebInspector.searchController.updateCurrentMatchIndex(searchResult.currentMatchIndex, this); 697 698 } 698 699 … … 895 896 }, 896 897 898 get searchMatchesCount() 899 { 900 return 0; 901 }, 902 897 903 isEventWithinDisclosureTriangle: function(event) 898 904 { … … 1589 1595 /** 1590 1596 * @constructor 1597 * @param {WebInspector.BaseStorageTreeElement} rootElement 1598 * @param {number} matchesCount 1591 1599 */ 1592 WebInspector.ResourcesSearchController = function(rootElement )1600 WebInspector.ResourcesSearchController = function(rootElement, matchesCount) 1593 1601 { 1594 1602 this._root = rootElement; 1603 this._matchesCount = matchesCount; 1595 1604 this._traverser = new WebInspector.SearchResultsTreeElementsTraverser(rootElement); 1596 1605 this._lastTreeElement = null; … … 1599 1608 1600 1609 WebInspector.ResourcesSearchController.prototype = { 1610 /** 1611 * @param {WebInspector.BaseStorageTreeElement} currentTreeElement 1612 */ 1601 1613 nextSearchResult: function(currentTreeElement) 1602 1614 { 1603 1615 if (!currentTreeElement) 1604 return this._searchResult(this._traverser.first(), 0 );1616 return this._searchResult(this._traverser.first(), 0, 1); 1605 1617 1606 1618 if (!currentTreeElement.searchMatchesCount) … … 1611 1623 1612 1624 if (this._lastIndex == currentTreeElement.searchMatchesCount - 1) 1613 return this._searchResult(this._traverser.next(currentTreeElement), 0); 1614 1615 return this._searchResult(currentTreeElement, this._lastIndex + 1); 1616 }, 1617 1625 return this._searchResult(this._traverser.next(currentTreeElement), 0, this._currentMatchIndex % this._matchesCount + 1); 1626 1627 return this._searchResult(currentTreeElement, this._lastIndex + 1, this._currentMatchIndex + 1); 1628 }, 1629 1630 /** 1631 * @param {WebInspector.BaseStorageTreeElement} currentTreeElement 1632 */ 1618 1633 previousSearchResult: function(currentTreeElement) 1619 1634 { 1620 1635 if (!currentTreeElement) { 1621 1636 var treeElement = this._traverser.last(); 1622 return this._searchResult(treeElement, treeElement.searchMatchesCount - 1); 1623 } 1624 1625 if (currentTreeElement.searchMatchesCount && this._lastTreeElement === currentTreeElement && this._lastIndex > 0) 1626 return this._searchResult(currentTreeElement, this._lastIndex - 1); 1637 return this._searchResult(treeElement, treeElement.searchMatchesCount - 1, this._matchesCount); 1638 } 1639 1640 if (currentTreeElement.searchMatchesCount && this._lastTreeElement === currentTreeElement) { 1641 if (this._lastIndex > 0) 1642 return this._searchResult(currentTreeElement, this._lastIndex - 1, this._currentMatchIndex - 1); 1643 else { 1644 var treeElement = this._traverser.previous(currentTreeElement); 1645 var currentMatchIndex = this._currentMatchIndex - 1 ? this._currentMatchIndex - 1 : this._matchesCount; 1646 return this._searchResult(treeElement, treeElement.searchMatchesCount - 1, currentMatchIndex); 1647 } 1648 } 1627 1649 1628 1650 var treeElement = this._traverser.previous(currentTreeElement) … … 1630 1652 }, 1631 1653 1632 _searchResult: function(treeElement, index) 1654 /** 1655 * @param {WebInspector.BaseStorageTreeElement} treeElement 1656 * @param {number} index 1657 * @param {number=} currentMatchIndex 1658 * @return {Object} 1659 */ 1660 _searchResult: function(treeElement, index, currentMatchIndex) 1633 1661 { 1634 1662 this._lastTreeElement = treeElement; 1635 1663 this._lastIndex = index; 1636 return {treeElement: treeElement, index: index}; 1664 if (!currentMatchIndex) 1665 currentMatchIndex = this._traverser.matchIndex(treeElement, index); 1666 this._currentMatchIndex = currentMatchIndex; 1667 return {treeElement: treeElement, index: index, currentMatchIndex: currentMatchIndex}; 1637 1668 } 1638 1669 } … … 1640 1671 /** 1641 1672 * @constructor 1673 * @param {WebInspector.BaseStorageTreeElement} rootElement 1642 1674 */ 1643 1675 WebInspector.SearchResultsTreeElementsTraverser = function(rootElement) … … 1647 1679 1648 1680 WebInspector.SearchResultsTreeElementsTraverser.prototype = { 1681 /** 1682 * @return {WebInspector.BaseStorageTreeElement} 1683 */ 1649 1684 first: function() 1650 1685 { … … 1652 1687 }, 1653 1688 1689 /** 1690 * @return {WebInspector.BaseStorageTreeElement} 1691 */ 1654 1692 last: function() 1655 1693 { … … 1657 1695 }, 1658 1696 1697 /** 1698 * @param {WebInspector.BaseStorageTreeElement} startTreeElement 1699 * @return {WebInspector.BaseStorageTreeElement} 1700 */ 1659 1701 next: function(startTreeElement) 1660 1702 { … … 1662 1704 do { 1663 1705 treeElement = this._traverseNext(treeElement) || this._root; 1664 } while (treeElement != startTreeElement && !this._element HasSearchResults(treeElement));1706 } while (treeElement != startTreeElement && !this._elementSearchMatchesCount(treeElement)); 1665 1707 return treeElement; 1666 1708 }, 1667 1709 1710 /** 1711 * @param {WebInspector.BaseStorageTreeElement} startTreeElement 1712 * @return {WebInspector.BaseStorageTreeElement} 1713 */ 1668 1714 previous: function(startTreeElement) 1669 1715 { … … 1671 1717 do { 1672 1718 treeElement = this._traversePrevious(treeElement) || this._lastTreeElement(); 1673 } while (treeElement != startTreeElement && !this._element HasSearchResults(treeElement));1719 } while (treeElement != startTreeElement && !this._elementSearchMatchesCount(treeElement)); 1674 1720 return treeElement; 1675 1721 }, 1676 1722 1723 /** 1724 * @param {WebInspector.BaseStorageTreeElement} startTreeElement 1725 * @param {number} index 1726 * @return {number} 1727 */ 1728 matchIndex: function(startTreeElement, index) 1729 { 1730 var matchIndex = 1; 1731 var treeElement = this._root; 1732 while (treeElement != startTreeElement) { 1733 matchIndex += this._elementSearchMatchesCount(treeElement); 1734 treeElement = this._traverseNext(treeElement) || this._root; 1735 if (treeElement === this._root) 1736 return 0; 1737 } 1738 return matchIndex + index; 1739 }, 1740 1741 /** 1742 * @param {WebInspector.BaseStorageTreeElement} treeElement 1743 * @return {number} 1744 */ 1745 _elementSearchMatchesCount: function(treeElement) 1746 { 1747 return treeElement.searchMatchesCount; 1748 }, 1749 1750 /** 1751 * @param {WebInspector.BaseStorageTreeElement} treeElement 1752 * @return {WebInspector.BaseStorageTreeElement} 1753 */ 1677 1754 _traverseNext: function(treeElement) 1678 1755 { 1679 return treeElement.traverseNextTreeElement(false, this._root, true); 1680 }, 1681 1682 _elementHasSearchResults: function(treeElement) 1683 { 1684 return treeElement instanceof WebInspector.FrameResourceTreeElement && treeElement.searchMatchesCount; 1685 }, 1686 1756 return /** @type {WebInspector.BaseStorageTreeElement} */ treeElement.traverseNextTreeElement(false, this._root, true); 1757 }, 1758 1759 /** 1760 * @param {WebInspector.BaseStorageTreeElement} treeElement 1761 * @return {WebInspector.BaseStorageTreeElement} 1762 */ 1687 1763 _traversePrevious: function(treeElement) 1688 1764 { 1689 return treeElement.traversePreviousTreeElement(false, this._root, true); 1690 }, 1691 1765 return /** @type {WebInspector.BaseStorageTreeElement} */ treeElement.traversePreviousTreeElement(false, true); 1766 }, 1767 1768 /** 1769 * @return {WebInspector.BaseStorageTreeElement} 1770 */ 1692 1771 _lastTreeElement: function() 1693 1772 { -
trunk/Source/WebCore/inspector/front-end/treeoutline.js
r96949 r98339 888 888 } 889 889 890 /** 891 * @param {boolean} skipHidden 892 * @param {(TreeOutline|TreeElement)=} stayWithin 893 * @param {boolean=} dontPopulate 894 * @param {Object=} info 895 * @return {TreeElement} 896 */ 890 897 TreeElement.prototype.traverseNextTreeElement = function(skipHidden, stayWithin, dontPopulate, info) 891 898 { … … 923 930 } 924 931 932 /** 933 * @param {boolean} skipHidden 934 * @param {boolean=} dontPopulate 935 * @return {TreeElement} 936 */ 925 937 TreeElement.prototype.traversePreviousTreeElement = function(skipHidden, dontPopulate) 926 938 {
Note: See TracChangeset
for help on using the changeset viewer.