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

Side by Side Diff: Source/devtools/front_end/ui/UIUtils.js

Issue 676193002: Navigate between individual search matches in DevTools console (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Add tests Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
5 * Copyright (C) 2009 Joseph Pecoraro 5 * Copyright (C) 2009 Joseph Pecoraro
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 11 matching lines...) Expand all
22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 23 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32 WebInspector.highlightedSearchResultClassName = "highlighted-search-result";
33 WebInspector.currentHighlightedSearchResultClassName = "current-search-result";
34
32 /** 35 /**
33 * @param {!Element} element 36 * @param {!Element} element
34 * @param {?function(!MouseEvent): boolean} elementDragStart 37 * @param {?function(!MouseEvent): boolean} elementDragStart
35 * @param {function(!MouseEvent)} elementDrag 38 * @param {function(!MouseEvent)} elementDrag
36 * @param {?function(!MouseEvent)} elementDragEnd 39 * @param {?function(!MouseEvent)} elementDragEnd
37 * @param {string} cursor 40 * @param {string} cursor
38 * @param {?string=} hoverCursor 41 * @param {?string=} hoverCursor
39 */ 42 */
40 WebInspector.installDragHandle = function(element, elementDragStart, elementDrag , elementDragEnd, cursor, hoverCursor) 43 WebInspector.installDragHandle = function(element, elementDragStart, elementDrag , elementDragEnd, cursor, hoverCursor)
41 { 44 {
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
779 var result = WebInspector.highlightSearchResults(element, [new WebInspector. SourceRange(offset, length)], domChanges); 782 var result = WebInspector.highlightSearchResults(element, [new WebInspector. SourceRange(offset, length)], domChanges);
780 return result.length ? result[0] : null; 783 return result.length ? result[0] : null;
781 } 784 }
782 785
783 /** 786 /**
784 * @param {!Element} element 787 * @param {!Element} element
785 * @param {!Array.<!WebInspector.SourceRange>} resultRanges 788 * @param {!Array.<!WebInspector.SourceRange>} resultRanges
786 * @param {!Array.<!Object>=} changes 789 * @param {!Array.<!Object>=} changes
787 * @return {!Array.<!Element>} 790 * @return {!Array.<!Element>}
788 */ 791 */
789 WebInspector.highlightSearchResults = function(element, resultRanges, changes) 792 WebInspector.highlightSearchResults = function(element, resultRanges, changes)
lushnikov 2014/11/07 16:27:19 This method exists by mistake, it's not general. L
aknudsen 2014/11/08 12:00:53 Acknowledged.
aknudsen 2014/11/09 00:02:14 Done.
790 { 793 {
791 return WebInspector.highlightRangesWithStyleClass(element, resultRanges, "hi ghlighted-search-result", changes); 794 return WebInspector.highlightRangesWithStyleClass(element, resultRanges,
795 WebInspector.highlightedSearchResultClassName, changes);
792 } 796 }
793 797
794 /** 798 /**
795 * @param {!Element} element 799 * @param {!Element} element
796 */ 800 */
797 WebInspector.removeSearchResultsHighlight = function(element) 801 WebInspector.removeSearchResultsHighlight = function(element)
lushnikov 2014/11/07 16:27:19 this method should accept one more argument - styl
aknudsen 2014/11/08 12:00:53 Acknowledged.
aknudsen 2014/11/09 00:02:14 Done.
798 { 802 {
799 var highlightBits = element.querySelectorAll(".highlighted-search-result"); 803 var query = "." + WebInspector.highlightedSearchResultClassName + ",." +
804 WebInspector.currentHighlightedSearchResultClassName;
805 var highlightBits = element.querySelectorAll(query);
800 for (var i = 0; i < highlightBits.length; ++i) { 806 for (var i = 0; i < highlightBits.length; ++i) {
801 var span = highlightBits[i]; 807 var span = highlightBits[i];
802 span.parentElement.replaceChild(createTextNode(span.textContent), span); 808 span.parentElement.replaceChild(createTextNode(span.textContent), span);
803 } 809 }
804 } 810 }
805 811
806 /** 812 /**
807 * @param {!Element} element 813 * @param {!Element} element
808 * @param {string} className 814 * @param {string} className
809 */ 815 */
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 /** 1227 /**
1222 * @param {!Window} window 1228 * @param {!Window} window
1223 */ 1229 */
1224 WebInspector.initializeUIUtils = function(window) 1230 WebInspector.initializeUIUtils = function(window)
1225 { 1231 {
1226 window.addEventListener("focus", WebInspector._windowFocused.bind(WebInspect or, window.document), false); 1232 window.addEventListener("focus", WebInspector._windowFocused.bind(WebInspect or, window.document), false);
1227 window.addEventListener("blur", WebInspector._windowBlurred.bind(WebInspecto r, window.document), false); 1233 window.addEventListener("blur", WebInspector._windowBlurred.bind(WebInspecto r, window.document), false);
1228 window.document.addEventListener("focus", WebInspector._focusChanged.bind(We bInspector, window.document), true); 1234 window.document.addEventListener("focus", WebInspector._focusChanged.bind(We bInspector, window.document), true);
1229 window.document.addEventListener("blur", WebInspector._documentBlurred.bind( WebInspector, window.document), true); 1235 window.document.addEventListener("blur", WebInspector._documentBlurred.bind( WebInspector, window.document), true);
1230 } 1236 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698