servoshell: Migrate to egui-file-dialog from tinyfiledialogs (#34823)

This is the first step toward completely replacing tinyfiledialogs with
an egui-based solution.

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
This commit is contained in:
chickenleaf 2025-02-04 23:54:24 +05:30 committed by GitHub
parent e41b34a1bf
commit 62f1dbebff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 261 additions and 70 deletions

View file

@ -6,7 +6,9 @@ use std::borrow::Cow;
use std::cell::Cell;
use std::cmp::Ordering;
use std::ops::Range;
use std::path::PathBuf;
use std::ptr::NonNull;
use std::str::FromStr;
use std::{f64, ptr};
use dom_struct::dom_struct;
@ -1905,8 +1907,12 @@ impl HTMLInputElement {
let target = self.upcast::<EventTarget>();
if self.Multiple() {
let opt_test_paths =
opt_test_paths.map(|paths| paths.iter().map(|p| p.to_string()).collect());
let opt_test_paths = opt_test_paths.map(|paths| {
paths
.iter()
.filter_map(|p| PathBuf::from_str(p).ok())
.collect()
});
let (chan, recv) = ipc::channel(self.global().time_profiler_chan().clone())
.expect("Error initializing channel");
@ -1930,7 +1936,7 @@ impl HTMLInputElement {
if paths.is_empty() {
return;
} else {
Some(paths[0].to_string()) // neglect other paths
Some(PathBuf::from(paths[0].to_string())) // neglect other paths
}
},
None => None,
@ -2948,6 +2954,7 @@ impl Activatable for HTMLInputElement {
fn filter_from_accept(s: &DOMString) -> Vec<FilterPattern> {
let mut filter = vec![];
for p in split_commas(s) {
let p = p.trim();
if let Some('.') = p.chars().next() {
filter.push(FilterPattern(p[1..].to_string()));
} else if let Some(exts) = mime_guess::get_mime_extensions_str(p) {