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

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

Issue 2527503002: Revert of DevTools: all swatches should have a default focused element (Closed)
Patch Set: Created 4 years 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 | « third_party/WebKit/Source/devtools/front_end/ui/Popover.js ('k') | 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 /** 4 /**
5 * @unrestricted 5 * @unrestricted
6 */ 6 */
7 UI.SwatchPopoverHelper = class extends Common.Object { 7 UI.SwatchPopoverHelper = class extends Common.Object {
8 constructor() { 8 constructor() {
9 super(); 9 super();
10 this._popover = new UI.Popover(); 10 this._popover = new UI.Popover();
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 // Reopen the picker for another anchor element. 47 // Reopen the picker for another anchor element.
48 this.hide(true); 48 this.hide(true);
49 } 49 }
50 50
51 delete this._isHidden; 51 delete this._isHidden;
52 this._anchorElement = anchorElement; 52 this._anchorElement = anchorElement;
53 this._view = view; 53 this._view = view;
54 this._hiddenCallback = hiddenCallback; 54 this._hiddenCallback = hiddenCallback;
55 this.reposition(); 55 this.reposition();
56 view.focus();
57 56
58 var document = this._popover.element.ownerDocument; 57 var document = this._popover.element.ownerDocument;
59 document.addEventListener('mousedown', this._hideProxy, false); 58 document.addEventListener('mousedown', this._hideProxy, false);
60 document.defaultView.addEventListener('resize', this._hideProxy, false); 59 document.defaultView.addEventListener('resize', this._hideProxy, false);
61 this._view.contentElement.addEventListener('keydown', this._boundOnKeyDown, false); 60 this._view.contentElement.addEventListener('keydown', this._boundOnKeyDown, false);
62 } 61 }
63 62
64 reposition() { 63 reposition() {
65 // Unbind "blur" listener to avoid reenterability: |popover.showView| will h ide the popover and trigger it synchronously. 64 // Unbind "blur" listener to avoid reenterability: |popover.showView| will h ide the popover and trigger it synchronously.
66 this._view.contentElement.removeEventListener('focusout', this._boundFocusOu t, false); 65 this._view.contentElement.removeEventListener('focusout', this._boundFocusOu t, false);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 this.hide(true); 103 this.hide(true);
105 event.consume(true); 104 event.consume(true);
106 return; 105 return;
107 } 106 }
108 if (event.key === 'Escape') { 107 if (event.key === 'Escape') {
109 this.hide(false); 108 this.hide(false);
110 event.consume(true); 109 event.consume(true);
111 } 110 }
112 } 111 }
113 }; 112 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/ui/Popover.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698