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

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

Issue 2881453003: DevTools: update buttons to new style (Closed)
Patch Set: fix test 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
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 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 * @template T 1163 * @template T
1164 */ 1164 */
1165 UI.registerCustomElement = function(localName, typeExtension, prototype) { 1165 UI.registerCustomElement = function(localName, typeExtension, prototype) {
1166 return document.registerElement(typeExtension, {prototype: Object.create(proto type), extends: localName}); 1166 return document.registerElement(typeExtension, {prototype: Object.create(proto type), extends: localName});
1167 }; 1167 };
1168 1168
1169 /** 1169 /**
1170 * @param {string} text 1170 * @param {string} text
1171 * @param {function(!Event)=} clickHandler 1171 * @param {function(!Event)=} clickHandler
1172 * @param {string=} className 1172 * @param {string=} className
1173 * @param {boolean=} primary
1173 * @return {!Element} 1174 * @return {!Element}
1174 */ 1175 */
1175 UI.createTextButton = function(text, clickHandler, className) { 1176 UI.createTextButton = function(text, clickHandler, className, primary) {
1176 var element = createElementWithClass('button', className || '', 'text-button') ; 1177 var element = createElementWithClass('button', className || '', 'text-button') ;
1177 element.textContent = text; 1178 element.textContent = text;
1179 if (primary)
1180 element.classList.add('primary-button');
1178 if (clickHandler) 1181 if (clickHandler)
1179 element.addEventListener('click', clickHandler, false); 1182 element.addEventListener('click', clickHandler, false);
1180 return element; 1183 return element;
1181 }; 1184 };
1182 1185
1183 /** 1186 /**
1184 * @param {string} name 1187 * @param {string} name
1185 * @param {string} title 1188 * @param {string} title
1186 * @param {boolean=} checked 1189 * @param {boolean=} checked
1187 * @return {!Element} 1190 * @return {!Element}
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2036 */ 2039 */
2037 UI.createInlineButton = function(toolbarButton) { 2040 UI.createInlineButton = function(toolbarButton) {
2038 var element = createElement('span'); 2041 var element = createElement('span');
2039 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'ui/inlineButton.c ss'); 2042 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'ui/inlineButton.c ss');
2040 element.classList.add('inline-button'); 2043 element.classList.add('inline-button');
2041 var toolbar = new UI.Toolbar(''); 2044 var toolbar = new UI.Toolbar('');
2042 toolbar.appendToolbarItem(toolbarButton); 2045 toolbar.appendToolbarItem(toolbarButton);
2043 shadowRoot.appendChild(toolbar.element); 2046 shadowRoot.appendChild(toolbar.element);
2044 return element; 2047 return element;
2045 }; 2048 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698