| 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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 /** | 765 /** |
| 766 * @param {?Node} x | 766 * @param {?Node} x |
| 767 */ | 767 */ |
| 768 WebInspector.setCurrentFocusElement = function(x) | 768 WebInspector.setCurrentFocusElement = function(x) |
| 769 { | 769 { |
| 770 if (WebInspector._glassPane && x && !WebInspector._glassPane.element.isAnces
tor(x)) | 770 if (WebInspector._glassPane && x && !WebInspector._glassPane.element.isAnces
tor(x)) |
| 771 return; | 771 return; |
| 772 if (WebInspector._currentFocusElement !== x) | 772 if (WebInspector._currentFocusElement !== x) |
| 773 WebInspector._previousFocusElement = WebInspector._currentFocusElement; | 773 WebInspector._previousFocusElement = WebInspector._currentFocusElement; |
| 774 WebInspector._currentFocusElement = x; | 774 WebInspector._currentFocusElement = x; |
| 775 if (WebInspector._previousFocusElement && WebInspector._previousFocusElement
!== x) | |
| 776 WebInspector._previousFocusElement.blur(); | |
| 777 | 775 |
| 778 if (x) { | 776 if (x) { |
| 779 x.focus(); | 777 x.focus(); |
| 780 | 778 |
| 781 // Make a caret selection inside the new element if there isn't a range
selection and there isn't already a caret selection inside. | 779 // Make a caret selection inside the new element if there isn't a range
selection and there isn't already a caret selection inside. |
| 782 // This is needed (at least) to remove caret from console when focus is
moved to some element in the panel. | 780 // This is needed (at least) to remove caret from console when focus is
moved to some element in the panel. |
| 783 // The code below should not be applied to text fields and text areas, h
ence _isTextEditingElement check. | 781 // The code below should not be applied to text fields and text areas, h
ence _isTextEditingElement check. |
| 784 var selection = x.getComponentSelection(); | 782 var selection = x.getComponentSelection(); |
| 785 if (!WebInspector._isTextEditingElement(x) && selection.isCollapsed && !
x.isInsertionCaretInside()) { | 783 if (!WebInspector._isTextEditingElement(x) && selection.isCollapsed && !
x.isInsertionCaretInside()) { |
| 786 var selectionRange = x.ownerDocument.createRange(); | 784 var selectionRange = x.ownerDocument.createRange(); |
| 787 selectionRange.setStart(x, 0); | 785 selectionRange.setStart(x, 0); |
| 788 selectionRange.setEnd(x, 0); | 786 selectionRange.setEnd(x, 0); |
| 789 | 787 |
| 790 selection.removeAllRanges(); | 788 selection.removeAllRanges(); |
| 791 selection.addRange(selectionRange); | 789 selection.addRange(selectionRange); |
| 792 } | 790 } |
| 793 } | 791 } else if (WebInspector._previousFocusElement) |
| 792 WebInspector._previousFocusElement.blur(); |
| 794 } | 793 } |
| 795 | 794 |
| 796 WebInspector.restoreFocusFromElement = function(element) | 795 WebInspector.restoreFocusFromElement = function(element) |
| 797 { | 796 { |
| 798 if (element && element.isSelfOrAncestor(WebInspector.currentFocusElement())) | 797 if (element && element.isSelfOrAncestor(WebInspector.currentFocusElement())) |
| 799 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement())
; | 798 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement())
; |
| 800 } | 799 } |
| 801 | 800 |
| 802 /** | 801 /** |
| 803 * @param {!Element} element | 802 * @param {!Element} element |
| (...skipping 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1898 * @param {string} title | 1897 * @param {string} title |
| 1899 * @return {!Element} | 1898 * @return {!Element} |
| 1900 */ | 1899 */ |
| 1901 WebInspector.linkifyDocumentationURLAsNode = function(article, title) | 1900 WebInspector.linkifyDocumentationURLAsNode = function(article, title) |
| 1902 { | 1901 { |
| 1903 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool
s/chrome-devtools/" + article, title, undefined, true); | 1902 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool
s/chrome-devtools/" + article, title, undefined, true); |
| 1904 } | 1903 } |
| 1905 | 1904 |
| 1906 /** @type {!WebInspector.ThemeSupport} */ | 1905 /** @type {!WebInspector.ThemeSupport} */ |
| 1907 WebInspector.themeSupport; | 1906 WebInspector.themeSupport; |
| OLD | NEW |