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

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

Issue 1822613002: Devtools: Don't show color swatch for variables like var(--blue) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/elements/styles/url-color-swatch-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2960 matching lines...) Expand 10 before | Expand all | Expand 10 after
2971 * @param {string} value 2971 * @param {string} value
2972 */ 2972 */
2973 WebInspector.StylesSidebarPropertyRenderer = function(rule, node, name, value) 2973 WebInspector.StylesSidebarPropertyRenderer = function(rule, node, name, value)
2974 { 2974 {
2975 this._rule = rule; 2975 this._rule = rule;
2976 this._node = node; 2976 this._node = node;
2977 this._propertyName = name; 2977 this._propertyName = name;
2978 this._propertyValue = value; 2978 this._propertyValue = value;
2979 } 2979 }
2980 2980
2981 WebInspector.StylesSidebarPropertyRenderer._variableRegex = /(var\(--.*?\))/g;
2981 WebInspector.StylesSidebarPropertyRenderer._colorRegex = /((?:rgb|hsl)a?\([^)]+\ )|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|\b\w+\b(?!-))/g; 2982 WebInspector.StylesSidebarPropertyRenderer._colorRegex = /((?:rgb|hsl)a?\([^)]+\ )|#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}|\b\w+\b(?!-))/g;
2982 WebInspector.StylesSidebarPropertyRenderer._bezierRegex = /((cubic-bezier\([^)]+ \))|\b(linear|ease-in-out|ease-in|ease-out|ease)\b)/g; 2983 WebInspector.StylesSidebarPropertyRenderer._bezierRegex = /((cubic-bezier\([^)]+ \))|\b(linear|ease-in-out|ease-in|ease-out|ease)\b)/g;
2983 2984
2984 /** 2985 /**
2985 * @param {string} value 2986 * @param {string} value
2986 * @return {!RegExp} 2987 * @return {!RegExp}
2987 */ 2988 */
2988 WebInspector.StylesSidebarPropertyRenderer._urlRegex = function(value) 2989 WebInspector.StylesSidebarPropertyRenderer._urlRegex = function(value)
2989 { 2990 {
2990 // Heuristically choose between single-quoted, double-quoted or plain URL re gex. 2991 // Heuristically choose between single-quoted, double-quoted or plain URL re gex.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3029 */ 3030 */
3030 renderValue: function() 3031 renderValue: function()
3031 { 3032 {
3032 var valueElement = createElement("span"); 3033 var valueElement = createElement("span");
3033 valueElement.className = "value"; 3034 valueElement.className = "value";
3034 3035
3035 if (!this._propertyValue) 3036 if (!this._propertyValue)
3036 return valueElement; 3037 return valueElement;
3037 3038
3038 var formatter = new WebInspector.StringFormatter(); 3039 var formatter = new WebInspector.StringFormatter();
3040 formatter.addProcessor(WebInspector.StylesSidebarPropertyRenderer._varia bleRegex, createTextNode);
3039 formatter.addProcessor(WebInspector.StylesSidebarPropertyRenderer._urlRe gex(this._propertyValue), this._processURL.bind(this)); 3041 formatter.addProcessor(WebInspector.StylesSidebarPropertyRenderer._urlRe gex(this._propertyValue), this._processURL.bind(this));
3040 if (this._bezierHandler && WebInspector.CSSMetadata.isBezierAwarePropert y(this._propertyName)) 3042 if (this._bezierHandler && WebInspector.CSSMetadata.isBezierAwarePropert y(this._propertyName))
3041 formatter.addProcessor(WebInspector.StylesSidebarPropertyRenderer._b ezierRegex, this._bezierHandler); 3043 formatter.addProcessor(WebInspector.StylesSidebarPropertyRenderer._b ezierRegex, this._bezierHandler);
3042 if (this._colorHandler && WebInspector.CSSMetadata.isColorAwareProperty( this._propertyName)) 3044 if (this._colorHandler && WebInspector.CSSMetadata.isColorAwareProperty( this._propertyName))
3043 formatter.addProcessor(WebInspector.StylesSidebarPropertyRenderer._c olorRegex, this._colorHandler); 3045 formatter.addProcessor(WebInspector.StylesSidebarPropertyRenderer._c olorRegex, this._colorHandler);
3044 3046
3045 valueElement.appendChild(formatter.formatText(this._propertyValue)); 3047 valueElement.appendChild(formatter.formatText(this._propertyValue));
3046 valueElement.normalize(); 3048 valueElement.normalize();
3047 return valueElement; 3049 return valueElement;
3048 }, 3050 },
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
3084 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha nged); 3086 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, onNodeCha nged);
3085 onNodeChanged(); 3087 onNodeChanged();
3086 return button; 3088 return button;
3087 3089
3088 function onNodeChanged() 3090 function onNodeChanged()
3089 { 3091 {
3090 var node = WebInspector.context.flavor(WebInspector.DOMNode); 3092 var node = WebInspector.context.flavor(WebInspector.DOMNode);
3091 button.setEnabled(!!node); 3093 button.setEnabled(!!node);
3092 } 3094 }
3093 } 3095 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/elements/styles/url-color-swatch-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698