| OLD | NEW |
| 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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 }; | 811 }; |
| 812 | 812 |
| 813 /** | 813 /** |
| 814 * @param {!Element} element | 814 * @param {!Element} element |
| 815 * @param {number} offset | 815 * @param {number} offset |
| 816 * @param {number} length | 816 * @param {number} length |
| 817 * @param {!Array.<!Object>=} domChanges | 817 * @param {!Array.<!Object>=} domChanges |
| 818 * @return {?Element} | 818 * @return {?Element} |
| 819 */ | 819 */ |
| 820 UI.highlightSearchResult = function(element, offset, length, domChanges) { | 820 UI.highlightSearchResult = function(element, offset, length, domChanges) { |
| 821 var result = UI.highlightSearchResults(element, [new Common.SourceRange(offset
, length)], domChanges); | 821 var result = UI.highlightSearchResults(element, [new TextUtils.SourceRange(off
set, length)], domChanges); |
| 822 return result.length ? result[0] : null; | 822 return result.length ? result[0] : null; |
| 823 }; | 823 }; |
| 824 | 824 |
| 825 /** | 825 /** |
| 826 * @param {!Element} element | 826 * @param {!Element} element |
| 827 * @param {!Array.<!Common.SourceRange>} resultRanges | 827 * @param {!Array.<!TextUtils.SourceRange>} resultRanges |
| 828 * @param {!Array.<!Object>=} changes | 828 * @param {!Array.<!Object>=} changes |
| 829 * @return {!Array.<!Element>} | 829 * @return {!Array.<!Element>} |
| 830 */ | 830 */ |
| 831 UI.highlightSearchResults = function(element, resultRanges, changes) { | 831 UI.highlightSearchResults = function(element, resultRanges, changes) { |
| 832 return UI.highlightRangesWithStyleClass(element, resultRanges, UI.highlightedS
earchResultClassName, changes); | 832 return UI.highlightRangesWithStyleClass(element, resultRanges, UI.highlightedS
earchResultClassName, changes); |
| 833 }; | 833 }; |
| 834 | 834 |
| 835 /** | 835 /** |
| 836 * @param {!Element} element | 836 * @param {!Element} element |
| 837 * @param {string} className | 837 * @param {string} className |
| 838 */ | 838 */ |
| 839 UI.runCSSAnimationOnce = function(element, className) { | 839 UI.runCSSAnimationOnce = function(element, className) { |
| 840 function animationEndCallback() { | 840 function animationEndCallback() { |
| 841 element.classList.remove(className); | 841 element.classList.remove(className); |
| 842 element.removeEventListener('webkitAnimationEnd', animationEndCallback, fals
e); | 842 element.removeEventListener('webkitAnimationEnd', animationEndCallback, fals
e); |
| 843 } | 843 } |
| 844 | 844 |
| 845 if (element.classList.contains(className)) | 845 if (element.classList.contains(className)) |
| 846 element.classList.remove(className); | 846 element.classList.remove(className); |
| 847 | 847 |
| 848 element.addEventListener('webkitAnimationEnd', animationEndCallback, false); | 848 element.addEventListener('webkitAnimationEnd', animationEndCallback, false); |
| 849 element.classList.add(className); | 849 element.classList.add(className); |
| 850 }; | 850 }; |
| 851 | 851 |
| 852 /** | 852 /** |
| 853 * @param {!Element} element | 853 * @param {!Element} element |
| 854 * @param {!Array.<!Common.SourceRange>} resultRanges | 854 * @param {!Array.<!TextUtils.SourceRange>} resultRanges |
| 855 * @param {string} styleClass | 855 * @param {string} styleClass |
| 856 * @param {!Array.<!Object>=} changes | 856 * @param {!Array.<!Object>=} changes |
| 857 * @return {!Array.<!Element>} | 857 * @return {!Array.<!Element>} |
| 858 */ | 858 */ |
| 859 UI.highlightRangesWithStyleClass = function(element, resultRanges, styleClass, c
hanges) { | 859 UI.highlightRangesWithStyleClass = function(element, resultRanges, styleClass, c
hanges) { |
| 860 changes = changes || []; | 860 changes = changes || []; |
| 861 var highlightNodes = []; | 861 var highlightNodes = []; |
| 862 var textNodes = element.childTextNodes(); | 862 var textNodes = element.childTextNodes(); |
| 863 var lineText = textNodes | 863 var lineText = textNodes |
| 864 .map(function(node) { | 864 .map(function(node) { |
| (...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2064 */ | 2064 */ |
| 2065 constructor(message, okCallback, cancelCallback) { | 2065 constructor(message, okCallback, cancelCallback) { |
| 2066 super(true); | 2066 super(true); |
| 2067 this.registerRequiredCSS('ui/confirmDialog.css'); | 2067 this.registerRequiredCSS('ui/confirmDialog.css'); |
| 2068 this.contentElement.createChild('div', 'message').createChild('span').textCo
ntent = message; | 2068 this.contentElement.createChild('div', 'message').createChild('span').textCo
ntent = message; |
| 2069 var buttonsBar = this.contentElement.createChild('div', 'button'); | 2069 var buttonsBar = this.contentElement.createChild('div', 'button'); |
| 2070 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Ok'), okCallback
)); | 2070 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Ok'), okCallback
)); |
| 2071 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Cancel'), cancel
Callback)); | 2071 buttonsBar.appendChild(UI.createTextButton(Common.UIString('Cancel'), cancel
Callback)); |
| 2072 } | 2072 } |
| 2073 }; | 2073 }; |
| OLD | NEW |