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

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: rebase over cleanup 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 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 * @template T 1145 * @template T
1146 */ 1146 */
1147 UI.registerCustomElement = function(localName, typeExtension, prototype) { 1147 UI.registerCustomElement = function(localName, typeExtension, prototype) {
1148 return document.registerElement(typeExtension, {prototype: Object.create(proto type), extends: localName}); 1148 return document.registerElement(typeExtension, {prototype: Object.create(proto type), extends: localName});
1149 }; 1149 };
1150 1150
1151 /** 1151 /**
1152 * @param {string} text 1152 * @param {string} text
1153 * @param {function(!Event)=} clickHandler 1153 * @param {function(!Event)=} clickHandler
1154 * @param {string=} className 1154 * @param {string=} className
1155 * @param {boolean=} primary
1155 * @return {!Element} 1156 * @return {!Element}
1156 */ 1157 */
1157 UI.createTextButton = function(text, clickHandler, className) { 1158 UI.createTextButton = function(text, clickHandler, className, primary) {
1158 var element = createElementWithClass('button', className || '', 'text-button') ; 1159 var element = createElementWithClass('button', className || '', 'text-button') ;
1159 element.textContent = text; 1160 element.textContent = text;
1161 if (primary)
1162 element.classList.add('primary');
1160 if (clickHandler) 1163 if (clickHandler)
1161 element.addEventListener('click', clickHandler, false); 1164 element.addEventListener('click', clickHandler, false);
1162 return element; 1165 return element;
1163 }; 1166 };
1164 1167
1165 /** 1168 /**
1166 * @param {string} name 1169 * @param {string} name
1167 * @param {string} title 1170 * @param {string} title
1168 * @param {boolean=} checked 1171 * @param {boolean=} checked
1169 * @return {!Element} 1172 * @return {!Element}
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
2018 */ 2021 */
2019 UI.createInlineButton = function(toolbarButton) { 2022 UI.createInlineButton = function(toolbarButton) {
2020 var element = createElement('span'); 2023 var element = createElement('span');
2021 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'ui/inlineButton.c ss'); 2024 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'ui/inlineButton.c ss');
2022 element.classList.add('inline-button'); 2025 element.classList.add('inline-button');
2023 var toolbar = new UI.Toolbar(''); 2026 var toolbar = new UI.Toolbar('');
2024 toolbar.appendToolbarItem(toolbarButton); 2027 toolbar.appendToolbarItem(toolbarButton);
2025 shadowRoot.appendChild(toolbar.element); 2028 shadowRoot.appendChild(toolbar.element);
2026 return element; 2029 return element;
2027 }; 2030 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698