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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelinePanel.js

Issue 1636853002: Timeline: simplify handling of event category colors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 * Copyright (C) 2012 Intel Inc. All rights reserved. 3 * Copyright (C) 2012 Intel Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 * @override 175 * @override
176 * @return {?WebInspector.SearchableView} 176 * @return {?WebInspector.SearchableView}
177 */ 177 */
178 searchableView: function() 178 searchableView: function()
179 { 179 {
180 return this._searchableView; 180 return this._searchableView;
181 }, 181 },
182 182
183 wasShown: function() 183 wasShown: function()
184 { 184 {
185 if (!WebInspector.TimelinePanel._categoryStylesInitialized) {
186 WebInspector.TimelinePanel._categoryStylesInitialized = true;
187 var style = createElement("style");
188 var categories = WebInspector.TimelineUIUtils.categories();
189 style.textContent = Object.values(categories).map(WebInspector.Timel ineUIUtils.createStyleRuleForCategory).join("\n");
190 this.element.ownerDocument.head.appendChild(style);
191 }
192 WebInspector.context.setFlavor(WebInspector.TimelinePanel, this); 185 WebInspector.context.setFlavor(WebInspector.TimelinePanel, this);
193 }, 186 },
194 187
195 willHide: function() 188 willHide: function()
196 { 189 {
197 WebInspector.context.setFlavor(WebInspector.TimelinePanel, null); 190 WebInspector.context.setFlavor(WebInspector.TimelinePanel, null);
198 }, 191 },
199 192
200 /** 193 /**
201 * @return {number} 194 * @return {number}
(...skipping 1799 matching lines...) Expand 10 before | Expand all | Expand 10 after
2001 durationFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterCha nged, durationFilterChanged, this); 1994 durationFilterUI.addEventListener(WebInspector.FilterUI.Events.FilterCha nged, durationFilterChanged, this);
2002 this._filterBar.addFilter(durationFilterUI); 1995 this._filterBar.addFilter(durationFilterUI);
2003 1996
2004 var categoryFiltersUI = {}; 1997 var categoryFiltersUI = {};
2005 var categories = WebInspector.TimelineUIUtils.categories(); 1998 var categories = WebInspector.TimelineUIUtils.categories();
2006 for (var categoryName in categories) { 1999 for (var categoryName in categories) {
2007 var category = categories[categoryName]; 2000 var category = categories[categoryName];
2008 if (!category.visible) 2001 if (!category.visible)
2009 continue; 2002 continue;
2010 var filter = new WebInspector.CheckboxFilterUI(category.name, catego ry.title); 2003 var filter = new WebInspector.CheckboxFilterUI(category.name, catego ry.title);
2011 filter.setColor(category.fillColorStop0, category.borderColor); 2004 filter.setColor(category.color, "rgba(0, 0, 0, 0.2)");
2012 categoryFiltersUI[category.name] = filter; 2005 categoryFiltersUI[category.name] = filter;
2013 filter.addEventListener(WebInspector.FilterUI.Events.FilterChanged, categoriesFilterChanged.bind(this, categoryName)); 2006 filter.addEventListener(WebInspector.FilterUI.Events.FilterChanged, categoriesFilterChanged.bind(this, categoryName));
2014 this._filterBar.addFilter(filter); 2007 this._filterBar.addFilter(filter);
2015 } 2008 }
2016 return this._filterBar; 2009 return this._filterBar;
2017 2010
2018 /** 2011 /**
2019 * @this {WebInspector.TimelineFilters} 2012 * @this {WebInspector.TimelineFilters}
2020 */ 2013 */
2021 function textFilterChanged() 2014 function textFilterChanged()
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2100 * @override 2093 * @override
2101 * @param {!WebInspector.Target} target 2094 * @param {!WebInspector.Target} target
2102 */ 2095 */
2103 targetRemoved: function(target) 2096 targetRemoved: function(target)
2104 { 2097 {
2105 this._targets.remove(target, true); 2098 this._targets.remove(target, true);
2106 }, 2099 },
2107 2100
2108 __proto__: WebInspector.Object.prototype 2101 __proto__: WebInspector.Object.prototype
2109 } 2102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698