mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Handle servo:// url
This commit is contained in:
parent
5f89dc87bd
commit
5c1d130217
10 changed files with 91 additions and 40 deletions
|
@ -32,12 +32,13 @@ void on_panic(const char *backtrace) {
|
|||
throw hresult_error(E_FAIL, char2hstring(backtrace));
|
||||
}
|
||||
|
||||
Servo::Servo(GLsizei width, GLsizei height, ServoDelegate &aDelegate)
|
||||
Servo::Servo(hstring url, GLsizei width, GLsizei height,
|
||||
ServoDelegate &aDelegate)
|
||||
: mWindowHeight(height), mWindowWidth(width), mDelegate(aDelegate) {
|
||||
|
||||
capi::CInitOptions o;
|
||||
o.args = "--pref dom.webxr.enabled";
|
||||
o.url = "https://servo.org";
|
||||
o.url = *hstring2char(url);
|
||||
o.width = mWindowWidth;
|
||||
o.height = mWindowHeight;
|
||||
o.density = 1.0;
|
||||
|
@ -78,4 +79,13 @@ winrt::hstring char2hstring(const char *c_str) {
|
|||
return str3;
|
||||
}
|
||||
|
||||
std::unique_ptr<char *> hstring2char(hstring hstr) {
|
||||
const wchar_t *wc = hstr.c_str();
|
||||
size_t size = hstr.size() + 1;
|
||||
char *str = new char[size];
|
||||
size_t converted = 0;
|
||||
wcstombs_s(&converted, str, size, wc, hstr.size());
|
||||
return std::make_unique<char*>(str);
|
||||
}
|
||||
|
||||
} // namespace winrt::servo
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue