diff options
133 files changed, 686 insertions, 596 deletions
diff --git a/Cargo.lock b/Cargo.lock index 97f3f869cb8..19dae1aa9b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -137,14 +137,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "azure" -version = "0.36.0" -source = "git+https://github.com/servo/rust-azure#ca9cc643808f6f63576c5c2cd098e973406cc7f3" +version = "0.36.1" +source = "git+https://github.com/servo/rust-azure#37a57b3d862bcf345d1413c7ebb534ff69daab3b" dependencies = [ "cmake 0.1.40 (git+https://github.com/alexcrichton/cmake-rs)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)", "servo-freetype-sys 4.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "servo-skia 0.30000021.1 (registry+https://github.com/rust-lang/crates.io-index)", + "servo-skia 0.30000022.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -391,20 +391,20 @@ dependencies = [ name = "canvas" version = "0.0.1" dependencies = [ - "azure 0.36.0 (git+https://github.com/servo/rust-azure)", + "azure 0.36.1 (git+https://github.com/servo/rust-azure)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "canvas_traits 0.0.1", "cssparser 0.25.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "offscreen_gl_context 0.22.4 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "pixels 0.0.1", - "raqote 0.5.6-alpha.0 (git+https://github.com/jrmuizel/raqote)", + "raqote 0.6.1-alpha.0 (git+https://github.com/jrmuizel/raqote)", "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "servo_config 0.0.1", "webrender 0.60.0 (git+https://github.com/servo/webrender)", @@ -417,7 +417,7 @@ name = "canvas_traits" version = "0.0.1" dependencies = [ "cssparser 0.25.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -596,7 +596,7 @@ version = "0.0.1" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "embedder_traits 0.0.1", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -638,7 +638,7 @@ dependencies = [ "debugger 0.0.1", "devtools_traits 0.0.1", "embedder_traits 0.0.1", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gaol 0.2.0 (git+https://github.com/servo/gaol)", "gfx 0.0.1", "gfx_traits 0.0.1", @@ -1191,6 +1191,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "euclid_macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "euclid" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1261,7 +1269,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "font-kit" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1270,13 +1278,13 @@ dependencies = [ "core-text 13.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "float-ord 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon_path 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lyon_path 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "servo-fontconfig 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1399,7 +1407,7 @@ dependencies = [ "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-text 13.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "fontsan 0.4.0 (git+https://github.com/servo/fontsan)", "freetype 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2277,13 +2285,14 @@ dependencies = [ "canvas_traits 0.0.1", "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "embedder_traits 0.0.1", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "gfx 0.0.1", "gfx_traits 0.0.1", "html5ever 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.53 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", @@ -2330,7 +2339,7 @@ dependencies = [ "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "embedder_traits 0.0.1", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "gfx 0.0.1", @@ -2373,7 +2382,7 @@ name = "layout_thread_2020" version = "0.0.1" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx 0.0.1", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "layout_2020 0.0.1", @@ -2394,7 +2403,7 @@ name = "layout_traits" version = "0.0.1" dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx 0.0.1", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "metrics 0.0.1", @@ -2492,7 +2501,7 @@ dependencies = [ "devtools_traits 0.0.1", "embedder_traits 0.0.1", "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gaol 0.2.0 (git+https://github.com/servo/gaol)", "gfx 0.0.1", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2506,7 +2515,7 @@ dependencies = [ "msg 0.0.1", "net 0.0.1", "net_traits 0.0.1", - "offscreen_gl_context 0.22.4 (registry+https://github.com/rust-lang/crates.io-index)", + "offscreen_gl_context 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "profile 0.0.1", "profile_traits 0.0.1", "script 0.0.1", @@ -2588,20 +2597,20 @@ dependencies = [ [[package]] name = "lyon_geom" -version = "0.12.6" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "lyon_path" -version = "0.12.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lyon_geom 0.12.6 (registry+https://github.com/rust-lang/crates.io-index)", + "lyon_geom 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2637,7 +2646,7 @@ dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.25.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashglobe 0.1.0", "hyper 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", "hyper_serde 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2700,7 +2709,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "media" version = "0.0.1" dependencies = [ - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3141,12 +3150,12 @@ dependencies = [ [[package]] name = "offscreen_gl_context" -version = "0.22.4" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3303,6 +3312,27 @@ dependencies = [ ] [[package]] +name = "peek-poke" +version = "0.2.0" +source = "git+https://github.com/servo/webrender#964a2eb8d9ed25cfffe6dd446cfa21a37eefe9c7" +dependencies = [ + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "peek-poke-derive 0.2.0 (git+https://github.com/servo/webrender)", +] + +[[package]] +name = "peek-poke-derive" +version = "0.2.0" +source = "git+https://github.com/servo/webrender#964a2eb8d9ed25cfffe6dd446cfa21a37eefe9c7" +dependencies = [ + "proc-macro2 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.39 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] name = "peeking_take_while" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3360,7 +3390,7 @@ dependencies = [ name = "pixels" version = "0.0.1" dependencies = [ - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3373,11 +3403,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "plane-split" -version = "0.13.7" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "binary-space-partition 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3605,12 +3635,12 @@ dependencies = [ [[package]] name = "raqote" -version = "0.5.6-alpha.0" -source = "git+https://github.com/jrmuizel/raqote#40dd11e85e4800061c4f31223199949804d3f8da" +version = "0.6.1-alpha.0" +source = "git+https://github.com/jrmuizel/raqote#4b9ae1986e3211d788dacc0a58ce4d5734dbdb44" dependencies = [ - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", - "font-kit 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lyon_geom 0.12.6 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", + "font-kit 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lyon_geom 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "png 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "sw-composite 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "typed-arena 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3812,7 +3842,7 @@ dependencies = [ "embedder_traits 0.0.1", "encoding_rs 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", "enum-iterator 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "headers 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3892,7 +3922,7 @@ dependencies = [ "canvas_traits 0.0.1", "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.25.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "html5ever 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3932,7 +3962,7 @@ dependencies = [ name = "script_tests" version = "0.0.1" dependencies = [ - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "keyboard-types 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "script 0.0.1", "servo_url 0.0.1", @@ -3948,7 +3978,7 @@ dependencies = [ "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "devtools_traits 0.0.1", "embedder_traits 0.0.1", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gfx_traits 0.0.1", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4053,7 +4083,7 @@ dependencies = [ "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "clipboard 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4251,12 +4281,12 @@ dependencies = [ [[package]] name = "servo-skia" -version = "0.30000021.1" +version = "0.30000022.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cgl 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "cmake 0.1.40 (git+https://github.com/alexcrichton/cmake-rs)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "expat-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4301,7 +4331,7 @@ dependencies = [ "dirs 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "embedder_traits 0.0.1", "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -4331,7 +4361,7 @@ name = "servo_geometry" version = "0.0.1" dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "style_traits 0.0.1", @@ -4597,7 +4627,7 @@ dependencies = [ "cssparser 0.25.8 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "encoding_rs 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "fallible 0.0.1", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "hashglobe 0.1.0", @@ -4663,7 +4693,7 @@ dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.25.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "selectors 0.21.0", @@ -4685,7 +4715,7 @@ dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.25.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of 0.0.1", "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5331,7 +5361,7 @@ dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "cookie 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5354,7 +5384,7 @@ dependencies = [ [[package]] name = "webrender" version = "0.60.0" -source = "git+https://github.com/servo/webrender#2afa0c3ba85d2f6b219a1349268d1250760ebd64" +source = "git+https://github.com/servo/webrender#964a2eb8d9ed25cfffe6dd446cfa21a37eefe9c7" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5366,7 +5396,7 @@ dependencies = [ "core-text 13.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "cstr 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "dwrote 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "freetype 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5376,7 +5406,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", - "plane-split 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)", + "plane-split 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "ron 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5395,18 +5425,18 @@ dependencies = [ [[package]] name = "webrender_api" version = "0.60.0" -source = "git+https://github.com/servo/webrender#2afa0c3ba85d2f6b219a1349268d1250760ebd64" +source = "git+https://github.com/servo/webrender#964a2eb8d9ed25cfffe6dd446cfa21a37eefe9c7" dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bincode 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.17.3 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "malloc_size_of_derive 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "peek-poke 0.2.0 (git+https://github.com/servo/webrender)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5417,7 +5447,7 @@ dependencies = [ [[package]] name = "webrender_build" version = "0.0.1" -source = "git+https://github.com/servo/webrender#2afa0c3ba85d2f6b219a1349268d1250760ebd64" +source = "git+https://github.com/servo/webrender#964a2eb8d9ed25cfffe6dd446cfa21a37eefe9c7" dependencies = [ "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -5426,7 +5456,7 @@ dependencies = [ name = "webrender_traits" version = "0.0.1" dependencies = [ - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "webrender 0.60.0 (git+https://github.com/servo/webrender)", "webrender_api 0.60.0 (git+https://github.com/servo/webrender)", ] @@ -5437,7 +5467,7 @@ version = "0.0.1" dependencies = [ "canvas_traits 0.0.1", "crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5462,9 +5492,9 @@ dependencies = [ [[package]] name = "webxr" version = "0.0.1" -source = "git+https://github.com/servo/webxr#b5a4b93fcfb2b03ee264a8f95bbaa1500ff0a087" +source = "git+https://github.com/servo/webxr#43a54f4cbe0ed3037e5e2bf34769241a5bd3da60" dependencies = [ - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "glutin 0.21.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5474,9 +5504,9 @@ dependencies = [ [[package]] name = "webxr-api" version = "0.0.1" -source = "git+https://github.com/servo/webxr#b5a4b93fcfb2b03ee264a8f95bbaa1500ff0a087" +source = "git+https://github.com/servo/webxr#43a54f4cbe0ed3037e5e2bf34769241a5bd3da60" dependencies = [ - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.6.18 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", @@ -5570,10 +5600,10 @@ dependencies = [ [[package]] name = "wr_malloc_size_of" version = "0.0.1" -source = "git+https://github.com/servo/webrender#2afa0c3ba85d2f6b219a1349268d1250760ebd64" +source = "git+https://github.com/servo/webrender#964a2eb8d9ed25cfffe6dd446cfa21a37eefe9c7" dependencies = [ "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)", + "euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -5688,7 +5718,7 @@ dependencies = [ "checksum atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fb2dcb6e6d35f20276943cc04bb98e538b348d525a04ac79c10021561d202f21" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" -"checksum azure 0.36.0 (git+https://github.com/servo/rust-azure)" = "<none>" +"checksum azure 0.36.1 (git+https://github.com/servo/rust-azure)" = "<none>" "checksum backtrace 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)" = "1a13fc43f04daf08ab4f71e3d27e1fc27fc437d3e95ac0063a796d92fb40f39b" "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" @@ -5776,6 +5806,7 @@ dependencies = [ "checksum erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "3beee4bc16478a1b26f2e80ad819a52d24745e292f521a63c16eea5f74b7eb60" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum euclid 0.19.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7a4719a544a67ed3fc33784c2bd2c6581663dfe83b719a6ae05c6dabc3b51c73" +"checksum euclid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4786521fec183792e755bf32cd0188e4e7628c6d0fcfd51426435b9081a106" "checksum euclid_macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdcb84c18ea5037a1c5a23039b4ff29403abce2e0d6b1daa11cf0bde2b30be15" "checksum expat-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "658f19728920138342f68408b7cf7644d90d4784353d8ebc32e7e8663dbe45fa" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" @@ -5784,7 +5815,7 @@ dependencies = [ "checksum flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9fac2277e84e5e858483756647a9d0aa8d9a2b7cba517fd84325a0aaa69a0909" "checksum float-ord 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7bad48618fdb549078c333a7a8528acb57af271d0433bdecd523eb620628364e" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" -"checksum font-kit 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "da53acd00b0af3dbb578bdfa92d0acee09c7e4e4f4dfb4b9cb7d7bc57f135270" +"checksum font-kit 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b7ff8d2a0a660875d01689807925a45c5843bf90a1ef97ec52ef86ab0cafba" "checksum fontsan 0.4.0 (git+https://github.com/servo/fontsan)" = "<none>" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" "checksum foreign-types-shared 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" @@ -5886,8 +5917,8 @@ dependencies = [ "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" -"checksum lyon_geom 0.12.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0638070e85f0e8b5da3909d8c5c0a66785b18da96a1e8dc30acb0aea9770529a" -"checksum lyon_path 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e9dc8e0746b7cca11960b602f7fe037bb067746a01eab4aa502fed1494544843" +"checksum lyon_geom 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "69589b8844c0b3745cc031a35b62bc33b0fb9e5ba7613756d802c52861dcdb4c" +"checksum lyon_path 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0bcb57ac24a5428539e2c7c0592766d5933c937d703f430990c669c00de96862" "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" "checksum mach 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" @@ -5928,7 +5959,7 @@ dependencies = [ "checksum objc 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "31d20fd2b37e07cf5125be68357b588672e8cefe9a96f8c17a9d46053b3e590d" "checksum objc-foundation 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" "checksum objc_id 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e4730aa1c64d722db45f7ccc4113a3e2c465d018de6db4d3e7dfe031e8c8a297" -"checksum offscreen_gl_context 0.22.4 (registry+https://github.com/rust-lang/crates.io-index)" = "154c923c8bf54299672a5121836a929395d763778525ce752c00b61249fe9cab" +"checksum offscreen_gl_context 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b6b1df447af7a71721bfc33697b364831d59c0c8668dae0e570a7993ca84bc8" "checksum opaque-debug 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "51ecbcb821e1bd256d456fe858aaa7f380b63863eab2eb86eee1bd9f33dd6682" "checksum openssl 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6c24d3508b4fb6da175c10baac54c578b33f09c89ae90c6fe9788b3b4768efdc" "checksum openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)" = "912f301a749394e1025d9dcddef6106ddee9252620e6d0a0e5f8d0681de9b129" @@ -5945,6 +5976,8 @@ dependencies = [ "checksum parking_lot_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cb88cb1cb3790baa6776844f968fea3be44956cf184fa1be5a03341f5491278c" "checksum paste 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4a4a1c555c6505821f9d58b8779d0f630a6b7e4e1be24ba718610acf01fa79" "checksum paste-impl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "26e796e623b8b257215f27e6c80a5478856cae305f5b59810ff9acdaa34570e6" +"checksum peek-poke 0.2.0 (git+https://github.com/servo/webrender)" = "<none>" +"checksum peek-poke-derive 0.2.0 (git+https://github.com/servo/webrender)" = "<none>" "checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" "checksum percent-encoding 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "de154f638187706bde41d9b4738748933d64e6b37bdbffc0b47a97d16a6ae356" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" @@ -5953,7 +5986,7 @@ dependencies = [ "checksum phf_generator 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "09364cc93c159b8b06b1f4dd8a4398984503483891b0c26b867cf431fb132662" "checksum phf_shared 0.7.24 (registry+https://github.com/rust-lang/crates.io-index)" = "234f71a15de2288bcb7e3b6515828d22af7ec8598ee6d24c3b526fa0a80b67a0" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" -"checksum plane-split 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9760bb0546502fcfae6d2d1d638fac6b9272027a3efae34060218152d0ce8387" +"checksum plane-split 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "91821c7436aefc1b912552d494232efcaf9810c0189918749532be1e9dbace59" "checksum png 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9adebf7fb91ccf5eac9da1a8e00e83cb8ae882c3e8d8e4ad59da73cb8c82a2c9" "checksum podio 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "780fb4b6698bbf9cf2444ea5d22411cef2953f0824b98f33cf454ec5615645bd" "checksum precomputed-hash 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" @@ -5973,7 +6006,7 @@ dependencies = [ "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" -"checksum raqote 0.5.6-alpha.0 (git+https://github.com/jrmuizel/raqote)" = "<none>" +"checksum raqote 0.6.1-alpha.0 (git+https://github.com/jrmuizel/raqote)" = "<none>" "checksum rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a4b0186e22767d5b9738a05eab7c6ac90b15db17e5b5f9bd87976dd7d89a10a4" "checksum rayon-core 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe0df8435ac0c397d467b6cad6d25543d06e8a019ef3f6af3c384597515bd2" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" @@ -6015,7 +6048,7 @@ dependencies = [ "checksum servo-media-streams 0.1.0 (git+https://github.com/servo/media)" = "<none>" "checksum servo-media-traits 0.1.0 (git+https://github.com/servo/media)" = "<none>" "checksum servo-media-webrtc 0.1.0 (git+https://github.com/servo/media)" = "<none>" -"checksum servo-skia 0.30000021.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f6c0a65022054874fc1f38dc45e19192accbae775784c3ff05c3875bcc176c19" +"checksum servo-skia 0.30000022.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2df44d1fcd25d158fc5430a588daaa4aec88df6306ddf2a079f99dfd52672102" "checksum servo_media_derive 0.1.0 (git+https://github.com/servo/media)" = "<none>" "checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" diff --git a/components/canvas/Cargo.toml b/components/canvas/Cargo.toml index 93875f32242..dbc3b2a7200 100644 --- a/components/canvas/Cargo.toml +++ b/components/canvas/Cargo.toml @@ -21,14 +21,14 @@ azure = {git = "https://github.com/servo/rust-azure", optional = true} byteorder = "1" canvas_traits = {path = "../canvas_traits"} cssparser = "0.25" -euclid = "0.19" +euclid = "0.20" fnv = "1.0" gleam = "0.6.7" half = "1" ipc-channel = "0.11" log = "0.4" num-traits = "0.2" -offscreen_gl_context = {version = "0.22", features = ["serde", "osmesa"]} +offscreen_gl_context = {version = "0.23", features = ["serde", "osmesa"]} raqote = {git = "https://github.com/jrmuizel/raqote", optional = true} pixels = {path = "../pixels"} serde_bytes = "0.10" diff --git a/components/canvas/azure_backend.rs b/components/canvas/azure_backend.rs index 102cddd0565..57e53e6ab7e 100644 --- a/components/canvas/azure_backend.rs +++ b/components/canvas/azure_backend.rs @@ -16,7 +16,7 @@ use azure::azure_hl::{CapStyle, JoinStyle}; use azure::azure_hl::{LinearGradientPattern, RadialGradientPattern}; use canvas_traits::canvas::*; use cssparser::RGBA; -use euclid::{Point2D, Rect, Size2D, Transform2D, Vector2D}; +use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D}; pub struct AzureBackend; diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs index 4a55529066c..43e48bc8a65 100644 --- a/components/canvas/canvas_data.rs +++ b/components/canvas/canvas_data.rs @@ -5,7 +5,7 @@ use crate::canvas_paint_thread::AntialiasMode; use canvas_traits::canvas::*; use cssparser::RGBA; -use euclid::{Point2D, Rect, Size2D, Transform2D, Vector2D}; +use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D}; use ipc_channel::ipc::{IpcSender, IpcSharedMemory}; use num_traits::ToPrimitive; #[allow(unused_imports)] @@ -13,6 +13,7 @@ use std::marker::PhantomData; use std::mem; use std::sync::Arc; use webrender::api::DirtyRect; +use webrender_api::units::RectExt; /// The canvas data stores a state machine for the current status of /// the path data and any relevant transformations that are @@ -123,12 +124,12 @@ struct PathBuilderRef<'a> { impl<'a> PathBuilderRef<'a> { fn line_to(&self, pt: &Point2D<f32>) { - let pt = self.transform.transform_point(pt); + let pt = self.transform.transform_point(*pt); self.builder.line_to(pt); } fn move_to(&self, pt: &Point2D<f32>) { - let pt = self.transform.transform_point(pt); + let pt = self.transform.transform_point(*pt); self.builder.move_to(pt); } @@ -142,32 +143,30 @@ impl<'a> PathBuilderRef<'a> { ), Point2D::new(rect.origin.x, rect.origin.y + rect.size.height), ); - self.builder.move_to(self.transform.transform_point(&first)); - self.builder - .line_to(self.transform.transform_point(&second)); - self.builder.line_to(self.transform.transform_point(&third)); - self.builder - .line_to(self.transform.transform_point(&fourth)); + self.builder.move_to(self.transform.transform_point(first)); + self.builder.line_to(self.transform.transform_point(second)); + self.builder.line_to(self.transform.transform_point(third)); + self.builder.line_to(self.transform.transform_point(fourth)); self.builder.close(); } fn quadratic_curve_to(&self, cp: &Point2D<f32>, endpoint: &Point2D<f32>) { self.builder.quadratic_curve_to( - &self.transform.transform_point(cp), - &self.transform.transform_point(endpoint), + &self.transform.transform_point(*cp), + &self.transform.transform_point(*endpoint), ) } fn bezier_curve_to(&self, cp1: &Point2D<f32>, cp2: &Point2D<f32>, endpoint: &Point2D<f32>) { self.builder.bezier_curve_to( - &self.transform.transform_point(cp1), - &self.transform.transform_point(cp2), - &self.transform.transform_point(endpoint), + &self.transform.transform_point(*cp1), + &self.transform.transform_point(*cp2), + &self.transform.transform_point(*endpoint), ) } fn arc(&self, center: &Point2D<f32>, radius: f32, start_angle: f32, end_angle: f32, ccw: bool) { - let center = self.transform.transform_point(center); + let center = self.transform.transform_point(*center); self.builder .arc(center, radius, start_angle, end_angle, ccw); } @@ -182,7 +181,7 @@ impl<'a> PathBuilderRef<'a> { end_angle: f32, ccw: bool, ) { - let center = self.transform.transform_point(center); + let center = self.transform.transform_point(*center); self.builder.ellipse( center, radius_x, @@ -200,7 +199,7 @@ impl<'a> PathBuilderRef<'a> { None => return None, }; let current_point = self.builder.get_current_point(); - Some(inverse.transform_point(&Point2D::new(current_point.x, current_point.y))) + Some(inverse.transform_point(Point2D::new(current_point.x, current_point.y))) } } @@ -1033,7 +1032,7 @@ impl<'a> CanvasData<'a> { ); let matrix = Transform2D::identity() .pre_translate(-source_rect.origin.to_vector().cast()) - .pre_mul(&self.state.transform); + .pre_transform(&self.state.transform); draw_target.set_transform(&matrix); draw_target } diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs index f026311f2ee..e324c213d6e 100644 --- a/components/canvas/canvas_paint_thread.rs +++ b/components/canvas/canvas_paint_thread.rs @@ -4,7 +4,7 @@ use crate::canvas_data::*; use canvas_traits::canvas::*; -use euclid::Size2D; +use euclid::default::Size2D; use ipc_channel::ipc::{self, IpcSender}; use std::borrow::ToOwned; use std::collections::HashMap; diff --git a/components/canvas/gl_context.rs b/components/canvas/gl_context.rs index 84c907af617..e1e45f40a60 100644 --- a/components/canvas/gl_context.rs +++ b/components/canvas/gl_context.rs @@ -6,7 +6,7 @@ use super::webgl_thread::{GLState, WebGLImpl}; use canvas_traits::webgl::{ GLContextAttributes, GLLimits, WebGLCommand, WebGLCommandBacktrace, WebGLVersion, }; -use euclid::Size2D; +use euclid::default::Size2D; use gleam::gl; use offscreen_gl_context::{ ColorAttachmentType, DrawBuffer, GLContext, GLContextAttributes as RawGLContextAttributes, diff --git a/components/canvas/raqote_backend.rs b/components/canvas/raqote_backend.rs index 482ee4090c8..e33203226c8 100644 --- a/components/canvas/raqote_backend.rs +++ b/components/canvas/raqote_backend.rs @@ -10,7 +10,7 @@ use crate::canvas_data::{ use crate::canvas_paint_thread::AntialiasMode; use canvas_traits::canvas::*; use cssparser::RGBA; -use euclid::{Point2D, Rect, Size2D, Transform2D, Vector2D}; +use euclid::default::{Point2D, Rect, Size2D, Transform2D, Vector2D}; use std::marker::PhantomData; pub struct RaqoteBackend; diff --git a/components/canvas/webgl_mode/inprocess.rs b/components/canvas/webgl_mode/inprocess.rs index 8584289b904..76d468390db 100644 --- a/components/canvas/webgl_mode/inprocess.rs +++ b/components/canvas/webgl_mode/inprocess.rs @@ -8,7 +8,7 @@ use canvas_traits::webgl::webgl_channel; use canvas_traits::webgl::DOMToTextureCommand; use canvas_traits::webgl::{WebGLChan, WebGLContextId, WebGLMsg, WebGLPipeline, WebGLReceiver}; use canvas_traits::webgl::{WebGLSender, WebVRCommand, WebVRRenderHandler}; -use euclid::Size2D; +use euclid::default::Size2D; use fnv::FnvHashMap; use gleam::gl; use servo_config::pref; diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index b275e62bc7a..ce73b03cf09 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -5,7 +5,7 @@ use super::gl_context::{map_attrs_to_script_attrs, GLContextFactory, GLContextWrapper}; use byteorder::{ByteOrder, NativeEndian, WriteBytesExt}; use canvas_traits::webgl::*; -use euclid::Size2D; +use euclid::default::Size2D; use fnv::FnvHashMap; use gleam::gl; use half::f16; diff --git a/components/canvas_traits/Cargo.toml b/components/canvas_traits/Cargo.toml index 52388be8863..b8b34b7c960 100644 --- a/components/canvas_traits/Cargo.toml +++ b/components/canvas_traits/Cargo.toml @@ -15,7 +15,7 @@ webgl_backtrace = [] [dependencies] cssparser = "0.25" -euclid = "0.19" +euclid = "0.20" ipc-channel = "0.11" gleam = "0.6.7" lazy_static = "1" diff --git a/components/canvas_traits/canvas.rs b/components/canvas_traits/canvas.rs index 7f3d0ef20ca..ff7e65722e3 100644 --- a/components/canvas_traits/canvas.rs +++ b/components/canvas_traits/canvas.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use cssparser::RGBA; -use euclid::{Point2D, Rect, Size2D, Transform2D}; +use euclid::default::{Point2D, Rect, Size2D, Transform2D}; use ipc_channel::ipc::{IpcBytesReceiver, IpcBytesSender, IpcSender, IpcSharedMemory}; use serde_bytes::ByteBuf; use std::default::Default; diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs index 6ac103f629f..b33f5eae1be 100644 --- a/components/canvas_traits/webgl.rs +++ b/components/canvas_traits/webgl.rs @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ -use euclid::{Rect, Size2D}; +use euclid::default::{Rect, Size2D}; use gleam::gl; use gleam::gl::GLsync; use gleam::gl::GLuint; diff --git a/components/compositing/Cargo.toml b/components/compositing/Cargo.toml index 2d5fa600376..fb98050d022 100644 --- a/components/compositing/Cargo.toml +++ b/components/compositing/Cargo.toml @@ -18,7 +18,7 @@ gl = ["gleam", "pixels"] [dependencies] crossbeam-channel = "0.3" embedder_traits = {path = "../embedder_traits"} -euclid = "0.19" +euclid = "0.20" gfx_traits = {path = "../gfx_traits"} gleam = {version = "0.6", optional = true} image = "0.21" diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs index 4f42867ae67..98de79cc3f8 100644 --- a/components/compositing/compositor.rs +++ b/components/compositing/compositor.rs @@ -14,7 +14,7 @@ use crate::CompositionPipeline; use crate::SendableFrameTree; use crossbeam_channel::Sender; use embedder_traits::Cursor; -use euclid::{TypedPoint2D, TypedScale, TypedVector2D}; +use euclid::{Point2D, Scale, Vector2D}; use gfx_traits::Epoch; #[cfg(feature = "gl")] use image::{DynamicImage, ImageFormat}; @@ -115,7 +115,7 @@ pub struct IOCompositor<Window: WindowMethods + ?Sized> { pipeline_details: HashMap<PipelineId, PipelineDetails>, /// The scene scale, to allow for zooming and high-resolution painting. - scale: TypedScale<f32, LayerPixel, DevicePixel>, + scale: Scale<f32, LayerPixel, DevicePixel>, /// "Mobile-style" zoom that does not reflow the page. viewport_zoom: PinchZoomFactor, @@ -125,7 +125,7 @@ pub struct IOCompositor<Window: WindowMethods + ?Sized> { max_viewport_zoom: Option<PinchZoomFactor>, /// "Desktop-style" zoom that resizes the viewport to fit the window. - page_zoom: TypedScale<f32, CSSPixel, DeviceIndependentPixel>, + page_zoom: Scale<f32, CSSPixel, DeviceIndependentPixel>, /// The type of composition to perform composite_target: CompositeTarget, @@ -296,14 +296,14 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { port: state.receiver, root_pipeline: None, pipeline_details: HashMap::new(), - scale: TypedScale::new(1.0), + scale: Scale::new(1.0), composition_request: CompositionRequest::NoCompositingNecessary, touch_handler: TouchHandler::new(), pending_scroll_zoom_events: Vec::new(), waiting_for_results_of_scroll: false, composite_target, shutdown_state: ShutdownState::NotShuttingDown, - page_zoom: TypedScale::new(1.0), + page_zoom: Scale::new(1.0), viewport_zoom: PinchZoomFactor::new(1.0), min_viewport_zoom: None, max_viewport_zoom: None, @@ -741,7 +741,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { let dppx = self.page_zoom * self.hidpi_factor(); let scaled_point = (point / dppx).to_untyped(); - let world_cursor = webrender_api::units::WorldPoint::from_untyped(&scaled_point); + let world_cursor = webrender_api::units::WorldPoint::from_untyped(scaled_point); self.webrender_api.hit_test( self.webrender_document, None, @@ -845,15 +845,15 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { fn on_touch_move(&mut self, identifier: TouchId, point: DevicePoint) { match self.touch_handler.on_touch_move(identifier, point) { TouchAction::Scroll(delta) => self.on_scroll_window_event( - ScrollLocation::Delta(LayoutVector2D::from_untyped(&delta.to_untyped())), + ScrollLocation::Delta(LayoutVector2D::from_untyped(delta.to_untyped())), point.cast(), ), TouchAction::Zoom(magnification, scroll_delta) => { - let cursor = TypedPoint2D::new(-1, -1); // Make sure this hits the base layer. + let cursor = Point2D::new(-1, -1); // Make sure this hits the base layer. self.pending_scroll_zoom_events.push(ScrollZoomEvent { magnification: magnification, scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped( - &scroll_delta.to_untyped(), + scroll_delta.to_untyped(), )), cursor: cursor, event_count: 1, @@ -942,7 +942,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { *last_combined_event = Some(ScrollZoomEvent { magnification: scroll_event.magnification, scroll_location: ScrollLocation::Delta(LayoutVector2D::from_untyped( - &this_delta.to_untyped(), + this_delta.to_untyped(), )), cursor: this_cursor, event_count: 1, @@ -954,11 +954,9 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { // nasty-looking "pops". To mitigate this, during a fling we average // deltas instead of summing them. if let ScrollLocation::Delta(delta) = last_combined_event.scroll_location { - let old_event_count = - TypedScale::new(last_combined_event.event_count as f32); + let old_event_count = Scale::new(last_combined_event.event_count as f32); last_combined_event.event_count += 1; - let new_event_count = - TypedScale::new(last_combined_event.event_count as f32); + let new_event_count = Scale::new(last_combined_event.event_count as f32); last_combined_event.scroll_location = ScrollLocation::Delta( (delta * old_event_count + this_delta) / new_event_count, ); @@ -971,17 +969,16 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { if let Some(combined_event) = last_combined_event { let scroll_location = match combined_event.scroll_location { ScrollLocation::Delta(delta) => { - let scaled_delta = (TypedVector2D::from_untyped(&delta.to_untyped()) / - self.scale) - .to_untyped(); - let calculated_delta = LayoutVector2D::from_untyped(&scaled_delta); + let scaled_delta = + (Vector2D::from_untyped(delta.to_untyped()) / self.scale).to_untyped(); + let calculated_delta = LayoutVector2D::from_untyped(scaled_delta); ScrollLocation::Delta(calculated_delta) }, // Leave ScrollLocation unchanged if it is Start or End location. sl @ ScrollLocation::Start | sl @ ScrollLocation::End => sl, }; let cursor = (combined_event.cursor.to_f32() / self.scale).to_untyped(); - let cursor = webrender_api::units::WorldPoint::from_untyped(&cursor); + let cursor = webrender_api::units::WorldPoint::from_untyped(cursor); let mut txn = webrender_api::Transaction::new(); txn.scroll(scroll_location, cursor); if combined_event.magnification != 1.0 { @@ -1063,34 +1060,34 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { } } - fn hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> { + fn hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> { match self.device_pixels_per_px { - Some(device_pixels_per_px) => TypedScale::new(device_pixels_per_px), + Some(device_pixels_per_px) => Scale::new(device_pixels_per_px), None => match self.output_file { - Some(_) => TypedScale::new(1.0), + Some(_) => Scale::new(1.0), None => self.embedder_coordinates.hidpi_factor, }, } } - fn device_pixels_per_page_px(&self) -> TypedScale<f32, CSSPixel, DevicePixel> { + fn device_pixels_per_page_px(&self) -> Scale<f32, CSSPixel, DevicePixel> { self.page_zoom * self.hidpi_factor() } fn update_zoom_transform(&mut self) { let scale = self.device_pixels_per_page_px(); - self.scale = TypedScale::new(scale.get()); + self.scale = Scale::new(scale.get()); } pub fn on_zoom_reset_window_event(&mut self) { - self.page_zoom = TypedScale::new(1.0); + self.page_zoom = Scale::new(1.0); self.update_zoom_transform(); self.send_window_size(WindowSizeType::Resize); self.update_page_zoom_for_webrender(); } pub fn on_zoom_window_event(&mut self, magnification: f32) { - self.page_zoom = TypedScale::new( + self.page_zoom = Scale::new( (self.page_zoom.get() * magnification) .max(MIN_ZOOM) .min(MAX_ZOOM), @@ -1113,8 +1110,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { pub fn on_pinch_zoom_window_event(&mut self, magnification: f32) { self.pending_scroll_zoom_events.push(ScrollZoomEvent { magnification: magnification, - scroll_location: ScrollLocation::Delta(TypedVector2D::zero()), // TODO: Scroll to keep the center in view? - cursor: TypedPoint2D::new(-1, -1), // Make sure this hits the base layer. + scroll_location: ScrollLocation::Delta(Vector2D::zero()), // TODO: Scroll to keep the center in view? + cursor: Point2D::new(-1, -1), // Make sure this hits the base layer. event_count: 1, }); } @@ -1127,7 +1124,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { { let scroll_state = ScrollState { scroll_id: scroll_layer_state.id, - scroll_offset: scroll_layer_state.scroll_offset.to_untyped(), + scroll_offset: scroll_layer_state.scroll_offset, }; scroll_states_per_pipeline @@ -1243,12 +1240,7 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { &mut self, target: CompositeTarget, ) -> Result<Option<Image>, UnableToComposite> { - let width = self.embedder_coordinates.framebuffer.to_u32().width_typed(); - let height = self - .embedder_coordinates - .framebuffer - .to_u32() - .height_typed(); + let size = self.embedder_coordinates.framebuffer.to_u32(); self.window.prepare_for_composite(); self.webrender.update(); @@ -1279,8 +1271,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { #[cfg(feature = "gl")] CompositeTarget::WindowAndPng | CompositeTarget::PngFile => gl::initialize_png( &*self.window.gl(), - FramebufferUintLength::new(width.get()), - FramebufferUintLength::new(height.get()), + FramebufferUintLength::new(size.width), + FramebufferUintLength::new(size.height), ), #[cfg(not(feature = "gl"))] _ => (), @@ -1293,9 +1285,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { || { debug!("compositor: compositing"); - let size = DeviceIntSize::from_untyped( - &self.embedder_coordinates.framebuffer.to_untyped(), - ); + let size = + DeviceIntSize::from_untyped(self.embedder_coordinates.framebuffer.to_untyped()); // Paint the scene. // TODO(gw): Take notice of any errors the renderer returns! @@ -1346,8 +1337,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { let img = gl::draw_img( &*self.window.gl(), rt_info, - FramebufferUintLength::new(width.get()), - FramebufferUintLength::new(height.get()), + FramebufferUintLength::new(size.width), + FramebufferUintLength::new(size.height), ); Some(Image { width: img.width(), @@ -1370,8 +1361,8 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> { let img = gl::draw_img( gl, rt_info, - FramebufferUintLength::new(width.get()), - FramebufferUintLength::new(height.get()), + FramebufferUintLength::new(size.width), + FramebufferUintLength::new(size.height), ); let dynamic_image = DynamicImage::ImageRgb8(img); if let Err(e) = dynamic_image.write_to(&mut file, ImageFormat::PNG) diff --git a/components/compositing/touch.rs b/components/compositing/touch.rs index 44aa3ff1ad7..24082054b51 100644 --- a/components/compositing/touch.rs +++ b/components/compositing/touch.rs @@ -3,8 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use self::TouchState::*; -use euclid::TypedScale; -use euclid::{TypedPoint2D, TypedVector2D}; +use euclid::{Point2D, Scale, Vector2D}; use script_traits::{EventResult, TouchId}; use style_traits::DevicePixel; @@ -19,11 +18,11 @@ pub struct TouchHandler { #[derive(Clone, Copy, Debug)] pub struct TouchPoint { pub id: TouchId, - pub point: TypedPoint2D<f32, DevicePixel>, + pub point: Point2D<f32, DevicePixel>, } impl TouchPoint { - pub fn new(id: TouchId, point: TypedPoint2D<f32, DevicePixel>) -> Self { + pub fn new(id: TouchId, point: Point2D<f32, DevicePixel>) -> Self { TouchPoint { id: id, point: point, @@ -60,9 +59,9 @@ pub enum TouchAction { /// Simulate a mouse click. Click, /// Scroll by the provided offset. - Scroll(TypedVector2D<f32, DevicePixel>), + Scroll(Vector2D<f32, DevicePixel>), /// Zoom by a magnification factor and scroll by the provided offset. - Zoom(f32, TypedVector2D<f32, DevicePixel>), + Zoom(f32, Vector2D<f32, DevicePixel>), /// Send a JavaScript event to content. DispatchEvent, /// Don't do anything. @@ -77,7 +76,7 @@ impl TouchHandler { } } - pub fn on_touch_down(&mut self, id: TouchId, point: TypedPoint2D<f32, DevicePixel>) { + pub fn on_touch_down(&mut self, id: TouchId, point: Point2D<f32, DevicePixel>) { let point = TouchPoint::new(id, point); self.active_touch_points.push(point); @@ -90,11 +89,7 @@ impl TouchHandler { }; } - pub fn on_touch_move( - &mut self, - id: TouchId, - point: TypedPoint2D<f32, DevicePixel>, - ) -> TouchAction { + pub fn on_touch_move(&mut self, id: TouchId, point: Point2D<f32, DevicePixel>) -> TouchAction { let idx = match self.active_touch_points.iter_mut().position(|t| t.id == id) { Some(i) => i, None => { @@ -128,7 +123,7 @@ impl TouchHandler { let (d1, c1) = self.pinch_distance_and_center(); let magnification = d1 / d0; - let scroll_delta = c1 - c0 * TypedScale::new(magnification); + let scroll_delta = c1 - c0 * Scale::new(magnification); TouchAction::Zoom(magnification, scroll_delta) }, @@ -145,11 +140,7 @@ impl TouchHandler { action } - pub fn on_touch_up( - &mut self, - id: TouchId, - _point: TypedPoint2D<f32, DevicePixel>, - ) -> TouchAction { + pub fn on_touch_up(&mut self, id: TouchId, _point: Point2D<f32, DevicePixel>) -> TouchAction { match self.active_touch_points.iter().position(|t| t.id == id) { Some(i) => { self.active_touch_points.swap_remove(i); @@ -182,7 +173,7 @@ impl TouchHandler { } } - pub fn on_touch_cancel(&mut self, id: TouchId, _point: TypedPoint2D<f32, DevicePixel>) { + pub fn on_touch_cancel(&mut self, id: TouchId, _point: Point2D<f32, DevicePixel>) { match self.active_touch_points.iter().position(|t| t.id == id) { Some(i) => { self.active_touch_points.swap_remove(i); @@ -225,7 +216,7 @@ impl TouchHandler { self.active_touch_points.len() } - fn pinch_distance_and_center(&self) -> (f32, TypedPoint2D<f32, DevicePixel>) { + fn pinch_distance_and_center(&self) -> (f32, Point2D<f32, DevicePixel>) { debug_assert_eq!(self.touch_count(), 2); let p0 = self.active_touch_points[0].point; let p1 = self.active_touch_points[1].point; diff --git a/components/compositing/windowing.rs b/components/compositing/windowing.rs index d668b03979e..7e5b1530931 100644 --- a/components/compositing/windowing.rs +++ b/components/compositing/windowing.rs @@ -5,7 +5,7 @@ //! Abstract windowing methods. The concrete implementations of these can be found in `platform/`. use embedder_traits::EventLoopWaker; -use euclid::TypedScale; +use euclid::Scale; #[cfg(feature = "gl")] use gleam::gl; use keyboard_types::KeyboardEvent; @@ -183,7 +183,7 @@ pub trait EmbedderMethods { #[derive(Clone, Copy, Debug)] pub struct EmbedderCoordinates { /// The pixel density of the display. - pub hidpi_factor: TypedScale<f32, DeviceIndependentPixel, DevicePixel>, + pub hidpi_factor: Scale<f32, DeviceIndependentPixel, DevicePixel>, /// Size of the screen. pub screen: DeviceIntSize, /// Size of the available screen space (screen without toolbars and docks). diff --git a/components/config/Cargo.toml b/components/config/Cargo.toml index 4698bfe9a35..568d2acb92b 100644 --- a/components/config/Cargo.toml +++ b/components/config/Cargo.toml @@ -14,7 +14,7 @@ name = "servo_config" path = "lib.rs" [dependencies] -euclid = "0.19" +euclid = "0.20" embedder_traits = { path = "../embedder_traits" } getopts = "0.2.11" lazy_static = "1" diff --git a/components/config/opts.rs b/components/config/opts.rs index 49fa0fee344..ffc557c0a46 100644 --- a/components/config/opts.rs +++ b/components/config/opts.rs @@ -6,7 +6,7 @@ //! from command line arguments. use crate::prefs::{self, PrefValue}; -use euclid::TypedSize2D; +use euclid::Size2D; use getopts::Options; use servo_geometry::DeviceIndependentPixel; use servo_url::ServoUrl; @@ -135,7 +135,7 @@ pub struct Opts { pub webdriver_port: Option<u16>, /// The initial requested size of the window. - pub initial_window_size: TypedSize2D<u32, DeviceIndependentPixel>, + pub initial_window_size: Size2D<u32, DeviceIndependentPixel>, /// An optional string allowing the user agent to be set for testing. pub user_agent: Cow<'static, str>, @@ -576,7 +576,7 @@ pub fn default_opts() -> Opts { debugger_port: None, devtools_port: None, webdriver_port: None, - initial_window_size: TypedSize2D::new(1024, 740), + initial_window_size: Size2D::new(1024, 740), user_agent: default_user_agent_string(DEFAULT_USER_AGENT).into(), multiprocess: false, random_pipeline_closure_probability: None, @@ -954,9 +954,9 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { }) }) .collect(); - TypedSize2D::new(res[0], res[1]) + Size2D::new(res[0], res[1]) }, - None => TypedSize2D::new(1024, 740), + None => Size2D::new(1024, 740), }; if opt_match.opt_present("M") { diff --git a/components/constellation/Cargo.toml b/components/constellation/Cargo.toml index f5270aa2d90..835211f9c20 100644 --- a/components/constellation/Cargo.toml +++ b/components/constellation/Cargo.toml @@ -26,7 +26,7 @@ compositing = {path = "../compositing"} crossbeam-channel = "0.3" debugger = {path = "../debugger"} devtools_traits = {path = "../devtools_traits"} -euclid = "0.19" +euclid = "0.20" embedder_traits = { path = "../embedder_traits" } gfx = {path = "../gfx"} gfx_traits = {path = "../gfx_traits"} diff --git a/components/constellation/browsingcontext.rs b/components/constellation/browsingcontext.rs index e63d0701258..d90cb79cadd 100644 --- a/components/constellation/browsingcontext.rs +++ b/components/constellation/browsingcontext.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crate::pipeline::Pipeline; -use euclid::TypedSize2D; +use euclid::Size2D; use msg::constellation_msg::{ BrowsingContextGroupId, BrowsingContextId, PipelineId, TopLevelBrowsingContextId, }; @@ -46,7 +46,7 @@ pub struct BrowsingContext { pub top_level_id: TopLevelBrowsingContextId, /// The size of the frame. - pub size: TypedSize2D<f32, CSSPixel>, + pub size: Size2D<f32, CSSPixel>, /// Whether this browsing context is in private browsing mode. pub is_private: bool, @@ -76,7 +76,7 @@ impl BrowsingContext { top_level_id: TopLevelBrowsingContextId, pipeline_id: PipelineId, parent_pipeline_id: Option<PipelineId>, - size: TypedSize2D<f32, CSSPixel>, + size: Size2D<f32, CSSPixel>, is_private: bool, is_visible: bool, ) -> BrowsingContext { diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 9e14e38f645..9a4d8b3e93f 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -113,7 +113,7 @@ use compositing::SendableFrameTree; use crossbeam_channel::{unbounded, Receiver, Sender}; use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg}; use embedder_traits::{Cursor, EmbedderMsg, EmbedderProxy}; -use euclid::{Size2D, TypedScale, TypedSize2D}; +use euclid::{default::Size2D as UntypedSize2D, Scale, Size2D}; use gfx::font_cache_thread::FontCacheThread; use gfx_traits::Epoch; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; @@ -644,7 +644,7 @@ where /// Create a new constellation thread. pub fn start( state: InitialConstellationState, - initial_window_size: TypedSize2D<u32, DeviceIndependentPixel>, + initial_window_size: Size2D<u32, DeviceIndependentPixel>, device_pixels_per_px: Option<f32>, random_pipeline_closure_probability: Option<f32>, random_pipeline_closure_seed: Option<usize>, @@ -738,8 +738,8 @@ where time_profiler_chan: state.time_profiler_chan, mem_profiler_chan: state.mem_profiler_chan, window_size: WindowSizeData { - initial_viewport: initial_window_size.to_f32() * TypedScale::new(1.0), - device_pixel_ratio: TypedScale::new(device_pixels_per_px.unwrap_or(1.0)), + initial_viewport: initial_window_size.to_f32() * Scale::new(1.0), + device_pixel_ratio: Scale::new(device_pixels_per_px.unwrap_or(1.0)), }, phantom: PhantomData, webdriver: WebDriverData::new(), @@ -903,7 +903,7 @@ where top_level_browsing_context_id: TopLevelBrowsingContextId, parent_pipeline_id: Option<PipelineId>, opener: Option<BrowsingContextId>, - initial_window_size: TypedSize2D<f32, CSSPixel>, + initial_window_size: Size2D<f32, CSSPixel>, // TODO: we have to provide ownership of the LoadData // here, because it will be send on an ipc channel, // and ipc channels take onership of their data. @@ -1078,7 +1078,7 @@ where top_level_id: TopLevelBrowsingContextId, pipeline_id: PipelineId, parent_pipeline_id: Option<PipelineId>, - size: TypedSize2D<f32, CSSPixel>, + size: Size2D<f32, CSSPixel>, is_private: bool, is_visible: bool, ) { @@ -3341,7 +3341,7 @@ where fn handle_create_canvas_paint_thread_msg( &mut self, - size: Size2D<u64>, + size: UntypedSize2D<u64>, response_sender: IpcSender<(IpcSender<CanvasMsg>, CanvasId)>, ) { let webrender_api = self.webrender_api_sender.clone(); @@ -4015,7 +4015,7 @@ where // If the rectangle for this pipeline is zero sized, it will // never be painted. In this case, don't query the layout // thread as it won't contribute to the final output image. - if browsing_context.size == TypedSize2D::zero() { + if browsing_context.size == Size2D::zero() { continue; } diff --git a/components/constellation/pipeline.rs b/components/constellation/pipeline.rs index 36e6284ab1a..d2c006d368c 100644 --- a/components/constellation/pipeline.rs +++ b/components/constellation/pipeline.rs @@ -11,7 +11,7 @@ use compositing::CompositionPipeline; use compositing::CompositorProxy; use crossbeam_channel::Sender; use devtools_traits::{DevtoolsControlMsg, ScriptToDevtoolsControlMsg}; -use euclid::{TypedScale, TypedSize2D}; +use euclid::{Scale, Size2D}; use gfx::font_cache_thread::FontCacheThread; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; use ipc_channel::router::ROUTER; @@ -158,10 +158,10 @@ pub struct InitialPipelineState { pub mem_profiler_chan: profile_mem::ProfilerChan, /// Information about the initial window size. - pub window_size: TypedSize2D<f32, CSSPixel>, + pub window_size: Size2D<f32, CSSPixel>, /// Information about the device pixel ratio. - pub device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>, + pub device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>, /// The event loop to run in, if applicable. pub event_loop: Option<Rc<EventLoop>>, diff --git a/components/geometry/Cargo.toml b/components/geometry/Cargo.toml index 407fbe81e78..387f17a1e55 100644 --- a/components/geometry/Cargo.toml +++ b/components/geometry/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" [dependencies] app_units = "0.7" -euclid = "0.19" +euclid = "0.20" malloc_size_of = { path = "../malloc_size_of" } malloc_size_of_derive = "0.1" style_traits = { path = "../style_traits" } diff --git a/components/geometry/lib.rs b/components/geometry/lib.rs index 155551ee3d9..fd579b7f9bd 100644 --- a/components/geometry/lib.rs +++ b/components/geometry/lib.rs @@ -6,7 +6,10 @@ extern crate malloc_size_of_derive; use app_units::{Au, MAX_AU, MIN_AU}; -use euclid::{Length, Point2D, Rect, Size2D}; +use euclid::{ + default::{Point2D, Rect, Size2D}, + Length, +}; use std::f32; use webrender_api::units::{FramebufferPixel, LayoutPoint, LayoutRect, LayoutSize}; diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml index 8d2dbd33ad9..ba751a45e0d 100644 --- a/components/gfx/Cargo.toml +++ b/components/gfx/Cargo.toml @@ -16,7 +16,7 @@ doctest = false [dependencies] app_units = "0.7" bitflags = "1.0" -euclid = "0.19" +euclid = "0.20" fnv = "1.0" fontsan = {git = "https://github.com/servo/fontsan"} gfx_traits = {path = "../gfx_traits"} diff --git a/components/gfx/font.rs b/components/gfx/font.rs index 35ce19621ac..3dd5ac9f244 100644 --- a/components/gfx/font.rs +++ b/components/gfx/font.rs @@ -12,7 +12,7 @@ use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; use crate::text::shaping::ShaperMethods; use crate::text::Shaper; use app_units::Au; -use euclid::{Point2D, Rect, Size2D}; +use euclid::default::{Point2D, Rect, Size2D}; use ordered_float::NotNan; use servo_atoms::Atom; use smallvec::SmallVec; diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs index 82d002e61f4..99595eb47c8 100644 --- a/components/gfx/text/glyph.rs +++ b/components/gfx/text/glyph.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use app_units::Au; -use euclid::Point2D; +use euclid::default::Point2D; #[cfg(any(target_feature = "sse2", target_feature = "neon"))] use packed_simd::u32x4; use range::{self, EachIndex, Range, RangeIndex}; diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index ce8ce628f08..9599dd61a12 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -10,7 +10,7 @@ use crate::text::glyph::{ByteIndex, GlyphData, GlyphId, GlyphStore}; use crate::text::shaping::ShaperMethods; use crate::text::util::{fixed_to_float, float_to_fixed, is_bidi_control}; use app_units::Au; -use euclid::Point2D; +use euclid::default::Point2D; // Eventually we would like the shaper to be pluggable, as many operating systems have their own // shapers. For now, however, HarfBuzz is a hard dependency. use harfbuzz_sys::hb_blob_t; diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml index a6623516129..1f6027eab24 100644 --- a/components/layout/Cargo.toml +++ b/components/layout/Cargo.toml @@ -19,13 +19,14 @@ bitflags = "1.0" canvas_traits = {path = "../canvas_traits"} crossbeam-channel = "0.3" embedder_traits = {path = "../embedder_traits"} -euclid = "0.19" +euclid = "0.20" fnv = "1.0" fxhash = "0.2" gfx = {path = "../gfx"} gfx_traits = {path = "../gfx_traits"} html5ever = "0.23" ipc-channel = "0.11" +lazy_static = "1" libc = "0.2" log = "0.4" malloc_size_of = { path = "../malloc_size_of" } diff --git a/components/layout/block.rs b/components/layout/block.rs index 24128ca2ae7..1f4eb92ea51 100644 --- a/components/layout/block.rs +++ b/components/layout/block.rs @@ -50,7 +50,7 @@ use crate::model::{ use crate::sequential; use crate::traversal::PreorderFlowTraversal; use app_units::{Au, MAX_AU}; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; +use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D}; use gfx_traits::print_tree::PrintTree; use serde::{Serialize, Serializer}; use servo_geometry::MaxRect; @@ -2610,7 +2610,7 @@ impl Flow for BlockFlow { .relative_containing_block_mode, CoordinateSystem::Own, ) - .translate(&stacking_context_position.to_vector()), + .translate(stacking_context_position.to_vector()), ); } diff --git a/components/layout/display_list/background.rs b/components/layout/display_list/background.rs index c6fa1691e46..9d05cef9054 100644 --- a/components/layout/display_list/background.rs +++ b/components/layout/display_list/background.rs @@ -4,7 +4,7 @@ use crate::display_list::border; use app_units::Au; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; +use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D}; use style::computed_values::background_attachment::single_value::T as BackgroundAttachment; use style::computed_values::background_clip::single_value::T as BackgroundClip; use style::computed_values::background_origin::single_value::T as BackgroundOrigin; diff --git a/components/layout/display_list/border.rs b/components/layout/display_list/border.rs index fff18fcf6c0..4970b2a34de 100644 --- a/components/layout/display_list/border.rs +++ b/components/layout/display_list/border.rs @@ -4,7 +4,8 @@ use crate::display_list::ToLayout; use app_units::Au; -use euclid::{Rect, SideOffsets2D, Size2D}; +use euclid::default::{Rect, SideOffsets2D as UntypedSideOffsets2D, Size2D as UntypedSize2D}; +use euclid::{SideOffsets2D, Size2D}; use style::computed_values::border_image_outset::T as BorderImageOutset; use style::properties::style_structs::Border; use style::values::computed::NumberOrPercentage; @@ -23,7 +24,10 @@ use webrender_api::{BorderRadius, BorderSide, BorderStyle, ColorF, NormalBorder} /// > Percentages: Refer to corresponding dimension of the border box. /// /// [1]: https://drafts.csswg.org/css-backgrounds-3/#border-radius -fn corner_radius(radius: BorderCornerRadius, containing_size: Size2D<Au>) -> Size2D<Au> { +fn corner_radius( + radius: BorderCornerRadius, + containing_size: UntypedSize2D<Au>, +) -> UntypedSize2D<Au> { let w = radius.0.width().to_used_value(containing_size.width); let h = radius.0.height().to_used_value(containing_size.height); Size2D::new(w, h) @@ -105,7 +109,7 @@ pub fn radii(abs_bounds: Rect<Au>, border_style: &Border) -> BorderRadius { /// the inner radii need to be smaller depending on the line width. /// /// This is used to determine clipping areas. -pub fn inner_radii(mut radii: BorderRadius, offsets: SideOffsets2D<Au>) -> BorderRadius { +pub fn inner_radii(mut radii: BorderRadius, offsets: UntypedSideOffsets2D<Au>) -> BorderRadius { fn inner_length(x: f32, offset: Au) -> f32 { 0.0_f32.max(x - offset.to_f32_px()) } @@ -144,7 +148,10 @@ fn side_image_outset(outset: NonNegativeLengthOrNumber, border_width: Au) -> Au } /// Compute the additional border-image area. -pub fn image_outset(outset: BorderImageOutset, border: SideOffsets2D<Au>) -> SideOffsets2D<Au> { +pub fn image_outset( + outset: BorderImageOutset, + border: UntypedSideOffsets2D<Au>, +) -> UntypedSideOffsets2D<Au> { SideOffsets2D::new( side_image_outset(outset.0, border.top), side_image_outset(outset.1, border.right), @@ -168,7 +175,7 @@ fn side_image_width( pub fn image_width( width: &BorderImageWidth, border: LayoutSideOffsets, - border_area: Size2D<Au>, + border_area: UntypedSize2D<Au>, ) -> LayoutSideOffsets { LayoutSideOffsets::new( side_image_width(width.0, border.top, border_area.height), @@ -185,15 +192,14 @@ fn resolve_percentage(value: NonNegative<NumberOrPercentage>, length: i32) -> i3 } } -pub fn image_slice( +pub fn image_slice<U>( border_image_slice: &StyleRect<NonNegative<NumberOrPercentage>>, - width: i32, - height: i32, -) -> SideOffsets2D<i32> { + size: Size2D<i32, U>, +) -> SideOffsets2D<i32, U> { SideOffsets2D::new( - resolve_percentage(border_image_slice.0, height), - resolve_percentage(border_image_slice.1, width), - resolve_percentage(border_image_slice.2, height), - resolve_percentage(border_image_slice.3, width), + resolve_percentage(border_image_slice.0, size.height), + resolve_percentage(border_image_slice.1, size.width), + resolve_percentage(border_image_slice.2, size.height), + resolve_percentage(border_image_slice.3, size.width), ) } diff --git a/components/layout/display_list/builder.rs b/components/layout/display_list/builder.rs index e6ead2505ca..cba26fe05a4 100644 --- a/components/layout/display_list/builder.rs +++ b/components/layout/display_list/builder.rs @@ -32,7 +32,10 @@ use crate::table_cell::CollapsedBordersForCell; use app_units::{Au, AU_PER_PX}; use canvas_traits::canvas::{CanvasMsg, FromLayoutMsg}; use embedder_traits::Cursor; -use euclid::{rect, Point2D, Rect, SideOffsets2D, Size2D, TypedRect, TypedSize2D}; +use euclid::{ + default::{Point2D, Rect, SideOffsets2D as UntypedSideOffsets2D, Size2D}, + rect, SideOffsets2D, +}; use fnv::FnvHashMap; use gfx::text::glyph::ByteIndex; use gfx::text::TextRun; @@ -874,7 +877,7 @@ impl Fragment { ) -> Option<WebRenderImageInfo> { let device_pixel_ratio = state.layout_context.style_context.device_pixel_ratio(); let size_in_px = - TypedSize2D::new(size_in_au.width.to_f32_px(), size_in_au.height.to_f32_px()); + euclid::Size2D::new(size_in_au.width.to_f32_px(), size_in_au.height.to_f32_px()); // TODO: less copying. let name = paint_worklet.name.clone(); @@ -1169,7 +1172,7 @@ impl Fragment { base: BaseDisplayItem, bounds: Rect<Au>, image: &Image, - border_width: SideOffsets2D<Au>, + border_width: UntypedSideOffsets2D<Au>, ) -> Option<()> { let border_style_struct = style.get_border(); let border_image_outset = @@ -1238,11 +1241,13 @@ impl Fragment { _ => return None, }; + // FIXME(emilio): WR expects device pixels here... somehow? + let size = euclid::Size2D::new(width as i32, height as i32); let details = BorderDetails::NinePatch(NinePatchBorder { source, width: width as i32, height: height as i32, - slice: border::image_slice(border_image_slice, width as i32, height as i32), + slice: border::image_slice(border_image_slice, size), fill: border_image_fill, repeat_horizontal: border_image_repeat.0.to_layout(), repeat_vertical: border_image_repeat.1.to_layout(), @@ -1660,7 +1665,7 @@ impl Fragment { // of this fragment's background but behind its content. This ensures that any // hit tests inside the content box but not on actual content target the current // scrollable ancestor. - let content_size = TypedRect::new(stacking_relative_border_box.origin, content_size); + let content_size = Rect::new(stacking_relative_border_box.origin, content_size); let base = state.create_base_display_item_with_clipping_and_scrolling( content_size, self.node, @@ -1810,10 +1815,9 @@ impl Fragment { // XXXjdm: This sleight-of-hand to convert LayoutRect -> Size2D<CSSPixel> // looks bogus. - let size = Size2D::new(bounds.size.width, bounds.size.height); state.iframe_sizes.push(IFrameSize { id: browsing_context_id, - size: TypedSize2D::from_untyped(&size), + size: euclid::Size2D::new(bounds.size.width, bounds.size.height), }); state.add_display_item(item); @@ -1926,13 +1930,13 @@ impl Fragment { // First, compute the offset of our border box (including relative positioning) // from our flow origin, since that is what `BaseFlow::overflow` is relative to. let border_box_offset = border_box - .translate(&-base_flow.stacking_relative_position) + .translate(-base_flow.stacking_relative_position) .origin; // Then, using that, compute our overflow region relative to our border box. let overflow = base_flow .overflow .paint - .translate(&-border_box_offset.to_vector()); + .translate(-border_box_offset.to_vector()); // Create the filter pipeline. let effects = self.style().get_effects(); @@ -2269,7 +2273,7 @@ impl BlockFlow { .fragment .perspective_matrix(&border_box) .unwrap_or(LayoutTransform::identity()); - let transform = transform.pre_mul(&perspective).inverse(); + let transform = transform.pre_transform(&perspective).inverse(); let origin = border_box.origin; let transform_clip = |clip: Rect<Au>| { @@ -3016,7 +3020,7 @@ trait ToF32Px { fn to_f32_px(&self) -> Self::Output; } -impl ToF32Px for TypedRect<Au> { +impl ToF32Px for Rect<Au> { type Output = LayoutRect; fn to_f32_px(&self) -> LayoutRect { LayoutRect::from_untyped(&servo_geometry::au_rect_to_f32_rect(*self)) diff --git a/components/layout/display_list/conversions.rs b/components/layout/display_list/conversions.rs index 4624b5f8dd0..2759c5f65ac 100644 --- a/components/layout/display_list/conversions.rs +++ b/components/layout/display_list/conversions.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use app_units::Au; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D, Vector2D}; +use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D, Vector2D}; use style::computed_values::image_rendering::T as ImageRendering; use style::computed_values::mix_blend_mode::T as MixBlendMode; use style::computed_values::transform_style::T as TransformStyle; diff --git a/components/layout/display_list/gradient.rs b/components/layout/display_list/gradient.rs index ab56b1d6c9c..3d7730e4fe6 100644 --- a/components/layout/display_list/gradient.rs +++ b/components/layout/display_list/gradient.rs @@ -4,7 +4,7 @@ use crate::display_list::ToLayout; use app_units::Au; -use euclid::{Point2D, Size2D, Vector2D}; +use euclid::default::{Point2D, Size2D, Vector2D}; use style::properties::ComputedValues; use style::values::computed::image::{EndingShape, LineDirection}; use style::values::computed::{Angle, GradientItem, LengthPercentage, Percentage, Position}; diff --git a/components/layout/display_list/items.rs b/components/layout/display_list/items.rs index b6674d972fe..de7e49d306e 100644 --- a/components/layout/display_list/items.rs +++ b/components/layout/display_list/items.rs @@ -24,7 +24,7 @@ use std::f32; use std::fmt; use style::computed_values::_servo_top_layer::T as InTopLayer; use webrender_api as wr; -use webrender_api::units::{LayoutPoint, LayoutRect, LayoutSize, LayoutTransform}; +use webrender_api::units::{LayoutPixel, LayoutPoint, LayoutRect, LayoutSize, LayoutTransform}; use webrender_api::{BorderRadius, ClipId, ClipMode, CommonItemProperties, ComplexClipRegion}; use webrender_api::{ExternalScrollId, FilterOp, GlyphInstance, GradientStop, ImageKey}; use webrender_api::{MixBlendMode, ScrollSensitivity, Shadow, SpatialId}; @@ -343,7 +343,7 @@ impl fmt::Debug for StackingContext { #[derive(Clone, Debug, PartialEq, Serialize)] pub struct StickyFrameData { - pub margins: SideOffsets2D<Option<f32>>, + pub margins: SideOffsets2D<Option<f32>, LayoutPixel>, pub vertical_offset_bounds: StickyOffsetBounds, pub horizontal_offset_bounds: StickyOffsetBounds, } @@ -792,4 +792,4 @@ impl WebRenderImageInfo { } /// The type of the scroll offset list. This is only populated if WebRender is in use. -pub type ScrollOffsetMap = HashMap<ExternalScrollId, Vector2D<f32>>; +pub type ScrollOffsetMap = HashMap<ExternalScrollId, Vector2D<f32, LayoutPixel>>; diff --git a/components/layout/display_list/webrender_helpers.rs b/components/layout/display_list/webrender_helpers.rs index 6bdb1bfcfdc..37232dda832 100644 --- a/components/layout/display_list/webrender_helpers.rs +++ b/components/layout/display_list/webrender_helpers.rs @@ -189,7 +189,7 @@ impl WebRenderDisplayItemConverter for DisplayItem { ), (Some(t), None) => (t, ReferenceFrameKind::Transform), (Some(t), Some(p)) => ( - t.pre_mul(&p), + t.pre_transform(&p), ReferenceFrameKind::Perspective { scrolling_relative_to: None, }, diff --git a/components/layout/flex.rs b/components/layout/flex.rs index e6aa2f7b2c8..8d2f7b98fe1 100644 --- a/components/layout/flex.rs +++ b/components/layout/flex.rs @@ -17,7 +17,7 @@ use crate::model::{self, AdjoiningMargins, CollapsibleMargins}; use crate::model::{IntrinsicISizes, MaybeAuto, SizeConstraint}; use crate::traversal::PreorderFlowTraversal; use app_units::{Au, MAX_AU}; -use euclid::Point2D; +use euclid::default::Point2D; use std::cmp::{max, min}; use std::ops::Range; use style::computed_values::align_content::T as AlignContent; diff --git a/components/layout/flow.rs b/components/layout/flow.rs index d7ab73cd8d3..2d6e449766e 100644 --- a/components/layout/flow.rs +++ b/components/layout/flow.rs @@ -44,7 +44,7 @@ use crate::table_row::TableRowFlow; use crate::table_rowgroup::TableRowGroupFlow; use crate::table_wrapper::TableWrapperFlow; use app_units::Au; -use euclid::{Point2D, Rect, Size2D, Vector2D}; +use euclid::default::{Point2D, Rect, Size2D, Vector2D}; use gfx_traits::print_tree::PrintTree; use gfx_traits::StackingContextId; use num_traits::cast::FromPrimitive; diff --git a/components/layout/fragment.rs b/components/layout/fragment.rs index 879e2af2f64..f663dad744d 100644 --- a/components/layout/fragment.rs +++ b/components/layout/fragment.rs @@ -22,7 +22,7 @@ use crate::wrapper::ThreadSafeLayoutNodeHelpers; use crate::ServoArc; use app_units::Au; use canvas_traits::canvas::{CanvasId, CanvasMsg}; -use euclid::{Point2D, Rect, Size2D, Vector2D}; +use euclid::default::{Point2D, Rect, Size2D, Vector2D}; use gfx::text::glyph::ByteIndex; use gfx::text::text_run::{TextRun, TextRunSlice}; use gfx_traits::StackingContextId; @@ -2671,8 +2671,12 @@ impl Fragment { // this. let relative_position = self.relative_position(relative_containing_block_size); border_box - .translate_by_size(&relative_position.to_physical(self.style.writing_mode)) - .translate(&stacking_relative_flow_origin) + .translate( + relative_position + .to_physical(self.style.writing_mode) + .to_vector(), + ) + .translate(*stacking_relative_flow_origin) } /// Given the stacking-context-relative border box, returns the stacking-context-relative @@ -2789,8 +2793,11 @@ impl Fragment { // FIXME(pcwalton): I'm not a fan of the way this makes us crawl though so many styles all // the time. Can't we handle relative positioning by just adjusting `border_box`? let relative_position = self.relative_position(relative_containing_block_size); - border_box = - border_box.translate_by_size(&relative_position.to_physical(self.style.writing_mode)); + border_box = border_box.translate( + relative_position + .to_physical(self.style.writing_mode) + .to_vector(), + ); let mut overflow = Overflow::from_rect(&border_box); // Box shadows cause us to draw outside our border box. @@ -2803,7 +2810,7 @@ impl Fragment { Au::from(box_shadow.base.blur) * BLUR_INFLATION_FACTOR; overflow.paint = overflow .paint - .union(&border_box.translate(&offset).inflate(inflation, inflation)) + .union(&border_box.translate(offset).inflate(inflation, inflation)) } // Outlines cause us to draw outside our border box. @@ -3172,7 +3179,11 @@ impl Fragment { -transform_origin_z, ); - Some(pre_transform.pre_mul(&transform).pre_mul(&post_transform)) + Some( + pre_transform + .pre_transform(&transform) + .pre_transform(&post_transform), + ) } /// Returns the 4D matrix representing this fragment's perspective. @@ -3210,8 +3221,8 @@ impl Fragment { Some( pre_transform - .pre_mul(&perspective_matrix) - .pre_mul(&post_transform), + .pre_transform(&perspective_matrix) + .pre_transform(&post_transform), ) }, Perspective::None => None, @@ -3378,8 +3389,8 @@ impl Overflow { } pub fn translate(&mut self, by: &Vector2D<Au>) { - self.scroll = self.scroll.translate(by); - self.paint = self.paint.translate(by); + self.scroll = self.scroll.translate(*by); + self.paint = self.paint.translate(*by); } } diff --git a/components/layout/generated_content.rs b/components/layout/generated_content.rs index 737dc3e84b8..683bb316897 100644 --- a/components/layout/generated_content.rs +++ b/components/layout/generated_content.rs @@ -25,6 +25,23 @@ use style::properties::ComputedValues; use style::selector_parser::RestyleDamage; use style::servo::restyle_damage::ServoRestyleDamage; use style::values::generics::counters::ContentItem; +use style::values::specified::list::{QuotePair, Quotes}; + +lazy_static! { + static ref INITIAL_QUOTES: style::ArcSlice<QuotePair> = style::ArcSlice::from_iter_leaked( + vec![ + QuotePair { + opening: "\u{201c}".to_owned().into(), + closing: "\u{201d}".to_owned().into(), + }, + QuotePair { + opening: "\u{2018}".to_owned().into(), + closing: "\u{2019}".to_owned().into(), + }, + ] + .into_iter() + ); +} // Decimal styles per CSS-COUNTER-STYLES § 6.1: static DECIMAL: [char; 10] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']; @@ -326,14 +343,17 @@ impl<'a, 'b> ResolveGeneratedContentFragmentMutator<'a, 'b> { } fn quote(&self, style: &ComputedValues, close: bool) -> String { - let quotes = &style.get_list().quotes; - if quotes.0.is_empty() { + let quotes = match style.get_list().quotes { + Quotes::Auto => &*INITIAL_QUOTES, + Quotes::QuoteList(ref list) => &list.0, + }; + if quotes.is_empty() { return String::new(); } - let pair = if self.traversal.quote as usize >= quotes.0.len() { - quotes.0.last().unwrap() + let pair = if self.traversal.quote as usize >= quotes.len() { + quotes.last().unwrap() } else { - "es.0[self.traversal.quote as usize] + "es[self.traversal.quote as usize] }; if close { pair.closing.to_string() diff --git a/components/layout/inline.rs b/components/layout/inline.rs index 152108dc912..1c43ba13586 100644 --- a/components/layout/inline.rs +++ b/components/layout/inline.rs @@ -21,7 +21,7 @@ use crate::text; use crate::traversal::PreorderFlowTraversal; use crate::ServoArc; use app_units::{Au, MIN_AU}; -use euclid::{Point2D, Rect, Size2D}; +use euclid::default::{Point2D, Rect, Size2D}; use gfx::font::FontMetrics; use gfx_traits::print_tree::PrintTree; use range::{Range, RangeIndex}; @@ -1977,7 +1977,7 @@ impl Flow for InlineFlow { relative_containing_block_mode, CoordinateSystem::Own, ) - .translate(&stacking_context_position.to_vector()), + .translate(stacking_context_position.to_vector()), ) } } diff --git a/components/layout/lib.rs b/components/layout/lib.rs index f8afdc79190..fdf3971fc3f 100644 --- a/components/layout/lib.rs +++ b/components/layout/lib.rs @@ -9,6 +9,8 @@ extern crate bitflags; #[macro_use] extern crate html5ever; #[macro_use] +extern crate lazy_static; +#[macro_use] extern crate log; #[macro_use] extern crate range; diff --git a/components/layout/list_item.rs b/components/layout/list_item.rs index 3416ff444b3..c3e17fdfdc3 100644 --- a/components/layout/list_item.rs +++ b/components/layout/list_item.rs @@ -20,7 +20,7 @@ use crate::fragment::{ use crate::generated_content; use crate::inline::InlineFlow; use app_units::Au; -use euclid::Point2D; +use euclid::default::Point2D; use style::computed_values::list_style_type::T as ListStyleType; use style::computed_values::position::T as Position; use style::logical_geometry::LogicalSize; @@ -280,7 +280,7 @@ impl Flow for ListItemFlow { .relative_containing_block_mode, CoordinateSystem::Own, ) - .translate(&stacking_context_position.to_vector()), + .translate(stacking_context_position.to_vector()), ); } } diff --git a/components/layout/multicol.rs b/components/layout/multicol.rs index d49e5f1d79f..8890c08e189 100644 --- a/components/layout/multicol.rs +++ b/components/layout/multicol.rs @@ -12,7 +12,7 @@ use crate::flow::{Flow, FlowClass, FragmentationContext, GetBaseFlow, OpaqueFlow use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::ServoArc; use app_units::Au; -use euclid::{Point2D, Vector2D}; +use euclid::default::{Point2D, Vector2D}; use gfx_traits::print_tree::PrintTree; use std::cmp::{max, min}; use std::fmt; diff --git a/components/layout/query.rs b/components/layout/query.rs index 789056753d5..8dfd1bab795 100644 --- a/components/layout/query.rs +++ b/components/layout/query.rs @@ -15,7 +15,7 @@ use crate::opaque_node::OpaqueNodeMethods; use crate::sequential; use crate::wrapper::LayoutNodeLayoutData; use app_units::Au; -use euclid::{Point2D, Rect, Size2D, Vector2D}; +use euclid::default::{Point2D, Rect, Size2D, Vector2D}; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::PipelineId; use script_layout_interface::rpc::TextIndexResponse; diff --git a/components/layout/sequential.rs b/components/layout/sequential.rs index 16dd3b8d4da..8a113f39bb0 100644 --- a/components/layout/sequential.rs +++ b/components/layout/sequential.rs @@ -15,7 +15,7 @@ use crate::incremental::RelayoutMode; use crate::traversal::{AssignBSizes, AssignISizes, BubbleISizes, BuildDisplayList}; use crate::traversal::{InorderFlowTraversal, PostorderFlowTraversal, PreorderFlowTraversal}; use app_units::Au; -use euclid::{Point2D, Rect, Size2D, Vector2D}; +use euclid::default::{Point2D, Rect, Size2D, Vector2D}; use servo_config::opts; use style::servo::restyle_damage::ServoRestyleDamage; use webrender_api::units::LayoutPoint; @@ -125,7 +125,7 @@ pub fn iterate_through_flow_tree_fragment_border_boxes( .as_block() .stacking_relative_border_box(CoordinateSystem::Own); if let Some(matrix) = kid.as_block().fragment.transform_matrix(&relative_position) { - let transform_matrix = matrix.transform_point2d(&LayoutPoint::zero()).unwrap(); + let transform_matrix = matrix.transform_point2d(LayoutPoint::zero()).unwrap(); stacking_context_position = stacking_context_position + Vector2D::new( Au::from_f32_px(transform_matrix.x), diff --git a/components/layout/table.rs b/components/layout/table.rs index 9f6219f0980..190f6693256 100644 --- a/components/layout/table.rs +++ b/components/layout/table.rs @@ -24,7 +24,7 @@ use crate::table_row::{self, CellIntrinsicInlineSize, CollapsedBorder, Collapsed use crate::table_row::{TableRowFlow, TableRowSizeData}; use crate::table_wrapper::TableLayout; use app_units::Au; -use euclid::Point2D; +use euclid::default::Point2D; use gfx_traits::print_tree::PrintTree; use std::{cmp, fmt}; use style::computed_values::{border_collapse, border_spacing, table_layout}; diff --git a/components/layout/table_caption.rs b/components/layout/table_caption.rs index 3d44190f986..470a1c2f489 100644 --- a/components/layout/table_caption.rs +++ b/components/layout/table_caption.rs @@ -12,7 +12,7 @@ use crate::display_list::{ use crate::flow::{Flow, FlowClass, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use app_units::Au; -use euclid::Point2D; +use euclid::default::Point2D; use gfx_traits::print_tree::PrintTree; use std::fmt; use style::logical_geometry::LogicalSize; diff --git a/components/layout/table_cell.rs b/components/layout/table_cell.rs index ec79f9f4540..89d83702f0e 100644 --- a/components/layout/table_cell.rs +++ b/components/layout/table_cell.rs @@ -15,7 +15,7 @@ use crate::layout_debug; use crate::table::InternalTable; use crate::table_row::{CollapsedBorder, CollapsedBorderProvenance}; use app_units::Au; -use euclid::{Point2D, Rect, SideOffsets2D, Size2D}; +use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D}; use gfx_traits::print_tree::PrintTree; use script_layout_interface::wrapper_traits::ThreadSafeLayoutNode; use std::fmt; diff --git a/components/layout/table_colgroup.rs b/components/layout/table_colgroup.rs index c07ad56f95a..b318dd95efd 100644 --- a/components/layout/table_colgroup.rs +++ b/components/layout/table_colgroup.rs @@ -10,7 +10,7 @@ use crate::flow::{BaseFlow, Flow, FlowClass, ForceNonfloatedFlag, OpaqueFlow}; use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; use app_units::Au; -use euclid::Point2D; +use euclid::default::Point2D; use std::fmt; use style::logical_geometry::LogicalSize; use style::properties::ComputedValues; diff --git a/components/layout/table_row.rs b/components/layout/table_row.rs index 824da31edad..ffaf720467b 100644 --- a/components/layout/table_row.rs +++ b/components/layout/table_row.rs @@ -18,7 +18,7 @@ use crate::layout_debug; use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize, InternalTable, VecExt}; use crate::table_cell::{CollapsedBordersForCell, TableCellFlow}; use app_units::Au; -use euclid::Point2D; +use euclid::default::Point2D; use gfx_traits::print_tree::PrintTree; use serde::{Serialize, Serializer}; use std::cmp::max; diff --git a/components/layout/table_rowgroup.rs b/components/layout/table_rowgroup.rs index 814cbe0d2d2..fd984fa4291 100644 --- a/components/layout/table_rowgroup.rs +++ b/components/layout/table_rowgroup.rs @@ -14,7 +14,7 @@ use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::layout_debug; use crate::table::{ColumnIntrinsicInlineSize, InternalTable, TableLikeFlow}; use app_units::Au; -use euclid::Point2D; +use euclid::default::Point2D; use gfx_traits::print_tree::PrintTree; use serde::{Serialize, Serializer}; use std::fmt; diff --git a/components/layout/table_wrapper.rs b/components/layout/table_wrapper.rs index 65ecc07d3ab..d2eac788c60 100644 --- a/components/layout/table_wrapper.rs +++ b/components/layout/table_wrapper.rs @@ -24,7 +24,7 @@ use crate::fragment::{Fragment, FragmentBorderBoxIterator, Overflow}; use crate::model::MaybeAuto; use crate::table::{ColumnComputedInlineSize, ColumnIntrinsicInlineSize}; use app_units::Au; -use euclid::Point2D; +use euclid::default::Point2D; use gfx_traits::print_tree::PrintTree; use std::cmp::{max, min}; use std::fmt; diff --git a/components/layout_thread/Cargo.toml b/components/layout_thread/Cargo.toml index e0e91c0d449..dc3f06ce6ce 100644 --- a/components/layout_thread/Cargo.toml +++ b/components/layout_thread/Cargo.toml @@ -15,7 +15,7 @@ app_units = "0.7" atomic_refcell = "0.1" crossbeam-channel = "0.3" embedder_traits = {path = "../embedder_traits"} -euclid = "0.19" +euclid = "0.20" fnv = "1.0" fxhash = "0.2" gfx = {path = "../gfx"} diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 1d8448c6e74..2febabce08b 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -28,7 +28,7 @@ use crate::dom_wrapper::{ServoLayoutDocument, ServoLayoutElement, ServoLayoutNod use app_units::Au; use crossbeam_channel::{unbounded, Receiver, Sender}; use embedder_traits::resources::{self, Resource}; -use euclid::{Point2D, Rect, Size2D, TypedScale, TypedSize2D}; +use euclid::{default::Size2D as UntypedSize2D, Point2D, Rect, Scale, Size2D}; use fnv::FnvHashMap; use fxhash::{FxHashMap, FxHashSet}; use gfx::font; @@ -216,7 +216,7 @@ pub struct LayoutThread { /// The size of the viewport. This may be different from the size of the screen due to viewport /// constraints. - viewport_size: Size2D<Au>, + viewport_size: UntypedSize2D<Au>, /// A mutex to allow for fast, read-only RPC of layout's internal data /// structures, while still letting the LayoutThread modify them. @@ -246,7 +246,7 @@ pub struct LayoutThread { layout_query_waiting_time: Histogram, /// The sizes of all iframes encountered during the last layout operation. - last_iframe_sizes: RefCell<HashMap<BrowsingContextId, TypedSize2D<f32, CSSPixel>>>, + last_iframe_sizes: RefCell<HashMap<BrowsingContextId, Size2D<f32, CSSPixel>>>, /// Flag that indicates if LayoutThread is busy handling a request. busy: Arc<AtomicBool>, @@ -255,7 +255,7 @@ pub struct LayoutThread { load_webfonts_synchronously: bool, /// The initial request size of the window - initial_window_size: TypedSize2D<u32, DeviceIndependentPixel>, + initial_window_size: Size2D<u32, DeviceIndependentPixel>, /// The ratio of device pixels per px at the default scale. /// If unspecified, will use the platform default setting. @@ -312,7 +312,7 @@ impl LayoutThreadFactory for LayoutThread { paint_time_metrics: PaintTimeMetrics, busy: Arc<AtomicBool>, load_webfonts_synchronously: bool, - initial_window_size: TypedSize2D<u32, DeviceIndependentPixel>, + initial_window_size: Size2D<u32, DeviceIndependentPixel>, device_pixels_per_px: Option<f32>, dump_display_list: bool, dump_display_list_json: bool, @@ -535,7 +535,7 @@ impl LayoutThread { paint_time_metrics: PaintTimeMetrics, busy: Arc<AtomicBool>, load_webfonts_synchronously: bool, - initial_window_size: TypedSize2D<u32, DeviceIndependentPixel>, + initial_window_size: Size2D<u32, DeviceIndependentPixel>, device_pixels_per_px: Option<f32>, dump_display_list: bool, dump_display_list_json: bool, @@ -550,8 +550,8 @@ impl LayoutThread { // but it will be set correctly when the initial reflow takes place. let device = Device::new( MediaType::screen(), - initial_window_size.to_f32() * TypedScale::new(1.0), - TypedScale::new(device_pixels_per_px.unwrap_or(1.0)), + initial_window_size.to_f32() * Scale::new(1.0), + Scale::new(device_pixels_per_px.unwrap_or(1.0)), ); // Create the channel on which new animations can be sent. @@ -833,7 +833,7 @@ impl LayoutThread { let point = Point2D::new(-state.scroll_offset.x, -state.scroll_offset.y); let mut txn = webrender_api::Transaction::new(); txn.scroll_node_with_id( - webrender_api::units::LayoutPoint::from_untyped(&point), + webrender_api::units::LayoutPoint::from_untyped(point), state.scroll_id, webrender_api::ScrollClamping::ToContentBounds, ); @@ -1249,7 +1249,7 @@ impl LayoutThread { epoch.next(); self.epoch.set(epoch); - let viewport_size = webrender_api::units::LayoutSize::from_untyped(&viewport_size); + let viewport_size = webrender_api::units::LayoutSize::from_untyped(viewport_size); // Observe notifications about rendered frames if needed right before // sending the display list to WebRender in order to set time related @@ -1671,8 +1671,7 @@ impl LayoutThread { // particular pipeline, so we need to tell WebRender about that. flags.insert(webrender_api::HitTestFlags::POINT_RELATIVE_TO_PIPELINE_VIEWPORT); - let client_point = - webrender_api::units::WorldPoint::from_untyped(&client_point); + let client_point = webrender_api::units::WorldPoint::from_untyped(client_point); let results = self.webrender_api.hit_test( self.webrender_document, Some(self.id.to_webrender()), @@ -2134,8 +2133,8 @@ impl RegisteredSpeculativePainter for RegisteredPainterImpl { impl Painter for RegisteredPainterImpl { fn draw_a_paint_image( &self, - size: TypedSize2D<f32, CSSPixel>, - device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>, + size: Size2D<f32, CSSPixel>, + device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>, properties: Vec<(Atom, String)>, arguments: Vec<String>, ) -> Result<DrawAPaintImageResult, PaintWorkletError> { diff --git a/components/layout_thread_2020/Cargo.toml b/components/layout_thread_2020/Cargo.toml index 157d1085711..8711cec2638 100644 --- a/components/layout_thread_2020/Cargo.toml +++ b/components/layout_thread_2020/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" [dependencies] crossbeam-channel = "0.3" -euclid = "0.19" +euclid = "0.20" gfx = {path = "../gfx"} ipc-channel = "0.11" layout = {path = "../layout_2020", package = "layout_2020"} diff --git a/components/layout_thread_2020/lib.rs b/components/layout_thread_2020/lib.rs index d101ccac107..b5bbe316dcc 100644 --- a/components/layout_thread_2020/lib.rs +++ b/components/layout_thread_2020/lib.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use crossbeam_channel::{Receiver, Sender}; -use euclid::TypedSize2D; +use euclid::Size2D; use gfx::font_cache_thread::FontCacheThread; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use metrics::PaintTimeMetrics; @@ -44,7 +44,7 @@ impl layout_traits::LayoutThreadFactory for LayoutThread { paint_time_metrics: PaintTimeMetrics, busy: Arc<AtomicBool>, load_webfonts_synchronously: bool, - initial_window_size: TypedSize2D<u32, DeviceIndependentPixel>, + initial_window_size: Size2D<u32, DeviceIndependentPixel>, device_pixels_per_px: Option<f32>, dump_display_list: bool, dump_display_list_json: bool, diff --git a/components/layout_traits/Cargo.toml b/components/layout_traits/Cargo.toml index 500f59e05e6..eeed0c26c8a 100644 --- a/components/layout_traits/Cargo.toml +++ b/components/layout_traits/Cargo.toml @@ -12,7 +12,7 @@ path = "lib.rs" [dependencies] crossbeam-channel = "0.3" -euclid = "0.19" +euclid = "0.20" gfx = {path = "../gfx"} ipc-channel = "0.11" metrics = {path = "../metrics"} diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index b0526a4b915..a37e8943125 100644 --- a/components/layout_traits/lib.rs +++ b/components/layout_traits/lib.rs @@ -10,7 +10,7 @@ // that these modules won't have to depend on layout. use crossbeam_channel::{Receiver, Sender}; -use euclid::TypedSize2D; +use euclid::Size2D; use gfx::font_cache_thread::FontCacheThread; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use metrics::PaintTimeMetrics; @@ -49,7 +49,7 @@ pub trait LayoutThreadFactory { paint_time_metrics: PaintTimeMetrics, busy: Arc<AtomicBool>, load_webfonts_synchronously: bool, - initial_window_size: TypedSize2D<u32, DeviceIndependentPixel>, + initial_window_size: Size2D<u32, DeviceIndependentPixel>, device_pixels_per_px: Option<f32>, dump_display_list: bool, dump_display_list_json: bool, diff --git a/components/media/Cargo.toml b/components/media/Cargo.toml index 254b4246f7e..58adf721bc1 100644 --- a/components/media/Cargo.toml +++ b/components/media/Cargo.toml @@ -11,7 +11,7 @@ name = "media" path = "lib.rs" [dependencies] -euclid = "0.19" +euclid = "0.20" fnv = "1.0" ipc-channel = "0.11" lazy_static = "1" diff --git a/components/media/lib.rs b/components/media/lib.rs index 7c339693da2..86f403faa2b 100644 --- a/components/media/lib.rs +++ b/components/media/lib.rs @@ -17,7 +17,7 @@ mod media_thread; pub use crate::media_channel::glplayer_channel; use crate::media_channel::{GLPlayerChan, GLPlayerPipeline, GLPlayerReceiver, GLPlayerSender}; use crate::media_thread::GLPlayerThread; -use euclid::Size2D; +use euclid::default::Size2D; use servo_media::player::context::{GlApi, GlContext, NativeDisplay, PlayerGLContext}; use std::sync::{Arc, Mutex}; use webrender_traits::{WebrenderExternalImageApi, WebrenderExternalImageRegistry}; diff --git a/components/pixels/Cargo.toml b/components/pixels/Cargo.toml index 0d5c9161b26..1b9f4d97002 100644 --- a/components/pixels/Cargo.toml +++ b/components/pixels/Cargo.toml @@ -11,7 +11,7 @@ name = "pixels" path = "lib.rs" [dependencies] -euclid = "0.19" +euclid = "0.20" malloc_size_of = {path = "../malloc_size_of"} malloc_size_of_derive = "0.1" serde = {version = "1", features = ["derive"]} diff --git a/components/pixels/lib.rs b/components/pixels/lib.rs index 155a53b4b4b..68b22abb11d 100644 --- a/components/pixels/lib.rs +++ b/components/pixels/lib.rs @@ -5,7 +5,7 @@ #[macro_use] extern crate serde; -use euclid::{Point2D, Rect, Size2D}; +use euclid::default::{Point2D, Rect, Size2D}; use malloc_size_of_derive::MallocSizeOf; use std::borrow::Cow; diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml index 902a4031947..cb03c00b873 100644 --- a/components/script/Cargo.toml +++ b/components/script/Cargo.toml @@ -50,7 +50,7 @@ domobject_derive = {path = "../domobject_derive"} embedder_traits = {path = "../embedder_traits"} encoding_rs = "0.8" enum-iterator = "0.2.0" -euclid = "0.19.7" +euclid = "0.20" fnv = "1.0" gleam = "0.6" headers = "0.2" diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs index 7f4fad813e5..bad7ebaa4bb 100644 --- a/components/script/dom/bindings/trace.rs +++ b/components/script/dom/bindings/trace.rs @@ -55,11 +55,8 @@ use crossbeam_channel::{Receiver, Sender}; use cssparser::RGBA; use devtools_traits::{CSSError, TimelineMarkerType, WorkerId}; use encoding_rs::{Decoder, Encoding}; +use euclid::default::{Point2D, Rect, Rotation3D, Transform2D, Transform3D}; use euclid::Length as EuclidLength; -use euclid::{ - Point2D, Rect, RigidTransform3D, Rotation3D, Transform2D, Transform3D, TypedRect, - TypedRigidTransform3D, TypedScale, TypedSize2D, Vector2D, -}; use html5ever::buffer_queue::BufferQueue; use html5ever::{LocalName, Namespace, Prefix, QualName}; use http::header::HeaderMap; @@ -510,8 +507,8 @@ unsafe_no_jsmanaged_fields!(ResourceFetchTiming); unsafe_no_jsmanaged_fields!(Timespec); unsafe_no_jsmanaged_fields!(HTMLMediaElementFetchContext); unsafe_no_jsmanaged_fields!(Rotation3D<f64>, Transform2D<f32>, Transform3D<f64>); -unsafe_no_jsmanaged_fields!(Point2D<f32>, Vector2D<f32>, Rect<Au>); -unsafe_no_jsmanaged_fields!(Rect<f32>, RigidTransform3D<f64>); +unsafe_no_jsmanaged_fields!(Point2D<f32>, Rect<Au>); +unsafe_no_jsmanaged_fields!(Rect<f32>); unsafe_no_jsmanaged_fields!(CascadeData); unsafe_no_jsmanaged_fields!(WindowGLContext); @@ -605,14 +602,28 @@ where } } -unsafe impl<T, U> JSTraceable for TypedScale<f32, T, U> { +unsafe impl<U> JSTraceable for euclid::Vector2D<f32, U> { + #[inline] + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl<T, U> JSTraceable for euclid::Scale<f32, T, U> { + #[inline] + unsafe fn trace(&self, _trc: *mut JSTracer) { + // Do nothing + } +} + +unsafe impl<T, U> JSTraceable for euclid::RigidTransform3D<f32, T, U> { #[inline] unsafe fn trace(&self, _trc: *mut JSTracer) { // Do nothing } } -unsafe impl<T, U> JSTraceable for TypedRigidTransform3D<f32, T, U> { +unsafe impl<T, U> JSTraceable for euclid::RigidTransform3D<f64, T, U> { #[inline] unsafe fn trace(&self, _trc: *mut JSTracer) { // Do nothing @@ -626,28 +637,28 @@ unsafe impl<T> JSTraceable for EuclidLength<u64, T> { } } -unsafe impl<U> JSTraceable for TypedSize2D<i32, U> { +unsafe impl<U> JSTraceable for euclid::Size2D<i32, U> { #[inline] unsafe fn trace(&self, _trc: *mut JSTracer) { // Do nothing } } -unsafe impl<U> JSTraceable for TypedSize2D<f32, U> { +unsafe impl<U> JSTraceable for euclid::Size2D<f32, U> { #[inline] unsafe fn trace(&self, _trc: *mut JSTracer) { // Do nothing } } -unsafe impl<U> JSTraceable for TypedSize2D<u32, U> { +unsafe impl<U> JSTraceable for euclid::Size2D<u32, U> { #[inline] unsafe fn trace(&self, _trc: *mut JSTracer) { // Do nothing } } -unsafe impl<U> JSTraceable for TypedRect<i32, U> { +unsafe impl<U> JSTraceable for euclid::Rect<i32, U> { #[inline] unsafe fn trace(&self, _trc: *mut JSTracer) { // Do nothing diff --git a/components/script/dom/canvaspattern.rs b/components/script/dom/canvaspattern.rs index a60a92988ac..bce7cd24c54 100644 --- a/components/script/dom/canvaspattern.rs +++ b/components/script/dom/canvaspattern.rs @@ -9,7 +9,7 @@ use crate::dom::canvasgradient::ToFillOrStrokeStyle; use crate::dom::globalscope::GlobalScope; use canvas_traits::canvas::{FillOrStrokeStyle, RepetitionStyle, SurfaceStyle}; use dom_struct::dom_struct; -use euclid::Size2D; +use euclid::default::Size2D; // https://html.spec.whatwg.org/multipage/#canvaspattern #[dom_struct] diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index 039ff1039f9..2a8f14295c0 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -32,7 +32,10 @@ use canvas_traits::canvas::{RadialGradientStyle, RepetitionStyle}; use cssparser::Color as CSSColor; use cssparser::{Parser, ParserInput, RGBA}; use dom_struct::dom_struct; -use euclid::{vec2, Point2D, Rect, Size2D, Transform2D}; +use euclid::{ + default::{Point2D, Rect, Size2D, Transform2D}, + vec2, +}; use ipc_channel::ipc::{self, IpcSender}; use net_traits::image_cache::CanRequestImages; use net_traits::image_cache::ImageCache; @@ -1223,7 +1226,7 @@ impl CanvasState { let (sin, cos) = (angle.sin(), angle.cos()); let transform = self.state.borrow().transform; - self.state.borrow_mut().transform = transform.pre_mul(&Transform2D::row_major( + self.state.borrow_mut().transform = transform.pre_transform(&Transform2D::row_major( cos as f32, sin as f32, -sin as f32, @@ -1258,7 +1261,7 @@ impl CanvasState { } let transform = self.state.borrow().transform; - self.state.borrow_mut().transform = transform.pre_mul(&Transform2D::row_major( + self.state.borrow_mut().transform = transform.pre_transform(&Transform2D::row_major( a as f32, b as f32, c as f32, d as f32, e as f32, f as f32, )); self.update_transform() diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 5b17c8ea004..d7e77ef9243 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -113,7 +113,7 @@ use devtools_traits::ScriptToDevtoolsControlMsg; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; use encoding_rs::{Encoding, UTF_8}; -use euclid::Point2D; +use euclid::default::Point2D; use html5ever::{LocalName, Namespace, QualName}; use hyper_serde::Serde; use ipc_channel::ipc::{self, IpcSender}; diff --git a/components/script/dom/documentorshadowroot.rs b/components/script/dom/documentorshadowroot.rs index 8a29d16d013..9b57dd32bf6 100644 --- a/components/script/dom/documentorshadowroot.rs +++ b/components/script/dom/documentorshadowroot.rs @@ -13,7 +13,7 @@ use crate::dom::htmlmetaelement::HTMLMetaElement; use crate::dom::node::{self, Node, VecPreOrderInsertionHelper}; use crate::dom::window::Window; use crate::stylesheet_set::StylesheetSetRef; -use euclid::Point2D; +use euclid::default::Point2D; use js::jsapi::JS_GetRuntime; use script_layout_interface::message::{NodesFromPointQueryType, QueryMsg}; use script_traits::UntrustedNodeAddress; diff --git a/components/script/dom/dommatrix.rs b/components/script/dom/dommatrix.rs index 03e152a2f2c..c9cc366e8ec 100644 --- a/components/script/dom/dommatrix.rs +++ b/components/script/dom/dommatrix.rs @@ -18,7 +18,7 @@ use crate::dom::dommatrixreadonly::{ use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; use dom_struct::dom_struct; -use euclid::Transform3D; +use euclid::default::Transform3D; use js::rust::CustomAutoRooterGuard; use js::typedarray::{Float32Array, Float64Array}; diff --git a/components/script/dom/dommatrixreadonly.rs b/components/script/dom/dommatrixreadonly.rs index 7e9b2e716f4..cde3dbc4031 100644 --- a/components/script/dom/dommatrixreadonly.rs +++ b/components/script/dom/dommatrixreadonly.rs @@ -20,7 +20,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; use cssparser::{Parser, ParserInput}; use dom_struct::dom_struct; -use euclid::{Angle, Transform3D}; +use euclid::{default::Transform3D, Angle}; use js::jsapi::{JSContext, JSObject}; use js::rust::CustomAutoRooterGuard; use js::typedarray::CreateWith; @@ -180,7 +180,7 @@ impl DOMMatrixReadOnly { dommatrixinit_to_matrix(&other).map(|(is2D, other_matrix)| { // Step 2. let mut matrix = self.matrix.borrow_mut(); - *matrix = other_matrix.post_mul(&matrix); + *matrix = other_matrix.post_transform(&matrix); // Step 3. if !is2D { self.is2D.set(false); @@ -195,7 +195,7 @@ impl DOMMatrixReadOnly { dommatrixinit_to_matrix(&other).map(|(is2D, other_matrix)| { // Step 2. let mut matrix = self.matrix.borrow_mut(); - *matrix = other_matrix.pre_mul(&matrix); + *matrix = other_matrix.pre_transform(&matrix); // Step 3. if !is2D { self.is2D.set(false); @@ -209,7 +209,7 @@ impl DOMMatrixReadOnly { // Step 1. let translation = Transform3D::create_translation(tx, ty, tz); let mut matrix = self.matrix.borrow_mut(); - *matrix = translation.post_mul(&matrix); + *matrix = translation.post_transform(&matrix); // Step 2. if tz != 0.0 { self.is2D.set(false); @@ -235,7 +235,7 @@ impl DOMMatrixReadOnly { { let scale3D = Transform3D::create_scale(scaleX, scaleY, scaleZ); let mut matrix = self.matrix.borrow_mut(); - *matrix = scale3D.post_mul(&matrix); + *matrix = scale3D.post_transform(&matrix); } // Step 4. originX = -originX; @@ -258,7 +258,7 @@ impl DOMMatrixReadOnly { { let scale3D = Transform3D::create_scale(scale, scale, scale); let mut matrix = self.matrix.borrow_mut(); - *matrix = scale3D.post_mul(&matrix); + *matrix = scale3D.post_transform(&matrix); } // Step 3. self.translate_self(-originX, -originY, -originZ); @@ -291,7 +291,7 @@ impl DOMMatrixReadOnly { let rotation = Transform3D::create_rotation(0.0, 0.0, -1.0, Angle::radians(rotZ.to_radians())); let mut matrix = self.matrix.borrow_mut(); - *matrix = rotation.post_mul(&matrix); + *matrix = rotation.post_transform(&matrix); } if rotY != 0.0 { // Step 6. @@ -299,7 +299,7 @@ impl DOMMatrixReadOnly { let rotation = Transform3D::create_rotation(0.0, -1.0, 0.0, Angle::radians(rotY.to_radians())); let mut matrix = self.matrix.borrow_mut(); - *matrix = rotation.post_mul(&matrix); + *matrix = rotation.post_transform(&matrix); } if rotX != 0.0 { // Step 7. @@ -307,7 +307,7 @@ impl DOMMatrixReadOnly { let rotation = Transform3D::create_rotation(-1.0, 0.0, 0.0, Angle::radians(rotX.to_radians())); let mut matrix = self.matrix.borrow_mut(); - *matrix = rotation.post_mul(&matrix); + *matrix = rotation.post_transform(&matrix); } // Step 8 in DOMMatrix.RotateSelf } @@ -321,7 +321,7 @@ impl DOMMatrixReadOnly { // Beware: pass negated value until https://github.com/servo/euclid/issues/354 let rotation = Transform3D::create_rotation(0.0, 0.0, -1.0, rotZ); let mut matrix = self.matrix.borrow_mut(); - *matrix = rotation.post_mul(&matrix); + *matrix = rotation.post_transform(&matrix); } // Step 2 in DOMMatrix.RotateFromVectorSelf } @@ -338,7 +338,7 @@ impl DOMMatrixReadOnly { Angle::radians(angle.to_radians()), ); let mut matrix = self.matrix.borrow_mut(); - *matrix = rotation.post_mul(&matrix); + *matrix = rotation.post_transform(&matrix); // Step 2. if x != 0.0 || y != 0.0 { self.is2D.set(false); @@ -351,7 +351,7 @@ impl DOMMatrixReadOnly { // Step 1. let skew = Transform3D::create_skew(Angle::radians(sx.to_radians()), Angle::radians(0.0)); let mut matrix = self.matrix.borrow_mut(); - *matrix = skew.post_mul(&matrix); + *matrix = skew.post_transform(&matrix); // Step 2 in DOMMatrix.SkewXSelf } @@ -360,7 +360,7 @@ impl DOMMatrixReadOnly { // Step 1. let skew = Transform3D::create_skew(Angle::radians(0.0), Angle::radians(sy.to_radians())); let mut matrix = self.matrix.borrow_mut(); - *matrix = skew.post_mul(&matrix); + *matrix = skew.post_transform(&matrix); // Step 2 in DOMMatrix.SkewYSelf } @@ -629,7 +629,7 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly { let flip = Transform3D::row_major( -1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, ); - let matrix = flip.post_mul(&self.matrix.borrow()); + let matrix = flip.post_transform(&self.matrix.borrow()); DOMMatrix::new(&self.global(), is2D, matrix) } @@ -639,7 +639,7 @@ impl DOMMatrixReadOnlyMethods for DOMMatrixReadOnly { let flip = Transform3D::row_major( 1.0, 0.0, 0.0, 0.0, 0.0, -1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, ); - let matrix = flip.post_mul(&self.matrix.borrow()); + let matrix = flip.post_transform(&self.matrix.borrow()); DOMMatrix::new(&self.global(), is2D, matrix) } diff --git a/components/script/dom/fakexrdevice.rs b/components/script/dom/fakexrdevice.rs index c5e1d16eaff..239eb415478 100644 --- a/components/script/dom/fakexrdevice.rs +++ b/components/script/dom/fakexrdevice.rs @@ -11,8 +11,8 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; -use euclid::{TypedPoint2D, TypedRect, TypedSize2D}; -use euclid::{TypedRigidTransform3D, TypedRotation3D, TypedTransform3D, TypedVector3D}; +use euclid::{Point2D, Rect, Size2D}; +use euclid::{RigidTransform3D, Rotation3D, Transform3D, Vector3D}; use ipc_channel::ipc::IpcSender; use webxr_api::{MockDeviceMsg, View, Views}; @@ -67,23 +67,23 @@ pub fn get_views(views: &[FakeXRViewInit]) -> Fallible<Views> { let mut proj_r = [0.; 16]; let v: Vec<_> = left.projectionMatrix.iter().map(|x| **x).collect(); proj_l.copy_from_slice(&v); - let proj_l = TypedTransform3D::from_array(proj_l); + let proj_l = Transform3D::from_array(proj_l); let v: Vec<_> = right.projectionMatrix.iter().map(|x| **x).collect(); proj_r.copy_from_slice(&v); - let proj_r = TypedTransform3D::from_array(proj_r); + let proj_r = Transform3D::from_array(proj_r); // spec defines offsets as origins, but mock API expects the inverse transform let offset_l = get_origin(&left.viewOffset)?.inverse(); let offset_r = get_origin(&right.viewOffset)?.inverse(); - let size_l = TypedSize2D::new(views[0].resolution.width, views[0].resolution.height); - let size_r = TypedSize2D::new(views[1].resolution.width, views[1].resolution.height); + let size_l = Size2D::new(views[0].resolution.width, views[0].resolution.height); + let size_r = Size2D::new(views[1].resolution.width, views[1].resolution.height); - let origin_l = TypedPoint2D::new(0, 0); - let origin_r = TypedPoint2D::new(size_l.width, 0); + let origin_l = Point2D::new(0, 0); + let origin_r = Point2D::new(size_l.width, 0); - let viewport_l = TypedRect::new(origin_l, size_l); - let viewport_r = TypedRect::new(origin_r, size_r); + let viewport_l = Rect::new(origin_l, size_l); + let viewport_r = Rect::new(origin_r, size_r); let left = View { projection: proj_l, @@ -100,23 +100,23 @@ pub fn get_views(views: &[FakeXRViewInit]) -> Fallible<Views> { pub fn get_origin<T, U>( origin: &FakeXRRigidTransformInit, -) -> Fallible<TypedRigidTransform3D<f32, T, U>> { +) -> Fallible<RigidTransform3D<f32, T, U>> { if origin.position.len() != 3 || origin.orientation.len() != 4 { return Err(Error::Type("Incorrectly sized array".into())); } - let p = TypedVector3D::new( + let p = Vector3D::new( *origin.position[0], *origin.position[1], *origin.position[2], ); - let o = TypedRotation3D::unit_quaternion( + let o = Rotation3D::unit_quaternion( *origin.orientation[0], *origin.orientation[1], *origin.orientation[2], *origin.orientation[3], ); - Ok(TypedRigidTransform3D::new(o, p)) + Ok(RigidTransform3D::new(o, p)) } impl FakeXRDeviceMethods for FakeXRDevice { diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs index 2cbd4ed1e37..65e47911c0d 100644 --- a/components/script/dom/htmlareaelement.rs +++ b/components/script/dom/htmlareaelement.rs @@ -18,7 +18,7 @@ use crate::dom::htmlelement::HTMLElement; use crate::dom::node::Node; use crate::dom::virtualmethods::VirtualMethods; use dom_struct::dom_struct; -use euclid::Point2D; +use euclid::default::Point2D; use html5ever::{LocalName, Prefix}; use std::default::Default; use std::f32; diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs index ecf3a36c28e..6376e9d9a64 100644 --- a/components/script/dom/htmlcanvaselement.rs +++ b/components/script/dom/htmlcanvaselement.rs @@ -32,7 +32,7 @@ use base64; use canvas_traits::canvas::{CanvasId, CanvasMsg, FromScriptMsg}; use canvas_traits::webgl::{GLContextAttributes, WebGLVersion}; use dom_struct::dom_struct; -use euclid::{Rect, Size2D}; +use euclid::default::{Rect, Size2D}; use html5ever::{LocalName, Prefix}; use image::png::PNGEncoder; use image::ColorType; diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs index 58ddd48c8c9..fbeaf14cdf4 100644 --- a/components/script/dom/htmliframeelement.rs +++ b/components/script/dom/htmliframeelement.rs @@ -28,7 +28,7 @@ use crate::dom::windowproxy::WindowProxy; use crate::script_thread::ScriptThread; use crate::task_source::TaskSource; use dom_struct::dom_struct; -use euclid::TypedSize2D; +use euclid::Size2D; use html5ever::{LocalName, Prefix}; use ipc_channel::ipc; use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; @@ -202,10 +202,7 @@ impl HTMLIFrameElement { window_size: WindowSizeData { initial_viewport: { let rect = self.upcast::<Node>().bounding_content_box_or_zero(); - TypedSize2D::new( - rect.size.width.to_f32_px(), - rect.size.height.to_f32_px(), - ) + Size2D::new(rect.size.width.to_f32_px(), rect.size.height.to_f32_px()) }, device_pixel_ratio: window.device_pixel_ratio(), }, diff --git a/components/script/dom/htmlmediaelement.rs b/components/script/dom/htmlmediaelement.rs index 8eaa9c2b552..ef363813a5d 100644 --- a/components/script/dom/htmlmediaelement.rs +++ b/components/script/dom/htmlmediaelement.rs @@ -65,7 +65,7 @@ use crate::script_thread::ScriptThread; use crate::task_source::TaskSource; use dom_struct::dom_struct; use embedder_traits::resources::{self, Resource as EmbedderResource}; -use euclid::Size2D; +use euclid::default::Size2D; use headers::{ContentLength, ContentRange, HeaderMapExt}; use html5ever::{LocalName, Prefix}; use http::header::{self, HeaderMap, HeaderValue}; diff --git a/components/script/dom/imagedata.rs b/components/script/dom/imagedata.rs index 29c15f665a4..460c827ab1a 100644 --- a/components/script/dom/imagedata.rs +++ b/components/script/dom/imagedata.rs @@ -9,7 +9,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; -use euclid::{Rect, Size2D}; +use euclid::default::{Rect, Size2D}; use ipc_channel::ipc::IpcSharedMemory; use js::jsapi::{Heap, JSContext, JSObject}; use js::rust::Runtime; diff --git a/components/script/dom/mouseevent.rs b/components/script/dom/mouseevent.rs index 7a54a20925b..6656eac90fe 100644 --- a/components/script/dom/mouseevent.rs +++ b/components/script/dom/mouseevent.rs @@ -15,7 +15,7 @@ use crate::dom::eventtarget::EventTarget; use crate::dom::uievent::UIEvent; use crate::dom::window::Window; use dom_struct::dom_struct; -use euclid::Point2D; +use euclid::default::Point2D; use servo_config::pref; use std::cell::Cell; use std::default::Default; diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs index 8165d0c4eef..75172c70717 100644 --- a/components/script/dom/node.rs +++ b/components/script/dom/node.rs @@ -64,7 +64,7 @@ use crate::script_thread::ScriptThread; use app_units::Au; use devtools_traits::NodeInfo; use dom_struct::dom_struct; -use euclid::{Point2D, Rect, Size2D, Vector2D}; +use euclid::default::{Point2D, Rect, Size2D, Vector2D}; use html5ever::{Namespace, Prefix, QualName}; use js::jsapi::{JSContext, JSObject, JSRuntime}; use libc::{self, c_void, uintptr_t}; @@ -778,7 +778,7 @@ impl Node { pub fn scroll_offset(&self) -> Vector2D<f32> { let document = self.owner_doc(); let window = document.window(); - window.scroll_offset_query(self) + window.scroll_offset_query(self).to_untyped() } // https://dom.spec.whatwg.org/#dom-childnode-before diff --git a/components/script/dom/offscreencanvas.rs b/components/script/dom/offscreencanvas.rs index 5086287dbb3..2087c47c91f 100644 --- a/components/script/dom/offscreencanvas.rs +++ b/components/script/dom/offscreencanvas.rs @@ -16,7 +16,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::htmlcanvaselement::HTMLCanvasElement; use crate::dom::offscreencanvasrenderingcontext2d::OffscreenCanvasRenderingContext2D; use dom_struct::dom_struct; -use euclid::Size2D; +use euclid::default::Size2D; use js::jsapi::JSContext; use js::rust::HandleValue; use ref_filter_map; diff --git a/components/script/dom/offscreencanvasrenderingcontext2d.rs b/components/script/dom/offscreencanvasrenderingcontext2d.rs index 502600a9145..461af3b882f 100644 --- a/components/script/dom/offscreencanvasrenderingcontext2d.rs +++ b/components/script/dom/offscreencanvasrenderingcontext2d.rs @@ -24,7 +24,7 @@ use crate::dom::htmlcanvaselement::HTMLCanvasElement; use crate::dom::imagedata::ImageData; use crate::dom::offscreencanvas::OffscreenCanvas; use dom_struct::dom_struct; -use euclid::Size2D; +use euclid::default::Size2D; #[dom_struct] pub struct OffscreenCanvasRenderingContext2D { diff --git a/components/script/dom/paintrenderingcontext2d.rs b/components/script/dom/paintrenderingcontext2d.rs index 9bf7cc38eb4..1bbb52d05fe 100644 --- a/components/script/dom/paintrenderingcontext2d.rs +++ b/components/script/dom/paintrenderingcontext2d.rs @@ -25,9 +25,7 @@ use canvas_traits::canvas::CanvasImageData; use canvas_traits::canvas::CanvasMsg; use canvas_traits::canvas::FromLayoutMsg; use dom_struct::dom_struct; -use euclid::Size2D; -use euclid::TypedScale; -use euclid::TypedSize2D; +use euclid::{Scale, Size2D}; use ipc_channel::ipc::IpcSender; use servo_url::ServoUrl; use std::cell::Cell; @@ -37,7 +35,7 @@ use style_traits::DevicePixel; #[dom_struct] pub struct PaintRenderingContext2D { context: CanvasRenderingContext2D, - device_pixel_ratio: Cell<TypedScale<f32, CSSPixel, DevicePixel>>, + device_pixel_ratio: Cell<Scale<f32, CSSPixel, DevicePixel>>, } impl PaintRenderingContext2D { @@ -45,7 +43,7 @@ impl PaintRenderingContext2D { let size = Size2D::zero(); PaintRenderingContext2D { context: CanvasRenderingContext2D::new_inherited(global.upcast(), None, size), - device_pixel_ratio: Cell::new(TypedScale::new(1.0)), + device_pixel_ratio: Cell::new(Scale::new(1.0)), } } @@ -71,8 +69,8 @@ impl PaintRenderingContext2D { pub fn set_bitmap_dimensions( &self, - size: TypedSize2D<f32, CSSPixel>, - device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>, + size: Size2D<f32, CSSPixel>, + device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>, ) { let size = size * device_pixel_ratio; self.device_pixel_ratio.set(device_pixel_ratio); diff --git a/components/script/dom/paintsize.rs b/components/script/dom/paintsize.rs index eb460c5f12d..7f7fa61346b 100644 --- a/components/script/dom/paintsize.rs +++ b/components/script/dom/paintsize.rs @@ -10,7 +10,7 @@ use crate::dom::bindings::reflector::Reflector; use crate::dom::bindings::root::DomRoot; use crate::dom::paintworkletglobalscope::PaintWorkletGlobalScope; use dom_struct::dom_struct; -use euclid::TypedSize2D; +use euclid::Size2D; use style_traits::CSSPixel; #[dom_struct] @@ -21,7 +21,7 @@ pub struct PaintSize { } impl PaintSize { - fn new_inherited(size: TypedSize2D<f32, CSSPixel>) -> PaintSize { + fn new_inherited(size: Size2D<f32, CSSPixel>) -> PaintSize { PaintSize { reflector: Reflector::new(), width: Finite::wrap(size.width as f64), @@ -31,7 +31,7 @@ impl PaintSize { pub fn new( global: &PaintWorkletGlobalScope, - size: TypedSize2D<f32, CSSPixel>, + size: Size2D<f32, CSSPixel>, ) -> DomRoot<PaintSize> { reflect_dom_object( Box::new(PaintSize::new_inherited(size)), diff --git a/components/script/dom/paintworkletglobalscope.rs b/components/script/dom/paintworkletglobalscope.rs index 7791456294d..2cd6ae19846 100644 --- a/components/script/dom/paintworkletglobalscope.rs +++ b/components/script/dom/paintworkletglobalscope.rs @@ -25,8 +25,8 @@ use crate::dom::workletglobalscope::WorkletGlobalScopeInit; use crate::dom::workletglobalscope::WorkletTask; use crossbeam_channel::{unbounded, Sender}; use dom_struct::dom_struct; -use euclid::TypedScale; -use euclid::TypedSize2D; +use euclid::Scale; +use euclid::Size2D; use js::jsapi::HandleValueArray; use js::jsapi::Heap; use js::jsapi::IsCallable; @@ -81,9 +81,9 @@ pub struct PaintWorkletGlobalScope { /// The most recent name the worklet was called with cached_name: DomRefCell<Atom>, /// The most recent size the worklet was drawn at - cached_size: Cell<TypedSize2D<f32, CSSPixel>>, + cached_size: Cell<Size2D<f32, CSSPixel>>, /// The most recent device pixel ratio the worklet was drawn at - cached_device_pixel_ratio: Cell<TypedScale<f32, CSSPixel, DevicePixel>>, + cached_device_pixel_ratio: Cell<Scale<f32, CSSPixel, DevicePixel>>, /// The most recent properties the worklet was drawn at cached_properties: DomRefCell<Vec<(Atom, String)>>, /// The most recent arguments the worklet was drawn at @@ -116,8 +116,8 @@ impl PaintWorkletGlobalScope { paint_definitions: Default::default(), paint_class_instances: Default::default(), cached_name: DomRefCell::new(Atom::from("")), - cached_size: Cell::new(TypedSize2D::zero()), - cached_device_pixel_ratio: Cell::new(TypedScale::new(1.0)), + cached_size: Cell::new(Size2D::zero()), + cached_device_pixel_ratio: Cell::new(Scale::new(1.0)), cached_properties: Default::default(), cached_arguments: Default::default(), cached_result: DomRefCell::new(DrawAPaintImageResult { @@ -211,13 +211,13 @@ impl PaintWorkletGlobalScope { fn draw_a_paint_image( &self, name: &Atom, - size_in_px: TypedSize2D<f32, CSSPixel>, - device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>, + size_in_px: Size2D<f32, CSSPixel>, + device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>, properties: &StylePropertyMapReadOnly, arguments: &[String], ) -> DrawAPaintImageResult { let size_in_dpx = size_in_px * device_pixel_ratio; - let size_in_dpx = TypedSize2D::new( + let size_in_dpx = Size2D::new( size_in_dpx.width.abs() as u32, size_in_dpx.height.abs() as u32, ); @@ -240,9 +240,9 @@ impl PaintWorkletGlobalScope { fn invoke_a_paint_callback( &self, name: &Atom, - size_in_px: TypedSize2D<f32, CSSPixel>, - size_in_dpx: TypedSize2D<u32, DevicePixel>, - device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>, + size_in_px: Size2D<f32, CSSPixel>, + size_in_dpx: Size2D<u32, DevicePixel>, + device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>, properties: &StylePropertyMapReadOnly, arguments: &[String], ) -> DrawAPaintImageResult { @@ -383,7 +383,7 @@ impl PaintWorkletGlobalScope { // https://drafts.csswg.org/css-images-4/#invalid-image fn invalid_image( &self, - size: TypedSize2D<u32, DevicePixel>, + size: Size2D<u32, DevicePixel>, missing_image_urls: Vec<ServoUrl>, ) -> DrawAPaintImageResult { debug!("Returning an invalid image."); @@ -420,8 +420,8 @@ impl PaintWorkletGlobalScope { impl Painter for WorkletPainter { fn draw_a_paint_image( &self, - size: TypedSize2D<f32, CSSPixel>, - device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>, + size: Size2D<f32, CSSPixel>, + device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>, properties: Vec<(Atom, String)>, arguments: Vec<String>, ) -> Result<DrawAPaintImageResult, PaintWorkletError> { @@ -458,8 +458,8 @@ impl PaintWorkletGlobalScope { pub enum PaintWorkletTask { DrawAPaintImage( Atom, - TypedSize2D<f32, CSSPixel>, - TypedScale<f32, CSSPixel, DevicePixel>, + Size2D<f32, CSSPixel>, + Scale<f32, CSSPixel, DevicePixel>, Vec<(Atom, String)>, Vec<String>, Sender<DrawAPaintImageResult>, diff --git a/components/script/dom/screen.rs b/components/script/dom/screen.rs index ff90224d53a..cf5d6785405 100644 --- a/components/script/dom/screen.rs +++ b/components/script/dom/screen.rs @@ -12,7 +12,7 @@ use crate::dom::bindings::root::{Dom, DomRoot}; use crate::dom::globalscope::GlobalScope; use crate::dom::window::Window; use dom_struct::dom_struct; -use euclid::TypedSize2D; +use euclid::Size2D; use profile_traits::ipc; use script_traits::ScriptMsg; use style_traits::CSSPixel; @@ -40,7 +40,7 @@ impl Screen { ) } - fn screen_size(&self) -> TypedSize2D<u32, CSSPixel> { + fn screen_size(&self) -> Size2D<u32, CSSPixel> { let (send, recv) = ipc::channel::<DeviceIntSize>(self.global().time_profiler_chan().clone()).unwrap(); self.window @@ -49,11 +49,11 @@ impl Screen { .send(ScriptMsg::GetScreenSize(send)) .unwrap(); let dpr = self.window.device_pixel_ratio(); - let screen = recv.recv().unwrap_or(TypedSize2D::zero()); + let screen = recv.recv().unwrap_or(Size2D::zero()); (screen.to_f32() / dpr).to_u32() } - fn screen_avail_size(&self) -> TypedSize2D<u32, CSSPixel> { + fn screen_avail_size(&self) -> Size2D<u32, CSSPixel> { let (send, recv) = ipc::channel::<DeviceIntSize>(self.global().time_profiler_chan().clone()).unwrap(); self.window @@ -62,7 +62,7 @@ impl Screen { .send(ScriptMsg::GetScreenAvailSize(send)) .unwrap(); let dpr = self.window.device_pixel_ratio(); - let screen = recv.recv().unwrap_or(TypedSize2D::zero()); + let screen = recv.recv().unwrap_or(Size2D::zero()); (screen.to_f32() / dpr).to_u32() } } diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs index 98056104848..3b068caafca 100644 --- a/components/script/dom/webgl2renderingcontext.rs +++ b/components/script/dom/webgl2renderingcontext.rs @@ -32,7 +32,7 @@ use crate::dom::window::Window; /// https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl.idl use canvas_traits::webgl::{GLContextAttributes, WebGLVersion}; use dom_struct::dom_struct; -use euclid::Size2D; +use euclid::default::Size2D; use js::jsapi::{JSContext, JSObject}; use js::jsval::JSVal; use js::rust::CustomAutoRooterGuard; diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 6e249a38ed0..21927e6bf44 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -59,7 +59,7 @@ use canvas_traits::webgl::{ YAxisTreatment, }; use dom_struct::dom_struct; -use euclid::{Point2D, Rect, Size2D}; +use euclid::default::{Point2D, Rect, Size2D}; use ipc_channel::ipc::{self, IpcSharedMemory}; use js::jsapi::{JSContext, JSObject, Type}; use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, UInt32Value}; diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs index 31d66963327..4d1ea5e80d4 100644 --- a/components/script/dom/window.rs +++ b/components/script/dom/window.rs @@ -74,7 +74,8 @@ use cssparser::{Parser, ParserInput, SourceLocation}; use devtools_traits::{ScriptToDevtoolsControlMsg, TimelineMarker, TimelineMarkerType}; use dom_struct::dom_struct; use embedder_traits::EmbedderMsg; -use euclid::{Point2D, Rect, Size2D, TypedPoint2D, TypedScale, TypedSize2D, Vector2D}; +use euclid::default::{Point2D as UntypedPoint2D, Rect as UntypedRect}; +use euclid::{Point2D, Rect, Scale, Size2D, Vector2D}; use ipc_channel::ipc::{channel, IpcSender}; use ipc_channel::router::ROUTER; use js::jsapi::JSAutoRealm; @@ -131,7 +132,7 @@ use style::str::HTML_SPACE_CHARACTERS; use style::stylesheets::CssRuleType; use style_traits::{CSSPixel, DevicePixel, ParsingMode}; use url::Position; -use webrender_api::units::{DeviceIntPoint, DeviceIntSize}; +use webrender_api::units::{DeviceIntPoint, DeviceIntSize, LayoutPixel}; use webrender_api::{DocumentId, ExternalScrollId, RenderApiSender}; use webvr_traits::WebVRMsg; @@ -229,7 +230,7 @@ pub struct Window { /// An enlarged rectangle around the page contents visible in the viewport, used /// to prevent creating display list items for content that is far away from the viewport. - page_clip_rect: Cell<Rect<Au>>, + page_clip_rect: Cell<UntypedRect<Au>>, /// Flag to suppress reflows. The first reflow will come either with /// RefreshTick or with FirstLoad. Until those first reflows, we want to @@ -246,12 +247,12 @@ pub struct Window { /// The current state of the window object current_state: Cell<WindowState>, - current_viewport: Cell<Rect<Au>>, + current_viewport: Cell<UntypedRect<Au>>, error_reporter: CSSErrorReporter, /// A list of scroll offsets for each scrollable element. - scroll_offsets: DomRefCell<HashMap<OpaqueNode, Vector2D<f32>>>, + scroll_offsets: DomRefCell<HashMap<OpaqueNode, Vector2D<f32, LayoutPixel>>>, /// All the MediaQueryLists we need to update media_query_lists: DOMTracker<MediaQueryList>, @@ -423,11 +424,11 @@ impl Window { /// Sets a new list of scroll offsets. /// /// This is called when layout gives us new ones and WebRender is in use. - pub fn set_scroll_offsets(&self, offsets: HashMap<OpaqueNode, Vector2D<f32>>) { + pub fn set_scroll_offsets(&self, offsets: HashMap<OpaqueNode, Vector2D<f32, LayoutPixel>>) { *self.scroll_offsets.borrow_mut() = offsets } - pub fn current_viewport(&self) -> Rect<Au> { + pub fn current_viewport(&self) -> UntypedRect<Au> { self.current_viewport.clone().get() } @@ -1093,7 +1094,7 @@ impl WindowMethods for Window { // Step 1 //TODO determine if this operation is allowed let dpr = self.device_pixel_ratio(); - let size = TypedSize2D::new(width, height).to_f32() * dpr; + let size = Size2D::new(width, height).to_f32() * dpr; self.send_to_embedder(EmbedderMsg::ResizeTo(size.to_i32())); } @@ -1112,7 +1113,7 @@ impl WindowMethods for Window { // Step 1 //TODO determine if this operation is allowed let dpr = self.device_pixel_ratio(); - let point = TypedPoint2D::new(x, y).to_f32() * dpr; + let point = Point2D::new(x, y).to_f32() * dpr; let msg = EmbedderMsg::MoveTo(point.to_i32()); self.send_to_embedder(msg); } @@ -1377,18 +1378,16 @@ impl Window { self.current_viewport.set(new_viewport) } - pub fn device_pixel_ratio(&self) -> TypedScale<f32, CSSPixel, DevicePixel> { + pub fn device_pixel_ratio(&self) -> Scale<f32, CSSPixel, DevicePixel> { self.window_size.get().device_pixel_ratio } - fn client_window(&self) -> (TypedSize2D<u32, CSSPixel>, TypedPoint2D<i32, CSSPixel>) { + fn client_window(&self) -> (Size2D<u32, CSSPixel>, Point2D<i32, CSSPixel>) { let timer_profile_chan = self.global().time_profiler_chan().clone(); let (send, recv) = ProfiledIpc::channel::<(DeviceIntSize, DeviceIntPoint)>(timer_profile_chan).unwrap(); self.send_to_constellation(ScriptMsg::GetClientWindow(send)); - let (size, point) = recv - .recv() - .unwrap_or((TypedSize2D::zero(), TypedPoint2D::zero())); + let (size, point) = recv.recv().unwrap_or((Size2D::zero(), Point2D::zero())); let dpr = self.device_pixel_ratio(); ( (size.to_f32() / dpr).to_u32(), @@ -1626,7 +1625,7 @@ impl Window { &*self.layout_rpc } - pub fn content_box_query(&self, node: &Node) -> Option<Rect<Au>> { + pub fn content_box_query(&self, node: &Node) -> Option<UntypedRect<Au>> { if !self.layout_reflow(QueryMsg::ContentBoxQuery(node.to_opaque())) { return None; } @@ -1634,7 +1633,7 @@ impl Window { rect } - pub fn content_boxes_query(&self, node: &Node) -> Vec<Rect<Au>> { + pub fn content_boxes_query(&self, node: &Node) -> Vec<UntypedRect<Au>> { if !self.layout_reflow(QueryMsg::ContentBoxesQuery(node.to_opaque())) { return vec![]; } @@ -1642,21 +1641,21 @@ impl Window { rects } - pub fn client_rect_query(&self, node: &Node) -> Rect<i32> { + pub fn client_rect_query(&self, node: &Node) -> UntypedRect<i32> { if !self.layout_reflow(QueryMsg::NodeGeometryQuery(node.to_opaque())) { return Rect::zero(); } self.layout_rpc.node_geometry().client_rect } - pub fn scroll_area_query(&self, node: &Node) -> Rect<i32> { + pub fn scroll_area_query(&self, node: &Node) -> UntypedRect<i32> { if !self.layout_reflow(QueryMsg::NodeScrollGeometryQuery(node.to_opaque())) { return Rect::zero(); } self.layout_rpc.node_scroll_area().client_rect } - pub fn scroll_offset_query(&self, node: &Node) -> Vector2D<f32> { + pub fn scroll_offset_query(&self, node: &Node) -> Vector2D<f32, LayoutPixel> { if let Some(scroll_offset) = self.scroll_offsets.borrow().get(&node.to_opaque()) { return *scroll_offset; } @@ -1702,7 +1701,7 @@ impl Window { } #[allow(unsafe_code)] - pub fn offset_parent_query(&self, node: &Node) -> (Option<DomRoot<Element>>, Rect<Au>) { + pub fn offset_parent_query(&self, node: &Node) -> (Option<DomRoot<Element>>, UntypedRect<Au>) { if !self.layout_reflow(QueryMsg::OffsetParentQuery(node.to_opaque())) { return (None, Rect::zero()); } @@ -1726,7 +1725,11 @@ impl Window { self.layout_rpc.style().0 } - pub fn text_index_query(&self, node: &Node, point_in_node: Point2D<f32>) -> TextIndexResponse { + pub fn text_index_query( + &self, + node: &Node, + point_in_node: UntypedPoint2D<f32>, + ) -> TextIndexResponse { if !self.layout_reflow(QueryMsg::TextIndexQuery(node.to_opaque(), point_in_node)) { return TextIndexResponse(None); } @@ -1891,7 +1894,7 @@ impl Window { event } - pub fn set_page_clip_rect_with_new_viewport(&self, viewport: Rect<f32>) -> bool { + pub fn set_page_clip_rect_with_new_viewport(&self, viewport: UntypedRect<f32>) -> bool { let rect = f32_rect_to_au_rect(viewport.clone()); self.current_viewport.set(rect); // We use a clipping rectangle that is five times the size of the of the viewport, @@ -2184,8 +2187,8 @@ impl Window { } } -fn should_move_clip_rect(clip_rect: Rect<Au>, new_viewport: Rect<f32>) -> bool { - let clip_rect = Rect::new( +fn should_move_clip_rect(clip_rect: UntypedRect<Au>, new_viewport: UntypedRect<f32>) -> bool { + let clip_rect = UntypedRect::new( Point2D::new( clip_rect.origin.x.to_f32_px(), clip_rect.origin.y.to_f32_px(), diff --git a/components/script/dom/xrframe.rs b/components/script/dom/xrframe.rs index 8c3bf737ec1..29572c02300 100644 --- a/components/script/dom/xrframe.rs +++ b/components/script/dom/xrframe.rs @@ -95,7 +95,7 @@ impl XRFrameMethods for XRFrame { } let space = space.get_pose(&self.data); let relative_to = relative_to.get_pose(&self.data); - let pose = relative_to.inverse().pre_mul(&space); + let pose = relative_to.inverse().pre_transform(&space); Ok(Some(XRPose::new(&self.global(), pose))) } } diff --git a/components/script/dom/xrreferencespace.rs b/components/script/dom/xrreferencespace.rs index f07ea8e7658..829fdfc02fa 100644 --- a/components/script/dom/xrreferencespace.rs +++ b/components/script/dom/xrreferencespace.rs @@ -13,7 +13,7 @@ use crate::dom::xrrigidtransform::XRRigidTransform; use crate::dom::xrsession::{cast_transform, ApiPose, ApiRigidTransform, ApiViewerPose, XRSession}; use crate::dom::xrspace::XRSpace; use dom_struct::dom_struct; -use euclid::{TypedRigidTransform3D, TypedVector3D}; +use euclid::{RigidTransform3D, Vector3D}; use webxr_api::Frame; #[dom_struct] @@ -64,7 +64,7 @@ impl XRReferenceSpace { impl XRReferenceSpaceMethods for XRReferenceSpace { /// https://immersive-web.github.io/webxr/#dom-xrreferencespace-getoffsetreferencespace fn GetOffsetReferenceSpace(&self, new: &XRRigidTransform) -> DomRoot<Self> { - let offset = new.transform().pre_mul(&self.offset.transform()); + let offset = new.transform().pre_transform(&self.offset.transform()); let offset = XRRigidTransform::new(&self.global(), offset); Self::new_offset( &self.global(), @@ -92,7 +92,7 @@ impl XRReferenceSpace { // = offset.inverse() * get_unoffset_viewer_pose(space) let offset = self.offset.transform(); let inverse = offset.inverse(); - inverse.pre_mul(&pose) + inverse.pre_transform(&pose) } /// Gets pose of the viewer with respect to this space @@ -120,13 +120,13 @@ impl XRReferenceSpace { // = Translate(2) * viewer_pose // assume approximate user height of 2 meters - let floor_to_eye: ApiRigidTransform = TypedVector3D::new(0., 2., 0.).into(); - floor_to_eye.pre_mul(&viewer_pose) + let floor_to_eye: ApiRigidTransform = Vector3D::new(0., 2., 0.).into(); + floor_to_eye.pre_transform(&viewer_pose) }, XRReferenceSpaceType::Viewer => { // This reference space follows the viewer around, so the viewer is // always at an identity transform with respect to it - TypedRigidTransform3D::identity() + RigidTransform3D::identity() }, _ => unimplemented!(), } @@ -142,7 +142,7 @@ impl XRReferenceSpace { // This may change, see https://github.com/immersive-web/webxr/issues/567 let offset = self.offset.transform(); - offset.post_mul(&pose) + offset.post_transform(&pose) } /// Gets pose represented by this space @@ -153,14 +153,14 @@ impl XRReferenceSpace { XRReferenceSpaceType::Local => { // The eye-level pose is basically whatever the headset pose was at t=0, which // for most devices is (0, 0, 0) - TypedRigidTransform3D::identity() + RigidTransform3D::identity() }, XRReferenceSpaceType::Local_floor => { // XXXManishearth support getting floor info from stage parameters // Assume approximate height of 2m // the floor-level space is 2m below the eye-level space, which is (0, 0, 0) - TypedVector3D::new(0., -2., 0.).into() + Vector3D::new(0., -2., 0.).into() }, XRReferenceSpaceType::Viewer => cast_transform(base_pose.transform), _ => unimplemented!(), diff --git a/components/script/dom/xrrigidtransform.rs b/components/script/dom/xrrigidtransform.rs index ca73121d931..887b54f688c 100644 --- a/components/script/dom/xrrigidtransform.rs +++ b/components/script/dom/xrrigidtransform.rs @@ -16,7 +16,7 @@ use crate::dom::vrframedata::create_typed_array; use crate::dom::window::Window; use crate::dom::xrsession::ApiRigidTransform; use dom_struct::dom_struct; -use euclid::{TypedRigidTransform3D, TypedRotation3D, TypedVector3D}; +use euclid::{RigidTransform3D, Rotation3D, Vector3D}; use js::jsapi::{Heap, JSContext, JSObject}; use std::ptr::NonNull; @@ -53,7 +53,7 @@ impl XRRigidTransform { } pub fn identity(window: &GlobalScope) -> DomRoot<XRRigidTransform> { - let transform = TypedRigidTransform3D::identity(); + let transform = RigidTransform3D::identity(); XRRigidTransform::new(window, transform) } @@ -70,8 +70,8 @@ impl XRRigidTransform { ))); } - let translate = TypedVector3D::new(position.x as f32, position.y as f32, position.z as f32); - let rotate = TypedRotation3D::unit_quaternion( + let translate = Vector3D::new(position.x as f32, position.y as f32, position.z as f32); + let rotate = Rotation3D::unit_quaternion( orientation.x as f32, orientation.y as f32, orientation.z as f32, @@ -83,7 +83,7 @@ impl XRRigidTransform { // value for each element. This is preferable to checking for zero. return Err(Error::InvalidState); } - let transform = TypedRigidTransform3D::new(rotate, translate); + let transform = RigidTransform3D::new(rotate, translate); Ok(XRRigidTransform::new(&window.global(), transform)) } } diff --git a/components/script/dom/xrsession.rs b/components/script/dom/xrsession.rs index 0ea8a0e0e46..9542486f3ae 100644 --- a/components/script/dom/xrsession.rs +++ b/components/script/dom/xrsession.rs @@ -38,7 +38,7 @@ use crate::dom::xrspace::XRSpace; use crate::dom::xrwebgllayer::XRWebGLLayer; use crate::task_source::TaskSource; use dom_struct::dom_struct; -use euclid::TypedRigidTransform3D; +use euclid::RigidTransform3D; use ipc_channel::ipc::IpcSender; use ipc_channel::router::ROUTER; use profile_traits::ipc; @@ -403,15 +403,15 @@ impl XRSessionMethods for XRSession { #[derive(Clone, Copy, Debug)] pub struct ApiSpace; // The pose of an object in native-space. Should never be exposed. -pub type ApiPose = TypedRigidTransform3D<f32, ApiSpace, webxr_api::Native>; +pub type ApiPose = RigidTransform3D<f32, ApiSpace, webxr_api::Native>; // The pose of the viewer in some api-space. -pub type ApiViewerPose = TypedRigidTransform3D<f32, webxr_api::Viewer, ApiSpace>; +pub type ApiViewerPose = RigidTransform3D<f32, webxr_api::Viewer, ApiSpace>; // A transform between objects in some API-space -pub type ApiRigidTransform = TypedRigidTransform3D<f32, ApiSpace, ApiSpace>; +pub type ApiRigidTransform = RigidTransform3D<f32, ApiSpace, ApiSpace>; #[allow(unsafe_code)] pub fn cast_transform<T, U, V, W>( - transform: TypedRigidTransform3D<f32, T, U>, -) -> TypedRigidTransform3D<f32, V, W> { + transform: RigidTransform3D<f32, T, U>, +) -> RigidTransform3D<f32, V, W> { unsafe { mem::transmute(transform) } } diff --git a/components/script/dom/xrtest.rs b/components/script/dom/xrtest.rs index 81949addf02..c8f45b75b4f 100644 --- a/components/script/dom/xrtest.rs +++ b/components/script/dom/xrtest.rs @@ -20,7 +20,7 @@ use crate::dom::globalscope::GlobalScope; use crate::dom::promise::Promise; use crate::task_source::TaskSource; use dom_struct::dom_struct; -use euclid::TypedRigidTransform3D; +use euclid::RigidTransform3D; use ipc_channel::ipc::IpcSender; use ipc_channel::router::ROUTER; use profile_traits::ipc; @@ -103,7 +103,7 @@ impl XRTestMethods for XRTest { }, } } else { - TypedRigidTransform3D::identity() + RigidTransform3D::identity() }; let floor_origin = if let Some(ref o) = init.floorOrigin { @@ -115,7 +115,7 @@ impl XRTestMethods for XRTest { }, } } else { - TypedRigidTransform3D::identity() + RigidTransform3D::identity() }; let views = match get_views(&init.views) { diff --git a/components/script/dom/xrview.rs b/components/script/dom/xrview.rs index 5ff8d397bd6..807217945a6 100644 --- a/components/script/dom/xrview.rs +++ b/components/script/dom/xrview.rs @@ -53,7 +53,7 @@ impl XRView { // from the viewer space to the eye space. We invert it to get the pose of the eye in the viewer space. let offset = view.transform.inverse(); - let transform = pose.pre_mul(&offset); + let transform = pose.pre_transform(&offset); let transform = XRRigidTransform::new(global, cast_transform(transform)); let ret = reflect_dom_object( diff --git a/components/script/dom/xrviewport.rs b/components/script/dom/xrviewport.rs index f0b013a317e..80b8c27fbaa 100644 --- a/components/script/dom/xrviewport.rs +++ b/components/script/dom/xrviewport.rs @@ -8,24 +8,24 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector}; use crate::dom::bindings::root::DomRoot; use crate::dom::globalscope::GlobalScope; use dom_struct::dom_struct; -use euclid::TypedRect; +use euclid::Rect; use webxr_api::Viewport; #[dom_struct] pub struct XRViewport { reflector_: Reflector, - viewport: TypedRect<i32, Viewport>, + viewport: Rect<i32, Viewport>, } impl XRViewport { - fn new_inherited(viewport: TypedRect<i32, Viewport>) -> XRViewport { + fn new_inherited(viewport: Rect<i32, Viewport>) -> XRViewport { XRViewport { reflector_: Reflector::new(), viewport, } } - pub fn new(global: &GlobalScope, viewport: TypedRect<i32, Viewport>) -> DomRoot<XRViewport> { + pub fn new(global: &GlobalScope, viewport: Rect<i32, Viewport>) -> DomRoot<XRViewport> { reflect_dom_object( Box::new(XRViewport::new_inherited(viewport)), global, diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 07626cc80bd..8193c9b7ace 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -94,7 +94,8 @@ use devtools_traits::CSSError; use devtools_traits::{DevtoolScriptControlMsg, DevtoolsPageInfo}; use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use embedder_traits::EmbedderMsg; -use euclid::{Point2D, Rect, Vector2D}; +use euclid::default::{Point2D, Rect}; +use euclid::Vector2D; use headers::ReferrerPolicy as ReferrerPolicyHeader; use headers::{HeaderMapExt, LastModified}; use hyper_serde::Serde; @@ -161,6 +162,7 @@ use style::thread_state::{self, ThreadState}; use time::{at_utc, get_time, precise_time_ns, Timespec}; use url::percent_encoding::percent_decode; use url::Position; +use webrender_api::units::LayoutPixel; use webrender_api::{DocumentId, RenderApiSender}; use webvr_traits::{WebVREvent, WebVRMsg}; @@ -2230,7 +2232,7 @@ impl ScriptThread { fn handle_set_scroll_state( &self, id: PipelineId, - scroll_states: &[(UntrustedNodeAddress, Vector2D<f32>)], + scroll_states: &[(UntrustedNodeAddress, Vector2D<f32, LayoutPixel>)], ) { let window = match { self.documents.borrow().find_window(id) } { Some(window) => window, diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs index 03b61875b3b..3871b7a6ef5 100644 --- a/components/script/webdriver_handlers.rs +++ b/components/script/webdriver_handlers.rs @@ -29,7 +29,7 @@ use crate::dom::window::Window; use crate::dom::xmlserializer::XMLSerializer; use crate::script_thread::Documents; use cookie::Cookie; -use euclid::{Point2D, Rect, Size2D}; +use euclid::default::{Point2D, Rect, Size2D}; use hyper_serde::Serde; use ipc_channel::ipc::{self, IpcSender}; use js::jsapi::JSContext; diff --git a/components/script_layout_interface/Cargo.toml b/components/script_layout_interface/Cargo.toml index 91ef929ec28..88eaddfa6c5 100644 --- a/components/script_layout_interface/Cargo.toml +++ b/components/script_layout_interface/Cargo.toml @@ -16,7 +16,7 @@ atomic_refcell = "0.1" canvas_traits = {path = "../canvas_traits"} cssparser = "0.25" crossbeam-channel = "0.3" -euclid = "0.19" +euclid = "0.20" gfx_traits = {path = "../gfx_traits"} html5ever = "0.23" ipc-channel = "0.11" diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs index 2c2c2229ba0..c6d9710541f 100644 --- a/components/script_layout_interface/message.rs +++ b/components/script_layout_interface/message.rs @@ -6,7 +6,7 @@ use crate::rpc::LayoutRPC; use crate::{OpaqueStyleAndLayoutData, PendingImage, TrustedNodeAddress}; use app_units::Au; use crossbeam_channel::{Receiver, Sender}; -use euclid::{Point2D, Rect}; +use euclid::default::{Point2D, Rect}; use gfx_traits::Epoch; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use metrics::PaintTimeMetrics; diff --git a/components/script_layout_interface/rpc.rs b/components/script_layout_interface/rpc.rs index f77b7e63836..95d25082ed8 100644 --- a/components/script_layout_interface/rpc.rs +++ b/components/script_layout_interface/rpc.rs @@ -3,7 +3,7 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use app_units::Au; -use euclid::Rect; +use euclid::default::Rect; use script_traits::UntrustedNodeAddress; use servo_arc::Arc; use style::properties::ComputedValues; diff --git a/components/script_traits/Cargo.toml b/components/script_traits/Cargo.toml index 5cc35639ae0..61e1dda7410 100644 --- a/components/script_traits/Cargo.toml +++ b/components/script_traits/Cargo.toml @@ -17,7 +17,7 @@ cookie = "0.11" crossbeam-channel = "0.3" devtools_traits = {path = "../devtools_traits"} embedder_traits = {path = "../embedder_traits"} -euclid = "0.19" +euclid = "0.20" gfx_traits = {path = "../gfx_traits"} http = "0.1" hyper = "0.12" diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 518bea585e6..19c8a41e8c5 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -25,7 +25,10 @@ use canvas_traits::webgl::WebGLPipeline; use crossbeam_channel::{Receiver, RecvTimeoutError, Sender}; use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId}; use embedder_traits::Cursor; -use euclid::{Length, Point2D, Rect, TypedScale, TypedSize2D, Vector2D}; +use euclid::{ + default::{Point2D, Rect}, + Length, Scale, Size2D, Vector2D, +}; use gfx_traits::Epoch; use http::HeaderMap; use hyper::Method; @@ -58,7 +61,7 @@ use std::sync::Arc; use std::time::Duration; use style_traits::CSSPixel; use style_traits::SpeculativePainter; -use webrender_api::units::{DeviceIntSize, DevicePixel}; +use webrender_api::units::{DeviceIntSize, DevicePixel, LayoutPixel}; use webrender_api::{DocumentId, ExternalScrollId, ImageKey, RenderApiSender}; use webvr_traits::{WebVREvent, WebVRMsg}; @@ -295,7 +298,10 @@ pub enum ConstellationControlMsg { /// Notifies script of the viewport. Viewport(PipelineId, Rect<f32>), /// Notifies script of a new set of scroll offsets. - SetScrollState(PipelineId, Vec<(UntrustedNodeAddress, Vector2D<f32>)>), + SetScrollState( + PipelineId, + Vec<(UntrustedNodeAddress, Vector2D<f32, LayoutPixel>)>, + ), /// Requests that the script thread immediately send the constellation the title of a pipeline. GetTitle(PipelineId), /// Notifies script thread of a change to one of its document's activity @@ -753,7 +759,7 @@ pub struct ScrollState { /// The ID of the scroll root. pub scroll_id: ExternalScrollId, /// The scrolling offset of this stacking context. - pub scroll_offset: Vector2D<f32>, + pub scroll_offset: Vector2D<f32, LayoutPixel>, } /// Data about the window size. @@ -761,10 +767,10 @@ pub struct ScrollState { pub struct WindowSizeData { /// The size of the initial layout viewport, before parsing an /// <http://www.w3.org/TR/css-device-adapt/#initial-viewport> - pub initial_viewport: TypedSize2D<f32, CSSPixel>, + pub initial_viewport: Size2D<f32, CSSPixel>, /// The resolution of the window in dppx, not including any "pinch zoom" factor. - pub device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>, + pub device_pixel_ratio: Scale<f32, CSSPixel, DevicePixel>, } /// The type of window size change. @@ -953,8 +959,8 @@ pub trait Painter: SpeculativePainter { /// <https://drafts.css-houdini.org/css-paint-api/#draw-a-paint-image> fn draw_a_paint_image( &self, - size: TypedSize2D<f32, CSSPixel>, - zoom: TypedScale<f32, CSSPixel, DevicePixel>, + size: Size2D<f32, CSSPixel>, + zoom: Scale<f32, CSSPixel, DevicePixel>, properties: Vec<(Atom, String)>, arguments: Vec<String>, ) -> Result<DrawAPaintImageResult, PaintWorkletError>; diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs index 200604cbbf5..c3ee8d75205 100644 --- a/components/script_traits/script_msg.rs +++ b/components/script_traits/script_msg.rs @@ -14,7 +14,8 @@ use crate::WorkerScriptLoadOrigin; use canvas_traits::canvas::{CanvasId, CanvasMsg}; use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId}; use embedder_traits::EmbedderMsg; -use euclid::{Size2D, TypedSize2D}; +use euclid::default::Size2D as UntypedSize2D; +use euclid::Size2D; use gfx_traits::Epoch; use ipc_channel::ipc::{IpcReceiver, IpcSender}; use msg::constellation_msg::{BrowsingContextId, PipelineId, TopLevelBrowsingContextId}; @@ -35,7 +36,7 @@ pub struct IFrameSize { /// The child browsing context for this iframe. pub id: BrowsingContextId, /// The size of the iframe. - pub size: TypedSize2D<f32, CSSPixel>, + pub size: Size2D<f32, CSSPixel>, } /// An iframe sizing operation. @@ -126,7 +127,10 @@ pub enum ScriptMsg { ChangeRunningAnimationsState(AnimationState), /// Requests that a new 2D canvas thread be created. (This is done in the constellation because /// 2D canvases may use the GPU and we don't want to give untrusted content access to the GPU.) - CreateCanvasPaintThread(Size2D<u64>, IpcSender<(IpcSender<CanvasMsg>, CanvasId)>), + CreateCanvasPaintThread( + UntypedSize2D<u64>, + IpcSender<(IpcSender<CanvasMsg>, CanvasId)>, + ), /// Notifies the constellation that this frame has received focus. Focus, /// Get the top-level browsing context info for a given browsing context. diff --git a/components/script_traits/webdriver_msg.rs b/components/script_traits/webdriver_msg.rs index db7fc65d042..2d15172fe30 100644 --- a/components/script_traits/webdriver_msg.rs +++ b/components/script_traits/webdriver_msg.rs @@ -5,7 +5,7 @@ #![allow(missing_docs)] use cookie::Cookie; -use euclid::Rect; +use euclid::default::Rect; use hyper_serde::Serde; use ipc_channel::ipc::IpcSender; use msg::constellation_msg::BrowsingContextId; diff --git a/components/servo/Cargo.toml b/components/servo/Cargo.toml index 77a297d67d1..cc158af843f 100644 --- a/components/servo/Cargo.toml +++ b/components/servo/Cargo.toml @@ -50,7 +50,7 @@ devtools = {path = "../devtools"} devtools_traits = {path = "../devtools_traits"} embedder_traits = {path = "../embedder_traits"} env_logger = "0.6" -euclid = "0.19" +euclid = "0.20" gfx = {path = "../gfx"} gleam = "0.6" ipc-channel = "0.11" @@ -60,7 +60,7 @@ layout_thread_2020 = {path = "../layout_thread_2020", optional = true} log = "0.4" media = {path = "../media"} msg = {path = "../msg"} -offscreen_gl_context = "0.22" +offscreen_gl_context = "0.23" net = {path = "../net"} net_traits = {path = "../net_traits"} profile = {path = "../profile"} diff --git a/components/servo/lib.rs b/components/servo/lib.rs index ac1cd492a12..a64972bc1a7 100644 --- a/components/servo/lib.rs +++ b/components/servo/lib.rs @@ -84,7 +84,7 @@ use constellation::{FromCompositorLogger, FromScriptLogger}; use crossbeam_channel::{unbounded, Sender}; use embedder_traits::{EmbedderMsg, EmbedderProxy, EmbedderReceiver, EventLoopWaker}; use env_logger::Builder as EnvLoggerBuilder; -use euclid::TypedSize2D; +use euclid::Size2D; #[cfg(all( not(target_os = "windows"), not(target_os = "ios"), @@ -326,8 +326,8 @@ where // Cast from `DeviceIndependentPixel` to `DevicePixel` let device_pixel_ratio = coordinates.hidpi_factor.get(); - let window_size = TypedSize2D::from_untyped( - &(opts.initial_window_size.to_f32() / device_pixel_ratio) + let window_size = Size2D::from_untyped( + (opts.initial_window_size.to_f32() / device_pixel_ratio) .to_i32() .to_untyped(), ); diff --git a/components/style/logical_geometry.rs b/components/style/logical_geometry.rs index 90fbabe0a7f..3817c12dcf0 100644 --- a/components/style/logical_geometry.rs +++ b/components/style/logical_geometry.rs @@ -5,8 +5,8 @@ //! Geometry in flow-relative space. use crate::properties::style_structs; +use euclid::default::{Point2D, Rect, SideOffsets2D, Size2D}; use euclid::num::Zero; -use euclid::default::{Point2D, Rect, Size2D, SideOffsets2D}; use std::cmp::{max, min}; use std::fmt::{self, Debug, Error, Formatter}; use std::ops::{Add, Sub}; diff --git a/components/style/matching.rs b/components/style/matching.rs index 2c6b16d964d..958ec00f1d9 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -262,7 +262,7 @@ trait PrivateMatchMethods: TElement { // around... None => { return new_style_specifies_animations || new_style.is_pseudo_style(); - } + }, }; let old_box_style = old_style.get_box(); diff --git a/components/style/servo/media_queries.rs b/components/style/servo/media_queries.rs index b007823eeeb..df7bf93b8ac 100644 --- a/components/style/servo/media_queries.rs +++ b/components/style/servo/media_queries.rs @@ -15,7 +15,8 @@ use crate::values::computed::CSSPixelLength; use crate::values::KeyframesName; use app_units::Au; use cssparser::RGBA; -use euclid::{Size2D, Scale, Size2D}; +use euclid::default::Size2D as UntypedSize2D; +use euclid::{Scale, Size2D}; use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering}; use style_traits::viewport::ViewportConstraints; use style_traits::{CSSPixel, DevicePixel}; @@ -121,7 +122,7 @@ impl Device { /// Returns the viewport size of the current device in app units, needed, /// among other things, to resolve viewport units. #[inline] - pub fn au_viewport_size(&self) -> Size2D<Au> { + pub fn au_viewport_size(&self) -> UntypedSize2D<Au> { Size2D::new( Au::from_f32_px(self.viewport_size.width), Au::from_f32_px(self.viewport_size.height), @@ -129,7 +130,7 @@ impl Device { } /// Like the above, but records that we've used viewport units. - pub fn au_viewport_size_for_viewport_unit_resolution(&self) -> Size2D<Au> { + pub fn au_viewport_size_for_viewport_unit_resolution(&self) -> UntypedSize2D<Au> { self.used_viewport_units.store(true, Ordering::Relaxed); self.au_viewport_size() } diff --git a/components/style/stylesheets/mod.rs b/components/style/stylesheets/mod.rs index 91d1bbc30c4..b74413866f5 100644 --- a/components/style/stylesheets/mod.rs +++ b/components/style/stylesheets/mod.rs @@ -194,11 +194,15 @@ impl fmt::Debug for UrlExtraData { spec.fmt(formatter) } } - } + }; } define_debug_struct!(DebugURI, nsIURI, Gecko_nsIURI_Debug); - define_debug_struct!(DebugReferrerInfo, nsIReferrerInfo, Gecko_nsIReferrerInfo_Debug); + define_debug_struct!( + DebugReferrerInfo, + nsIReferrerInfo, + Gecko_nsIReferrerInfo_Debug + ); formatter .debug_struct("URLExtraData") @@ -209,7 +213,11 @@ impl fmt::Debug for UrlExtraData { ) .field( "referrer", - &DebugReferrerInfo(self.as_ref().mReferrerInfo.raw::<structs::nsIReferrerInfo>()), + &DebugReferrerInfo( + self.as_ref() + .mReferrerInfo + .raw::<structs::nsIReferrerInfo>(), + ), ) .finish() } diff --git a/components/style/values/generics/transform.rs b/components/style/values/generics/transform.rs index d8e9b27f5f0..8dbbdfcd168 100644 --- a/components/style/values/generics/transform.rs +++ b/components/style/values/generics/transform.rs @@ -12,8 +12,8 @@ use crate::values::specified::length::LengthPercentage as SpecifiedLengthPercent use crate::values::{computed, CSSFloat}; use crate::Zero; use app_units::Au; -use euclid::default::{Rect, Transform3D}; use euclid; +use euclid::default::{Rect, Transform3D}; use std::fmt::{self, Write}; use style_traits::{CssWriter, ToCss}; diff --git a/components/style/values/specified/list.rs b/components/style/values/specified/list.rs index f5bda33ce73..3946d78652e 100644 --- a/components/style/values/specified/list.rs +++ b/components/style/values/specified/list.rs @@ -163,7 +163,7 @@ impl Parse for Quotes { .try(|input| input.expect_ident_matching("none")) .is_ok() { - return Ok(Quotes::QuoteList(QuoteList::default())) + return Ok(Quotes::QuoteList(QuoteList::default())); } let mut quotes = Vec::new(); @@ -180,7 +180,9 @@ impl Parse for Quotes { } if !quotes.is_empty() { - Ok(Quotes::QuoteList(QuoteList(crate::ArcSlice::from_iter(quotes.into_iter())))) + Ok(Quotes::QuoteList(QuoteList(crate::ArcSlice::from_iter( + quotes.into_iter(), + )))) } else { Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)) } diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index a989e0a0885..c8cce337381 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -142,8 +142,8 @@ fn parse_number_with_clamping_mode<'i, 't>( value: value.min(f32::MAX).max(f32::MIN), calc_clamping_mode: None, }); - } - Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {} + }, + Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {}, ref t => return Err(location.new_unexpected_token_error(t.clone())), } @@ -537,7 +537,7 @@ impl Parse for Integer { Token::Number { int_value: Some(v), .. } => return Ok(Integer::new(v)), - Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {} + Token::Function(ref name) if name.eq_ignore_ascii_case("calc") => {}, ref t => return Err(location.new_unexpected_token_error(t.clone())), } @@ -813,7 +813,7 @@ impl Attr { None => { return Err(location .new_custom_error(StyleParseErrorKind::UnspecifiedError)); - } + }, }; Some((prefix, ns)) } else { @@ -823,10 +823,10 @@ impl Attr { namespace: prefix_and_ns, attribute: Atom::from(second_token.as_ref()), }); - } + }, // In the case of attr(foobar ) we don't want to error out // because of the trailing whitespace - Token::WhiteSpace(..) => {} + Token::WhiteSpace(..) => {}, ref t => return Err(input.new_unexpected_token_error(t.clone())), } } diff --git a/components/style/values/specified/position.rs b/components/style/values/specified/position.rs index e4ab6536a65..4e6a71ec2ca 100644 --- a/components/style/values/specified/position.rs +++ b/components/style/values/specified/position.rs @@ -266,11 +266,14 @@ impl<S> PositionComponent<S> { /// Returns the count of this component. fn component_count(&self) -> usize { match *self { - PositionComponent::Length(..) | - PositionComponent::Center => 1, + PositionComponent::Length(..) | PositionComponent::Center => 1, PositionComponent::Side(_, ref lp) => { - if lp.is_some() { 2 } else { 1 } - } + if lp.is_some() { + 2 + } else { + 1 + } + }, } } } diff --git a/components/style_traits/Cargo.toml b/components/style_traits/Cargo.toml index fbd804737a5..e2cb4f1bd12 100644 --- a/components/style_traits/Cargo.toml +++ b/components/style_traits/Cargo.toml @@ -10,7 +10,7 @@ name = "style_traits" path = "lib.rs" [features] -servo = ["serde", "servo_atoms", "cssparser/serde", "webrender_api", "servo_url"] +servo = ["serde", "servo_atoms", "cssparser/serde", "webrender_api", "servo_url", "euclid/serde"] gecko = [] [dependencies] diff --git a/components/webdriver_server/Cargo.toml b/components/webdriver_server/Cargo.toml index 50a3816073a..06b1d539291 100644 --- a/components/webdriver_server/Cargo.toml +++ b/components/webdriver_server/Cargo.toml @@ -14,7 +14,7 @@ path = "lib.rs" base64 = "0.10" cookie = "0.11" crossbeam-channel = "0.3" -euclid = "0.19" +euclid = "0.20" hyper = "0.12" image = "0.21" ipc-channel = "0.11" diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index d227973edc9..dd745ae256d 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -18,7 +18,7 @@ mod capabilities; use base64; use capabilities::ServoCapabilities; use crossbeam_channel::Sender; -use euclid::TypedSize2D; +use euclid::Size2D; use hyper::Method; use image::{DynamicImage, ImageFormat, RgbImage}; use ipc_channel::ipc::{self, IpcReceiver, IpcSender}; @@ -667,7 +667,7 @@ impl Handler { Some(v) => v, None => 0, }; - let size = TypedSize2D::new(width as u32, height as u32); + let size = Size2D::new(width as u32, height as u32); let top_level_browsing_context_id = self.session()?.top_level_browsing_context_id; let cmd_msg = WebDriverCommandMsg::SetWindowSize( top_level_browsing_context_id, diff --git a/components/webrender_traits/Cargo.toml b/components/webrender_traits/Cargo.toml index 01e2ca2f2e3..76c359d01e6 100644 --- a/components/webrender_traits/Cargo.toml +++ b/components/webrender_traits/Cargo.toml @@ -11,7 +11,7 @@ name = "webrender_traits" path = "lib.rs" [dependencies] -euclid = "0.19" +euclid = "0.20" webrender = {git = "https://github.com/servo/webrender"} webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} diff --git a/components/webrender_traits/lib.rs b/components/webrender_traits/lib.rs index 60492121663..90b1b944369 100644 --- a/components/webrender_traits/lib.rs +++ b/components/webrender_traits/lib.rs @@ -4,7 +4,7 @@ #![deny(unsafe_code)] -use euclid::Size2D; +use euclid::default::Size2D; use std::collections::HashMap; use std::sync::{Arc, Mutex}; use webrender_api::units::TexelRect; diff --git a/components/webvr/Cargo.toml b/components/webvr/Cargo.toml index 02da9dbd6f3..247eb08f818 100644 --- a/components/webvr/Cargo.toml +++ b/components/webvr/Cargo.toml @@ -17,7 +17,7 @@ oculusvr = ['rust-webvr/oculusvr'] [dependencies] canvas_traits = {path = "../canvas_traits"} crossbeam-channel = "0.3" -euclid = "0.19" +euclid = "0.20" gleam = "0.6" ipc-channel = "0.11.2" log = "0.4" diff --git a/components/webvr/webvr_thread.rs b/components/webvr/webvr_thread.rs index 0da3b98d820..c782fb2e562 100644 --- a/components/webvr/webvr_thread.rs +++ b/components/webvr/webvr_thread.rs @@ -4,7 +4,7 @@ use canvas_traits::webgl; use crossbeam_channel::{unbounded, Receiver, Sender}; -use euclid::Size2D; +use euclid::default::Size2D; use gleam::gl::Gl; use ipc_channel::ipc; use ipc_channel::ipc::{IpcReceiver, IpcSender}; diff --git a/ports/glutin/Cargo.toml b/ports/glutin/Cargo.toml index 50bd77efe71..77717076cde 100644 --- a/ports/glutin/Cargo.toml +++ b/ports/glutin/Cargo.toml @@ -49,7 +49,7 @@ backtrace = "0.3" bitflags = "1.0" clipboard = "0.5" crossbeam-channel = "0.3" -euclid = "0.19" +euclid = "0.20" gleam = "0.6" glutin = "0.21.0" keyboard-types = "0.4.3" diff --git a/ports/glutin/browser.rs b/ports/glutin/browser.rs index 042f84072c7..7255390fdf6 100644 --- a/ports/glutin/browser.rs +++ b/ports/glutin/browser.rs @@ -4,7 +4,7 @@ use crate::keyutils::{CMD_OR_ALT, CMD_OR_CONTROL}; use crate::window_trait::{WindowPortsMethods, LINE_HEIGHT}; -use euclid::{TypedPoint2D, TypedVector2D}; +use euclid::{Point2D, Vector2D}; use keyboard_types::{Key, KeyboardEvent, Modifiers, ShortcutMatcher}; use servo::compositing::windowing::{WebRenderDebugOption, WindowEvent}; use servo::embedder_traits::{EmbedderMsg, FilterPattern}; @@ -222,14 +222,14 @@ where self.event_queue.push(WindowEvent::ResetZoom) }) .shortcut(Modifiers::empty(), Key::PageDown, || { - let scroll_location = ScrollLocation::Delta(TypedVector2D::new( + let scroll_location = ScrollLocation::Delta(Vector2D::new( 0.0, -self.window.page_height() + 2.0 * LINE_HEIGHT, )); self.scroll_window_from_key(scroll_location, TouchEventType::Move); }) .shortcut(Modifiers::empty(), Key::PageUp, || { - let scroll_location = ScrollLocation::Delta(TypedVector2D::new( + let scroll_location = ScrollLocation::Delta(Vector2D::new( 0.0, self.window.page_height() - 2.0 * LINE_HEIGHT, )); @@ -243,32 +243,32 @@ where }) .shortcut(Modifiers::empty(), Key::ArrowUp, || { self.scroll_window_from_key( - ScrollLocation::Delta(TypedVector2D::new(0.0, 3.0 * LINE_HEIGHT)), + ScrollLocation::Delta(Vector2D::new(0.0, 3.0 * LINE_HEIGHT)), TouchEventType::Move, ); }) .shortcut(Modifiers::empty(), Key::ArrowDown, || { self.scroll_window_from_key( - ScrollLocation::Delta(TypedVector2D::new(0.0, -3.0 * LINE_HEIGHT)), + ScrollLocation::Delta(Vector2D::new(0.0, -3.0 * LINE_HEIGHT)), TouchEventType::Move, ); }) .shortcut(Modifiers::empty(), Key::ArrowLeft, || { self.scroll_window_from_key( - ScrollLocation::Delta(TypedVector2D::new(LINE_HEIGHT, 0.0)), + ScrollLocation::Delta(Vector2D::new(LINE_HEIGHT, 0.0)), TouchEventType::Move, ); }) .shortcut(Modifiers::empty(), Key::ArrowRight, || { self.scroll_window_from_key( - ScrollLocation::Delta(TypedVector2D::new(-LINE_HEIGHT, 0.0)), + ScrollLocation::Delta(Vector2D::new(-LINE_HEIGHT, 0.0)), TouchEventType::Move, ); }); } fn scroll_window_from_key(&mut self, scroll_location: ScrollLocation, phase: TouchEventType) { - let event = WindowEvent::Scroll(scroll_location, TypedPoint2D::zero(), phase); + let event = WindowEvent::Scroll(scroll_location, Point2D::zero(), phase); self.event_queue.push(event); } diff --git a/ports/glutin/headed_window.rs b/ports/glutin/headed_window.rs index 4de73fdcf78..082f344badb 100644 --- a/ports/glutin/headed_window.rs +++ b/ports/glutin/headed_window.rs @@ -9,7 +9,7 @@ use crate::context::GlContext; use crate::events_loop::EventsLoop; use crate::keyutils::keyboard_event_from_winit; use crate::window_trait::{WindowPortsMethods, LINE_HEIGHT}; -use euclid::{Size2D, TypedPoint2D, TypedScale, TypedSize2D, TypedVector2D}; +use euclid::{default::Size2D as UntypedSize2D, Point2D, Scale, Size2D, Vector2D}; use gleam::gl; use glutin::dpi::{LogicalPosition, LogicalSize, PhysicalSize}; #[cfg(target_os = "macos")] @@ -57,13 +57,13 @@ fn builder_with_platform_options(builder: glutin::WindowBuilder) -> glutin::Wind pub struct Window { gl_context: RefCell<GlContext>, events_loop: Rc<RefCell<EventsLoop>>, - screen_size: TypedSize2D<u32, DeviceIndependentPixel>, - inner_size: Cell<TypedSize2D<u32, DeviceIndependentPixel>>, + screen_size: Size2D<u32, DeviceIndependentPixel>, + inner_size: Cell<Size2D<u32, DeviceIndependentPixel>>, mouse_down_button: Cell<Option<glutin::MouseButton>>, - mouse_down_point: Cell<TypedPoint2D<i32, DevicePixel>>, + mouse_down_point: Cell<Point2D<i32, DevicePixel>>, primary_monitor: glutin::MonitorId, event_queue: RefCell<Vec<WindowEvent>>, - mouse_pos: Cell<TypedPoint2D<i32, DevicePixel>>, + mouse_pos: Cell<Point2D<i32, DevicePixel>>, last_pressed: Cell<Option<KeyboardEvent>>, animation_state: Cell<AnimationState>, fullscreen: Cell<bool>, @@ -71,20 +71,20 @@ pub struct Window { } #[cfg(not(target_os = "windows"))] -fn window_creation_scale_factor() -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> { - TypedScale::new(1.0) +fn window_creation_scale_factor() -> Scale<f32, DeviceIndependentPixel, DevicePixel> { + Scale::new(1.0) } #[cfg(target_os = "windows")] -fn window_creation_scale_factor() -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> { +fn window_creation_scale_factor() -> Scale<f32, DeviceIndependentPixel, DevicePixel> { let hdc = unsafe { winapi::um::winuser::GetDC(::std::ptr::null_mut()) }; let ppi = unsafe { winapi::um::wingdi::GetDeviceCaps(hdc, winapi::um::wingdi::LOGPIXELSY) }; - TypedScale::new(ppi as f32 / 96.0) + Scale::new(ppi as f32 / 96.0) } impl Window { pub fn new( - win_size: TypedSize2D<u32, DeviceIndependentPixel>, + win_size: Size2D<u32, DeviceIndependentPixel>, sharing: Option<&GlContext>, events_loop: Rc<RefCell<EventsLoop>>, ) -> Window { @@ -139,13 +139,13 @@ impl Window { width: screen_width, height: screen_height, } = primary_monitor.get_dimensions(); - let screen_size = TypedSize2D::new(screen_width as u32, screen_height as u32); + let screen_size = Size2D::new(screen_width as u32, screen_height as u32); // TODO(ajeffrey): can this fail? let LogicalSize { width, height } = context .window() .get_inner_size() .expect("Failed to get window inner size."); - let inner_size = TypedSize2D::new(width as u32, height as u32); + let inner_size = Size2D::new(width as u32, height as u32); context.window().show(); @@ -172,8 +172,8 @@ impl Window { events_loop, event_queue: RefCell::new(vec![]), mouse_down_button: Cell::new(None), - mouse_down_point: Cell::new(TypedPoint2D::new(0, 0)), - mouse_pos: Cell::new(TypedPoint2D::new(0, 0)), + mouse_down_point: Cell::new(Point2D::new(0, 0)), + mouse_pos: Cell::new(Point2D::new(0, 0)), last_pressed: Cell::new(None), gl: gl.clone(), animation_state: Cell::new(AnimationState::Idle), @@ -233,7 +233,7 @@ impl Window { &self, button: glutin::MouseButton, action: glutin::ElementState, - coords: TypedPoint2D<i32, DevicePixel>, + coords: Point2D<i32, DevicePixel>, ) { use servo::script_traits::MouseButton; @@ -271,15 +271,15 @@ impl Window { .push(WindowEvent::MouseWindowEventClass(event)); } - fn device_hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> { - TypedScale::new(self.gl_context.borrow().window().get_hidpi_factor() as f32) + fn device_hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> { + Scale::new(self.gl_context.borrow().window().get_hidpi_factor() as f32) } - fn servo_hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> { + fn servo_hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> { match opts::get().device_pixels_per_px { - Some(device_pixels_per_px) => TypedScale::new(device_pixels_per_px), + Some(device_pixels_per_px) => Scale::new(device_pixels_per_px), _ => match opts::get().output_file { - Some(_) => TypedScale::new(1.0), + Some(_) => Scale::new(1.0), None => self.device_hidpi_factor(), }, } @@ -397,10 +397,10 @@ impl WindowPortsMethods for Window { glutin::WindowEvent::CursorMoved { position, .. } => { let pos = position.to_physical(self.device_hidpi_factor().get() as f64); let (x, y): (i32, i32) = pos.into(); - self.mouse_pos.set(TypedPoint2D::new(x, y)); + self.mouse_pos.set(Point2D::new(x, y)); self.event_queue .borrow_mut() - .push(WindowEvent::MouseWindowMoveEventClass(TypedPoint2D::new( + .push(WindowEvent::MouseWindowMoveEventClass(Point2D::new( x as f32, y as f32, ))); }, @@ -418,7 +418,7 @@ impl WindowPortsMethods for Window { // Create wheel event before snapping to the major axis of movement let wheel_delta = WheelDelta { x: dx, y: dy, z: 0.0, mode }; let pos = self.mouse_pos.get(); - let position = TypedPoint2D::new(pos.x as f32, pos.y as f32); + let position = Point2D::new(pos.x as f32, pos.y as f32); let wheel_event = WindowEvent::Wheel(wheel_delta, position); // Scroll events snap to the major axis of movement, with vertical @@ -429,7 +429,7 @@ impl WindowPortsMethods for Window { dy = 0.0; } - let scroll_location = ScrollLocation::Delta(TypedVector2D::new(dx as f32, dy as f32)); + let scroll_location = ScrollLocation::Delta(Vector2D::new(dx as f32, dy as f32)); let phase = winit_phase_to_touch_event_type(phase); let scroll_event = WindowEvent::Scroll(scroll_location, self.mouse_pos.get(), phase); @@ -445,7 +445,7 @@ impl WindowPortsMethods for Window { let position = touch .location .to_physical(self.device_hidpi_factor().get() as f64); - let point = TypedPoint2D::new(position.x as f32, position.y as f32); + let point = Point2D::new(position.x as f32, position.y as f32); self.event_queue .borrow_mut() .push(WindowEvent::Touch(phase, id, point)); @@ -461,7 +461,7 @@ impl WindowPortsMethods for Window { self.gl_context.borrow_mut().resize(physical_size); // window.set_inner_size() takes DeviceIndependentPixel. let (width, height) = size.into(); - let new_size = TypedSize2D::new(width, height); + let new_size = Size2D::new(width, height); if self.inner_size.get() != new_size { self.inner_size.set(new_size); self.event_queue.borrow_mut().push(WindowEvent::Resize); @@ -482,7 +482,7 @@ impl webxr::glwindow::GlWindow for Window { self.gl_context.get_mut().make_not_current(); } - fn size(&self) -> Size2D<gl::GLsizei> { + fn size(&self) -> UntypedSize2D<gl::GLsizei> { let dpr = self.device_hidpi_factor().get() as f64; let LogicalSize { width, height } = self .gl_context @@ -523,8 +523,8 @@ impl WindowMethods for Window { .window() .get_position() .unwrap_or(LogicalPosition::new(0., 0.)); - let win_size = (TypedSize2D::new(width as f32, height as f32) * dpr).to_i32(); - let win_origin = (TypedPoint2D::new(x as f32, y as f32) * dpr).to_i32(); + let win_size = (Size2D::new(width as f32, height as f32) * dpr).to_i32(); + let win_origin = (Point2D::new(x as f32, y as f32) * dpr).to_i32(); let screen = (self.screen_size.to_f32() * dpr).to_i32(); let LogicalSize { width, height } = self @@ -533,9 +533,9 @@ impl WindowMethods for Window { .window() .get_inner_size() .expect("Failed to get window inner size."); - let inner_size = (TypedSize2D::new(width as f32, height as f32) * dpr).to_i32(); - let viewport = DeviceIntRect::new(TypedPoint2D::zero(), inner_size); - let framebuffer = DeviceIntSize::from_untyped(&viewport.size.to_untyped()); + let inner_size = (Size2D::new(width as f32, height as f32) * dpr).to_i32(); + let viewport = DeviceIntRect::new(Point2D::zero(), inner_size); + let framebuffer = DeviceIntSize::from_untyped(viewport.size.to_untyped()); EmbedderCoordinates { viewport, diff --git a/ports/glutin/headless_window.rs b/ports/glutin/headless_window.rs index 934f15b3bd2..e2b4132bc1c 100644 --- a/ports/glutin/headless_window.rs +++ b/ports/glutin/headless_window.rs @@ -6,7 +6,7 @@ use crate::window_trait::WindowPortsMethods; use glutin; -use euclid::{Size2D, TypedPoint2D, TypedScale, TypedSize2D}; +use euclid::{default::Size2D as UntypedSize2D, Point2D, Scale, Size2D}; use gleam::gl; use servo::compositing::windowing::{AnimationState, WindowEvent}; use servo::compositing::windowing::{EmbedderCoordinates, WindowMethods}; @@ -106,7 +106,7 @@ pub struct Window { } impl Window { - pub fn new(size: TypedSize2D<u32, DeviceIndependentPixel>) -> Rc<dyn WindowPortsMethods> { + pub fn new(size: Size2D<u32, DeviceIndependentPixel>) -> Rc<dyn WindowPortsMethods> { let context = HeadlessContext::new(size.width, size.height, None); let gl = unsafe { gl::GlFns::load_with(|s| HeadlessContext::get_proc_address(s)) }; @@ -126,10 +126,10 @@ impl Window { Rc::new(window) } - fn servo_hidpi_factor(&self) -> TypedScale<f32, DeviceIndependentPixel, DevicePixel> { + fn servo_hidpi_factor(&self) -> Scale<f32, DeviceIndependentPixel, DevicePixel> { match opts::get().device_pixels_per_px { - Some(device_pixels_per_px) => TypedScale::new(device_pixels_per_px), - _ => TypedScale::new(1.0), + Some(device_pixels_per_px) => Scale::new(device_pixels_per_px), + _ => Scale::new(1.0), } } } @@ -177,13 +177,13 @@ impl WindowMethods for Window { fn get_coordinates(&self) -> EmbedderCoordinates { let dpr = self.servo_hidpi_factor(); let size = - (TypedSize2D::new(self.context.width, self.context.height).to_f32() * dpr).to_i32(); - let viewport = DeviceIntRect::new(TypedPoint2D::zero(), size); - let framebuffer = DeviceIntSize::from_untyped(&size.to_untyped()); + (Size2D::new(self.context.width, self.context.height).to_f32() * dpr).to_i32(); + let viewport = DeviceIntRect::new(Point2D::zero(), size); + let framebuffer = DeviceIntSize::from_untyped(size.to_untyped()); EmbedderCoordinates { viewport, framebuffer, - window: (size, TypedPoint2D::zero()), + window: (size, Point2D::zero()), screen: size, screen_avail: size, hidpi_factor: dpr, @@ -214,7 +214,7 @@ impl WindowMethods for Window { impl webxr::glwindow::GlWindow for Window { fn make_current(&mut self) {} fn swap_buffers(&mut self) {} - fn size(&self) -> Size2D<gl::GLsizei> { + fn size(&self) -> UntypedSize2D<gl::GLsizei> { let dpr = self.servo_hidpi_factor().get(); Size2D::new((self.context.width as f32 * dpr) as gl::GLsizei, (self.context.height as f32 * dpr) as gl::GLsizei) } diff --git a/ports/libmlservo/src/lib.rs b/ports/libmlservo/src/lib.rs index 310182a813a..07b2912dd87 100644 --- a/ports/libmlservo/src/lib.rs +++ b/ports/libmlservo/src/lib.rs @@ -11,7 +11,7 @@ use libc::{dup2, pipe, read}; use log::info; use log::warn; use rust_webvr::api::MagicLeapVRService; -use servo::euclid::TypedScale; +use servo::euclid::Scale; use servo::keyboard_types::Key; use servo::servo_url::ServoUrl; use servo::webrender_api::units::{DevicePixel, DevicePoint, LayoutPixel}; @@ -176,7 +176,7 @@ pub unsafe extern "C" fn init_servo( let result = Box::new(ServoInstance { scroll_state: ScrollState::TriggerUp, - scroll_scale: TypedScale::new(SCROLL_SCALE / hidpi), + scroll_scale: Scale::new(SCROLL_SCALE / hidpi), shut_down_complete, }); Box::into_raw(result) @@ -389,7 +389,7 @@ impl HostTrait for HostCallbacks { pub struct ServoInstance { scroll_state: ScrollState, - scroll_scale: TypedScale<f32, DevicePixel, LayoutPixel>, + scroll_scale: Scale<f32, DevicePixel, LayoutPixel>, shut_down_complete: Rc<Cell<bool>>, } diff --git a/ports/libsimpleservo/api/src/lib.rs b/ports/libsimpleservo/api/src/lib.rs index cbd7ee16fd7..3032fa65a2c 100644 --- a/ports/libsimpleservo/api/src/lib.rs +++ b/ports/libsimpleservo/api/src/lib.rs @@ -15,7 +15,7 @@ use servo::compositing::windowing::{ }; use servo::embedder_traits::resources::{self, Resource, ResourceReaderMethods}; use servo::embedder_traits::EmbedderMsg; -use servo::euclid::{TypedPoint2D, TypedRect, TypedScale, TypedSize2D, TypedVector2D}; +use servo::euclid::{Point2D, Rect, Scale, Size2D, Vector2D}; use servo::keyboard_types::{Key, KeyState, KeyboardEvent}; use servo::msg::constellation_msg::TraversalDirection; use servo::script_traits::{TouchEventType, TouchId}; @@ -61,8 +61,8 @@ pub enum VRInitOptions { #[derive(Clone, Debug)] pub struct Coordinates { - pub viewport: TypedRect<i32, DevicePixel>, - pub framebuffer: TypedSize2D<i32, DevicePixel>, + pub viewport: Rect<i32, DevicePixel>, + pub framebuffer: Size2D<i32, DevicePixel>, } impl Coordinates { @@ -75,8 +75,8 @@ impl Coordinates { fb_height: i32, ) -> Coordinates { Coordinates { - viewport: TypedRect::new(TypedPoint2D::new(x, y), TypedSize2D::new(width, height)), - framebuffer: TypedSize2D::new(fb_width, fb_height), + viewport: Rect::new(Point2D::new(x, y), Size2D::new(width, height)), + framebuffer: Size2D::new(fb_width, fb_height), } } } @@ -324,13 +324,9 @@ impl ServoGlue { /// x/y are scroll coordinates. /// dx/dy are scroll deltas. pub fn scroll_start(&mut self, dx: f32, dy: f32, x: i32, y: i32) -> Result<(), &'static str> { - let delta = TypedVector2D::new(dx, dy); + let delta = Vector2D::new(dx, dy); let scroll_location = ScrollLocation::Delta(delta); - let event = WindowEvent::Scroll( - scroll_location, - TypedPoint2D::new(x, y), - TouchEventType::Down, - ); + let event = WindowEvent::Scroll(scroll_location, Point2D::new(x, y), TouchEventType::Down); self.process_event(event) } @@ -338,13 +334,9 @@ impl ServoGlue { /// x/y are scroll coordinates. /// dx/dy are scroll deltas. pub fn scroll(&mut self, dx: f32, dy: f32, x: i32, y: i32) -> Result<(), &'static str> { - let delta = TypedVector2D::new(dx, dy); + let delta = Vector2D::new(dx, dy); let scroll_location = ScrollLocation::Delta(delta); - let event = WindowEvent::Scroll( - scroll_location, - TypedPoint2D::new(x, y), - TouchEventType::Move, - ); + let event = WindowEvent::Scroll(scroll_location, Point2D::new(x, y), TouchEventType::Move); self.process_event(event) } @@ -352,10 +344,9 @@ impl ServoGlue { /// x/y are scroll coordinates. /// dx/dy are scroll deltas. pub fn scroll_end(&mut self, dx: f32, dy: f32, x: i32, y: i32) -> Result<(), &'static str> { - let delta = TypedVector2D::new(dx, dy); + let delta = Vector2D::new(dx, dy); let scroll_location = ScrollLocation::Delta(delta); - let event = - WindowEvent::Scroll(scroll_location, TypedPoint2D::new(x, y), TouchEventType::Up); + let event = WindowEvent::Scroll(scroll_location, Point2D::new(x, y), TouchEventType::Up); self.process_event(event) } @@ -364,7 +355,7 @@ impl ServoGlue { let event = WindowEvent::Touch( TouchEventType::Down, TouchId(pointer_id), - TypedPoint2D::new(x as f32, y as f32), + Point2D::new(x as f32, y as f32), ); self.process_event(event) } @@ -374,7 +365,7 @@ impl ServoGlue { let event = WindowEvent::Touch( TouchEventType::Move, TouchId(pointer_id), - TypedPoint2D::new(x as f32, y as f32), + Point2D::new(x as f32, y as f32), ); self.process_event(event) } @@ -384,7 +375,7 @@ impl ServoGlue { let event = WindowEvent::Touch( TouchEventType::Up, TouchId(pointer_id), - TypedPoint2D::new(x as f32, y as f32), + Point2D::new(x as f32, y as f32), ); self.process_event(event) } @@ -394,28 +385,28 @@ impl ServoGlue { let event = WindowEvent::Touch( TouchEventType::Cancel, TouchId(pointer_id), - TypedPoint2D::new(x as f32, y as f32), + Point2D::new(x as f32, y as f32), ); self.process_event(event) } /// Register a mouse movement. pub fn move_mouse(&mut self, x: f32, y: f32) -> Result<(), &'static str> { - let point = TypedPoint2D::new(x, y); + let point = Point2D::new(x, y); let event = WindowEvent::MouseWindowMoveEventClass(point); self.process_event(event) } /// Register a mouse button press. pub fn mouse_down(&mut self, x: f32, y: f32, button: MouseButton) -> Result<(), &'static str> { - let point = TypedPoint2D::new(x, y); + let point = Point2D::new(x, y); let event = WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseDown(button, point)); self.process_event(event) } /// Register a mouse button release. pub fn mouse_up(&mut self, x: f32, y: f32, button: MouseButton) -> Result<(), &'static str> { - let point = TypedPoint2D::new(x, y); + let point = Point2D::new(x, y); let event = WindowEvent::MouseWindowEventClass(MouseWindowEvent::MouseUp(button, point)); self.process_event(event) } @@ -440,7 +431,7 @@ impl ServoGlue { /// Perform a click. pub fn click(&mut self, x: f32, y: f32) -> Result<(), &'static str> { - let mouse_event = MouseWindowEvent::Click(MouseButton::Left, TypedPoint2D::new(x, y)); + let mouse_event = MouseWindowEvent::Click(MouseButton::Left, Point2D::new(x, y)); let event = WindowEvent::MouseWindowEventClass(mouse_event); self.process_event(event) } @@ -647,10 +638,10 @@ impl WindowMethods for ServoWindowCallbacks { EmbedderCoordinates { viewport: coords.viewport, framebuffer: coords.framebuffer, - window: (coords.viewport.size, TypedPoint2D::new(0, 0)), + window: (coords.viewport.size, Point2D::new(0, 0)), screen: coords.viewport.size, screen_avail: coords.viewport.size, - hidpi_factor: TypedScale::new(self.density), + hidpi_factor: Scale::new(self.density), } } diff --git a/servo-tidy.toml b/servo-tidy.toml index ff8a2ac55e5..4dd6e71ef20 100644 --- a/servo-tidy.toml +++ b/servo-tidy.toml @@ -33,6 +33,7 @@ rand = [ # Ignored packages with duplicated versions packages = [ "crossbeam-deque", + "euclid", # https://github.com/servo/rust-webvr/pull/89 "gl_generator", # https://github.com/servo/servo/pull/23288#issuecomment-494687746 "lock_api", "nix", # https://github.com/servo/servo/issues/23189#issuecomment-487512605 diff --git a/tests/unit/script/Cargo.toml b/tests/unit/script/Cargo.toml index e772e776bc5..3194bc35ddc 100644 --- a/tests/unit/script/Cargo.toml +++ b/tests/unit/script/Cargo.toml @@ -10,7 +10,7 @@ name = "script_tests" path = "lib.rs" [dependencies] -euclid = "0.19" +euclid = "0.20" keyboard-types = "0.4.3" script = {path = "../../../components/script"} servo_url = {path = "../../../components/url"} diff --git a/tests/unit/style/Cargo.toml b/tests/unit/style/Cargo.toml index b339ed48c52..06e9d2cfd1a 100644 --- a/tests/unit/style/Cargo.toml +++ b/tests/unit/style/Cargo.toml @@ -13,7 +13,7 @@ doctest = false byteorder = "1.0" app_units = "0.7" cssparser = "0.25" -euclid = "0.19" +euclid = "0.20" html5ever = "0.23" rayon = "1" serde_json = "1.0" diff --git a/tests/unit/style/stylist.rs b/tests/unit/style/stylist.rs index ce247229740..0d7511f0583 100644 --- a/tests/unit/style/stylist.rs +++ b/tests/unit/style/stylist.rs @@ -3,8 +3,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use cssparser::SourceLocation; -use euclid::TypedScale; -use euclid::TypedSize2D; +use euclid::Scale; +use euclid::Size2D; use selectors::parser::{AncestorHashes, Selector}; use servo_arc::Arc; use servo_atoms::Atom; @@ -214,8 +214,8 @@ fn test_insert() { fn mock_stylist() -> Stylist { let device = Device::new( MediaType::screen(), - TypedSize2D::new(0f32, 0f32), - TypedScale::new(1.0), + Size2D::new(0f32, 0f32), + Scale::new(1.0), ); Stylist::new(device, QuirksMode::NoQuirks) } diff --git a/tests/unit/style/viewport.rs b/tests/unit/style/viewport.rs index 23e6c05dc25..636a6321d89 100644 --- a/tests/unit/style/viewport.rs +++ b/tests/unit/style/viewport.rs @@ -3,8 +3,8 @@ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ use cssparser::{Parser, ParserInput}; -use euclid::TypedScale; -use euclid::TypedSize2D; +use euclid::Scale; +use euclid::Size2D; use servo_arc::Arc; use servo_config::set_pref; use servo_url::ServoUrl; @@ -113,8 +113,8 @@ macro_rules! viewport_length { fn empty_viewport_rule() { let device = Device::new( MediaType::screen(), - TypedSize2D::new(800., 600.), - TypedScale::new(1.0), + Size2D::new(800., 600.), + Scale::new(1.0), ); test_viewport_rule("@viewport {}", &device, |declarations, css| { @@ -140,8 +140,8 @@ macro_rules! assert_decl_eq { fn simple_viewport_rules() { let device = Device::new( MediaType::screen(), - TypedSize2D::new(800., 600.), - TypedScale::new(1.0), + Size2D::new(800., 600.), + Scale::new(1.0), ); test_viewport_rule( @@ -308,8 +308,8 @@ fn simple_meta_viewport_contents() { fn cascading_within_viewport_rule() { let device = Device::new( MediaType::screen(), - TypedSize2D::new(800., 600.), - TypedScale::new(1.0), + Size2D::new(800., 600.), + Scale::new(1.0), ); // normal order of appearance @@ -448,8 +448,8 @@ fn multiple_stylesheets_cascading() { set_pref!(layout.viewport.enabled, true); let device = Device::new( MediaType::screen(), - TypedSize2D::new(800., 600.), - TypedScale::new(1.0), + Size2D::new(800., 600.), + Scale::new(1.0), ); let shared_lock = SharedRwLock::new(); let stylesheets = vec![ @@ -538,8 +538,8 @@ fn constrain_viewport() { }; } - let initial_viewport = TypedSize2D::new(800., 600.); - let device = Device::new(MediaType::screen(), initial_viewport, TypedScale::new(1.0)); + let initial_viewport = Size2D::new(800., 600.); + let device = Device::new(MediaType::screen(), initial_viewport, Scale::new(1.0)); let mut input = ParserInput::new(""); assert_eq!( ViewportConstraints::maybe_new(&device, from_css!(input), QuirksMode::NoQuirks), @@ -596,13 +596,13 @@ fn constrain_viewport() { }) ); - let initial_viewport = TypedSize2D::new(200., 150.); - let device = Device::new(MediaType::screen(), initial_viewport, TypedScale::new(1.0)); + let initial_viewport = Size2D::new(200., 150.); + let device = Device::new(MediaType::screen(), initial_viewport, Scale::new(1.0)); let mut input = ParserInput::new("width: 320px auto"); assert_eq!( ViewportConstraints::maybe_new(&device, from_css!(input), QuirksMode::NoQuirks), Some(ViewportConstraints { - size: TypedSize2D::new(320., 240.), + size: Size2D::new(320., 240.), initial_zoom: PinchZoomFactor::new(1.), min_zoom: None, |