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

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

Issue 2324313002: DevTools: Add buttons to add box-shadow and text-shadow properties in SSP (Closed)
Patch Set: Rename function Created 4 years, 3 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 }, 703 },
704 704
705 /** 705 /**
706 * @param {!Element} container 706 * @param {!Element} container
707 */ 707 */
708 _createHoverMenuToolbar: function(container) 708 _createHoverMenuToolbar: function(container)
709 { 709 {
710 if (!this.editable) 710 if (!this.editable)
711 return; 711 return;
712 var items = []; 712 var items = [];
713
714 var textShadowButton = new WebInspector.ToolbarButton(WebInspector.UIStr ing("Add text-shadow"), "text-shadow-toolbar-item");
715 textShadowButton.addEventListener("click", this._onInsertShadowPropertyC lick.bind(this, "text-shadow"));
716 items.push(textShadowButton);
717
718 var boxShadowButton = new WebInspector.ToolbarButton(WebInspector.UIStri ng("Add box-shadow"), "box-shadow-toolbar-item");
719 boxShadowButton.addEventListener("click", this._onInsertShadowPropertyCl ick.bind(this, "box-shadow"));
720 items.push(boxShadowButton);
721
713 var colorButton = new WebInspector.ToolbarButton(WebInspector.UIString(" Add color"), "foreground-color-toolbar-item"); 722 var colorButton = new WebInspector.ToolbarButton(WebInspector.UIString(" Add color"), "foreground-color-toolbar-item");
714 colorButton.addEventListener("click", this._onInsertColorPropertyClick.b ind(this)); 723 colorButton.addEventListener("click", this._onInsertColorPropertyClick.b ind(this));
715 items.push(colorButton); 724 items.push(colorButton);
716 725
717 var backgroundButton = new WebInspector.ToolbarButton(WebInspector.UIStr ing("Add background-color"), "background-color-toolbar-item"); 726 var backgroundButton = new WebInspector.ToolbarButton(WebInspector.UIStr ing("Add background-color"), "background-color-toolbar-item");
718 backgroundButton.addEventListener("click", this._onInsertBackgroundColor PropertyClick.bind(this)); 727 backgroundButton.addEventListener("click", this._onInsertBackgroundColor PropertyClick.bind(this));
719 items.push(backgroundButton); 728 items.push(backgroundButton);
720 729
721 var newRuleButton = null; 730 var newRuleButton = null;
722 if (this._style.parentRule) { 731 if (this._style.parentRule) {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 */ 884 */
876 _onNewRuleClick: function(event) 885 _onNewRuleClick: function(event)
877 { 886 {
878 event.consume(); 887 event.consume();
879 var rule = this._style.parentRule; 888 var rule = this._style.parentRule;
880 var range = WebInspector.TextRange.createFromLocation(rule.style.range.e ndLine, rule.style.range.endColumn + 1); 889 var range = WebInspector.TextRange.createFromLocation(rule.style.range.e ndLine, rule.style.range.endColumn + 1);
881 this._parentPane._addBlankSection(this, /** @type {string} */(rule.style SheetId), range); 890 this._parentPane._addBlankSection(this, /** @type {string} */(rule.style SheetId), range);
882 }, 891 },
883 892
884 /** 893 /**
894 * @param {string} propertyName
895 * @param {!WebInspector.Event} event
896 */
897 _onInsertShadowPropertyClick: function(propertyName, event)
898 {
899 event.consume(true);
900 var treeElement = this.addNewBlankProperty();
901 treeElement.property.name = propertyName;
902 treeElement.property.value = "0 0 black";
903 treeElement.updateTitle();
904 var shadowSwatchPopoverHelper = WebInspector.ShadowSwatchPopoverHelper.f orTreeElement(treeElement);
905 if (shadowSwatchPopoverHelper)
906 shadowSwatchPopoverHelper.showPopover();
907 },
908
909 /**
885 * @param {!WebInspector.Event} event 910 * @param {!WebInspector.Event} event
886 */ 911 */
887 _onInsertColorPropertyClick: function(event) 912 _onInsertColorPropertyClick: function(event)
888 { 913 {
889 event.consume(true); 914 event.consume(true);
890 var treeElement = this.addNewBlankProperty(); 915 var treeElement = this.addNewBlankProperty();
891 treeElement.property.name = "color"; 916 treeElement.property.name = "color";
892 treeElement.property.value = "black"; 917 treeElement.property.value = "black";
893 treeElement.updateTitle(); 918 treeElement.updateTitle();
894 var colorSwatch = WebInspector.ColorSwatchPopoverIcon.forTreeElement(tre eElement); 919 var colorSwatch = WebInspector.ColorSwatchPopoverIcon.forTreeElement(tre eElement);
(...skipping 2258 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 3178
3154 /** 3179 /**
3155 * @override 3180 * @override
3156 * @return {!WebInspector.ToolbarItem} 3181 * @return {!WebInspector.ToolbarItem}
3157 */ 3182 */
3158 item: function() 3183 item: function()
3159 { 3184 {
3160 return this._button; 3185 return this._button;
3161 } 3186 }
3162 } 3187 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698