Chromium Code Reviews| 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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 848 { | 848 { |
| 849 if (WebInspector._glassPane && x && !WebInspector._glassPane.element.isAnces tor(x)) | 849 if (WebInspector._glassPane && x && !WebInspector._glassPane.element.isAnces tor(x)) |
| 850 return; | 850 return; |
| 851 if (x && !x.ownerDocument.isAncestor(x)) | 851 if (x && !x.ownerDocument.isAncestor(x)) |
| 852 return; | 852 return; |
| 853 if (WebInspector._currentFocusElement !== x) | 853 if (WebInspector._currentFocusElement !== x) |
| 854 WebInspector._previousFocusElement = WebInspector._currentFocusElement; | 854 WebInspector._previousFocusElement = WebInspector._currentFocusElement; |
| 855 WebInspector._currentFocusElement = x; | 855 WebInspector._currentFocusElement = x; |
| 856 | 856 |
| 857 if (x) { | 857 if (x) { |
| 858 x.focus(); | 858 x.focus(); |
|
luoe
2016/09/08 20:48:56
I'm a little confused, if we have this x.focus(),
| |
| 859 | 859 |
| 860 // Make a caret selection inside the new element if there isn't a range selection and there isn't already a caret selection inside. | 860 // Make a caret selection inside the new element if there isn't a range selection and there isn't already a caret selection inside. |
| 861 // This is needed (at least) to remove caret from console when focus is moved to some element in the panel. | 861 // This is needed (at least) to remove caret from console when focus is moved to some element in the panel. |
| 862 // The code below should not be applied to text fields and text areas, h ence _isTextEditingElement check. | 862 // The code below should not be applied to text fields and text areas, h ence _isTextEditingElement check. |
| 863 var selection = x.getComponentSelection(); | 863 var selection = x.getComponentSelection(); |
| 864 if (!WebInspector._isTextEditingElement(x) && selection.isCollapsed && ! x.isInsertionCaretInside()) { | 864 if (!WebInspector._isTextEditingElement(x) && selection.isCollapsed && ! x.isInsertionCaretInside()) { |
| 865 var selectionRange = x.ownerDocument.createRange(); | 865 var selectionRange = x.ownerDocument.createRange(); |
| 866 selectionRange.setStart(x, 0); | 866 selectionRange.setStart(x, 0); |
| 867 selectionRange.setEnd(x, 0); | 867 selectionRange.setEnd(x, 0); |
| 868 | 868 |
| 869 selection.removeAllRanges(); | 869 selection.removeAllRanges(); |
| 870 selection.addRange(selectionRange); | 870 selection.addRange(selectionRange); |
| 871 } | 871 } |
| 872 | |
| 873 WebInspector.Widget.focusWidgetForNode(x); | |
|
pfeldman
2016/09/08 00:53:50
I'd listen to focus event independently to decoupl
einbinder
2016/09/09 01:32:16
Listening for focus is a bit complicated because o
| |
| 872 } else if (WebInspector._previousFocusElement) | 874 } else if (WebInspector._previousFocusElement) |
| 873 WebInspector._previousFocusElement.blur(); | 875 WebInspector._previousFocusElement.blur(); |
| 874 } | 876 } |
| 875 | 877 |
| 876 WebInspector.restoreFocusFromElement = function(element) | 878 WebInspector.restoreFocusFromElement = function(element) |
| 877 { | 879 { |
| 878 if (element && element.isSelfOrAncestor(WebInspector.currentFocusElement())) | 880 if (element && element.isSelfOrAncestor(WebInspector.currentFocusElement())) |
| 879 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement()) ; | 881 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement()) ; |
| 880 } | 882 } |
| 881 | 883 |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2011 * @param {string} title | 2013 * @param {string} title |
| 2012 * @return {!Element} | 2014 * @return {!Element} |
| 2013 */ | 2015 */ |
| 2014 WebInspector.linkifyDocumentationURLAsNode = function(article, title) | 2016 WebInspector.linkifyDocumentationURLAsNode = function(article, title) |
| 2015 { | 2017 { |
| 2016 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool s/chrome-devtools/" + article, title, undefined, true); | 2018 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool s/chrome-devtools/" + article, title, undefined, true); |
| 2017 } | 2019 } |
| 2018 | 2020 |
| 2019 /** @type {!WebInspector.ThemeSupport} */ | 2021 /** @type {!WebInspector.ThemeSupport} */ |
| 2020 WebInspector.themeSupport; | 2022 WebInspector.themeSupport; |
| OLD | NEW |