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

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

Issue 2626143004: DevTools: move from Common module - Geometry and CSSShadowModel (Closed)
Patch Set: minimize test diff Created 3 years, 11 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 1906 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 */ 1917 */
1918 renderedPropertyText() { 1918 renderedPropertyText() {
1919 return this.nameElement.textContent + ': ' + this.valueElement.textContent; 1919 return this.nameElement.textContent + ': ' + this.valueElement.textContent;
1920 } 1920 }
1921 1921
1922 /** 1922 /**
1923 * @param {string} text 1923 * @param {string} text
1924 * @return {!Node} 1924 * @return {!Node}
1925 */ 1925 */
1926 _processBezier(text) { 1926 _processBezier(text) {
1927 if (!this._editable() || !Common.Geometry.CubicBezier.parse(text)) 1927 if (!this._editable() || !UI.Geometry.CubicBezier.parse(text))
1928 return createTextNode(text); 1928 return createTextNode(text);
1929 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper; 1929 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper;
1930 var swatch = InlineEditor.BezierSwatch.create(); 1930 var swatch = InlineEditor.BezierSwatch.create();
1931 swatch.setBezierText(text); 1931 swatch.setBezierText(text);
1932 new Elements.BezierPopoverIcon(this, swatchPopoverHelper, swatch); 1932 new Elements.BezierPopoverIcon(this, swatchPopoverHelper, swatch);
1933 return swatch; 1933 return swatch;
1934 } 1934 }
1935 1935
1936 /** 1936 /**
1937 * @param {string} propertyValue 1937 * @param {string} propertyValue
1938 * @param {string} propertyName 1938 * @param {string} propertyName
1939 * @return {!Node} 1939 * @return {!Node}
1940 */ 1940 */
1941 _processShadow(propertyValue, propertyName) { 1941 _processShadow(propertyValue, propertyName) {
1942 if (!this._editable()) 1942 if (!this._editable())
1943 return createTextNode(propertyValue); 1943 return createTextNode(propertyValue);
1944 var shadows; 1944 var shadows;
1945 if (propertyName === 'text-shadow') 1945 if (propertyName === 'text-shadow')
1946 shadows = Common.CSSShadowModel.parseTextShadow(propertyValue); 1946 shadows = InlineEditor.CSSShadowModel.parseTextShadow(propertyValue);
1947 else 1947 else
1948 shadows = Common.CSSShadowModel.parseBoxShadow(propertyValue); 1948 shadows = InlineEditor.CSSShadowModel.parseBoxShadow(propertyValue);
1949 if (!shadows.length) 1949 if (!shadows.length)
1950 return createTextNode(propertyValue); 1950 return createTextNode(propertyValue);
1951 var container = createDocumentFragment(); 1951 var container = createDocumentFragment();
1952 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper; 1952 var swatchPopoverHelper = this._parentPane._swatchPopoverHelper;
1953 for (var i = 0; i < shadows.length; i++) { 1953 for (var i = 0; i < shadows.length; i++) {
1954 if (i !== 0) 1954 if (i !== 0)
1955 container.appendChild(createTextNode(', ')); // Add back commas and spa ces between each shadow. 1955 container.appendChild(createTextNode(', ')); // Add back commas and spa ces between each shadow.
1956 // TODO(flandy): editing the property value should use the original value with all spaces. 1956 // TODO(flandy): editing the property value should use the original value with all spaces.
1957 var cssShadowSwatch = InlineEditor.CSSShadowSwatch.create(); 1957 var cssShadowSwatch = InlineEditor.CSSShadowSwatch.create();
1958 cssShadowSwatch.setCSSShadow(shadows[i]); 1958 cssShadowSwatch.setCSSShadow(shadows[i]);
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
2993 this._propertyName === '-webkit-box-shadow') && 2993 this._propertyName === '-webkit-box-shadow') &&
2994 !SDK.CSSMetadata.VariableRegex.test(this._propertyValue)) { 2994 !SDK.CSSMetadata.VariableRegex.test(this._propertyValue)) {
2995 valueElement.appendChild(this._shadowHandler(this._propertyValue, this._pr opertyName)); 2995 valueElement.appendChild(this._shadowHandler(this._propertyValue, this._pr opertyName));
2996 valueElement.normalize(); 2996 valueElement.normalize();
2997 return valueElement; 2997 return valueElement;
2998 } 2998 }
2999 2999
3000 var regexes = [SDK.CSSMetadata.VariableRegex, SDK.CSSMetadata.URLRegex]; 3000 var regexes = [SDK.CSSMetadata.VariableRegex, SDK.CSSMetadata.URLRegex];
3001 var processors = [createTextNode, this._processURL.bind(this)]; 3001 var processors = [createTextNode, this._processURL.bind(this)];
3002 if (this._bezierHandler && SDK.cssMetadata().isBezierAwareProperty(this._pro pertyName)) { 3002 if (this._bezierHandler && SDK.cssMetadata().isBezierAwareProperty(this._pro pertyName)) {
3003 regexes.push(Common.Geometry.CubicBezier.Regex); 3003 regexes.push(UI.Geometry.CubicBezier.Regex);
3004 processors.push(this._bezierHandler); 3004 processors.push(this._bezierHandler);
3005 } 3005 }
3006 if (this._colorHandler && SDK.cssMetadata().isColorAwareProperty(this._prope rtyName)) { 3006 if (this._colorHandler && SDK.cssMetadata().isColorAwareProperty(this._prope rtyName)) {
3007 regexes.push(Common.Color.Regex); 3007 regexes.push(Common.Color.Regex);
3008 processors.push(this._colorHandler); 3008 processors.push(this._colorHandler);
3009 } 3009 }
3010 var results = Common.TextUtils.splitStringByRegexes(this._propertyValue, reg exes); 3010 var results = Common.TextUtils.splitStringByRegexes(this._propertyValue, reg exes);
3011 for (var i = 0; i < results.length; i++) { 3011 for (var i = 0; i < results.length; i++) {
3012 var result = results[i]; 3012 var result = results[i];
3013 var processor = result.regexIndex === -1 ? createTextNode : processors[res ult.regexIndex]; 3013 var processor = result.regexIndex === -1 ? createTextNode : processors[res ult.regexIndex];
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3080 } 3080 }
3081 3081
3082 /** 3082 /**
3083 * @override 3083 * @override
3084 * @return {!UI.ToolbarItem} 3084 * @return {!UI.ToolbarItem}
3085 */ 3085 */
3086 item() { 3086 item() {
3087 return this._button; 3087 return this._button;
3088 } 3088 }
3089 }; 3089 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698