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

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: Resolve black box 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._onInsertTextShadowPrope rtyClick.bind(this));
lushnikov 2016/09/10 00:17:23 this._onShadowButtonClick.bind(this, "text-shadow"
flandy 2016/09/10 00:26:04 Done.
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._onInsertBoxShadowPropert yClick.bind(this));
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 /**
885 * @param {!WebInspector.Event} event 894 * @param {!WebInspector.Event} event
886 */ 895 */
896 _onInsertTextShadowPropertyClick: function(event)
lushnikov 2016/09/10 00:17:23 onShadowButtonClick: function(text, shadow) { ...
flandy 2016/09/10 00:26:04 Done.
897 {
898 event.consume(true);
899 var treeElement = this.addNewBlankProperty();
900 treeElement.property.name = "text-shadow";
901 treeElement.property.value = "0 0 black";
902 treeElement.updateTitle();
903 var shadowSwatchPopoverHelper = WebInspector.ShadowSwatchPopoverHelper.f orTreeElement(treeElement);
904 if (shadowSwatchPopoverHelper)
905 shadowSwatchPopoverHelper.showPopover();
906 },
907
908 /**
909 * @param {!WebInspector.Event} event
910 */
911 _onInsertBoxShadowPropertyClick: function(event)
912 {
913 event.consume(true);
914 var treeElement = this.addNewBlankProperty();
915 treeElement.property.name = "box-shadow";
916 treeElement.property.value = "0 0 black";
917 treeElement.updateTitle();
918 var shadowSwatchPopoverHelper = WebInspector.ShadowSwatchPopoverHelper.f orTreeElement(treeElement);
919 if (shadowSwatchPopoverHelper)
920 shadowSwatchPopoverHelper.showPopover();
921 },
922
923 /**
924 * @param {!WebInspector.Event} event
925 */
887 _onInsertColorPropertyClick: function(event) 926 _onInsertColorPropertyClick: function(event)
888 { 927 {
889 event.consume(true); 928 event.consume(true);
890 var treeElement = this.addNewBlankProperty(); 929 var treeElement = this.addNewBlankProperty();
891 treeElement.property.name = "color"; 930 treeElement.property.name = "color";
892 treeElement.property.value = "black"; 931 treeElement.property.value = "black";
893 treeElement.updateTitle(); 932 treeElement.updateTitle();
894 var colorSwatch = WebInspector.ColorSwatchPopoverIcon.forTreeElement(tre eElement); 933 var colorSwatch = WebInspector.ColorSwatchPopoverIcon.forTreeElement(tre eElement);
895 if (colorSwatch) 934 if (colorSwatch)
896 colorSwatch.showPopover(); 935 colorSwatch.showPopover();
(...skipping 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after
3153 3192
3154 /** 3193 /**
3155 * @override 3194 * @override
3156 * @return {!WebInspector.ToolbarItem} 3195 * @return {!WebInspector.ToolbarItem}
3157 */ 3196 */
3158 item: function() 3197 item: function()
3159 { 3198 {
3160 return this._button; 3199 return this._button;
3161 } 3200 }
3162 } 3201 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698