108 *out =
String(text.data(), text.size());
113 return ulCreateJSValueStringUTF8(ctx, utf8.
data(), utf8.
length());
115 static constexpr const char*
SchemaType() {
return "string"; }
137 *out = std::move(parsed);
142 return ulCreateJSValueNull(ctx);
149 static void WriteSchemaExpr(std::string& out) { out +=
"{\"union\":[\"string\",\"null\"]}"; }
178 return ulCreateJSValueNull(ctx);
181 static constexpr const char*
SchemaType() {
return "color"; }
184 static void WriteSchemaExpr(std::string& out) { out +=
"{\"union\":[\"color\",\"null\"]}"; }
struct C_JSContext * ULJSContext
Opaque handle to a JavaScript execution context (one page's script world in one View).
Definition View.h:25
An RGBA color value in a certain color space (with CSS parsing helpers).
Definition Color.h:69
static Color Parse(const String &css)
Parse a CSS color string at runtime: the full CSS color grammar (named colors, hex,...
String ToHexString() const
Serialize this color as CSS hex text: lowercase #rrggbb, or #rrggbbaa when the alpha channel is not f...
constexpr bool invalid() const
Whether or not this color came from a string that failed to parse (Parse() at runtime,...
Definition Color.h:187
A null-terminated UTF-8 string container.
Definition String8.h:17
char * data()
Get raw UTF-8 data.
Definition String8.h:53
size_t length() const
Get length in bytes (not including null terminator).
Definition String8.h:59
Unicode string container with conversions for UTF-8, UTF-16, and UTF-32.
Definition String.h:31
String8 & utf8()
Get native UTF-8 string.
Definition String.h:109
String()
Create empty string.
Parsed web address.
Definition URL.h:104
bool is_valid() const
Whether or not this URL parsed successfully.
String str() const
Get the canonical serialization of the whole URL ("" if invalid).
Type-checked JavaScript bridge between C++ and web pages.
Definition JSInterop.h:141
Type
The type of a JavaScript value.
Definition Value.h:95
@ String
Definition Value.h:101
Root namespace for every public Ultralight type, function, and enumeration.
static bool AcceptsJSType(Type type, bool, bool)
Definition JS.h:185
static bool FromJS(ULJSContext ctx, ULJSValue borrowed, Color *out, ULJSValue *exception)
Definition JS.h:166
static void WriteSchemaExpr(std::string &out)
Definition JS.h:184
static ULJSValue ToJS(ULJSContext ctx, const Color &value)
Definition JS.h:176
static constexpr const char * SchemaType()
Definition JS.h:181
static ULJSValue ToJS(ULJSContext ctx, const String &value)
Definition JS.h:111
static bool AcceptsJSType(Type type, bool, bool)
Definition JS.h:116
static bool FromJS(ULJSContext ctx, ULJSValue borrowed, String *out, ULJSValue *exception)
Definition JS.h:104
static constexpr const char * SchemaType()
Definition JS.h:115
static bool AcceptsJSType(Type type, bool, bool)
Definition JS.h:150
static void WriteSchemaExpr(std::string &out)
Definition JS.h:149
static ULJSValue ToJS(ULJSContext ctx, const URL &value)
Definition JS.h:140
static bool FromJS(ULJSContext ctx, ULJSValue borrowed, URL *out, ULJSValue *exception)
Definition JS.h:130
static constexpr const char * SchemaType()
Definition JS.h:145
Type conversions between C++ and JavaScript across the bridge.
Definition TypeTraits.h:240