Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/ui/ShadowEditor.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ShadowEditor.js b/third_party/WebKit/Source/devtools/front_end/ui/ShadowEditor.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..06f217f31e3389e8c53fa0428e41dfc1b969f6d8 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/devtools/front_end/ui/ShadowEditor.js |
| @@ -0,0 +1,34 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @constructor |
| + */ |
| +WebInspector.ShadowEditor = function() {} |
| + |
| +/** |
| + * @constructor |
| + */ |
| +WebInspector.ShadowEditor.Shadow = function() {} |
| + |
| +/** |
| + * @param {string} text |
| + * @return {!Array<string>} |
| + */ |
| +WebInspector.ShadowEditor.Shadow.splitShadows = function(text) |
|
lushnikov
2016/08/11 01:40:07
I don't like this - it seems to be a utility metho
flandy
2016/08/12 19:31:42
Yes I was planning on adding much to the Shadow Mo
|
| +{ |
| + var shadows = []; |
| + // Split by commas that aren't inside of color values to get the individual shadow values. |
| + var results = WebInspector.TextUtils.splitStringByRegexes(text, [WebInspector.Color.Regex, /,/g]); |
| + var currentIndex = 0; |
| + for (var i = 0; i < results.length; i++) { |
| + if (results[i].regexIndex === 1) { |
| + var comma = results[i]; |
| + shadows.push(text.substring(currentIndex, comma.position)); |
| + currentIndex = comma.position + 1; |
| + } |
| + } |
| + shadows.push(text.substring(currentIndex, text.length)); |
| + return shadows; |
| +} |