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

Unified Diff: third_party/WebKit/Source/devtools/front_end/ui/ShadowEditor.js

Issue 2230183004: DevTools: Add shadow-editor swatch/icon before box-shadows and text-shadows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New image swatches.png 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 side-by-side diff with in-line comments
Download patch
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;
+}

Powered by Google App Engine
This is Rietveld 408576698