Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

femtovg: Fix warning about deprecated web_sys::set_fill_style #6571

Merged
merged 1 commit into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ spin_on = { version = "0.1" }
strum = { version = "0.26.1", default-features = false, features = ["derive"] }
toml_edit = { version = "0.22.7" }
ttf-parser = { version = "0.21" }
# web-sys needs to be >= 0.3.72 for set_fill_style_str
Copy link
Member

@ogoffart ogoffart Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't ususally write these kind of comments.
(otherwise we'd have one comment for each dependency)

web-sys = { version = "0.3.72", default-features = false }

raw-window-handle-06 = { package = "raw-window-handle", version = "0.6", features = ["alloc"] }

Expand Down
11 changes: 1 addition & 10 deletions api/wasm-interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,7 @@ console_error_panic_hook = { version = "0.1.6", optional = true }
js-sys = "0.3.44"
wasm-bindgen-futures = { version = "0.4.18" }
wasm-bindgen = { version = "0.2.66" }

[dependencies.web-sys]
version = "0.3"
features = [
'Request',
'RequestInit',
'RequestMode',
'Response',
'Window',
]
web-sys = { workspace = true, features = ["Request", "RequestInit", "RequestMode", "Response", "Window"] }

#[dev-dependencies]
#wasm-bindgen-test = "0.3.13"
2 changes: 1 addition & 1 deletion internal/backends/winit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bytemuck = { workspace = true, optional = true, features = ["derive"] }


[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3", features=["HtmlInputElement", "HtmlCanvasElement", "Window", "Document", "Event", "KeyboardEvent", "InputEvent", "CompositionEvent", "DomStringMap", "ClipboardEvent", "DataTransfer"] }
web-sys = { workspace = true, features=["HtmlInputElement", "HtmlCanvasElement", "Window", "Document", "Event", "KeyboardEvent", "InputEvent", "CompositionEvent", "DomStringMap", "ClipboardEvent", "DataTransfer"] }
wasm-bindgen = { version = "0.2" }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
2 changes: 1 addition & 1 deletion internal/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ gettext-rs = { version = "0.7.1", optional = true, features = ["gettext-system"]
[target.'cfg(target_arch = "wasm32")'.dependencies]
web-time = { version = "1.0", optional = true }
wasm-bindgen = { version = "0.2" }
web-sys = { version = "0.3", features = [ "HtmlImageElement" ] }
web-sys = { workspace = true, features = [ "HtmlImageElement" ] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
fontdb = { workspace = true, optional = true, default-features = true }
Expand Down
2 changes: 1 addition & 1 deletion internal/renderers/femtovg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ core-foundation = { version = "0.9.1" }
core-text = { version = "20.1.0" }

[target.'cfg(target_arch = "wasm32")'.dependencies]
web-sys = { version = "0.3", features=["console", "WebGlContextAttributes", "CanvasRenderingContext2d", "HtmlInputElement", "HtmlCanvasElement", "Window", "Document"] }
web-sys = { workspace = true, features=["console", "WebGlContextAttributes", "CanvasRenderingContext2d", "HtmlInputElement", "HtmlCanvasElement", "Window", "Document"] }
wasm-bindgen = { version = "0.2" }
2 changes: 1 addition & 1 deletion internal/renderers/femtovg/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ impl FemtoVGRendererExt for FemtoVGRenderer {
.unwrap();
context_2d.set_font("20px serif");
// We don't know if we're rendering on dark or white background, so choose a "color" in the middle for the text.
context_2d.set_fill_style(&wasm_bindgen::JsValue::from_str("red"));
context_2d.set_fill_style_str("red");
context_2d
.fill_text("Slint requires WebGL to be enabled in your browser", 0., 30.)
.unwrap();
Expand Down
Loading