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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js

Issue 2319523004: DevTools: Remember the last focused widget. (Closed)
Patch Set: setDefaultFocusedChild Created 4 years, 3 months 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
OLDNEW
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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 { 806 {
807 return WebInspector._currentFocusElement; 807 return WebInspector._currentFocusElement;
808 } 808 }
809 809
810 /** 810 /**
811 * @param {!Event} event 811 * @param {!Event} event
812 */ 812 */
813 WebInspector._focusChanged = function(event) 813 WebInspector._focusChanged = function(event)
814 { 814 {
815 var node = event.deepActiveElement(); 815 var node = event.deepActiveElement();
816 if (WebInspector._currentFocusElement !== node)
817 WebInspector.Widget.focusWidgetForNode(node);
816 WebInspector.setCurrentFocusElement(node); 818 WebInspector.setCurrentFocusElement(node);
817 } 819 }
818 820
819 /** 821 /**
820 * @param {!Document} document 822 * @param {!Document} document
821 * @param {!Event} event 823 * @param {!Event} event
822 */ 824 */
823 WebInspector._documentBlurred = function(document, event) 825 WebInspector._documentBlurred = function(document, event)
824 { 826 {
825 // We want to know when currentFocusElement loses focus to nowhere. 827 // We want to know when currentFocusElement loses focus to nowhere.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 // The code below should not be applied to text fields and text areas, h ence _isTextEditingElement check. 864 // The code below should not be applied to text fields and text areas, h ence _isTextEditingElement check.
863 var selection = x.getComponentSelection(); 865 var selection = x.getComponentSelection();
864 if (!WebInspector._isTextEditingElement(x) && selection.isCollapsed && ! x.isInsertionCaretInside()) { 866 if (!WebInspector._isTextEditingElement(x) && selection.isCollapsed && ! x.isInsertionCaretInside()) {
865 var selectionRange = x.ownerDocument.createRange(); 867 var selectionRange = x.ownerDocument.createRange();
866 selectionRange.setStart(x, 0); 868 selectionRange.setStart(x, 0);
867 selectionRange.setEnd(x, 0); 869 selectionRange.setEnd(x, 0);
868 870
869 selection.removeAllRanges(); 871 selection.removeAllRanges();
870 selection.addRange(selectionRange); 872 selection.addRange(selectionRange);
871 } 873 }
874
dgozman 2016/09/12 16:50:21 stray blank line
einbinder 2016/09/12 18:18:54 Done.
872 } else if (WebInspector._previousFocusElement) 875 } else if (WebInspector._previousFocusElement)
873 WebInspector._previousFocusElement.blur(); 876 WebInspector._previousFocusElement.blur();
874 } 877 }
875 878
876 WebInspector.restoreFocusFromElement = function(element) 879 WebInspector.restoreFocusFromElement = function(element)
877 { 880 {
878 if (element && element.isSelfOrAncestor(WebInspector.currentFocusElement())) 881 if (element && element.isSelfOrAncestor(WebInspector.currentFocusElement()))
879 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement()) ; 882 WebInspector.setCurrentFocusElement(WebInspector.previousFocusElement()) ;
880 } 883 }
881 884
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2011 * @param {string} title 2014 * @param {string} title
2012 * @return {!Element} 2015 * @return {!Element}
2013 */ 2016 */
2014 WebInspector.linkifyDocumentationURLAsNode = function(article, title) 2017 WebInspector.linkifyDocumentationURLAsNode = function(article, title)
2015 { 2018 {
2016 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool s/chrome-devtools/" + article, title, undefined, true); 2019 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool s/chrome-devtools/" + article, title, undefined, true);
2017 } 2020 }
2018 2021
2019 /** @type {!WebInspector.ThemeSupport} */ 2022 /** @type {!WebInspector.ThemeSupport} */
2020 WebInspector.themeSupport; 2023 WebInspector.themeSupport;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698