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

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

Issue 2680543003: DevTools: Show scrollbars on a small FilteredListWidget (Closed)
Patch Set: Created 3 years, 10 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 30 matching lines...) Expand all
41 this.contentElement.tabIndex = 0; 41 this.contentElement.tabIndex = 0;
42 this.contentElement.addEventListener('focus', this.focus.bind(this), false); 42 this.contentElement.addEventListener('focus', this.focus.bind(this), false);
43 this.contentElement.addEventListener('keydown', this._onKeyDown.bind(this), false); 43 this.contentElement.addEventListener('keydown', this._onKeyDown.bind(this), false);
44 this._dimmed = false; 44 this._dimmed = false;
45 this._wrapsContent = false; 45 this._wrapsContent = false;
46 this._maxSize = null; 46 this._maxSize = null;
47 /** @type {?number} */ 47 /** @type {?number} */
48 this._positionX = null; 48 this._positionX = null;
49 /** @type {?number} */ 49 /** @type {?number} */
50 this._positionY = null; 50 this._positionY = null;
51 this._fixedHeight = true;
51 52
52 /** @type {!Map<!HTMLElement, number>} */ 53 /** @type {!Map<!HTMLElement, number>} */
53 this._tabIndexMap = new Map(); 54 this._tabIndexMap = new Map();
54 } 55 }
55 56
56 /** 57 /**
57 * @return {boolean} 58 * @return {boolean}
58 */ 59 */
59 static hasInstance() { 60 static hasInstance() {
60 return !!UI.Dialog._instance; 61 return !!UI.Dialog._instance;
61 } 62 }
62 63
63 /** 64 /**
64 * @override 65 * @override
65 * @suppressGlobalPropertiesCheck 66 * @suppressGlobalPropertiesCheck
66 * TODO(dgozman): pass document in constructor. 67 * TODO(dgozman): pass document in constructor.
67 */ 68 */
68 show() { 69 show() {
69 if (UI.Dialog._instance) 70 if (UI.Dialog._instance)
70 UI.Dialog._instance.detach(); 71 UI.Dialog._instance.detach();
71 UI.Dialog._instance = this; 72 UI.Dialog._instance = this;
72 73
73 this._disableTabIndexOnElements(document); 74 this._disableTabIndexOnElements(document);
74 75
75 this._glassPane = new UI.GlassPane(document, this._dimmed, true /* blockPoin terEvents*/, event => { 76 this._glassPane = new UI.GlassPane(document, this._dimmed, true /* blockPoin terEvents*/, event => {
76 this.detach(); 77 this.detach();
77 event.consume(true); 78 event.consume(true);
78 }); 79 });
80 this._glassPane.setFixedHeight(this._fixedHeight);
79 this._glassPane.show(); 81 this._glassPane.show();
80 super.show(this._glassPane.contentElement); 82 super.show(this._glassPane.contentElement);
81 this._glassPane.setContentPosition(this._positionX, this._positionY); 83 this._glassPane.setContentPosition(this._positionX, this._positionY);
82 this._glassPane.setMaxContentSize(this._effectiveMaxSize()); 84 this._glassPane.setMaxContentSize(this._effectiveMaxSize());
83 this._focusRestorer = new UI.WidgetFocusRestorer(this); 85 this._focusRestorer = new UI.WidgetFocusRestorer(this);
84 } 86 }
85 87
86 /** 88 /**
87 * @override 89 * @override
88 */ 90 */
(...skipping 25 matching lines...) Expand all
114 } 116 }
115 117
116 /** 118 /**
117 * @param {!UI.Size} size 119 * @param {!UI.Size} size
118 */ 120 */
119 setMaxSize(size) { 121 setMaxSize(size) {
120 this._maxSize = size; 122 this._maxSize = size;
121 } 123 }
122 124
123 /** 125 /**
126 * @param {boolean} fixedHeight
127 */
128 setFixedHeight(fixedHeight) {
129 this._fixedHeight = fixedHeight;
130 }
131
132 /**
124 * @return {?UI.Size} 133 * @return {?UI.Size}
125 */ 134 */
126 _effectiveMaxSize() { 135 _effectiveMaxSize() {
127 if (!this._wrapsContent) 136 if (!this._wrapsContent)
128 return this._maxSize; 137 return this._maxSize;
129 return new UI.Size(this.contentElement.offsetWidth, this.contentElement.offs etHeight).clipTo(this._maxSize); 138 return new UI.Size(this.contentElement.offsetWidth, this.contentElement.offs etHeight).clipTo(this._maxSize);
130 } 139 }
131 140
132 /** 141 /**
133 * @param {boolean} wraps 142 * @param {boolean} wraps
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 /** 185 /**
177 * @param {!Event} event 186 * @param {!Event} event
178 */ 187 */
179 _onKeyDown(event) { 188 _onKeyDown(event) {
180 if (event.keyCode === UI.KeyboardShortcut.Keys.Esc.code) { 189 if (event.keyCode === UI.KeyboardShortcut.Keys.Esc.code) {
181 event.consume(true); 190 event.consume(true);
182 this.detach(); 191 this.detach();
183 } 192 }
184 } 193 }
185 }; 194 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698