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

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

Issue 2921363002: DevTools: Add keyboard focus highlight when focusing window (Closed)
Patch Set: move listener to windowFocused Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 return shadowRoot; 704 return shadowRoot;
705 }; 705 };
706 706
707 /** 707 /**
708 * @param {!Document} document 708 * @param {!Document} document
709 * @param {!Event} event 709 * @param {!Event} event
710 */ 710 */
711 UI._windowFocused = function(document, event) { 711 UI._windowFocused = function(document, event) {
712 if (event.target.document.nodeType === Node.DOCUMENT_NODE) 712 if (event.target.document.nodeType === Node.DOCUMENT_NODE)
713 document.body.classList.remove('inactive'); 713 document.body.classList.remove('inactive');
714 UI._keyboardFocus = true;
715 var listener = () => {
716 var activeElement = document.deepActiveElement();
717 if (activeElement)
718 activeElement.removeAttribute('data-keyboard-focus');
719 UI._keyboardFocus = false;
720 };
721 document.defaultView.requestAnimationFrame(() => {
722 UI._keyboardFocus = false;
723 document.removeEventListener('mousedown', listener, true);
724 });
725 document.addEventListener('mousedown', listener, true);
726
714 }; 727 };
715 728
716 /** 729 /**
717 * @param {!Document} document 730 * @param {!Document} document
718 * @param {!Event} event 731 * @param {!Event} event
719 */ 732 */
720 UI._windowBlurred = function(document, event) { 733 UI._windowBlurred = function(document, event) {
721 if (event.target.document.nodeType === Node.DOCUMENT_NODE) 734 if (event.target.document.nodeType === Node.DOCUMENT_NODE)
722 document.body.classList.add('inactive'); 735 document.body.classList.add('inactive');
723 }; 736 };
(...skipping 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 */ 2049 */
2037 UI.createInlineButton = function(toolbarButton) { 2050 UI.createInlineButton = function(toolbarButton) {
2038 var element = createElement('span'); 2051 var element = createElement('span');
2039 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'ui/inlineButton.c ss'); 2052 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'ui/inlineButton.c ss');
2040 element.classList.add('inline-button'); 2053 element.classList.add('inline-button');
2041 var toolbar = new UI.Toolbar(''); 2054 var toolbar = new UI.Toolbar('');
2042 toolbar.appendToolbarItem(toolbarButton); 2055 toolbar.appendToolbarItem(toolbarButton);
2043 shadowRoot.appendChild(toolbar.element); 2056 shadowRoot.appendChild(toolbar.element);
2044 return element; 2057 return element;
2045 }; 2058 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698