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

Side by Side Diff: Source/web/resources/listPicker.js

Issue 1193813002: New SELECT Popup: Reduce the size of JSON data. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/PopupMenuImpl.cpp ('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 "use strict"; 1 "use strict";
2 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 2 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be 3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file. 4 // found in the LICENSE file.
5 5
6 var global = { 6 var global = {
7 argumentsReceived: false, 7 argumentsReceived: false,
8 params: null, 8 params: null,
9 picker: null 9 picker: null
10 }; 10 };
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 element = createElement("optgroup"); 308 element = createElement("optgroup");
309 else if (config.type === "separator") 309 else if (config.type === "separator")
310 element = createElement("hr"); 310 element = createElement("hr");
311 return element; 311 return element;
312 }; 312 };
313 313
314 ListPicker.prototype._applyItemStyle = function(element, styleConfig) { 314 ListPicker.prototype._applyItemStyle = function(element, styleConfig) {
315 if (!styleConfig) 315 if (!styleConfig)
316 return; 316 return;
317 var style = element.style; 317 var style = element.style;
318 style.visibility = styleConfig.visibility; 318 style.visibility = styleConfig.visibility ? styleConfig.visibility : "";
319 style.display = styleConfig.display; 319 style.display = styleConfig.display ? styleConfig.display : "";
320 style.direction = styleConfig.direction; 320 style.direction = styleConfig.direction ? styleConfig.direction : "";
321 style.unicodeBidi = styleConfig.unicodeBidi; 321 style.unicodeBidi = styleConfig.unicodeBidi ? styleConfig.unicodeBidi : "";
322 if (!styleConfig.color) 322 if (!styleConfig.color)
323 return; 323 return;
324 style.color = styleConfig.color; 324 style.color = styleConfig.color;
325 style.backgroundColor = styleConfig.backgroundColor; 325 style.backgroundColor = styleConfig.backgroundColor;
326 style.fontSize = styleConfig.fontSize + "px"; 326 style.fontSize = styleConfig.fontSize + "px";
327 style.fontWeight = styleConfig.fontWeight; 327 style.fontWeight = styleConfig.fontWeight;
328 style.fontFamily = styleConfig.fontFamily.join(","); 328 style.fontFamily = styleConfig.fontFamily.join(",");
329 style.fontStyle = styleConfig.fontStyle; 329 style.fontStyle = styleConfig.fontStyle;
330 style.fontVariant = styleConfig.fontVariant; 330 style.fontVariant = styleConfig.fontVariant;
331 style.textTransform = styleConfig.textTransform; 331 style.textTransform = styleConfig.textTransform;
332 }; 332 };
333 333
334 ListPicker.prototype._configureItem = function(element, config, inGroup) { 334 ListPicker.prototype._configureItem = function(element, config, inGroup) {
335 if (config.type === "option") { 335 if (config.type === "option") {
336 element.label = config.label; 336 element.label = config.label;
337 element.value = config.value; 337 element.value = config.value;
338 element.title = config.title; 338 if (config.title)
339 element.disabled = config.disabled; 339 element.title = config.title;
340 element.setAttribute("aria-label", config.ariaLabel); 340 else
341 element.removeAttribute("title");
342 element.disabled = !!config.disabled
343 if (config.ariaLabel)
344 element.setAttribute("aria-label", config.ariaLabel);
345 else
346 element.removeAttribute("aria-label");
341 element.style.webkitPaddingStart = this._config.paddingStart + "px"; 347 element.style.webkitPaddingStart = this._config.paddingStart + "px";
342 if (inGroup) { 348 if (inGroup) {
343 element.style.webkitMarginStart = (- this._config.paddingStart) + "p x"; 349 element.style.webkitMarginStart = (- this._config.paddingStart) + "p x";
344 // Should be synchronized with padding-end in listPicker.css. 350 // Should be synchronized with padding-end in listPicker.css.
345 element.style.webkitMarginEnd = "-2px"; 351 element.style.webkitMarginEnd = "-2px";
346 } 352 }
347 } else if (config.type === "optgroup") { 353 } else if (config.type === "optgroup") {
348 element.label = config.label; 354 element.label = config.label;
349 element.title = config.title; 355 element.title = config.title;
350 element.disabled = config.disabled; 356 element.disabled = config.disabled;
(...skipping 12 matching lines...) Expand all
363 } 369 }
364 this._applyItemStyle(element, config.style); 370 this._applyItemStyle(element, config.style);
365 }; 371 };
366 372
367 if (window.dialogArguments) { 373 if (window.dialogArguments) {
368 initialize(dialogArguments); 374 initialize(dialogArguments);
369 } else { 375 } else {
370 window.addEventListener("message", handleMessage, false); 376 window.addEventListener("message", handleMessage, false);
371 window.setTimeout(handleArgumentsTimeout, 1000); 377 window.setTimeout(handleArgumentsTimeout, 1000);
372 } 378 }
OLDNEW
« no previous file with comments | « Source/web/PopupMenuImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698