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

Side by Side Diff: Source/devtools/front_end/elements/StylesSidebarPane.js

Issue 1172643002: DevTools: migrate sidebar pane's titleElement to use Toolbar. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: only using latin1 in css 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
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 22 matching lines...) Expand all
33 * @param {function()} requestShowCallback 33 * @param {function()} requestShowCallback
34 */ 34 */
35 WebInspector.StylesSidebarPane = function(requestShowCallback) 35 WebInspector.StylesSidebarPane = function(requestShowCallback)
36 { 36 {
37 WebInspector.ElementsSidebarPane.call(this, WebInspector.UIString("Styles")) ; 37 WebInspector.ElementsSidebarPane.call(this, WebInspector.UIString("Styles")) ;
38 38
39 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bin d(this), true); 39 this.element.addEventListener("contextmenu", this._contextMenuEventFired.bin d(this), true);
40 WebInspector.moduleSetting("colorFormat").addChangeListener(this.update.bind (this)); 40 WebInspector.moduleSetting("colorFormat").addChangeListener(this.update.bind (this));
41 WebInspector.moduleSetting("textEditorIndent").addChangeListener(this.update .bind(this)); 41 WebInspector.moduleSetting("textEditorIndent").addChangeListener(this.update .bind(this));
42 42
43 var toolbar = new WebInspector.ExtensibleToolbar("styles-sidebarpane-toolbar ", this.titleElement); 43 var toolbar = new WebInspector.ExtensibleToolbar("styles-sidebarpane-toolbar ", this.element);
44 toolbar.element.classList.add("styles-pane-toolbar"); 44 toolbar.element.classList.add("styles-pane-toolbar");
45 if (!Runtime.experiments.isEnabled("materialDesign"))
46 toolbar.makeNarrow();
47 45
48 this._requestShowCallback = requestShowCallback; 46 this._requestShowCallback = requestShowCallback;
49 var toolbarPaneContainer = this.bodyElement.createChild("div", "styles-sideb ar-toolbar-pane-container"); 47 var toolbarPaneContainer = this.element.createChild("div", "styles-sidebar-t oolbar-pane-container");
50 this._toolbarPaneElement = toolbarPaneContainer.createChild("div", "styles-s idebar-toolbar-pane"); 48 this._toolbarPaneElement = toolbarPaneContainer.createChild("div", "styles-s idebar-toolbar-pane");
51 this._sectionsContainer = this.bodyElement.createChild("div"); 49 this._sectionsContainer = this.element.createChild("div");
52 50
53 this._stylesPopoverHelper = new WebInspector.StylesPopoverHelper(); 51 this._stylesPopoverHelper = new WebInspector.StylesPopoverHelper();
54 52
55 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter()); 53 this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.Defa ultCSSFormatter());
56 54
57 this.element.classList.add("styles-pane"); 55 this.element.classList.add("styles-pane");
58 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind( this), false); 56 this.element.addEventListener("mousemove", this._mouseMovedOverElement.bind( this), false);
59 this._keyDownBound = this._keyDown.bind(this); 57 this._keyDownBound = this._keyDown.bind(this);
60 this._keyUpBound = this._keyUp.bind(this); 58 this._keyUpBound = this._keyUp.bind(this);
61 } 59 }
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 }, 815 },
818 816
819 /** 817 /**
820 * @param {?WebInspector.Widget} widget 818 * @param {?WebInspector.Widget} widget
821 */ 819 */
822 _startToolbarPaneAnimation: function(widget) 820 _startToolbarPaneAnimation: function(widget)
823 { 821 {
824 if (widget === this._currentToolbarPane) 822 if (widget === this._currentToolbarPane)
825 return; 823 return;
826 824
825 if (widget && this._currentToolbarPane) {
826 this._currentToolbarPane.detach();
827 widget.show(this._toolbarPaneElement);
828 this._currentToolbarPane = widget;
829 return;
830 }
831
827 this._animatedToolbarPane = widget; 832 this._animatedToolbarPane = widget;
828 833
829 if (this._currentToolbarPane) 834 if (this._currentToolbarPane)
830 this._toolbarPaneElement.style.animationName = 'styles-element-state -pane-slideout'; 835 this._toolbarPaneElement.style.animationName = 'styles-element-state -pane-slideout';
831 else if (widget) 836 else if (widget)
832 this._toolbarPaneElement.style.animationName = 'styles-element-state -pane-slidein'; 837 this._toolbarPaneElement.style.animationName = 'styles-element-state -pane-slidein';
833 838
834 if (widget) 839 if (widget)
835 widget.show(this._toolbarPaneElement); 840 widget.show(this._toolbarPaneElement);
836 841
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 WebInspector.StylePropertiesSection = function(parentPane, styleRule) 981 WebInspector.StylePropertiesSection = function(parentPane, styleRule)
977 { 982 {
978 this._parentPane = parentPane; 983 this._parentPane = parentPane;
979 this.styleRule = styleRule; 984 this.styleRule = styleRule;
980 this.editable = styleRule.editable(); 985 this.editable = styleRule.editable();
981 986
982 var rule = styleRule.rule(); 987 var rule = styleRule.rule();
983 this.element = createElementWithClass("div", "styles-section matched-styles monospace"); 988 this.element = createElementWithClass("div", "styles-section matched-styles monospace");
984 this.element._section = this; 989 this.element._section = this;
985 990
986 this.titleElement = this.element.createChild("div", "styles-section-title " + (rule ? "styles-selector" : "")); 991 this._titleElement = this.element.createChild("div", "styles-section-title " + (rule ? "styles-selector" : ""));
987 992
988 this.propertiesTreeOutline = new TreeOutline(); 993 this.propertiesTreeOutline = new TreeOutline();
989 this.propertiesTreeOutline.element.classList.add("style-properties", "monosp ace"); 994 this.propertiesTreeOutline.element.classList.add("style-properties", "monosp ace");
990 this.propertiesTreeOutline.section = this; 995 this.propertiesTreeOutline.section = this;
991 this.element.appendChild(this.propertiesTreeOutline.element); 996 this.element.appendChild(this.propertiesTreeOutline.element);
992 997
993 var selectorContainer = createElement("div"); 998 var selectorContainer = createElement("div");
994 this._selectorElement = createElementWithClass("span", "selector"); 999 this._selectorElement = createElementWithClass("span", "selector");
995 this._selectorElement.textContent = styleRule.selectorText(); 1000 this._selectorElement.textContent = styleRule.selectorText();
996 selectorContainer.appendChild(this._selectorElement); 1001 selectorContainer.appendChild(this._selectorElement);
(...skipping 23 matching lines...) Expand all
1020 if (rule.isUserAgent || rule.isInjected) { 1025 if (rule.isUserAgent || rule.isInjected) {
1021 this.editable = false; 1026 this.editable = false;
1022 } else { 1027 } else {
1023 // Check this is a real CSSRule, not a bogus object coming from WebI nspector.BlankStylePropertiesSection. 1028 // Check this is a real CSSRule, not a bogus object coming from WebI nspector.BlankStylePropertiesSection.
1024 if (rule.styleSheetId) 1029 if (rule.styleSheetId)
1025 this.navigable = !!rule.resourceURL(); 1030 this.navigable = !!rule.resourceURL();
1026 } 1031 }
1027 } 1032 }
1028 1033
1029 this._selectorRefElement = createElementWithClass("div", "styles-section-sub title"); 1034 this._selectorRefElement = createElementWithClass("div", "styles-section-sub title");
1030 this._mediaListElement = this.titleElement.createChild("div", "media-list me dia-matches"); 1035 this._mediaListElement = this._titleElement.createChild("div", "media-list m edia-matches");
1031 this._updateMediaList(); 1036 this._updateMediaList();
1032 this._updateRuleOrigin(); 1037 this._updateRuleOrigin();
1033 selectorContainer.insertBefore(this._selectorRefElement, selectorContainer.f irstChild); 1038 selectorContainer.insertBefore(this._selectorRefElement, selectorContainer.f irstChild);
1034 this.titleElement.appendChild(selectorContainer); 1039 this._titleElement.appendChild(selectorContainer);
1035 this._selectorContainer = selectorContainer; 1040 this._selectorContainer = selectorContainer;
1036 1041
1037 if (this.navigable) 1042 if (this.navigable)
1038 this.element.classList.add("navigable"); 1043 this.element.classList.add("navigable");
1039 1044
1040 if (!this.editable) 1045 if (!this.editable)
1041 this.element.classList.add("read-only"); 1046 this.element.classList.add("read-only");
1042 1047
1043 this._markSelectorMatches(); 1048 this._markSelectorMatches();
1044 this.onpopulate(); 1049 this.onpopulate();
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after
3256 3261
3257 /** 3262 /**
3258 * @override 3263 * @override
3259 * @return {?WebInspector.ToolbarItem} 3264 * @return {?WebInspector.ToolbarItem}
3260 */ 3265 */
3261 item: function() 3266 item: function()
3262 { 3267 {
3263 return this._button; 3268 return this._button;
3264 } 3269 }
3265 } 3270 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/elements/MetricsSidebarPane.js ('k') | Source/devtools/front_end/elements/elementsPanel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698