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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ComputedStyleWidget.js

Issue 2932593003: DevTools: migrate ComputedStyleWidget to shadow (Closed)
Patch Set: ac 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) 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2009 Joseph Pecoraro 3 * Copyright (C) 2009 Joseph Pecoraro
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 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. 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 14 matching lines...) Expand all
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 /** 30 /**
31 * @unrestricted 31 * @unrestricted
32 */ 32 */
33 Elements.ComputedStyleWidget = class extends UI.ThrottledWidget { 33 Elements.ComputedStyleWidget = class extends UI.ThrottledWidget {
34 constructor() { 34 constructor() {
35 super(); 35 super(true);
36 this.element.classList.add('computed-style-sidebar-pane');
37
38 this.registerRequiredCSS('elements/computedStyleSidebarPane.css'); 36 this.registerRequiredCSS('elements/computedStyleSidebarPane.css');
39 this._alwaysShowComputedProperties = {'display': true, 'height': true, 'widt h': true}; 37 this._alwaysShowComputedProperties = {'display': true, 'height': true, 'widt h': true};
40 38
41 this._computedStyleModel = new Elements.ComputedStyleModel(); 39 this._computedStyleModel = new Elements.ComputedStyleModel();
42 this._computedStyleModel.addEventListener( 40 this._computedStyleModel.addEventListener(
43 Elements.ComputedStyleModel.Events.ComputedStyleChanged, this.update, th is); 41 Elements.ComputedStyleModel.Events.ComputedStyleChanged, this.update, th is);
44 42
45 this._showInheritedComputedStylePropertiesSetting = 43 this._showInheritedComputedStylePropertiesSetting =
46 Common.settings.createSetting('showInheritedComputedStyleProperties', fa lse); 44 Common.settings.createSetting('showInheritedComputedStyleProperties', fa lse);
47 this._showInheritedComputedStylePropertiesSetting.addChangeListener( 45 this._showInheritedComputedStylePropertiesSetting.addChangeListener(
48 this._showInheritedComputedStyleChanged.bind(this)); 46 this._showInheritedComputedStyleChanged.bind(this));
49 47
50 var hbox = this.element.createChild('div', 'hbox styles-sidebar-pane-toolbar '); 48 var hbox = this.contentElement.createChild('div', 'hbox styles-sidebar-pane- toolbar');
51 var filterContainerElement = hbox.createChild('div', 'styles-sidebar-pane-fi lter-box'); 49 var filterContainerElement = hbox.createChild('div', 'styles-sidebar-pane-fi lter-box');
52 var filterInput = Elements.StylesSidebarPane.createPropertyFilterElement( 50 var filterInput = Elements.StylesSidebarPane.createPropertyFilterElement(
53 Common.UIString('Filter'), hbox, filterCallback.bind(this)); 51 Common.UIString('Filter'), hbox, filterCallback.bind(this), 'styles-filt er-engaged');
54 UI.ARIAUtils.setAccessibleName(filterInput, Common.UIString('Filter Computed Styles')); 52 UI.ARIAUtils.setAccessibleName(filterInput, Common.UIString('Filter Computed Styles'));
55 filterContainerElement.appendChild(filterInput); 53 filterContainerElement.appendChild(filterInput);
56 54
57 var toolbar = new UI.Toolbar('styles-pane-toolbar', hbox); 55 var toolbar = new UI.Toolbar('styles-pane-toolbar', hbox);
58 toolbar.appendToolbarItem(new UI.ToolbarSettingCheckbox( 56 toolbar.appendToolbarItem(new UI.ToolbarSettingCheckbox(
59 this._showInheritedComputedStylePropertiesSetting, undefined, Common.UIS tring('Show all'))); 57 this._showInheritedComputedStylePropertiesSetting, undefined, Common.UIS tring('Show all')));
60 58
61 this._propertiesOutline = new UI.TreeOutlineInShadow(); 59 this._propertiesOutline = new UI.TreeOutlineInShadow();
62 this._propertiesOutline.hideOverflow(); 60 this._propertiesOutline.hideOverflow();
63 this._propertiesOutline.registerRequiredCSS('elements/computedStyleSidebarPa ne.css'); 61 this._propertiesOutline.registerRequiredCSS('elements/computedStyleWidgetTre e.css');
64 this._propertiesOutline.element.classList.add('monospace', 'computed-propert ies'); 62 this._propertiesOutline.element.classList.add('monospace', 'computed-propert ies');
65 this.element.appendChild(this._propertiesOutline.element); 63 this.contentElement.appendChild(this._propertiesOutline.element);
66 64
67 this._linkifier = new Components.Linkifier(Elements.ComputedStyleWidget._max LinkLength); 65 this._linkifier = new Components.Linkifier(Elements.ComputedStyleWidget._max LinkLength);
68 66
69 /** 67 /**
70 * @param {?RegExp} regex 68 * @param {?RegExp} regex
71 * @this {Elements.ComputedStyleWidget} 69 * @this {Elements.ComputedStyleWidget}
72 */ 70 */
73 function filterCallback(regex) { 71 function filterCallback(regex) {
74 this._filterRegex = regex; 72 this._filterRegex = regex;
75 this._updateFilter(regex); 73 this._updateFilter(regex);
76 } 74 }
77 75
78 var fontsWidget = new Elements.PlatformFontsWidget(this._computedStyleModel) ; 76 var fontsWidget = new Elements.PlatformFontsWidget(this._computedStyleModel) ;
79 fontsWidget.show(this.element); 77 fontsWidget.show(this.contentElement);
80 } 78 }
81 79
82 _showInheritedComputedStyleChanged() { 80 _showInheritedComputedStyleChanged() {
83 this.update(); 81 this.update();
84 } 82 }
85 83
86 /** 84 /**
87 * @override 85 * @override
88 * @return {!Promise.<?>} 86 * @return {!Promise.<?>}
89 */ 87 */
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 var property = child[Elements.ComputedStyleWidget._propertySymbol]; 339 var property = child[Elements.ComputedStyleWidget._propertySymbol];
342 var matched = !regex || regex.test(property.name) || regex.test(property.v alue); 340 var matched = !regex || regex.test(property.name) || regex.test(property.v alue);
343 child.hidden = !matched; 341 child.hidden = !matched;
344 } 342 }
345 } 343 }
346 }; 344 };
347 345
348 Elements.ComputedStyleWidget._maxLinkLength = 30; 346 Elements.ComputedStyleWidget._maxLinkLength = 30;
349 347
350 Elements.ComputedStyleWidget._propertySymbol = Symbol('property'); 348 Elements.ComputedStyleWidget._propertySymbol = Symbol('property');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698