I must be missing something, then.  When do we convert the variant map data values from strings into non-string datatypes?

At least previously, the variantmaps passed to this function were all string->string maps (generated by the json parser, from the JSON data), which is why the implementation of this function previously did string comparisons (and why the various getter/accessor functions had code like d->data().value(SOME_FIELD).toString.toInt(); for fields like width/height etc.