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