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

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

Issue 727823002: [DevTools] Ban getSelection, requestAnimationFrame, cancelAnimationFrame global functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * Copyright (C) 2011 Google Inc. All rights reserved. 5 * Copyright (C) 2011 Google Inc. All rights reserved.
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 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 this._updateSearchNavigationButtonState(matches > 0); 447 this._updateSearchNavigationButtonState(matches > 0);
448 }, 448 },
449 449
450 showSearchField: function() 450 showSearchField: function()
451 { 451 {
452 if (this._searchIsVisible) 452 if (this._searchIsVisible)
453 this.cancelSearch(); 453 this.cancelSearch();
454 454
455 var queryCandidate; 455 var queryCandidate;
456 if (WebInspector.currentFocusElement() !== this._searchInputElement) { 456 if (WebInspector.currentFocusElement() !== this._searchInputElement) {
457 var selection = window.getSelection(); 457 var selection = this._searchInputElement.window().getSelection();
458 if (selection.rangeCount) 458 if (selection.rangeCount)
459 queryCandidate = selection.toString().replace(/\r?\n.*/, ""); 459 queryCandidate = selection.toString().replace(/\r?\n.*/, "");
460 } 460 }
461 461
462 this._toggleSearchBar(true); 462 this._toggleSearchBar(true);
463 this._updateReplaceVisibility(); 463 this._updateReplaceVisibility();
464 if (queryCandidate) 464 if (queryCandidate)
465 this._searchInputElement.value = queryCandidate; 465 this._searchInputElement.value = queryCandidate;
466 this._performSearch(false, false); 466 this._performSearch(false, false);
467 this._searchInputElement.focus(); 467 this._searchInputElement.focus();
468 this._searchInputElement.select(); 468 this._searchInputElement.select();
469 this._searchIsVisible = true; 469 this._searchIsVisible = true;
470 }, 470 },
471 471
472 _updateReplaceVisibility: function() 472 _updateReplaceVisibility: function()
473 { 473 {
474 this._replaceElement.classList.toggle("hidden", !this._replaceable); 474 this._replaceElement.classList.toggle("hidden", !this._replaceable);
475 if (!this._replaceable) { 475 if (!this._replaceable) {
476 this._replaceCheckboxElement.checked = false; 476 this._replaceCheckboxElement.checked = false;
477 this._updateSecondRowVisibility(); 477 this._updateSecondRowVisibility();
478 } 478 }
479 }, 479 },
480 480
481 /** 481 /**
482 * @param {!Event} event 482 * @param {!Event} event
483 */ 483 */
484 _onSearchFieldManualFocus: function(event) 484 _onSearchFieldManualFocus: function(event)
485 { 485 {
486 WebInspector.setCurrentFocusElement(event.target); 486 WebInspector.setCurrentFocusElement(/** @type {?Node} */ (event.target)) ;
487 }, 487 },
488 488
489 /** 489 /**
490 * @param {!Event} event 490 * @param {!Event} event
491 */ 491 */
492 _onSearchKeyDown: function(event) 492 _onSearchKeyDown: function(event)
493 { 493 {
494 if (!isEnterKey(event)) 494 if (!isEnterKey(event))
495 return; 495 return;
496 496
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 * @param {string} query 700 * @param {string} query
701 * @param {boolean} caseSensitive 701 * @param {boolean} caseSensitive
702 * @param {boolean} isRegex 702 * @param {boolean} isRegex
703 */ 703 */
704 WebInspector.SearchableView.SearchConfig = function(query, caseSensitive, isRege x) 704 WebInspector.SearchableView.SearchConfig = function(query, caseSensitive, isRege x)
705 { 705 {
706 this.query = query; 706 this.query = query;
707 this.caseSensitive = caseSensitive; 707 this.caseSensitive = caseSensitive;
708 this.isRegex = isRegex; 708 this.isRegex = isRegex;
709 } 709 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698