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

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

Issue 2252913002: DevTools: Box-shadow editor initial implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shadowIcon
Patch Set: Heavily updated Created 4 years, 4 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 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 2020
2021 /** 2021 /**
2022 * @param {string} propertyValue 2022 * @param {string} propertyValue
2023 * @param {string} propertyName 2023 * @param {string} propertyName
2024 * @return {!Node} 2024 * @return {!Node}
2025 */ 2025 */
2026 _processShadow: function(propertyValue, propertyName) 2026 _processShadow: function(propertyValue, propertyName)
2027 { 2027 {
2028 if (!this._editable()) 2028 if (!this._editable())
2029 return createTextNode(propertyValue); 2029 return createTextNode(propertyValue);
2030 var shadows; 2030 var shadows, isBoxShadow;
dgozman 2016/08/24 19:18:30 style: one variable per declaration
flandy 2016/08/24 22:08:41 Done.
2031 if (propertyName === "text-shadow") 2031 if (propertyName === "text-shadow") {
2032 shadows = WebInspector.CSSShadowModel.parseTextShadow(propertyValue) ; 2032 shadows = WebInspector.CSSShadowModel.parseTextShadow(propertyValue) ;
2033 else 2033 isBoxShadow = false;
2034 } else {
2034 shadows = WebInspector.CSSShadowModel.parseBoxShadow(propertyValue); 2035 shadows = WebInspector.CSSShadowModel.parseBoxShadow(propertyValue);
2036 isBoxShadow = true;
2037 }
2035 if (!shadows.length) 2038 if (!shadows.length)
2036 return createTextNode(propertyValue); 2039 return createTextNode(propertyValue);
2037 var container = createDocumentFragment(); 2040 var container = createDocumentFragment();
2038 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper; 2041 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper;
2039 for (var i = 0; i < shadows.length; i++) { 2042 for (var i = 0; i < shadows.length; i++) {
2040 if (i !== 0) 2043 if (i !== 0)
2041 container.appendChild(createTextNode(", ")); // Add back commas and spaces between each shadow. 2044 container.appendChild(createTextNode(", ")); // Add back commas and spaces between each shadow.
2042 // TODO(flandy): editing the property value should use the original value with all spaces. 2045 // TODO(flandy): editing the property value should use the original value with all spaces.
2043 var cssShadowSwatch = WebInspector.CSSShadowSwatch.create(); 2046 var cssShadowSwatch = WebInspector.CSSShadowSwatch.create();
2044 cssShadowSwatch.setCSSShadow(shadows[i]); 2047 cssShadowSwatch.setCSSShadow(shadows[i]);
2048 new WebInspector.ShadowSwatchPopoverHelper(this, swatchPopoverHelper , cssShadowSwatch, isBoxShadow);
2045 container.appendChild(cssShadowSwatch); 2049 container.appendChild(cssShadowSwatch);
2046 } 2050 }
2047 return container; 2051 return container;
2048 }, 2052 },
2049 2053
2050 _updateState: function() 2054 _updateState: function()
2051 { 2055 {
2052 if (!this.listItemElement) 2056 if (!this.listItemElement)
2053 return; 2057 return;
2054 2058
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
3144 3148
3145 /** 3149 /**
3146 * @override 3150 * @override
3147 * @return {!WebInspector.ToolbarItem} 3151 * @return {!WebInspector.ToolbarItem}
3148 */ 3152 */
3149 item: function() 3153 item: function()
3150 { 3154 {
3151 return this._button; 3155 return this._button;
3152 } 3156 }
3153 } 3157 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698