add short-desc

So that the UI can display the contents of "short-desc" inline with the verb.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2107913003

Review-Url: https://codereview.chromium.org/2107913003
diff --git a/tools/debugger/SkDrawCommand.cpp b/tools/debugger/SkDrawCommand.cpp
index 029be6c..22655a0 100644
--- a/tools/debugger/SkDrawCommand.cpp
+++ b/tools/debugger/SkDrawCommand.cpp
@@ -5,7 +5,6 @@
  * found in the LICENSE file.
  */
 
-
 #include "SkDrawCommand.h"
 
 #include "SkBlurMaskFilter.h"
@@ -92,6 +91,8 @@
 #define SKDEBUGCANVAS_ATTRIBUTE_TEXTURECOORDS     "textureCoords"
 #define SKDEBUGCANVAS_ATTRIBUTE_FILTERQUALITY     "filterQuality"
 
+#define SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC         "short-desc"
+
 #define SKDEBUGCANVAS_VERB_MOVE                   "move"
 #define SKDEBUGCANVAS_VERB_LINE                   "line"
 #define SKDEBUGCANVAS_VERB_QUAD                   "quad"
@@ -158,6 +159,11 @@
 
 typedef SkDrawCommand* (*FROM_JSON)(Json::Value&, UrlDataManager&);
 
+static SkString* str_append(SkString* str, const SkRect& r) {
+    str->appendf(" [%g %g %g %g]", r.left(), r.top(), r.right(), r.bottom());
+    return str;
+}
+
 // TODO(chudy): Refactor into non subclass model.
 
 SkDrawCommand::SkDrawCommand(OpType type)
@@ -1643,6 +1649,10 @@
     result[SKDEBUGCANVAS_ATTRIBUTE_COORDS] = MakeJsonRect(fRect);
     result[SKDEBUGCANVAS_ATTRIBUTE_REGIONOP] = make_json_regionop(fOp);
     result[SKDEBUGCANVAS_ATTRIBUTE_ANTIALIAS] = Json::Value(fDoAA);
+
+    SkString desc;
+    result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fRect)->c_str());
+
     return result;
 }
 
@@ -1746,6 +1756,11 @@
     if (fValue.get()) {
         // TODO: dump out the "value"
     }
+
+    SkString desc;
+    str_append(&desc, fRect)->appendf(" %s", fKey.c_str());
+    result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(desc.c_str());
+
     return result;
 }
 
@@ -1950,6 +1965,10 @@
             result[SKDEBUGCANVAS_ATTRIBUTE_STRICT] = Json::Value(true);
         }
     }
+
+    SkString desc;
+    result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fDst)->c_str());
+
     return result;
 }
 
@@ -2117,6 +2136,10 @@
             result[SKDEBUGCANVAS_ATTRIBUTE_STRICT] = Json::Value(true);
         }
     }
+
+    SkString desc;
+    result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fDst)->c_str());
+
     return result;
 }
 
@@ -2791,6 +2814,10 @@
     Json::Value result = INHERITED::toJSON(urlDataManager);
     result[SKDEBUGCANVAS_ATTRIBUTE_COORDS] = MakeJsonRect(fRect);
     result[SKDEBUGCANVAS_ATTRIBUTE_PAINT] = MakeJsonPaint(fPaint, urlDataManager);
+
+    SkString desc;
+    result[SKDEBUGCANVAS_ATTRIBUTE_SHORTDESC] = Json::Value(str_append(&desc, fRect)->c_str());
+
     return result;
 }