зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #3438 - Upgrade Rust (from servo:rustup)
Source-Repo: https://github.com/servo/servo Source-Revision: 045328c8e94f5bdfcd67105c5dfa9209f4cd501c
This commit is contained in:
Родитель
ead29cd307
Коммит
e9f1c0bcd3
|
@ -8,7 +8,7 @@ dependencies = [
|
|||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"script 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -17,94 +17,94 @@ name = "alert"
|
|||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-alert#fdc24f13be8d8a2d15214ec228d166b3221b809e"
|
||||
dependencies = [
|
||||
"cocoa 0.1.0 (git+https://github.com/servo/rust-cocoa#f5da9ccfaeb701ff1b5ab9e1784e999d04530e8f)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"cocoa 0.1.0 (git+https://github.com/servo/rust-cocoa#cfbf6d9d5a68d3c8f424d678aa22096c49136e25)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "azure"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21"
|
||||
source = "git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be)",
|
||||
"core_text 0.1.0 (git+https://github.com/servo/rust-core-text#e2280222889c030df27ded9a378c14a0e31ab463)",
|
||||
"egl 0.1.0 (git+https://github.com/servo/rust-egl#48b85e30d557ab2ee536730a73dd86a8160d618b)",
|
||||
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype#fb15dd309750c8ec664b2c9f245cfcb06731872e)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"glfw 0.0.1 (git+https://github.com/servo/glfw-rs?ref=servo#dd1a111c827994886d2cdebf91a1838603256390)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#e29c5cd670a0b42e8ac50e7099c265c481640dd5)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#6a9919f8a912cc67571b891ba198d5325964a104)",
|
||||
"core_text 0.1.0 (git+https://github.com/servo/rust-core-text#1ad11072b31657eeccaf4879c6e98723d488bd3d)",
|
||||
"egl 0.1.0 (git+https://github.com/servo/rust-egl#88f2a13812ddbce2bf2317221663a61c31b3e220)",
|
||||
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype#0b03da276e4bdeae2300596dabc4ccb16733ad70)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"glfw 0.0.1 (git+https://github.com/servo/glfw-rs?ref=servo#955dbe919870b0536f79123232d87c0efe3c552e)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#ef89918471815dfced7aaf2f1594d5469f03eab7)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#6776e9c07feb149d34b087039ecf6b2c143e3afc)",
|
||||
"skia-sys 0.0.20130412 (git+https://github.com/servo/skia#6d696712962fd0d41120b7a414a48417da8e6a92)",
|
||||
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib#79904fb42ff8a0e888f70fae336fbf6c11f1e6c8)",
|
||||
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib#581d4faddec5188d3c3ae5307dbea28aab90644c)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "canvas"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cocoa"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-cocoa#f5da9ccfaeb701ff1b5ab9e1784e999d04530e8f"
|
||||
source = "git+https://github.com/servo/rust-cocoa#cfbf6d9d5a68d3c8f424d678aa22096c49136e25"
|
||||
|
||||
[[package]]
|
||||
name = "compositing"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"alert 0.1.0 (git+https://github.com/servo/rust-alert#fdc24f13be8d8a2d15214ec228d166b3221b809e)",
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be)",
|
||||
"core_text 0.1.0 (git+https://github.com/servo/rust-core-text#e2280222889c030df27ded9a378c14a0e31ab463)",
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#6a9919f8a912cc67571b891ba198d5325964a104)",
|
||||
"core_text 0.1.0 (git+https://github.com/servo/rust-core-text#1ad11072b31657eeccaf4879c6e98723d488bd3d)",
|
||||
"devtools 0.0.1",
|
||||
"devtools_traits 0.0.1",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"gfx 0.0.1",
|
||||
"glfw 0.0.1 (git+https://github.com/servo/glfw-rs?ref=servo#dd1a111c827994886d2cdebf91a1838603256390)",
|
||||
"glut 0.0.1 (git+https://github.com/servo/rust-glut#d351eed425464c58671c6ec33445ee896fd42ff1)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#e29c5cd670a0b42e8ac50e7099c265c481640dd5)",
|
||||
"glfw 0.0.1 (git+https://github.com/servo/glfw-rs?ref=servo#955dbe919870b0536f79123232d87c0efe3c552e)",
|
||||
"glut 0.0.1 (git+https://github.com/servo/rust-glut#01af0162ea0322ad1a40d6adb023a39813605949)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#ef89918471815dfced7aaf2f1594d5469f03eab7)",
|
||||
"layout_traits 0.0.1",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#f3640b37e71a02ee3e140e181cc9accb0a123e16)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#6776e9c07feb149d34b087039ecf6b2c143e3afc)",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#74418ffbf20e94b0d3bed4a9d004062a13342c79)",
|
||||
"script_traits 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core_foundation"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff"
|
||||
source = "git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a"
|
||||
|
||||
[[package]]
|
||||
name = "core_graphics"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be"
|
||||
source = "git+https://github.com/servo/rust-core-graphics#6a9919f8a912cc67571b891ba198d5325964a104"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "core_text"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-core-text#e2280222889c030df27ded9a378c14a0e31ab463"
|
||||
source = "git+https://github.com/servo/rust-core-text#1ad11072b31657eeccaf4879c6e98723d488bd3d"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#6a9919f8a912cc67571b891ba198d5325964a104)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cssparser"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-cssparser#42346400a6629b17a48d06f0a9b28ae498947c6f"
|
||||
source = "git+https://github.com/servo/rust-cssparser#fa619d4ffd6920dee6e7ea79f42d9cceb9015407"
|
||||
dependencies = [
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7)",
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -125,12 +125,12 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "egl"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-egl#48b85e30d557ab2ee536730a73dd86a8160d618b"
|
||||
source = "git+https://github.com/servo/rust-egl#88f2a13812ddbce2bf2317221663a61c31b3e220"
|
||||
|
||||
[[package]]
|
||||
name = "encoding"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7"
|
||||
source = "git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79"
|
||||
|
||||
[[package]]
|
||||
name = "expat-sys"
|
||||
|
@ -140,7 +140,7 @@ source = "git+https://github.com/servo/libexpat#da2ddaf78cbef836b8790807bb76b357
|
|||
[[package]]
|
||||
name = "fontconfig"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-fontconfig#6e02b6df7815dc4bf1f8ef20b926e717891f8544"
|
||||
source = "git+https://github.com/servo/rust-fontconfig#b16c1e12ecb74b1e4e9a9b23c2b98580a34cf201"
|
||||
dependencies = [
|
||||
"fontconfig-sys 2.11.1 (git+https://github.com/servo/libfontconfig#fcc324d2c8175d2e8e8c0aab032c03a404809f6d)",
|
||||
]
|
||||
|
@ -157,7 +157,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "freetype"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-freetype#fb15dd309750c8ec664b2c9f245cfcb06731872e"
|
||||
source = "git+https://github.com/servo/rust-freetype#0b03da276e4bdeae2300596dabc4ccb16733ad70"
|
||||
|
||||
[[package]]
|
||||
name = "freetype-sys"
|
||||
|
@ -167,60 +167,65 @@ source = "git+https://github.com/servo/libfreetype2#5b6499164106f094937565595c7b
|
|||
[[package]]
|
||||
name = "geom"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489"
|
||||
source = "git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692"
|
||||
|
||||
[[package]]
|
||||
name = "gfx"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#04bd18a4eb83a645a1a32326a33149ba2d0e81be)",
|
||||
"core_text 0.1.0 (git+https://github.com/servo/rust-core-text#e2280222889c030df27ded9a378c14a0e31ab463)",
|
||||
"fontconfig 0.1.0 (git+https://github.com/servo/rust-fontconfig#6e02b6df7815dc4bf1f8ef20b926e717891f8544)",
|
||||
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype#fb15dd309750c8ec664b2c9f245cfcb06731872e)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"harfbuzz 0.1.0 (git+https://github.com/servo/rust-harfbuzz#a502be3df659cd13bac0e62638f4dac3dfb2f52d)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#e29c5cd670a0b42e8ac50e7099c265c481640dd5)",
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a)",
|
||||
"core_graphics 0.1.0 (git+https://github.com/servo/rust-core-graphics#6a9919f8a912cc67571b891ba198d5325964a104)",
|
||||
"core_text 0.1.0 (git+https://github.com/servo/rust-core-text#1ad11072b31657eeccaf4879c6e98723d488bd3d)",
|
||||
"fontconfig 0.1.0 (git+https://github.com/servo/rust-fontconfig#b16c1e12ecb74b1e4e9a9b23c2b98580a34cf201)",
|
||||
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype#0b03da276e4bdeae2300596dabc4ccb16733ad70)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"harfbuzz 0.1.0 (git+https://github.com/servo/rust-harfbuzz#ad520942cc17232e1a40cdd8a99c2905623d35f6)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#ef89918471815dfced7aaf2f1594d5469f03eab7)",
|
||||
"macros 0.0.1",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#f3640b37e71a02ee3e140e181cc9accb0a123e16)",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#74418ffbf20e94b0d3bed4a9d004062a13342c79)",
|
||||
"stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image#f5022de4ad6bb474a03493d1f274dde9b0f1af0c)",
|
||||
"style 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glfw"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/glfw-rs?ref=servo#dd1a111c827994886d2cdebf91a1838603256390"
|
||||
source = "git+https://github.com/servo/glfw-rs?ref=servo#955dbe919870b0536f79123232d87c0efe3c552e"
|
||||
dependencies = [
|
||||
"link_glfw 0.1.0 (git+https://github.com/servo/glfw-rs?ref=servo#dd1a111c827994886d2cdebf91a1838603256390)",
|
||||
"semver 0.0.1 (git+https://github.com/rust-lang/semver#df163f7b22686493b037eee1f1f9d1a2742f9bbe)",
|
||||
"glfw-sys 3.0.4 (git+https://github.com/servo/glfw?ref=cargo-3.0.4#65a2b4721276589d9de24f6a9999a2db37286cae)",
|
||||
"semver 0.0.1 (git+https://github.com/rust-lang/semver#d04583a173395b76c1eaa15cc630a5f6f8f0ae10)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glfw-sys"
|
||||
version = "3.0.4"
|
||||
source = "git+https://github.com/servo/glfw?ref=cargo-3.0.4#65a2b4721276589d9de24f6a9999a2db37286cae"
|
||||
|
||||
[[package]]
|
||||
name = "glut"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/servo/rust-glut#d351eed425464c58671c6ec33445ee896fd42ff1"
|
||||
source = "git+https://github.com/servo/rust-glut#01af0162ea0322ad1a40d6adb023a39813605949"
|
||||
dependencies = [
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#6776e9c07feb149d34b087039ecf6b2c143e3afc)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "harfbuzz"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-harfbuzz#a502be3df659cd13bac0e62638f4dac3dfb2f52d"
|
||||
source = "git+https://github.com/servo/rust-harfbuzz#ad520942cc17232e1a40cdd8a99c2905623d35f6"
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.1.0-pre"
|
||||
source = "git+https://github.com/servo/rust-http?ref=servo#13be91d968d3e5ba032d19a3bb3438c2c4c6b372"
|
||||
source = "git+https://github.com/servo/rust-http?ref=servo#4fdedeea8fc77149adf51bb24a37372af21c25b7"
|
||||
dependencies = [
|
||||
"openssl 0.0.0 (git+https://github.com/sfackler/rust-openssl.git#cd40d25cb5721064c5c2002c41a616d2dba7399a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"openssl 0.0.0 (git+https://github.com/sfackler/rust-openssl.git#a495465b75ffb18ff2303c5a11a103e00a15a13d)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -242,17 +247,17 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "io_surface"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-io-surface#05f102273e16e9432245f813e5fe6280087e2b44"
|
||||
source = "git+https://github.com/servo/rust-io-surface#7038341220bd7e86e21118fac2cbc6bd50890e47"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#6776e9c07feb149d34b087039ecf6b2c143e3afc)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-mozjs#c9bd679428e8e83e585702a949d593bda8ac04d6"
|
||||
source = "git+https://github.com/servo/rust-mozjs#41fb0d80a5ed5614ca13a120cdb3281e599d4e04"
|
||||
dependencies = [
|
||||
"mozjs-sys 0.0.0 (git+https://github.com/servo/mozjs#47cd6a4e60c75642ba182f0df9a42b71ec7c2c88)",
|
||||
]
|
||||
|
@ -260,22 +265,22 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "layers"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-layers#e29c5cd670a0b42e8ac50e7099c265c481640dd5"
|
||||
source = "git+https://github.com/servo/rust-layers#ef89918471815dfced7aaf2f1594d5469f03eab7"
|
||||
dependencies = [
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"egl 0.1.0 (git+https://github.com/servo/rust-egl#48b85e30d557ab2ee536730a73dd86a8160d618b)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface#05f102273e16e9432245f813e5fe6280087e2b44)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a)",
|
||||
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib#79904fb42ff8a0e888f70fae336fbf6c11f1e6c8)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a)",
|
||||
"egl 0.1.0 (git+https://github.com/servo/rust-egl#88f2a13812ddbce2bf2317221663a61c31b3e220)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface#7038341220bd7e86e21118fac2cbc6bd50890e47)",
|
||||
"opengles 0.1.0 (git+https://github.com/servo/rust-opengles#6776e9c07feb149d34b087039ecf6b2c143e3afc)",
|
||||
"xlib 0.1.0 (git+https://github.com/servo/rust-xlib#581d4faddec5188d3c3ae5307dbea28aab90644c)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "layout"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"gfx 0.0.1",
|
||||
"layout_traits 0.0.1",
|
||||
"macros 0.0.1",
|
||||
|
@ -283,7 +288,7 @@ dependencies = [
|
|||
"script 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"style 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -299,9 +304,9 @@ dependencies = [
|
|||
]
|
||||
|
||||
[[package]]
|
||||
name = "link_glfw"
|
||||
name = "lazy_static"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/glfw-rs?ref=servo#dd1a111c827994886d2cdebf91a1838603256390"
|
||||
source = "git+https://github.com/Kimundi/lazy-static.rs#e62a65372f1dd9019e37eb9381d819edff80e360"
|
||||
|
||||
[[package]]
|
||||
name = "macros"
|
||||
|
@ -316,12 +321,12 @@ source = "git+https://github.com/servo/mozjs#47cd6a4e60c75642ba182f0df9a42b71ec7
|
|||
name = "msg"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#9aeaee0bceb3241d6efca07cc6b82747339ffbff)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface#05f102273e16e9432245f813e5fe6280087e2b44)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#e29c5cd670a0b42e8ac50e7099c265c481640dd5)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)",
|
||||
"core_foundation 0.1.0 (git+https://github.com/servo/rust-core-foundation#166a601ff3e0fc3a64ca1a9090d02c8d4f22b61a)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"io_surface 0.1.0 (git+https://github.com/servo/rust-io-surface#7038341220bd7e86e21118fac2cbc6bd50890e47)",
|
||||
"layers 0.1.0 (git+https://github.com/servo/rust-layers#ef89918471815dfced7aaf2f1594d5469f03eab7)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -329,23 +334,23 @@ dependencies = [
|
|||
name = "net"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo#13be91d968d3e5ba032d19a3bb3438c2c4c6b372)",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#f3640b37e71a02ee3e140e181cc9accb0a123e16)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo#4fdedeea8fc77149adf51bb24a37372af21c25b7)",
|
||||
"png 0.1.0 (git+https://github.com/servo/rust-png#74418ffbf20e94b0d3bed4a9d004062a13342c79)",
|
||||
"stb_image 0.1.0 (git+https://github.com/servo/rust-stb-image#f5022de4ad6bb474a03493d1f274dde9b0f1af0c)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "opengles"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-opengles#13cccda11011716fd75526a74dfd03122110f95a"
|
||||
source = "git+https://github.com/servo/rust-opengles#6776e9c07feb149d34b087039ecf6b2c143e3afc"
|
||||
|
||||
[[package]]
|
||||
name = "openssl"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/sfackler/rust-openssl.git#cd40d25cb5721064c5c2002c41a616d2dba7399a"
|
||||
source = "git+https://github.com/sfackler/rust-openssl.git#a495465b75ffb18ff2303c5a11a103e00a15a13d"
|
||||
|
||||
[[package]]
|
||||
name = "parserutils-sys"
|
||||
|
@ -355,17 +360,17 @@ source = "git+http://github.com/servo/libparserutils#651b636ba1214bceeb0907adb1e
|
|||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/sfackler/rust-phf#fa5d803428dd760287330571c919c7c5e11b2e1b"
|
||||
source = "git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0"
|
||||
|
||||
[[package]]
|
||||
name = "phf_mac"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/sfackler/rust-phf#fa5d803428dd760287330571c919c7c5e11b2e1b"
|
||||
source = "git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0"
|
||||
|
||||
[[package]]
|
||||
name = "png"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-png#f3640b37e71a02ee3e140e181cc9accb0a123e16"
|
||||
source = "git+https://github.com/servo/rust-png#74418ffbf20e94b0d3bed4a9d004062a13342c79"
|
||||
dependencies = [
|
||||
"png-sys 1.6.3 (git+https://github.com/servo/libpng?ref=servo#d01f32b4eb86904695efe7fc02b574f902e21a98)",
|
||||
]
|
||||
|
@ -380,20 +385,20 @@ name = "script"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"canvas 0.0.1",
|
||||
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser#42346400a6629b17a48d06f0a9b28ae498947c6f)",
|
||||
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser#fa619d4ffd6920dee6e7ea79f42d9cceb9015407)",
|
||||
"devtools_traits 0.0.1",
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"gfx 0.0.1",
|
||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo#13be91d968d3e5ba032d19a3bb3438c2c4c6b372)",
|
||||
"http 0.1.0-pre (git+https://github.com/servo/rust-http?ref=servo#4fdedeea8fc77149adf51bb24a37372af21c25b7)",
|
||||
"hubbub 0.1.0 (git+https://github.com/servo/rust-hubbub#c7f868e688de6e9cbdc26aa09292ed072bc2648b)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs#c9bd679428e8e83e585702a949d593bda8ac04d6)",
|
||||
"js 0.1.0 (git+https://github.com/servo/rust-mozjs#41fb0d80a5ed5614ca13a120cdb3281e599d4e04)",
|
||||
"macros 0.0.1",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"style 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -402,16 +407,16 @@ name = "script_traits"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"devtools_traits 0.0.1",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"msg 0.0.1",
|
||||
"net 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.0.1"
|
||||
source = "git+https://github.com/rust-lang/semver#df163f7b22686493b037eee1f1f9d1a2742f9bbe"
|
||||
source = "git+https://github.com/rust-lang/semver#d04583a173395b76c1eaa15cc630a5f6f8f0ae10"
|
||||
|
||||
[[package]]
|
||||
name = "skia-sys"
|
||||
|
@ -430,27 +435,31 @@ source = "git+https://github.com/servo/rust-stb-image#f5022de4ad6bb474a03493d1f2
|
|||
[[package]]
|
||||
name = "string_cache"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/servo/string-cache?ref=pre-rustup#37a5869d4130bf75e2f082bab54767d56d4ba63a"
|
||||
source = "git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb"
|
||||
dependencies = [
|
||||
"phf 0.0.0 (git+https://github.com/sfackler/rust-phf#fa5d803428dd760287330571c919c7c5e11b2e1b)",
|
||||
"phf_mac 0.0.0 (git+https://github.com/sfackler/rust-phf#fa5d803428dd760287330571c919c7c5e11b2e1b)",
|
||||
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache?ref=pre-rustup#37a5869d4130bf75e2f082bab54767d56d4ba63a)",
|
||||
"phf 0.0.0 (git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0)",
|
||||
"phf_mac 0.0.0 (git+https://github.com/sfackler/rust-phf#06254fdde7708630a6397c41c6c17ef81a4b66a0)",
|
||||
"string_cache_macros 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "string_cache_macros"
|
||||
version = "0.0.0"
|
||||
source = "git+https://github.com/servo/string-cache?ref=pre-rustup#37a5869d4130bf75e2f082bab54767d56d4ba63a"
|
||||
source = "git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb"
|
||||
dependencies = [
|
||||
"lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs#e62a65372f1dd9019e37eb9381d819edff80e360)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "style"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser#42346400a6629b17a48d06f0a9b28ae498947c6f)",
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"cssparser 0.1.0 (git+https://github.com/servo/rust-cssparser#fa619d4ffd6920dee6e7ea79f42d9cceb9015407)",
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"lazy_static 0.1.0 (git+https://github.com/Kimundi/lazy-static.rs#e62a65372f1dd9019e37eb9381d819edff80e360)",
|
||||
"macros 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
"util 0.0.1",
|
||||
]
|
||||
|
||||
|
@ -461,24 +470,24 @@ version = "0.0.1"
|
|||
[[package]]
|
||||
name = "url"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a"
|
||||
source = "git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379"
|
||||
dependencies = [
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#12b6610adff6eddc060691888c36017cd3ad57f7)",
|
||||
"encoding 0.1.0 (git+https://github.com/lifthrasiir/rust-encoding#35f0d70f65f73ba16f296f9ec675eddee661ba79)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "util"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#9c5567b79d8b87e8ef3b48c5842f453978035d21)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#2982b770db6e5e3270305e0fd6b8068f6f80a489)",
|
||||
"string_cache 0.0.0 (git+https://github.com/servo/string-cache?ref=pre-rustup#37a5869d4130bf75e2f082bab54767d56d4ba63a)",
|
||||
"azure 0.1.0 (git+https://github.com/servo/rust-azure#b357751c04a89a87e6ef1f0cebe5f20957dd112d)",
|
||||
"geom 0.1.0 (git+https://github.com/servo/rust-geom#50a294fd997f0c6eb43e9a58ad6e227fdc2a4692)",
|
||||
"string_cache 0.0.0 (git+https://github.com/servo/string-cache#b348bd00cc8991e1f25749be077c5bd9cec019bb)",
|
||||
"task_info 0.0.1",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#678bb4d52638b1cfdab78ef8e521566c9240fb1a)",
|
||||
"url 0.1.0 (git+https://github.com/servo/rust-url#bfdf809365600a7941a77524f9bb065886de3379)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xlib"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/servo/rust-xlib#79904fb42ff8a0e888f70fae336fbf6c11f1e6c8"
|
||||
source = "git+https://github.com/servo/rust-xlib#581d4faddec5188d3c3ae5307dbea28aab90644c"
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ use windowing::PinchZoomWindowEvent;
|
|||
use azure::azure_hl::SourceSurfaceMethods;
|
||||
use azure::azure_hl;
|
||||
use std::cmp;
|
||||
use std::time::duration::Duration;
|
||||
use geom::point::{Point2D, TypedPoint2D};
|
||||
use geom::rect::Rect;
|
||||
use geom::size::TypedSize2D;
|
||||
|
@ -223,7 +224,7 @@ impl IOCompositor {
|
|||
self.composite();
|
||||
}
|
||||
|
||||
sleep(10);
|
||||
sleep(Duration::milliseconds(10));
|
||||
|
||||
// If a pinch-zoom happened recently, ask for tiles at the new resolution
|
||||
if self.zoom_action && precise_time_s() - self.zoom_time > 0.3 {
|
||||
|
@ -316,7 +317,7 @@ impl IOCompositor {
|
|||
}
|
||||
|
||||
(Ok(Paint(pipeline_id, epoch, replies)), NotShuttingDown) => {
|
||||
for (layer_id, new_layer_buffer_set) in replies.move_iter() {
|
||||
for (layer_id, new_layer_buffer_set) in replies.into_iter() {
|
||||
self.paint(pipeline_id, layer_id, new_layer_buffer_set, epoch);
|
||||
}
|
||||
self.remove_outstanding_render_msg();
|
||||
|
@ -838,7 +839,7 @@ impl IOCompositor {
|
|||
let mut results:
|
||||
HashMap<PipelineId, (RenderChan, Vec<RenderRequest>)> = HashMap::new();
|
||||
|
||||
for (layer, mut layer_requests) in requests.move_iter() {
|
||||
for (layer, mut layer_requests) in requests.into_iter() {
|
||||
let pipeline_id = layer.extra_data.borrow().pipeline.id;
|
||||
let &(_, ref mut vec) = results.find_or_insert_with(pipeline_id, |_| {
|
||||
(layer.extra_data.borrow().pipeline.render_chan.clone(), Vec::new())
|
||||
|
@ -846,7 +847,7 @@ impl IOCompositor {
|
|||
|
||||
// All the BufferRequests are in layer/device coordinates, but the render task
|
||||
// wants to know the page coordinates. We scale them before sending them.
|
||||
for request in layer_requests.mut_iter() {
|
||||
for request in layer_requests.iter_mut() {
|
||||
request.page_rect = request.page_rect / scale.get();
|
||||
}
|
||||
|
||||
|
@ -894,7 +895,7 @@ impl IOCompositor {
|
|||
self.convert_buffer_requests_to_pipeline_requests_map(layers_and_requests);
|
||||
|
||||
let mut num_render_msgs_sent = 0;
|
||||
for (_pipeline_id, (chan, requests)) in pipeline_requests.move_iter() {
|
||||
for (_pipeline_id, (chan, requests)) in pipeline_requests.into_iter() {
|
||||
num_render_msgs_sent += 1;
|
||||
let _ = chan.send_opt(RenderMsg(requests));
|
||||
}
|
||||
|
@ -948,7 +949,7 @@ impl IOCompositor {
|
|||
// We must read from the back buffer (ie, before self.window.present()) as
|
||||
// OpenGL ES 2 does not have glReadBuffer().
|
||||
let (width, height) = (self.window_size.width.get(), self.window_size.height.get());
|
||||
let path = from_str::<Path>(self.opts.output_file.get_ref().as_slice()).unwrap();
|
||||
let path = from_str::<Path>(self.opts.output_file.as_ref().unwrap().as_slice()).unwrap();
|
||||
let mut pixels = gl2::read_pixels(0, 0,
|
||||
width as gl2::GLsizei,
|
||||
height as gl2::GLsizei,
|
||||
|
@ -961,7 +962,7 @@ impl IOCompositor {
|
|||
let src_start = (height - y - 1) * stride;
|
||||
unsafe {
|
||||
let src_slice = orig_pixels.slice(src_start, src_start + stride);
|
||||
pixels.mut_slice(dst_start, dst_start + stride)
|
||||
pixels.slice_mut(dst_start, dst_start + stride)
|
||||
.copy_memory(src_slice.slice_to(stride));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ impl CompositorData {
|
|||
}
|
||||
|
||||
{
|
||||
for buffer in new_buffers.buffers.move_iter().rev() {
|
||||
for buffer in new_buffers.buffers.into_iter().rev() {
|
||||
layer.add_buffer(buffer);
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ impl CompositorData {
|
|||
// We have no way of knowing without a race whether the render task is even up and
|
||||
// running, but mark the buffers as not leaking. If the render task died, then the
|
||||
// buffers are going to be cleaned up.
|
||||
for buffer in buffers.mut_iter() {
|
||||
for buffer in buffers.iter_mut() {
|
||||
buffer.mark_wont_leak()
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ impl CompositorData {
|
|||
/// This is used during shutdown, when we know the render task is going away.
|
||||
pub fn forget_all_tiles(layer: Rc<Layer<CompositorData>>) {
|
||||
let tiles = layer.collect_buffers();
|
||||
for tile in tiles.move_iter() {
|
||||
for tile in tiles.into_iter() {
|
||||
let mut tile = tile;
|
||||
tile.mark_wont_leak()
|
||||
}
|
||||
|
|
|
@ -56,8 +56,8 @@ impl ScriptListener for CompositorChan {
|
|||
port.recv();
|
||||
}
|
||||
|
||||
fn dup(&self) -> Box<ScriptListener> {
|
||||
box self.clone() as Box<ScriptListener>
|
||||
fn dup(&self) -> Box<ScriptListener+'static> {
|
||||
box self.clone() as Box<ScriptListener+'static>
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -116,9 +116,9 @@ impl FrameTreeTraversal for Rc<FrameTree> {
|
|||
fn replace_child(&self, id: PipelineId, new_child: Rc<FrameTree>) -> ReplaceResult {
|
||||
for frame_tree in self.iter() {
|
||||
let mut children = frame_tree.children.borrow_mut();
|
||||
let mut child = children.mut_iter()
|
||||
let mut child = children.iter_mut()
|
||||
.find(|child| child.frame_tree.pipeline.id == id);
|
||||
for child in child.mut_iter() {
|
||||
for child in child.iter_mut() {
|
||||
*new_child.parent.borrow_mut() = child.frame_tree.parent.borrow().clone();
|
||||
return ReplacedNode(replace(&mut child.frame_tree, new_child));
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ impl Iterator<Rc<FrameTree>> for FrameTreeIterator {
|
|||
fn next(&mut self) -> Option<Rc<FrameTree>> {
|
||||
if !self.stack.is_empty() {
|
||||
let next = self.stack.pop();
|
||||
for cft in next.get_ref().children.borrow().iter() {
|
||||
for cft in next.as_ref().unwrap().children.borrow().iter() {
|
||||
self.stack.push(cft.frame_tree.clone());
|
||||
}
|
||||
Some(next.unwrap())
|
||||
|
@ -190,14 +190,14 @@ impl NavigationContext {
|
|||
* when it is known that there exists either a previous page or a next page. */
|
||||
|
||||
fn back(&mut self) -> Rc<FrameTree> {
|
||||
self.next.push(self.current.take_unwrap());
|
||||
self.next.push(self.current.take().unwrap());
|
||||
let prev = self.previous.pop().unwrap();
|
||||
self.current = Some(prev.clone());
|
||||
prev
|
||||
}
|
||||
|
||||
fn forward(&mut self) -> Rc<FrameTree> {
|
||||
self.previous.push(self.current.take_unwrap());
|
||||
self.previous.push(self.current.take().unwrap());
|
||||
let next = self.next.pop().unwrap();
|
||||
self.current = Some(next.clone());
|
||||
next
|
||||
|
@ -208,7 +208,7 @@ impl NavigationContext {
|
|||
debug!("navigating to {:?}", frame_tree.pipeline.id);
|
||||
let evicted = replace(&mut self.next, vec!());
|
||||
if self.current.is_some() {
|
||||
self.previous.push(self.current.take_unwrap());
|
||||
self.previous.push(self.current.take().unwrap());
|
||||
}
|
||||
self.current = Some(frame_tree.clone());
|
||||
evicted
|
||||
|
@ -333,7 +333,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
let matching_pending_frames = self.pending_frames.iter().filter_map(|frame_change| {
|
||||
frame_change.after.find(pipeline_id)
|
||||
});
|
||||
matching_navi_frames.move_iter().chain(matching_pending_frames).collect()
|
||||
matching_navi_frames.into_iter().chain(matching_pending_frames).collect()
|
||||
}
|
||||
|
||||
/// Handles loading pages, navigation, and granting access to the compositor
|
||||
|
@ -527,7 +527,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
let source_frame = current_frame.find(pipeline_id);
|
||||
for source_frame in source_frame.iter() {
|
||||
let mut children = source_frame.children.borrow_mut();
|
||||
let found_child = children.mut_iter().find(|child| subpage_eq(child));
|
||||
let found_child = children.iter_mut().find(|child| subpage_eq(child));
|
||||
found_child.map(|child| update_child_rect(child, true));
|
||||
}
|
||||
}
|
||||
|
@ -535,7 +535,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
// Update all frames with matching pipeline- and subpage-ids
|
||||
for frame_tree in frames.iter() {
|
||||
let mut children = frame_tree.children.borrow_mut();
|
||||
let found_child = children.mut_iter().find(|child| subpage_eq(child));
|
||||
let found_child = children.iter_mut().find(|child| subpage_eq(child));
|
||||
found_child.map(|child| update_child_rect(child, false));
|
||||
}
|
||||
}
|
||||
|
@ -612,7 +612,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
fn handle_load_url_msg(&mut self, source_id: PipelineId, url: Url) {
|
||||
debug!("Constellation: received message to load {:s}", url.to_string());
|
||||
// Make sure no pending page would be overridden.
|
||||
let source_frame = self.current_frame().get_ref().find(source_id).expect(
|
||||
let source_frame = self.current_frame().as_ref().unwrap().find(source_id).expect(
|
||||
"Constellation: received a LoadUrlMsg from a pipeline_id associated
|
||||
with a pipeline not in the active frame tree. This should be
|
||||
impossible.");
|
||||
|
@ -621,7 +621,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
let old_id = frame_change.before.expect("Constellation: Received load msg
|
||||
from pipeline, but there is no currently active page. This should
|
||||
be impossible.");
|
||||
let changing_frame = self.current_frame().get_ref().find(old_id).expect("Constellation:
|
||||
let changing_frame = self.current_frame().as_ref().unwrap().find(old_id).expect("Constellation:
|
||||
Pending change has non-active source pipeline. This should be
|
||||
impossible.");
|
||||
if changing_frame.contains(source_id) || source_frame.contains(old_id) {
|
||||
|
@ -663,7 +663,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
debug!("no next page to navigate to");
|
||||
return;
|
||||
} else {
|
||||
let old = self.current_frame().get_ref();
|
||||
let old = self.current_frame().as_ref().unwrap();
|
||||
for frame in old.iter() {
|
||||
frame.pipeline.revoke_paint_permission();
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
debug!("no previous page to navigate to");
|
||||
return;
|
||||
} else {
|
||||
let old = self.current_frame().get_ref();
|
||||
let old = self.current_frame().as_ref().unwrap();
|
||||
for frame in old.iter() {
|
||||
frame.pipeline.revoke_paint_permission();
|
||||
}
|
||||
|
@ -721,7 +721,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
// Create the next frame tree that will be given to the compositor
|
||||
let next_frame_tree = if to_add.parent.borrow().is_some() {
|
||||
// NOTE: work around borrowchk issues
|
||||
self.current_frame().get_ref().clone()
|
||||
self.current_frame().as_ref().unwrap().clone()
|
||||
} else {
|
||||
to_add.clone()
|
||||
};
|
||||
|
@ -730,7 +730,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
|
|||
match frame_change.before {
|
||||
Some(revoke_id) if self.current_frame().is_some() => {
|
||||
debug!("Constellation: revoking permission from {:?}", revoke_id);
|
||||
let current_frame = self.current_frame().get_ref();
|
||||
let current_frame = self.current_frame().as_ref().unwrap();
|
||||
|
||||
let to_revoke = current_frame.find(revoke_id).expect(
|
||||
"Constellation: pending frame change refers to an old \
|
||||
|
|
|
@ -28,10 +28,10 @@ extern crate layout_traits;
|
|||
extern crate opengles;
|
||||
extern crate png;
|
||||
extern crate script_traits;
|
||||
extern crate servo_msg = "msg";
|
||||
extern crate servo_net = "net";
|
||||
extern crate "msg" as servo_msg;
|
||||
extern crate "net" as servo_net;
|
||||
#[phase(plugin, link)]
|
||||
extern crate servo_util = "util";
|
||||
extern crate "util" as servo_util;
|
||||
|
||||
extern crate libc;
|
||||
extern crate time;
|
||||
|
|
|
@ -8,7 +8,7 @@ use std::any::{Any, AnyRefExt, AnyMutRefExt};
|
|||
use std::collections::hashmap::HashMap;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::io::TcpStream;
|
||||
use std::mem::{transmute, transmute_copy};
|
||||
use std::mem::{transmute, transmute_copy, replace};
|
||||
use std::raw::TraitObject;
|
||||
use serialize::json;
|
||||
|
||||
|
@ -24,7 +24,7 @@ pub trait Actor: Any {
|
|||
fn name(&self) -> String;
|
||||
}
|
||||
|
||||
impl<'a> AnyMutRefExt<'a> for &'a mut Actor {
|
||||
impl<'a> AnyMutRefExt<'a> for &'a mut Actor + 'a {
|
||||
fn downcast_mut<T: 'static>(self) -> Option<&'a mut T> {
|
||||
if self.is::<T>() {
|
||||
unsafe {
|
||||
|
@ -40,7 +40,7 @@ impl<'a> AnyMutRefExt<'a> for &'a mut Actor {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> AnyRefExt<'a> for &'a Actor {
|
||||
impl<'a> AnyRefExt<'a> for &'a Actor + 'a {
|
||||
fn is<T: 'static>(self) -> bool {
|
||||
//FIXME: This implementation is bogus since get_type_id is private now.
|
||||
// However, this implementation is only needed so long as there's a Rust bug
|
||||
|
@ -162,10 +162,9 @@ impl ActorRegistry {
|
|||
}
|
||||
}
|
||||
}
|
||||
let mut new_actors = self.new_actors.borrow_mut();
|
||||
for &actor in new_actors.iter() {
|
||||
let mut new_actors = replace(&mut *self.new_actors.borrow_mut(), vec!());
|
||||
for actor in new_actors.into_iter() {
|
||||
self.actors.insert(actor.name().to_string(), actor);
|
||||
}
|
||||
new_actors.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,10 +22,9 @@ extern crate collections;
|
|||
extern crate core;
|
||||
extern crate devtools_traits;
|
||||
extern crate debug;
|
||||
extern crate std;
|
||||
extern crate serialize;
|
||||
extern crate sync;
|
||||
extern crate servo_msg = "msg";
|
||||
extern crate "msg" as servo_msg;
|
||||
|
||||
use actor::{Actor, ActorRegistry};
|
||||
use actors::console::ConsoleActor;
|
||||
|
@ -181,8 +180,8 @@ fn run_server(port: Receiver<DevtoolsControlMsg>) {
|
|||
//TODO: make constellation send ServerExitMsg on shutdown.
|
||||
|
||||
// accept connections and process them, spawning a new tasks for each one
|
||||
for stream in acceptor.incoming() {
|
||||
match stream {
|
||||
loop {
|
||||
match acceptor.accept() {
|
||||
Err(ref e) if e.kind == TimedOut => {
|
||||
match port.try_recv() {
|
||||
Ok(ServerExitMsg) | Err(Disconnected) => break,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#![comment = "The Servo Parallel Browser Project"]
|
||||
#![license = "MPL"]
|
||||
|
||||
extern crate servo_msg = "msg";
|
||||
extern crate "msg" as servo_msg;
|
||||
|
||||
/// This module contains shared types and messages for use by devtools/script.
|
||||
/// The traits are here instead of in script so that the devtools crate can be
|
||||
|
|
|
@ -103,7 +103,7 @@ impl BufferMap {
|
|||
};
|
||||
if {
|
||||
let list = &mut self.map.get_mut(&old_key).buffers;
|
||||
let condemned_buffer = list.pop().take_unwrap();
|
||||
let condemned_buffer = list.pop().take().unwrap();
|
||||
self.mem -= condemned_buffer.get_mem();
|
||||
condemned_buffer.destroy(graphics_context);
|
||||
list.is_empty()
|
||||
|
@ -126,7 +126,7 @@ impl BufferMap {
|
|||
buffer_val.last_action = self.counter;
|
||||
self.counter += 1;
|
||||
|
||||
let buffer = buffer_val.buffers.pop().take_unwrap();
|
||||
let buffer = buffer_val.buffers.pop().take().unwrap();
|
||||
self.mem -= buffer.get_mem();
|
||||
if buffer_val.buffers.is_empty() {
|
||||
flag = true;
|
||||
|
@ -146,8 +146,8 @@ impl BufferMap {
|
|||
/// Destroys all buffers.
|
||||
pub fn clear(&mut self, graphics_context: &NativePaintingGraphicsContext) {
|
||||
let map = mem::replace(&mut self.map, HashMap::new());
|
||||
for (_, value) in map.move_iter() {
|
||||
for tile in value.buffers.move_iter() {
|
||||
for (_, value) in map.into_iter() {
|
||||
for tile in value.buffers.into_iter() {
|
||||
tile.destroy(graphics_context)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use azure::AzFloat;
|
||||
use AzColor = azure::azure_hl::Color;
|
||||
use azure::azure_hl::Color as AzColor;
|
||||
|
||||
pub type Color = AzColor;
|
||||
|
||||
|
|
|
@ -134,7 +134,7 @@ impl ScaledFontExtensionMethods for ScaledFont {
|
|||
&mut glyphbuf,
|
||||
azure_pattern,
|
||||
&mut options,
|
||||
ptr::mut_null());
|
||||
ptr::null_mut());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +198,7 @@ impl StackingContext {
|
|||
positioned_descendants: Vec::new(),
|
||||
};
|
||||
|
||||
for item in list.move_iter() {
|
||||
for item in list.into_iter() {
|
||||
match item {
|
||||
ClipDisplayItemClass(box ClipDisplayItem {
|
||||
base: base,
|
||||
|
@ -219,7 +219,7 @@ impl StackingContext {
|
|||
ContentStackingLevel => stacking_context.content.push(item),
|
||||
PositionedDescendantStackingLevel(z_index) => {
|
||||
match stacking_context.positioned_descendants
|
||||
.mut_iter()
|
||||
.iter_mut()
|
||||
.find(|& &(z, _)| z_index == z) {
|
||||
Some(&(_, ref mut my_list)) => {
|
||||
my_list.push(item);
|
||||
|
@ -270,9 +270,9 @@ impl StackingContext {
|
|||
push(&mut self.floats, floats, FloatStackingLevel);
|
||||
push(&mut self.content, content, ContentStackingLevel);
|
||||
|
||||
for (z_index, list) in positioned_descendants.move_iter() {
|
||||
for (z_index, list) in positioned_descendants.into_iter() {
|
||||
match self.positioned_descendants
|
||||
.mut_iter()
|
||||
.iter_mut()
|
||||
.find(|& &(existing_z_index, _)| z_index == existing_z_index) {
|
||||
Some(&(_, ref mut existing_list)) => {
|
||||
push(existing_list, list, PositionedDescendantStackingLevel(z_index));
|
||||
|
@ -386,7 +386,7 @@ impl DisplayList {
|
|||
// TODO(pcwalton): Sort positioned children according to z-index.
|
||||
|
||||
// Step 3: Positioned descendants with negative z-indices.
|
||||
for &(ref mut z_index, ref mut list) in positioned_descendants.mut_iter() {
|
||||
for &(ref mut z_index, ref mut list) in positioned_descendants.iter_mut() {
|
||||
if *z_index < 0 {
|
||||
result.push_all_move(mem::replace(list, DisplayList::new()))
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ impl DisplayList {
|
|||
result.push_all_move(content);
|
||||
|
||||
// Steps 8 and 9: Positioned descendants with nonnegative z-indices.
|
||||
for &(ref mut z_index, ref mut list) in positioned_descendants.mut_iter() {
|
||||
for &(ref mut z_index, ref mut list) in positioned_descendants.iter_mut() {
|
||||
if *z_index >= 0 {
|
||||
result.push_all_move(mem::replace(list, DisplayList::new()))
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ impl DisplayList {
|
|||
|
||||
/// Sets the stacking level for this display list and all its subitems.
|
||||
fn set_stacking_level(&mut self, new_level: StackingLevel) {
|
||||
for item in self.list.mut_iter() {
|
||||
for item in self.list.iter_mut() {
|
||||
item.mut_base().level = new_level;
|
||||
match item.mut_sublist() {
|
||||
None => {}
|
||||
|
|
|
@ -115,7 +115,7 @@ impl Font {
|
|||
let shaper = &self.shaper;
|
||||
self.shape_cache.find_or_create(&text, |txt| {
|
||||
let mut glyphs = GlyphStore::new(text.as_slice().char_len() as int, is_whitespace);
|
||||
shaper.get_ref().shape_text(txt.as_slice(), &mut glyphs);
|
||||
shaper.as_ref().unwrap().shape_text(txt.as_slice(), &mut glyphs);
|
||||
Arc::new(glyphs)
|
||||
})
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ impl Font {
|
|||
|
||||
let shaper = Shaper::new(self);
|
||||
self.shaper = Some(shaper);
|
||||
self.shaper.get_ref()
|
||||
self.shaper.as_ref().unwrap()
|
||||
}
|
||||
|
||||
pub fn get_table_for_tag(&self, tag: FontTableTag) -> Option<FontTable> {
|
||||
|
|
|
@ -36,7 +36,7 @@ impl FontFamily {
|
|||
|
||||
// TODO(Issue #190): if not in the fast path above, do
|
||||
// expensive matching of weights, etc.
|
||||
for template in self.templates.mut_iter() {
|
||||
for template in self.templates.iter_mut() {
|
||||
let maybe_template = template.get_if_matches(fctx, desc);
|
||||
if maybe_template.is_some() {
|
||||
return maybe_template;
|
||||
|
@ -46,7 +46,7 @@ impl FontFamily {
|
|||
// If a request is made for a font family that exists,
|
||||
// pick the first valid font in the family if we failed
|
||||
// to find an exact match for the descriptor.
|
||||
for template in self.templates.mut_iter() {
|
||||
for template in self.templates.iter_mut() {
|
||||
let maybe_template = template.get();
|
||||
if maybe_template.is_some() {
|
||||
return maybe_template;
|
||||
|
|
|
@ -34,7 +34,7 @@ fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt
|
|||
|
||||
#[cfg(target_os="macos")]
|
||||
fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt_size: f64) -> ScaledFont {
|
||||
let cgfont = template.ctfont.get_ref().copy_to_CGFont();
|
||||
let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont();
|
||||
ScaledFont::new(backend, &cgfont, pt_size as AzFloat)
|
||||
}
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@ extern crate stb_image;
|
|||
extern crate png;
|
||||
extern crate serialize;
|
||||
#[phase(plugin)]
|
||||
extern crate servo_macros = "macros";
|
||||
extern crate servo_net = "net";
|
||||
extern crate "macros" as servo_macros;
|
||||
extern crate "net" as servo_net;
|
||||
#[phase(plugin, link)]
|
||||
extern crate servo_util = "util";
|
||||
extern crate servo_msg = "msg";
|
||||
extern crate "util" as servo_util;
|
||||
extern crate "msg" as servo_msg;
|
||||
extern crate style;
|
||||
extern crate sync;
|
||||
extern crate url;
|
||||
|
|
|
@ -96,7 +96,7 @@ impl FontHandleMethods for FontHandle {
|
|||
fn create_face_from_buffer(lib: FT_Library, cbuf: *const u8, cbuflen: uint, pt_size: Option<f64>)
|
||||
-> Result<FT_Face, ()> {
|
||||
unsafe {
|
||||
let mut face: FT_Face = ptr::mut_null();
|
||||
let mut face: FT_Face = ptr::null_mut();
|
||||
let face_index = 0 as FT_Long;
|
||||
let result = FT_New_Memory_Face(lib, cbuf, cbuflen as FT_Long,
|
||||
face_index, &mut face);
|
||||
|
|
|
@ -61,13 +61,13 @@ impl FontContextHandle {
|
|||
let ptr = libc::malloc(mem::size_of::<struct_FT_MemoryRec_>() as size_t);
|
||||
let allocator: &mut struct_FT_MemoryRec_ = mem::transmute(ptr);
|
||||
ptr::write(allocator, struct_FT_MemoryRec_ {
|
||||
user: ptr::mut_null(),
|
||||
user: ptr::null_mut(),
|
||||
alloc: ft_alloc,
|
||||
free: ft_free,
|
||||
realloc: ft_realloc,
|
||||
});
|
||||
|
||||
let mut ctx: FT_Library = ptr::mut_null();
|
||||
let mut ctx: FT_Library = ptr::null_mut();
|
||||
|
||||
let result = FT_New_Library(ptr as FT_Memory, &mut ctx);
|
||||
if !result.succeeded() { fail!("Unable to initialize FreeType library"); }
|
||||
|
|
|
@ -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 http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#![allow(uppercase_variables)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
extern crate freetype;
|
||||
extern crate fontconfig;
|
||||
|
@ -35,7 +35,7 @@ pub fn get_available_families(callback: |String|) {
|
|||
let fontSet = FcConfigGetFonts(config, FcSetSystem);
|
||||
for i in range(0, (*fontSet).nfont as int) {
|
||||
let font = (*fontSet).fonts.offset(i);
|
||||
let mut family: *mut FcChar8 = ptr::mut_null();
|
||||
let mut family: *mut FcChar8 = ptr::null_mut();
|
||||
let mut v: c_int = 0;
|
||||
while FcPatternGetString(*font, FC_FAMILY.as_ptr() as *mut i8, v, &mut family) == FcResultMatch {
|
||||
let family_name = string::raw::from_buf(family as *const i8 as *const u8);
|
||||
|
@ -71,7 +71,7 @@ pub fn get_variations_for_family(family_name: &str, callback: |String|) {
|
|||
|
||||
for i in range(0, (*matches).nfont as int) {
|
||||
let font = (*matches).fonts.offset(i);
|
||||
let mut file: *mut FcChar8 = ptr::mut_null();
|
||||
let mut file: *mut FcChar8 = ptr::null_mut();
|
||||
let file = if FcPatternGetString(*font, FC_FILE.as_ptr() as *mut i8, 0, &mut file) == FcResultMatch {
|
||||
string::raw::from_buf(file as *const i8 as *const u8)
|
||||
} else {
|
||||
|
@ -103,14 +103,14 @@ pub fn get_system_default_family(generic_name: &str) -> Option<String> {
|
|||
unsafe {
|
||||
let pattern = FcNameParse(generic_name_ptr as *mut FcChar8);
|
||||
|
||||
FcConfigSubstitute(ptr::mut_null(), pattern, FcMatchPattern);
|
||||
FcConfigSubstitute(ptr::null_mut(), pattern, FcMatchPattern);
|
||||
FcDefaultSubstitute(pattern);
|
||||
|
||||
let mut result = 0;
|
||||
let family_match = FcFontMatch(ptr::mut_null(), pattern, &mut result);
|
||||
let family_match = FcFontMatch(ptr::null_mut(), pattern, &mut result);
|
||||
|
||||
let family_name = if result == FcResultMatch {
|
||||
let mut match_string: *mut FcChar8 = ptr::mut_null();
|
||||
let mut match_string: *mut FcChar8 = ptr::null_mut();
|
||||
FcPatternGetString(family_match, FC_FAMILY.as_ptr() as *mut i8, 0, &mut match_string);
|
||||
let result = string::raw::from_buf(match_string as *const i8 as *const u8);
|
||||
FcPatternDestroy(family_match);
|
||||
|
|
|
@ -138,7 +138,7 @@ impl FontHandleMethods for FontHandle {
|
|||
let glyphs = [glyph as CGGlyph];
|
||||
let advance = self.ctfont.get_advances_for_glyphs(kCTFontDefaultOrientation,
|
||||
&glyphs[0],
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
1);
|
||||
Some(advance as FractionalPixel)
|
||||
}
|
||||
|
|
|
@ -237,7 +237,7 @@ impl<C:RenderListener + Send> RenderTask<C> {
|
|||
let mut replies = Vec::new();
|
||||
self.compositor.set_render_state(self.id, RenderingRenderState);
|
||||
for RenderRequest { buffer_requests, scale, layer_id, epoch }
|
||||
in requests.move_iter() {
|
||||
in requests.into_iter() {
|
||||
if self.epoch == epoch {
|
||||
self.render(&mut replies, buffer_requests, scale, layer_id);
|
||||
} else {
|
||||
|
@ -251,7 +251,7 @@ impl<C:RenderListener + Send> RenderTask<C> {
|
|||
self.compositor.paint(self.id, self.epoch, replies);
|
||||
}
|
||||
UnusedBufferMsg(unused_buffers) => {
|
||||
for buffer in unused_buffers.move_iter().rev() {
|
||||
for buffer in unused_buffers.into_iter().rev() {
|
||||
self.buffer_map.insert(native_graphics_context!(self), buffer);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,8 +156,8 @@ fn is_simple_glyph_id(id: GlyphId) -> bool {
|
|||
}
|
||||
|
||||
fn is_simple_advance(advance: Au) -> bool {
|
||||
let unsignedAu = advance.to_u32().unwrap();
|
||||
(unsignedAu & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT as uint)) == unsignedAu
|
||||
let unsigned_au = advance.to_u32().unwrap();
|
||||
(unsigned_au & (GLYPH_ADVANCE_MASK >> GLYPH_ADVANCE_SHIFT as uint)) == unsigned_au
|
||||
}
|
||||
|
||||
type DetailedGlyphCount = u16;
|
||||
|
@ -700,7 +700,7 @@ impl<'a> GlyphIterator<'a> {
|
|||
// Slow path when there is a glyph range.
|
||||
#[inline(never)]
|
||||
fn next_glyph_range(&mut self) -> Option<(CharIndex, GlyphInfo<'a>)> {
|
||||
match self.glyph_range.get_mut_ref().next() {
|
||||
match self.glyph_range.as_mut().unwrap().next() {
|
||||
Some(j) => Some((self.char_index,
|
||||
DetailGlyphInfo(self.store, self.char_index, j.get() as u16 /* ??? */))),
|
||||
None => {
|
||||
|
|
|
@ -175,9 +175,9 @@ impl Shaper {
|
|||
// configure static function callbacks.
|
||||
// NB. This funcs structure could be reused globally, as it never changes.
|
||||
let hb_funcs: *mut hb_font_funcs_t = hb_font_funcs_create();
|
||||
hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::mut_null(), None);
|
||||
hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::mut_null(), None);
|
||||
hb_font_funcs_set_glyph_h_kerning_func(hb_funcs, glyph_h_kerning_func, ptr::mut_null(), ptr::mut_null());
|
||||
hb_font_funcs_set_glyph_func(hb_funcs, glyph_func, ptr::null_mut(), None);
|
||||
hb_font_funcs_set_glyph_h_advance_func(hb_funcs, glyph_h_advance_func, ptr::null_mut(), None);
|
||||
hb_font_funcs_set_glyph_h_kerning_func(hb_funcs, glyph_h_kerning_func, ptr::null_mut(), ptr::null_mut());
|
||||
hb_font_set_funcs(hb_font, hb_funcs, font_ptr as *mut c_void, None);
|
||||
|
||||
Shaper {
|
||||
|
@ -211,7 +211,7 @@ impl ShaperMethods for Shaper {
|
|||
0,
|
||||
text.len() as c_int);
|
||||
|
||||
hb_shape(self.hb_font, hb_buffer, ptr::mut_null(), 0);
|
||||
hb_shape(self.hb_font, hb_buffer, ptr::null_mut(), 0);
|
||||
self.save_glyph_results(text, glyphs, hb_buffer);
|
||||
hb_buffer_destroy(hb_buffer);
|
||||
}
|
||||
|
@ -241,15 +241,15 @@ impl Shaper {
|
|||
}
|
||||
|
||||
// make map of what chars have glyphs
|
||||
let mut byteToGlyph: Vec<i32>;
|
||||
let mut byte_to_glyph: Vec<i32>;
|
||||
|
||||
// fast path: all chars are single-byte.
|
||||
if byte_max == char_max {
|
||||
byteToGlyph = Vec::from_elem(byte_max as uint, NO_GLYPH);
|
||||
byte_to_glyph = Vec::from_elem(byte_max as uint, NO_GLYPH);
|
||||
} else {
|
||||
byteToGlyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE);
|
||||
byte_to_glyph = Vec::from_elem(byte_max as uint, CONTINUATION_BYTE);
|
||||
for (i, _) in text.char_indices() {
|
||||
*byteToGlyph.get_mut(i) = NO_GLYPH;
|
||||
*byte_to_glyph.get_mut(i) = NO_GLYPH;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -258,10 +258,10 @@ impl Shaper {
|
|||
// loc refers to a *byte* offset within the utf8 string.
|
||||
let loc = glyph_data.byte_offset_of_glyph(i);
|
||||
if loc < byte_max {
|
||||
assert!(*byteToGlyph.get(loc as uint) != CONTINUATION_BYTE);
|
||||
*byteToGlyph.get_mut(loc as uint) = i as i32;
|
||||
assert!(*byte_to_glyph.get(loc as uint) != CONTINUATION_BYTE);
|
||||
*byte_to_glyph.get_mut(loc as uint) = i as i32;
|
||||
} else {
|
||||
debug!("ERROR: tried to set out of range byteToGlyph: idx={}, glyph idx={}",
|
||||
debug!("ERROR: tried to set out of range byte_to_glyph: idx={}, glyph idx={}",
|
||||
loc,
|
||||
i);
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ impl Shaper {
|
|||
debug!("text: {:s}", text);
|
||||
debug!("(char idx): char->(glyph index):");
|
||||
for (i, ch) in text.char_indices() {
|
||||
debug!("{}: {} --> {:d}", i, ch, *byteToGlyph.get(i) as int);
|
||||
debug!("{}: {} --> {:d}", i, ch, *byte_to_glyph.get(i) as int);
|
||||
}
|
||||
|
||||
// some helpers
|
||||
|
@ -303,7 +303,7 @@ impl Shaper {
|
|||
char_byte_span.begin(), char_byte_span.length(), glyph_span.begin());
|
||||
|
||||
while char_byte_span.end() != byte_max &&
|
||||
byteToGlyph[char_byte_span.end() as uint] == NO_GLYPH {
|
||||
byte_to_glyph[char_byte_span.end() as uint] == NO_GLYPH {
|
||||
debug!("Extending char byte span to include byte offset={} with no associated \
|
||||
glyph", char_byte_span.end());
|
||||
let range = text.char_range_at(char_byte_span.end() as uint);
|
||||
|
@ -315,8 +315,8 @@ impl Shaper {
|
|||
// in cases where one char made several glyphs and left some unassociated chars.
|
||||
let mut max_glyph_idx = glyph_span.end();
|
||||
for i in char_byte_span.each_index() {
|
||||
if byteToGlyph[i as uint] > NO_GLYPH {
|
||||
max_glyph_idx = cmp::max(byteToGlyph[i as uint] as int + 1, max_glyph_idx);
|
||||
if byte_to_glyph[i as uint] > NO_GLYPH {
|
||||
max_glyph_idx = cmp::max(byte_to_glyph[i as uint] as int + 1, max_glyph_idx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -375,7 +375,7 @@ impl Shaper {
|
|||
let mut covered_byte_span = char_byte_span.clone();
|
||||
// extend, clipping at end of text range.
|
||||
while covered_byte_span.end() < byte_max
|
||||
&& byteToGlyph[covered_byte_span.end() as uint] == NO_GLYPH {
|
||||
&& byte_to_glyph[covered_byte_span.end() as uint] == NO_GLYPH {
|
||||
let range = text.char_range_at(covered_byte_span.end() as uint);
|
||||
drop(range.ch);
|
||||
covered_byte_span.extend_to(range.next as int);
|
||||
|
@ -511,11 +511,11 @@ extern fn get_font_table_func(_: *mut hb_face_t, tag: hb_tag_t, user_data: *mut
|
|||
|
||||
// TODO(Issue #197): reuse font table data, which will change the unsound trickery here.
|
||||
match (*font).get_table_for_tag(tag as FontTableTag) {
|
||||
None => ptr::mut_null(),
|
||||
None => ptr::null_mut(),
|
||||
Some(ref font_table) => {
|
||||
let skinny_font_table_ptr: *const FontTable = font_table; // private context
|
||||
|
||||
let mut blob: *mut hb_blob_t = ptr::mut_null();
|
||||
let mut blob: *mut hb_blob_t = ptr::null_mut();
|
||||
(*skinny_font_table_ptr).with_buffer(|buf: *const u8, len: uint| {
|
||||
// HarfBuzz calls `destroy_blob_func` when the buffer is no longer needed.
|
||||
blob = hb_blob_create(buf as *const c_char,
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
use text::glyph::GlyphStore;
|
||||
|
||||
pub use Shaper = text::shaping::harfbuzz::Shaper;
|
||||
pub use text::shaping::harfbuzz::Shaper;
|
||||
|
||||
pub mod harfbuzz;
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ impl<'a> Iterator<Range<CharIndex>> for LineIterator<'a> {
|
|||
None => {
|
||||
// flush any remaining chars as a line
|
||||
if self.clump.is_some() {
|
||||
let mut c = self.clump.take_unwrap();
|
||||
let mut c = self.clump.take().unwrap();
|
||||
c.extend_to(self.range.end());
|
||||
return Some(c);
|
||||
} else {
|
||||
|
|
|
@ -753,7 +753,7 @@ impl BlockFlow {
|
|||
// Avoid copying the offset vector.
|
||||
let offsets = mem::replace(&mut kid_base.abs_descendants.static_b_offsets, Vec::new());
|
||||
// Consume all the static y-offsets bubbled up by kid.
|
||||
for y_offset in offsets.move_iter() {
|
||||
for y_offset in offsets.into_iter() {
|
||||
// The offsets are wrt the kid flow box. Translate them to current flow.
|
||||
abs_descendant_y_offsets.push(y_offset + kid_base.position.start.b);
|
||||
}
|
||||
|
@ -977,12 +977,18 @@ impl BlockFlow {
|
|||
let mut candidate_block_size_iterator = CandidateBSizeIterator::new(
|
||||
self.fragment.style(),
|
||||
self.base.block_container_explicit_block_size);
|
||||
for candidate_block_size in candidate_block_size_iterator {
|
||||
// Can't use `for` because we assign to candidate_block_size_iterator.candidate_value
|
||||
loop {
|
||||
match candidate_block_size_iterator.next() {
|
||||
Some(candidate_block_size) => {
|
||||
candidate_block_size_iterator.candidate_value = match candidate_block_size {
|
||||
Auto => block_size,
|
||||
Specified(value) => value
|
||||
}
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust `cur_b` as necessary to account for the explicitly-specified block-size.
|
||||
block_size = candidate_block_size_iterator.candidate_value;
|
||||
|
@ -1040,15 +1046,15 @@ impl BlockFlow {
|
|||
self.fragment.border_padding.inline_start_end(),
|
||||
block_size + margin_block_size),
|
||||
ceiling: clearance + self.base.position.start.b,
|
||||
max_inline_size: self.float.get_ref().containing_inline_size,
|
||||
kind: self.float.get_ref().float_kind,
|
||||
max_inline_size: self.float.as_ref().unwrap().containing_inline_size,
|
||||
kind: self.float.as_ref().unwrap().float_kind,
|
||||
};
|
||||
|
||||
// Place the float and return the `Floats` back to the parent flow.
|
||||
// After, grab the position and use that to set our position.
|
||||
self.base.floats.add_float(&info);
|
||||
|
||||
self.float.get_mut_ref().rel_pos = self.base.floats.last_float_pos().unwrap();
|
||||
self.float.as_mut().unwrap().rel_pos = self.base.floats.last_float_pos().unwrap();
|
||||
}
|
||||
|
||||
/// Assign block-size for current flow.
|
||||
|
@ -1097,12 +1103,18 @@ impl BlockFlow {
|
|||
let mut candidate_block_size_iterator =
|
||||
CandidateBSizeIterator::new(self.fragment.style(),
|
||||
self.base.block_container_explicit_block_size);
|
||||
for candidate_block_size in candidate_block_size_iterator {
|
||||
// Can't use `for` because we assign to candidate_block_size_iterator.candidate_value
|
||||
loop {
|
||||
match candidate_block_size_iterator.next() {
|
||||
Some(candidate_block_size) => {
|
||||
candidate_block_size_iterator.candidate_value = match candidate_block_size {
|
||||
Auto => content_block_size,
|
||||
Specified(value) => value,
|
||||
}
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
|
||||
let content_block_size = candidate_block_size_iterator.candidate_value;
|
||||
let noncontent_block_size = self.fragment.border_padding.block_start_end();
|
||||
|
@ -1173,7 +1185,7 @@ impl BlockFlow {
|
|||
}
|
||||
|
||||
pub fn build_display_list_float(&mut self, layout_context: &LayoutContext) {
|
||||
let float_offset = self.float.get_ref().rel_pos;
|
||||
let float_offset = self.float.as_ref().unwrap().rel_pos;
|
||||
self.build_display_list_block_common(layout_context,
|
||||
float_offset,
|
||||
RootOfStackingContextLevel);
|
||||
|
@ -1241,7 +1253,10 @@ impl BlockFlow {
|
|||
let mut candidate_block_size_iterator =
|
||||
CandidateBSizeIterator::new(style, Some(containing_block_block_size));
|
||||
|
||||
for block_size_used_val in candidate_block_size_iterator {
|
||||
// Can't use `for` because we assign to candidate_block_size_iterator.candidate_value
|
||||
loop {
|
||||
match candidate_block_size_iterator.next() {
|
||||
Some(block_size_used_val) => {
|
||||
solution =
|
||||
Some(BSizeConstraintSolution::solve_vertical_constraints_abs_nonreplaced(
|
||||
block_size_used_val,
|
||||
|
@ -1253,7 +1268,11 @@ impl BlockFlow {
|
|||
available_block_size,
|
||||
static_b_offset));
|
||||
|
||||
candidate_block_size_iterator.candidate_value = solution.unwrap().block_size
|
||||
candidate_block_size_iterator.candidate_value
|
||||
= solution.unwrap().block_size;
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1580,7 +1599,7 @@ impl Flow for BlockFlow {
|
|||
let containing_block_inline_size = self.base.position.size.inline;
|
||||
self.compute_used_inline_size(layout_context, containing_block_inline_size);
|
||||
if self.is_float() {
|
||||
self.float.get_mut_ref().containing_inline_size = containing_block_inline_size;
|
||||
self.float.as_mut().unwrap().containing_inline_size = containing_block_inline_size;
|
||||
}
|
||||
|
||||
// Formatting contexts are never impacted by floats.
|
||||
|
@ -1701,7 +1720,7 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
|
||||
let float_offset = if self.is_float() {
|
||||
self.float.get_ref().rel_pos
|
||||
self.float.as_ref().unwrap().rel_pos
|
||||
} else {
|
||||
LogicalPoint::zero(self.base.writing_mode)
|
||||
};
|
||||
|
@ -1773,7 +1792,7 @@ impl Flow for BlockFlow {
|
|||
// FIXME(#2010, pcwalton): This is a hack and is totally bogus in the presence of pseudo-
|
||||
// elements. But until we have incremental reflow we can't do better--we recreate the flow
|
||||
// for every DOM node so otherwise we nuke layers on every reflow.
|
||||
LayerId(self.fragment.node.id(), fragment_index)
|
||||
LayerId(self.fragment.node.id() as uint, fragment_index)
|
||||
}
|
||||
|
||||
fn is_absolute_containing_block(&self) -> bool {
|
||||
|
|
|
@ -173,7 +173,7 @@ impl InlineFragmentsAccumulator {
|
|||
|
||||
match enclosing_style {
|
||||
Some(enclosing_style) => {
|
||||
for frag in fragments.fragments.mut_iter() {
|
||||
for frag in fragments.fragments.iter_mut() {
|
||||
frag.add_inline_context_style(enclosing_style.clone());
|
||||
}
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
abs_descendants: kid_abs_descendants,
|
||||
})) => {
|
||||
// Add any {ib} splits.
|
||||
for split in splits.move_iter() {
|
||||
for split in splits.into_iter() {
|
||||
// Pull apart the {ib} split object and push its predecessor fragments
|
||||
// onto the list.
|
||||
let InlineBlockSplit {
|
||||
|
@ -556,7 +556,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
})) => {
|
||||
|
||||
// Bubble up {ib} splits.
|
||||
for split in splits.move_iter() {
|
||||
for split in splits.into_iter() {
|
||||
let InlineBlockSplit {
|
||||
predecessors: predecessors,
|
||||
flow: kid_flow
|
||||
|
@ -709,7 +709,7 @@ impl<'a> FlowConstructor<'a> {
|
|||
node: &ThreadSafeLayoutNode) {
|
||||
let mut anonymous_flow = flow.get().generate_missing_child_flow(node);
|
||||
let mut consecutive_siblings = vec!();
|
||||
for kid_flow in child_flows.move_iter() {
|
||||
for kid_flow in child_flows.into_iter() {
|
||||
if anonymous_flow.get().need_anonymous_flow(kid_flow.get()) {
|
||||
consecutive_siblings.push(kid_flow);
|
||||
continue;
|
||||
|
|
|
@ -464,7 +464,7 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
|
|||
Some(shared_style) => {
|
||||
// Yay, cache hit. Share the style.
|
||||
let mut layout_data_ref = self.mutate_layout_data();
|
||||
layout_data_ref.get_mut_ref().shared_data.style = Some(shared_style);
|
||||
layout_data_ref.as_mut().unwrap().shared_data.style = Some(shared_style);
|
||||
return StyleWasShared(i)
|
||||
}
|
||||
None => {}
|
||||
|
@ -622,14 +622,14 @@ impl<'ln> MatchMethods for LayoutNode<'ln> {
|
|||
applicable_declarations_cache,
|
||||
applicable_declarations.normal_shareable);
|
||||
if applicable_declarations.before.len() > 0 {
|
||||
self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.get_ref()),
|
||||
self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.as_ref().unwrap()),
|
||||
applicable_declarations.before.as_slice(),
|
||||
&mut layout_data.data.before_style,
|
||||
applicable_declarations_cache,
|
||||
false);
|
||||
}
|
||||
if applicable_declarations.after.len() > 0 {
|
||||
self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.get_ref()),
|
||||
self.cascade_node_pseudo_element(Some(layout_data.shared_data.style.as_ref().unwrap()),
|
||||
applicable_declarations.after.as_slice(),
|
||||
&mut layout_data.data.after_style,
|
||||
applicable_declarations_cache,
|
||||
|
|
|
@ -57,7 +57,7 @@ impl<'ln> NodeUtil for ThreadSafeLayoutNode<'ln> {
|
|||
/// Does this node have a computed style yet?
|
||||
fn have_css_select_results(&self) -> bool {
|
||||
let layout_data_ref = self.borrow_layout_data();
|
||||
layout_data_ref.get_ref().shared_data.style.is_some()
|
||||
layout_data_ref.as_ref().unwrap().shared_data.style.is_some()
|
||||
}
|
||||
|
||||
/// Get the description of how to account for recent style changes.
|
||||
|
@ -73,7 +73,7 @@ impl<'ln> NodeUtil for ThreadSafeLayoutNode<'ln> {
|
|||
|
||||
let layout_data_ref = self.borrow_layout_data();
|
||||
layout_data_ref
|
||||
.get_ref()
|
||||
.as_ref().unwrap()
|
||||
.data
|
||||
.restyle_damage
|
||||
.unwrap_or(default)
|
||||
|
|
|
@ -29,7 +29,7 @@ use css::node_style::StyledNode;
|
|||
use block::BlockFlow;
|
||||
use context::LayoutContext;
|
||||
use floats::Floats;
|
||||
use flow_list::{FlowList, Link, FlowListIterator, MutFlowListIterator};
|
||||
use flow_list::{FlowList, FlowListIterator, MutFlowListIterator};
|
||||
use flow_ref::FlowRef;
|
||||
use fragment::{Fragment, TableRowFragment, TableCellFragment};
|
||||
use incremental::RestyleDamage;
|
||||
|
@ -67,7 +67,7 @@ use style::computed_values::{clear, float, position, text_align};
|
|||
///
|
||||
/// Note that virtual methods have a cost; we should not overuse them in Servo. Consider adding
|
||||
/// methods to `ImmutableFlowUtils` or `MutableFlowUtils` before adding more methods here.
|
||||
pub trait Flow: fmt::Show + ToString + Share {
|
||||
pub trait Flow: fmt::Show + ToString + Sync {
|
||||
// RTTI
|
||||
//
|
||||
// TODO(pcwalton): Use Rust's RTTI, once that works.
|
||||
|
@ -310,7 +310,7 @@ pub trait Flow: fmt::Show + ToString + Share {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, E, S: Encoder<E>> Encodable<S, E> for &'a Flow {
|
||||
impl<'a, E, S: Encoder<E>> Encodable<S, E> for &'a Flow + 'a {
|
||||
fn encode(&self, e: &mut S) -> Result<(), E> {
|
||||
e.emit_struct("flow", 0, |e| {
|
||||
try!(e.emit_struct_field("class", 0, |e| self.class().encode(e)))
|
||||
|
@ -355,7 +355,7 @@ pub fn mut_base<'a>(this: &'a mut Flow) -> &'a mut BaseFlow {
|
|||
|
||||
/// Iterates over the children of this flow.
|
||||
pub fn child_iter<'a>(flow: &'a mut Flow) -> MutFlowListIterator<'a> {
|
||||
mut_base(flow).children.mut_iter()
|
||||
mut_base(flow).children.iter_mut()
|
||||
}
|
||||
|
||||
pub trait ImmutableFlowUtils {
|
||||
|
@ -610,7 +610,7 @@ impl Descendants {
|
|||
///
|
||||
/// Ignore any static y offsets, because they are None before layout.
|
||||
pub fn push_descendants(&mut self, given_descendants: Descendants) {
|
||||
for elem in given_descendants.descendant_links.move_iter() {
|
||||
for elem in given_descendants.descendant_links.into_iter() {
|
||||
self.descendant_links.push(elem);
|
||||
}
|
||||
}
|
||||
|
@ -618,16 +618,16 @@ impl Descendants {
|
|||
/// Return an iterator over the descendant flows.
|
||||
pub fn iter<'a>(&'a mut self) -> DescendantIter<'a> {
|
||||
DescendantIter {
|
||||
iter: self.descendant_links.mut_slice_from(0).mut_iter(),
|
||||
iter: self.descendant_links.slice_from_mut(0).iter_mut(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Return an iterator over (descendant, static y offset).
|
||||
pub fn iter_with_offset<'a>(&'a mut self) -> DescendantOffsetIter<'a> {
|
||||
let descendant_iter = DescendantIter {
|
||||
iter: self.descendant_links.mut_slice_from(0).mut_iter(),
|
||||
iter: self.descendant_links.slice_from_mut(0).iter_mut(),
|
||||
};
|
||||
descendant_iter.zip(self.static_b_offsets.mut_slice_from(0).mut_iter())
|
||||
descendant_iter.zip(self.static_b_offsets.slice_from_mut(0).iter_mut())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -637,8 +637,8 @@ pub struct DescendantIter<'a> {
|
|||
iter: MutItems<'a, FlowRef>,
|
||||
}
|
||||
|
||||
impl<'a> Iterator<&'a mut Flow> for DescendantIter<'a> {
|
||||
fn next(&mut self) -> Option<&'a mut Flow> {
|
||||
impl<'a> Iterator<&'a mut Flow + 'a> for DescendantIter<'a> {
|
||||
fn next(&mut self) -> Option<&'a mut Flow + 'a> {
|
||||
match self.iter.next() {
|
||||
None => None,
|
||||
Some(ref mut flow) => {
|
||||
|
@ -691,16 +691,6 @@ pub struct BaseFlow {
|
|||
/// The children of this flow.
|
||||
pub children: FlowList,
|
||||
|
||||
/// The flow's next sibling.
|
||||
///
|
||||
/// FIXME(pcwalton): Make this private. Misuse of this can lead to data races.
|
||||
pub next_sibling: Link,
|
||||
|
||||
/// The flow's previous sibling.
|
||||
///
|
||||
/// FIXME(pcwalton): Make this private. Misuse of this can lead to data races.
|
||||
pub prev_sibling: Link,
|
||||
|
||||
/* layout computations */
|
||||
// TODO: min/pref and position are used during disjoint phases of
|
||||
// layout; maybe combine into a single enum to save space.
|
||||
|
@ -809,8 +799,6 @@ impl BaseFlow {
|
|||
restyle_damage: node.restyle_damage(),
|
||||
|
||||
children: FlowList::new(),
|
||||
next_sibling: None,
|
||||
prev_sibling: None,
|
||||
|
||||
intrinsic_inline_sizes: IntrinsicISizes::new(),
|
||||
position: LogicalRect::zero(writing_mode),
|
||||
|
@ -836,7 +824,7 @@ impl BaseFlow {
|
|||
}
|
||||
|
||||
pub fn child_iter<'a>(&'a mut self) -> MutFlowListIterator<'a> {
|
||||
self.children.mut_iter()
|
||||
self.children.iter_mut()
|
||||
}
|
||||
|
||||
pub unsafe fn ref_count<'a>(&'a self) -> &'a AtomicUint {
|
||||
|
@ -848,7 +836,7 @@ impl BaseFlow {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ImmutableFlowUtils for &'a Flow {
|
||||
impl<'a> ImmutableFlowUtils for &'a Flow + 'a {
|
||||
/// Returns true if this flow is a block or a float flow.
|
||||
fn is_block_like(self) -> bool {
|
||||
match self.class() {
|
||||
|
@ -1016,7 +1004,7 @@ impl<'a> ImmutableFlowUtils for &'a Flow {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> MutableFlowUtils for &'a mut Flow {
|
||||
impl<'a> MutableFlowUtils for &'a mut Flow + 'a {
|
||||
/// Traverses the tree in preorder.
|
||||
fn traverse_preorder<T:PreorderFlowTraversal>(self, traversal: &mut T) -> bool {
|
||||
if traversal.should_prune(self) {
|
||||
|
|
|
@ -2,198 +2,90 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! A variant of `DList` specialized to store `Flow`s without an extra
|
||||
//! indirection.
|
||||
|
||||
use flow::{Flow, base, mut_base};
|
||||
use flow::Flow;
|
||||
use flow_ref::FlowRef;
|
||||
|
||||
use std::kinds::marker::ContravariantLifetime;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
use std::raw;
|
||||
use std::collections::{Deque, dlist, DList};
|
||||
|
||||
pub type Link = Option<FlowRef>;
|
||||
// This needs to be reworked now that we have dynamically-sized types in Rust.
|
||||
// Until then, it's just a wrapper around DList.
|
||||
|
||||
|
||||
#[allow(raw_pointer_deriving)]
|
||||
pub struct Rawlink<'a> {
|
||||
object: raw::TraitObject,
|
||||
marker: ContravariantLifetime<'a>,
|
||||
}
|
||||
|
||||
/// Doubly-linked list of Flows.
|
||||
///
|
||||
/// The forward links are strong references.
|
||||
/// The backward links are weak references.
|
||||
pub struct FlowList {
|
||||
length: uint,
|
||||
list_head: Link,
|
||||
list_tail: Link,
|
||||
flows: DList<FlowRef>,
|
||||
}
|
||||
|
||||
/// Double-ended FlowList iterator
|
||||
pub struct FlowListIterator<'a> {
|
||||
head: &'a Link,
|
||||
nelem: uint,
|
||||
it: dlist::Items<'a, FlowRef>,
|
||||
}
|
||||
|
||||
/// Double-ended mutable FlowList iterator
|
||||
pub struct MutFlowListIterator<'a> {
|
||||
head: Rawlink<'a>,
|
||||
nelem: uint,
|
||||
}
|
||||
|
||||
impl<'a> Rawlink<'a> {
|
||||
/// Like Option::None for Rawlink
|
||||
pub fn none() -> Rawlink<'static> {
|
||||
Rawlink {
|
||||
object: raw::TraitObject {
|
||||
vtable: ptr::mut_null(),
|
||||
data: ptr::mut_null(),
|
||||
},
|
||||
marker: ContravariantLifetime,
|
||||
}
|
||||
}
|
||||
|
||||
/// Like Option::Some for Rawlink
|
||||
pub fn some(n: &Flow) -> Rawlink {
|
||||
unsafe {
|
||||
Rawlink {
|
||||
object: mem::transmute::<&Flow, raw::TraitObject>(n),
|
||||
marker: ContravariantLifetime,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub unsafe fn resolve_mut(&self) -> Option<&'a mut Flow> {
|
||||
if self.object.data.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(mem::transmute_copy::<raw::TraitObject, &mut Flow>(&self.object))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Set the .prev field on `next`, then return `Some(next)`
|
||||
unsafe fn link_with_prev(mut next: FlowRef, prev: Option<FlowRef>) -> Link {
|
||||
mut_base(next.get_mut()).prev_sibling = prev;
|
||||
Some(next)
|
||||
it: dlist::MutItems<'a, FlowRef>,
|
||||
}
|
||||
|
||||
impl Collection for FlowList {
|
||||
/// O(1)
|
||||
#[inline]
|
||||
fn is_empty(&self) -> bool {
|
||||
self.list_head.is_none()
|
||||
self.flows.is_empty()
|
||||
}
|
||||
/// O(1)
|
||||
#[inline]
|
||||
fn len(&self) -> uint {
|
||||
self.length
|
||||
self.flows.len()
|
||||
}
|
||||
}
|
||||
|
||||
// This doesn't quite fit the Deque trait because of the need to switch between
|
||||
// &Flow and ~Flow.
|
||||
impl FlowList {
|
||||
/// Provide a reference to the front element, or None if the list is empty
|
||||
#[inline]
|
||||
pub fn front<'a>(&'a self) -> Option<&'a Flow> {
|
||||
self.list_head.as_ref().map(|head| head.get())
|
||||
self.flows.front().map(|head| head.get())
|
||||
}
|
||||
|
||||
/// Provide a mutable reference to the front element, or None if the list is empty
|
||||
#[inline]
|
||||
pub unsafe fn front_mut<'a>(&'a mut self) -> Option<&'a mut Flow> {
|
||||
self.list_head.as_mut().map(|head| head.get_mut())
|
||||
self.flows.front_mut().map(|head| head.get_mut())
|
||||
}
|
||||
|
||||
/// Provide a reference to the back element, or None if the list is empty
|
||||
#[inline]
|
||||
pub fn back<'a>(&'a self) -> Option<&'a Flow> {
|
||||
match self.list_tail {
|
||||
None => None,
|
||||
Some(ref list_tail) => Some(list_tail.get())
|
||||
}
|
||||
self.flows.back().map(|tail| tail.get())
|
||||
}
|
||||
|
||||
/// Provide a mutable reference to the back element, or None if the list is empty
|
||||
#[inline]
|
||||
pub unsafe fn back_mut<'a>(&'a mut self) -> Option<&'a mut Flow> {
|
||||
// Can't use map() due to error:
|
||||
// lifetime of `tail` is too short to guarantee its contents can be safely reborrowed
|
||||
match self.list_tail {
|
||||
None => None,
|
||||
Some(ref mut tail) => {
|
||||
let x: &mut Flow = tail.get_mut();
|
||||
Some(mem::transmute_copy(&x))
|
||||
}
|
||||
}
|
||||
self.flows.back_mut().map(|tail| tail.get_mut())
|
||||
}
|
||||
|
||||
/// Add an element first in the list
|
||||
///
|
||||
/// O(1)
|
||||
pub fn push_front(&mut self, mut new_head: FlowRef) {
|
||||
unsafe {
|
||||
match self.list_head {
|
||||
None => {
|
||||
self.list_tail = Some(new_head.clone());
|
||||
self.list_head = link_with_prev(new_head, None);
|
||||
}
|
||||
Some(ref mut head) => {
|
||||
mut_base(new_head.get_mut()).prev_sibling = None;
|
||||
mut_base(head.get_mut()).prev_sibling = Some(new_head.clone());
|
||||
mem::swap(head, &mut new_head);
|
||||
mut_base(head.get_mut()).next_sibling = Some(new_head);
|
||||
}
|
||||
}
|
||||
self.length += 1;
|
||||
}
|
||||
pub fn push_front(&mut self, new_head: FlowRef) {
|
||||
self.flows.push_front(new_head);
|
||||
}
|
||||
|
||||
/// Remove the first element and return it, or None if the list is empty
|
||||
///
|
||||
/// O(1)
|
||||
pub fn pop_front(&mut self) -> Option<FlowRef> {
|
||||
self.list_head.take().map(|mut front_node| {
|
||||
self.length -= 1;
|
||||
unsafe {
|
||||
match mut_base(front_node.get_mut()).next_sibling.take() {
|
||||
Some(node) => self.list_head = link_with_prev(node, None),
|
||||
None => self.list_tail = None,
|
||||
}
|
||||
}
|
||||
front_node
|
||||
})
|
||||
self.flows.pop_front()
|
||||
}
|
||||
|
||||
/// Add an element last in the list
|
||||
///
|
||||
/// O(1)
|
||||
pub fn push_back(&mut self, new_tail: FlowRef) {
|
||||
if self.list_tail.is_none() {
|
||||
return self.push_front(new_tail);
|
||||
}
|
||||
|
||||
let old_tail = self.list_tail.clone();
|
||||
self.list_tail = Some(new_tail.clone());
|
||||
let mut tail = (*old_tail.as_ref().unwrap()).clone();
|
||||
let tail_clone = Some(tail.clone());
|
||||
unsafe {
|
||||
mut_base(tail.get_mut()).next_sibling = link_with_prev(new_tail, tail_clone);
|
||||
}
|
||||
self.length += 1;
|
||||
self.flows.push(new_tail);
|
||||
}
|
||||
|
||||
/// Create an empty list
|
||||
#[inline]
|
||||
pub fn new() -> FlowList {
|
||||
FlowList {
|
||||
list_head: None,
|
||||
list_tail: None,
|
||||
length: 0,
|
||||
flows: DList::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,96 +93,39 @@ impl FlowList {
|
|||
#[inline]
|
||||
pub fn iter<'a>(&'a self) -> FlowListIterator<'a> {
|
||||
FlowListIterator {
|
||||
nelem: self.len(),
|
||||
head: &self.list_head,
|
||||
it: self.flows.iter(),
|
||||
}
|
||||
}
|
||||
|
||||
/// Provide a forward iterator with mutable references
|
||||
#[inline]
|
||||
pub fn mut_iter<'a>(&'a mut self) -> MutFlowListIterator<'a> {
|
||||
let len = self.len();
|
||||
let head_raw = match self.list_head {
|
||||
Some(ref mut h) => Rawlink::some(h.get()),
|
||||
None => Rawlink::none(),
|
||||
};
|
||||
pub fn iter_mut<'a>(&'a mut self) -> MutFlowListIterator<'a> {
|
||||
MutFlowListIterator {
|
||||
nelem: len,
|
||||
head: head_raw,
|
||||
it: self.flows.iter_mut(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl Drop for FlowList {
|
||||
fn drop(&mut self) {
|
||||
// Dissolve the list in backwards direction
|
||||
// Just dropping the list_head can lead to stack exhaustion
|
||||
// when length is >> 1_000_000
|
||||
let mut tail = mem::replace(&mut self.list_tail, None);
|
||||
loop {
|
||||
let new_tail = match tail {
|
||||
None => break,
|
||||
Some(ref mut prev) => {
|
||||
let prev_base = mut_base(prev.get_mut());
|
||||
prev_base.next_sibling.take();
|
||||
prev_base.prev_sibling.clone()
|
||||
}
|
||||
};
|
||||
tail = new_tail
|
||||
}
|
||||
self.length = 0;
|
||||
self.list_head = None;
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator<&'a Flow> for FlowListIterator<'a> {
|
||||
impl<'a> Iterator<&'a Flow + 'a> for FlowListIterator<'a> {
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<&'a Flow> {
|
||||
if self.nelem == 0 {
|
||||
return None;
|
||||
}
|
||||
self.head.as_ref().map(|head| {
|
||||
let head_base = base(head.get());
|
||||
self.nelem -= 1;
|
||||
self.head = &head_base.next_sibling;
|
||||
let ret: &Flow = head.get();
|
||||
ret
|
||||
})
|
||||
fn next(&mut self) -> Option<&'a Flow + 'a> {
|
||||
self.it.next().map(|x| x.get())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn size_hint(&self) -> (uint, Option<uint>) {
|
||||
(self.nelem, Some(self.nelem))
|
||||
self.it.size_hint()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Iterator<&'a mut Flow> for MutFlowListIterator<'a> {
|
||||
impl<'a> Iterator<&'a mut Flow + 'a> for MutFlowListIterator<'a> {
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<&'a mut Flow> {
|
||||
if self.nelem == 0 {
|
||||
return None;
|
||||
}
|
||||
unsafe {
|
||||
self.head.resolve_mut().map(|next| {
|
||||
self.nelem -= 1;
|
||||
self.head = match mut_base(next).next_sibling {
|
||||
Some(ref mut node) => {
|
||||
let x: &mut Flow = node.get_mut();
|
||||
// NOTE: transmute needed here to break the link
|
||||
// between x and next so that it is no longer
|
||||
// borrowed.
|
||||
mem::transmute(Rawlink::some(x))
|
||||
}
|
||||
None => Rawlink::none(),
|
||||
};
|
||||
next
|
||||
})
|
||||
}
|
||||
fn next(&mut self) -> Option<&'a mut Flow + 'a> {
|
||||
self.it.next().map(|x| x.get_mut())
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn size_hint(&self) -> (uint, Option<uint>) {
|
||||
(self.nelem, Some(self.nelem))
|
||||
self.it.size_hint()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ impl FlowRef {
|
|||
pub fn new(mut flow: Box<Flow>) -> FlowRef {
|
||||
unsafe {
|
||||
let result = {
|
||||
let flow_ref: &mut Flow = flow;
|
||||
let flow_ref: &mut Flow = &mut *flow;
|
||||
let object = mem::transmute::<&mut Flow, raw::TraitObject>(flow_ref);
|
||||
FlowRef { object: object }
|
||||
};
|
||||
|
@ -56,14 +56,14 @@ impl Drop for FlowRef {
|
|||
}
|
||||
let flow_ref: FlowRef = mem::replace(self, FlowRef {
|
||||
object: raw::TraitObject {
|
||||
vtable: ptr::mut_null(),
|
||||
data: ptr::mut_null(),
|
||||
vtable: ptr::null_mut(),
|
||||
data: ptr::null_mut(),
|
||||
}
|
||||
});
|
||||
drop(mem::transmute::<raw::TraitObject, Box<Flow>>(flow_ref.object));
|
||||
mem::forget(flow_ref);
|
||||
self.object.vtable = ptr::mut_null();
|
||||
self.object.data = ptr::mut_null();
|
||||
self.object.vtable = ptr::null_mut();
|
||||
self.object.data = ptr::null_mut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -467,7 +467,7 @@ impl Fragment {
|
|||
if self.inline_context.is_none() {
|
||||
self.inline_context = Some(InlineFragmentContext::new());
|
||||
}
|
||||
self.inline_context.get_mut_ref().styles.push(style.clone());
|
||||
self.inline_context.as_mut().unwrap().styles.push(style.clone());
|
||||
}
|
||||
|
||||
/// Uses the style only to estimate the intrinsic inline-sizes. These may be modified for text or
|
||||
|
|
|
@ -495,7 +495,7 @@ impl LineBreaker {
|
|||
inline_start.new_line_pos = vec![];
|
||||
self.push_fragment_to_line(inline_start);
|
||||
|
||||
for inline_end in inline_end.move_iter() {
|
||||
for inline_end in inline_end.into_iter() {
|
||||
debug!("LineBreaker: Deferring the fragment to the inline_end of the new-line \
|
||||
character to the line.");
|
||||
let mut inline_end = split_fragment(inline_end);
|
||||
|
@ -680,7 +680,7 @@ impl InlineFragments {
|
|||
|
||||
// FIXME (rust#16151): This can be reverted back to using skip_while once
|
||||
// the upstream bug is fixed.
|
||||
let mut fragments = mem::replace(&mut self.fragments, vec![]).move_iter();
|
||||
let mut fragments = mem::replace(&mut self.fragments, vec![]).into_iter();
|
||||
let mut new_fragments = Vec::new();
|
||||
let mut skipping = true;
|
||||
for fragment in fragments {
|
||||
|
@ -703,7 +703,7 @@ impl InlineFragments {
|
|||
}
|
||||
|
||||
let mut new_fragments = self.fragments.clone();
|
||||
while new_fragments.len() > 0 && new_fragments.as_slice().last().get_ref().is_whitespace_only() {
|
||||
while new_fragments.len() > 0 && new_fragments.as_slice().last().as_ref().unwrap().is_whitespace_only() {
|
||||
debug!("stripping ignorable whitespace from end");
|
||||
drop(new_fragments.pop());
|
||||
}
|
||||
|
@ -757,7 +757,7 @@ impl InlineFlow {
|
|||
// not recurse on a line if nothing in it can intersect the dirty region.
|
||||
debug!("Flow: building display list for {:u} inline fragments", self.fragments.len());
|
||||
|
||||
for fragment in self.fragments.fragments.mut_iter() {
|
||||
for fragment in self.fragments.fragments.iter_mut() {
|
||||
let rel_offset = fragment.relative_position(&self.base
|
||||
.absolute_position_info
|
||||
.relative_containing_block_size);
|
||||
|
@ -923,7 +923,7 @@ impl Flow for InlineFlow {
|
|||
}
|
||||
|
||||
let mut intrinsic_inline_sizes = IntrinsicISizes::new();
|
||||
for fragment in self.fragments.fragments.mut_iter() {
|
||||
for fragment in self.fragments.fragments.iter_mut() {
|
||||
debug!("Flow: measuring {}", *fragment);
|
||||
|
||||
let fragment_intrinsic_inline_sizes =
|
||||
|
@ -953,7 +953,7 @@ impl Flow for InlineFlow {
|
|||
{
|
||||
let inline_size = self.base.position.size.inline;
|
||||
let this = &mut *self;
|
||||
for fragment in this.fragments.fragments.mut_iter() {
|
||||
for fragment in this.fragments.fragments.iter_mut() {
|
||||
fragment.assign_replaced_inline_size_if_necessary(inline_size);
|
||||
}
|
||||
}
|
||||
|
@ -982,7 +982,7 @@ impl Flow for InlineFlow {
|
|||
debug!("assign_block_size_inline: floats in: {:?}", self.base.floats);
|
||||
|
||||
// assign block-size for inline fragments
|
||||
for fragment in self.fragments.fragments.mut_iter() {
|
||||
for fragment in self.fragments.fragments.iter_mut() {
|
||||
fragment.assign_replaced_block_size_if_necessary();
|
||||
}
|
||||
|
||||
|
@ -995,7 +995,7 @@ impl Flow for InlineFlow {
|
|||
|
||||
// Now, go through each line and lay out the fragments inside.
|
||||
let mut line_distance_from_flow_block_start = Au(0);
|
||||
for line in self.lines.mut_iter() {
|
||||
for line in self.lines.iter_mut() {
|
||||
// Lay out fragments horizontally.
|
||||
InlineFlow::set_horizontal_fragment_positions(&mut self.fragments, line, text_align);
|
||||
|
||||
|
@ -1124,7 +1124,7 @@ impl Flow for InlineFlow {
|
|||
}
|
||||
|
||||
fn compute_absolute_position(&mut self) {
|
||||
for f in self.fragments.fragments.mut_iter() {
|
||||
for f in self.fragments.fragments.iter_mut() {
|
||||
match f.specific {
|
||||
InlineBlockFragment(ref mut info) => {
|
||||
let block_flow = info.flow_ref.get_mut().as_block();
|
||||
|
|
|
@ -81,7 +81,7 @@ impl Drop for Scope {
|
|||
let mut state = refcell.borrow_mut();
|
||||
let mut current_scope = state.scope_stack.pop().unwrap();
|
||||
current_scope.post = json::encode(&state.flow_root.get());
|
||||
let previous_scope = state.scope_stack.mut_last().unwrap();
|
||||
let previous_scope = state.scope_stack.last_mut().unwrap();
|
||||
previous_scope.children.push(current_scope);
|
||||
}
|
||||
None => {}
|
||||
|
|
|
@ -909,7 +909,7 @@ impl LayoutTask {
|
|||
let mut layers = SmallVec1::new();
|
||||
layers.push(render_layer);
|
||||
for layer in mem::replace(&mut flow::mut_base(layout_root.get_mut()).layers,
|
||||
DList::new()).move_iter() {
|
||||
DList::new()).into_iter() {
|
||||
layers.push(layer)
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,11 @@ extern crate script_traits;
|
|||
extern crate serialize;
|
||||
extern crate style;
|
||||
#[phase(plugin)]
|
||||
extern crate servo_macros = "macros";
|
||||
extern crate servo_net = "net";
|
||||
extern crate servo_msg = "msg";
|
||||
extern crate "macros" as servo_macros;
|
||||
extern crate "net" as servo_net;
|
||||
extern crate "msg" as servo_msg;
|
||||
#[phase(plugin, link)]
|
||||
extern crate servo_util = "util";
|
||||
extern crate "util" as servo_util;
|
||||
|
||||
extern crate collections;
|
||||
extern crate encoding;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
use fragment::Fragment;
|
||||
|
||||
use computed = style::computed_values;
|
||||
use style::computed_values as computed;
|
||||
use geom::SideOffsets2D;
|
||||
use style::computed_values::{LPA_Auto, LPA_Length, LPA_Percentage, LP_Length, LP_Percentage};
|
||||
use style::ComputedValues;
|
||||
|
|
|
@ -107,7 +107,7 @@ impl TableFlow {
|
|||
pub fn update_col_inline_sizes(self_inline_sizes: &mut Vec<Au>, kid_inline_sizes: &Vec<Au>) -> Au {
|
||||
let mut sum_inline_sizes = Au(0);
|
||||
let mut kid_inline_sizes_it = kid_inline_sizes.iter();
|
||||
for self_inline_size in self_inline_sizes.mut_iter() {
|
||||
for self_inline_size in self_inline_sizes.iter_mut() {
|
||||
match kid_inline_sizes_it.next() {
|
||||
Some(kid_inline_size) => {
|
||||
if *self_inline_size < *kid_inline_size {
|
||||
|
@ -197,7 +197,7 @@ impl Flow for TableFlow {
|
|||
if !did_first_row {
|
||||
did_first_row = true;
|
||||
let mut child_inline_sizes = kid_col_inline_sizes.iter();
|
||||
for col_inline_size in self.col_inline_sizes.mut_iter() {
|
||||
for col_inline_size in self.col_inline_sizes.iter_mut() {
|
||||
match child_inline_sizes.next() {
|
||||
Some(child_inline_size) => {
|
||||
if *col_inline_size == Au::new(0) {
|
||||
|
@ -280,12 +280,12 @@ impl Flow for TableFlow {
|
|||
// any, or among all the columns if all are specified.
|
||||
if (total_column_inline_size < content_inline_size) && (num_unspecified_inline_sizes == 0) {
|
||||
let ratio = content_inline_size.to_f64().unwrap() / total_column_inline_size.to_f64().unwrap();
|
||||
for col_inline_size in self.col_inline_sizes.mut_iter() {
|
||||
for col_inline_size in self.col_inline_sizes.iter_mut() {
|
||||
*col_inline_size = (*col_inline_size).scale_by(ratio);
|
||||
}
|
||||
} else if num_unspecified_inline_sizes != 0 {
|
||||
let extra_column_inline_size = (content_inline_size - total_column_inline_size) / num_unspecified_inline_sizes;
|
||||
for col_inline_size in self.col_inline_sizes.mut_iter() {
|
||||
for col_inline_size in self.col_inline_sizes.iter_mut() {
|
||||
if *col_inline_size == Au(0) {
|
||||
*col_inline_size = extra_column_inline_size;
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ impl TextRunScanner {
|
|||
continue
|
||||
}
|
||||
|
||||
let new_text_fragment_info = ScannedTextFragmentInfo::new(run.get_ref().clone(), range);
|
||||
let new_text_fragment_info = ScannedTextFragmentInfo::new(run.as_ref().unwrap().clone(), range);
|
||||
let old_fragment = &in_fragments[i.to_uint()];
|
||||
let new_metrics = new_text_fragment_info.run.metrics_for_range(&range);
|
||||
let bounding_box_size = bounding_box_for_run_metrics(
|
||||
|
|
|
@ -123,7 +123,7 @@ impl OpaqueNodeMethods for OpaqueNode {
|
|||
fn from_thread_safe_layout_node(node: &ThreadSafeLayoutNode) -> OpaqueNode {
|
||||
unsafe {
|
||||
let abstract_node = node.get_jsmanaged();
|
||||
let ptr: uintptr_t = abstract_node.reflector().get_jsobject() as uint;
|
||||
let ptr: uintptr_t = abstract_node.reflector().get_jsobject() as uintptr_t;
|
||||
OpaqueNode(ptr)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -452,7 +452,7 @@ impl<'le> TElement for LayoutElement<'le> {
|
|||
fn get_content(content_list: &content::T) -> String {
|
||||
match *content_list {
|
||||
content::Content(ref value) => {
|
||||
let iter = &mut value.clone().move_iter().peekable();
|
||||
let iter = &mut value.clone().into_iter().peekable();
|
||||
match iter.next() {
|
||||
Some(content::StringContent(content)) => content,
|
||||
_ => "".to_string(),
|
||||
|
@ -533,13 +533,13 @@ impl<'ln> TLayoutNode for ThreadSafeLayoutNode<'ln> {
|
|||
fn text(&self) -> String {
|
||||
if self.pseudo != Normal {
|
||||
let layout_data_ref = self.borrow_layout_data();
|
||||
let node_layout_data_wrapper = layout_data_ref.get_ref();
|
||||
let node_layout_data_wrapper = layout_data_ref.as_ref().unwrap();
|
||||
|
||||
if self.pseudo == Before || self.pseudo == BeforeBlock {
|
||||
let before_style = node_layout_data_wrapper.data.before_style.get_ref();
|
||||
let before_style = node_layout_data_wrapper.data.before_style.as_ref().unwrap();
|
||||
return get_content(&before_style.get_box().content)
|
||||
} else {
|
||||
let after_style = node_layout_data_wrapper.data.after_style.get_ref();
|
||||
let after_style = node_layout_data_wrapper.data.after_style.as_ref().unwrap();
|
||||
return get_content(&after_style.get_box().content)
|
||||
}
|
||||
}
|
||||
|
@ -610,19 +610,19 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
|
||||
pub fn is_block(&self, kind: PseudoElementType) -> bool {
|
||||
let mut layout_data_ref = self.mutate_layout_data();
|
||||
let node_layout_data_wrapper = layout_data_ref.get_mut_ref();
|
||||
let node_layout_data_wrapper = layout_data_ref.as_mut().unwrap();
|
||||
|
||||
let display = match kind {
|
||||
Before | BeforeBlock => {
|
||||
let before_style = node_layout_data_wrapper.data.before_style.get_ref();
|
||||
let before_style = node_layout_data_wrapper.data.before_style.as_ref().unwrap();
|
||||
before_style.get_box().display
|
||||
}
|
||||
After | AfterBlock => {
|
||||
let after_style = node_layout_data_wrapper.data.after_style.get_ref();
|
||||
let after_style = node_layout_data_wrapper.data.after_style.as_ref().unwrap();
|
||||
after_style.get_box().display
|
||||
}
|
||||
Normal => {
|
||||
let after_style = node_layout_data_wrapper.shared_data.style.get_ref();
|
||||
let after_style = node_layout_data_wrapper.shared_data.style.as_ref().unwrap();
|
||||
after_style.get_box().display
|
||||
}
|
||||
};
|
||||
|
@ -632,13 +632,13 @@ impl<'ln> ThreadSafeLayoutNode<'ln> {
|
|||
|
||||
pub fn has_before_pseudo(&self) -> bool {
|
||||
let layout_data_wrapper = self.borrow_layout_data();
|
||||
let layout_data_wrapper_ref = layout_data_wrapper.get_ref();
|
||||
let layout_data_wrapper_ref = layout_data_wrapper.as_ref().unwrap();
|
||||
layout_data_wrapper_ref.data.before_style.is_some()
|
||||
}
|
||||
|
||||
pub fn has_after_pseudo(&self) -> bool {
|
||||
let layout_data_wrapper = self.borrow_layout_data();
|
||||
let layout_data_wrapper_ref = layout_data_wrapper.get_ref();
|
||||
let layout_data_wrapper_ref = layout_data_wrapper.as_ref().unwrap();
|
||||
layout_data_wrapper_ref.data.after_style.is_some()
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
|
||||
extern crate gfx;
|
||||
extern crate script_traits;
|
||||
extern crate servo_msg = "msg";
|
||||
extern crate servo_net = "net";
|
||||
extern crate servo_util = "util";
|
||||
extern crate "msg" as servo_msg;
|
||||
extern crate "net" as servo_net;
|
||||
extern crate "util" as servo_util;
|
||||
|
||||
// This module contains traits in layout used generically
|
||||
// in the rest of Servo.
|
||||
|
|
|
@ -109,9 +109,9 @@ impl LintPass for UnrootedPass {
|
|||
}
|
||||
}
|
||||
|
||||
fn check_fn(&mut self, cx: &Context, kind: &syntax::visit::FnKind, decl: &ast::FnDecl,
|
||||
fn check_fn(&mut self, cx: &Context, kind: syntax::visit::FnKind, decl: &ast::FnDecl,
|
||||
block: &ast::Block, _span: syntax::codemap::Span, _id: ast::NodeId) {
|
||||
match *kind {
|
||||
match kind {
|
||||
syntax::visit::FkItemFn(i, _, _, _) |
|
||||
syntax::visit::FkMethod(i, _, _) if i.as_str() == "new" || i.as_str() == "new_inherited" => {
|
||||
return;
|
||||
|
@ -184,66 +184,3 @@ macro_rules! bitfield(
|
|||
}
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! lazy_init(
|
||||
($(static ref $N:ident : $T:ty = $e:expr;)*) => (
|
||||
$(
|
||||
#[allow(non_camel_case_types)]
|
||||
struct $N {__unit__: ()}
|
||||
static $N: $N = $N {__unit__: ()};
|
||||
impl Deref<$T> for $N {
|
||||
fn deref<'a>(&'a self) -> &'a $T {
|
||||
unsafe {
|
||||
static mut s: *const $T = 0 as *const $T;
|
||||
static mut ONCE: ::sync::one::Once = ::sync::one::ONCE_INIT;
|
||||
ONCE.doit(|| {
|
||||
s = ::std::mem::transmute::<Box<$T>, *const $T>(box () ($e));
|
||||
});
|
||||
&*s
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
)*
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::collections::hashmap::HashMap;
|
||||
lazy_init! {
|
||||
static ref NUMBER: uint = times_two(3);
|
||||
static ref VEC: [Box<uint>, ..3] = [box 1, box 2, box 3];
|
||||
static ref OWNED_STRING: String = "hello".to_string();
|
||||
static ref HASHMAP: HashMap<uint, &'static str> = {
|
||||
let mut m = HashMap::new();
|
||||
m.insert(0u, "abc");
|
||||
m.insert(1, "def");
|
||||
m.insert(2, "ghi");
|
||||
m
|
||||
};
|
||||
}
|
||||
|
||||
fn times_two(n: uint) -> uint {
|
||||
n * 2
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_basic() {
|
||||
assert_eq!(*OWNED_STRING, "hello".to_string());
|
||||
assert_eq!(*NUMBER, 6);
|
||||
assert!(HASHMAP.find(&1).is_some());
|
||||
assert!(HASHMAP.find(&3).is_none());
|
||||
assert_eq!(VEC.as_slice(), &[box 1, box 2, box 3]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_repeat() {
|
||||
assert_eq!(*NUMBER, 6);
|
||||
assert_eq!(*NUMBER, 6);
|
||||
assert_eq!(*NUMBER, 6);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,10 +113,10 @@ pub trait ScriptListener : Clone {
|
|||
layer_id: LayerId,
|
||||
point: Point2D<f32>);
|
||||
fn close(&self);
|
||||
fn dup(&self) -> Box<ScriptListener>;
|
||||
fn dup(&self) -> Box<ScriptListener+'static>;
|
||||
}
|
||||
|
||||
impl<E, S: Encoder<E>> Encodable<S, E> for Box<ScriptListener> {
|
||||
impl<E, S: Encoder<E>> Encodable<S, E> for Box<ScriptListener+'static> {
|
||||
fn encode(&self, _s: &mut S) -> Result<(), E> {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -8,8 +8,7 @@ extern crate azure;
|
|||
extern crate geom;
|
||||
extern crate layers;
|
||||
extern crate serialize;
|
||||
extern crate servo_util = "util";
|
||||
extern crate std;
|
||||
extern crate "util" as servo_util;
|
||||
extern crate url;
|
||||
|
||||
#[cfg(target_os="macos")]
|
||||
|
|
|
@ -6,8 +6,9 @@ use resource_task::{LoadResponse, Metadata, Done, LoadData, start_sending};
|
|||
use file_loader;
|
||||
|
||||
use std::os;
|
||||
use std::io::fs::PathExtensions;
|
||||
use url::Url;
|
||||
use StatusOk = http::status::Ok;
|
||||
use http::status::Ok as StatusOk;
|
||||
|
||||
|
||||
pub fn factory(mut load_data: LoadData, start_chan: Sender<LoadResponse>) {
|
||||
|
|
|
@ -37,7 +37,7 @@ fn load(load_data: LoadData, start_chan: Sender<LoadResponse>) {
|
|||
},
|
||||
None => ()
|
||||
}
|
||||
let parts: Vec<&str> = scheme_data.as_slice().splitn(',', 1).collect();
|
||||
let parts: Vec<&str> = scheme_data.as_slice().splitn(1, ',').collect();
|
||||
if parts.len() != 2 {
|
||||
start_sending(start_chan, metadata).send(Done(Err("invalid data uri".to_string())));
|
||||
return;
|
||||
|
@ -63,7 +63,7 @@ fn load(load_data: LoadData, start_chan: Sender<LoadResponse>) {
|
|||
if is_base64 {
|
||||
// FIXME(#2909): It’s unclear what to do with non-alphabet characters,
|
||||
// but Acid 3 apparently depends on spaces being ignored.
|
||||
let bytes = bytes.move_iter().filter(|&b| b != ' ' as u8).collect::<Vec<u8>>();
|
||||
let bytes = bytes.into_iter().filter(|&b| b != ' ' as u8).collect::<Vec<u8>>();
|
||||
match bytes.as_slice().from_base64() {
|
||||
Err(..) => {
|
||||
progress_chan.send(Done(Err("non-base64 data uri".to_string())));
|
||||
|
|
|
@ -108,7 +108,7 @@ impl BasicCORSCache {
|
|||
fn find_entry_by_header<'a>(&'a mut self, request: &CacheRequestDetails, header_name: &str) -> Option<&'a mut CORSCacheEntry> {
|
||||
self.cleanup();
|
||||
let BasicCORSCache(ref mut buf) = *self;
|
||||
let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||
e.origin.host() == request.origin.host() &&
|
||||
e.origin.port() == request.origin.port() &&
|
||||
e.url == request.destination &&
|
||||
|
@ -121,7 +121,7 @@ impl BasicCORSCache {
|
|||
// we can take the method from CORSRequest itself
|
||||
self.cleanup();
|
||||
let BasicCORSCache(ref mut buf) = *self;
|
||||
let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||
e.origin.host() == request.origin.host() &&
|
||||
e.origin.port() == request.origin.port() &&
|
||||
e.url == request.destination &&
|
||||
|
@ -136,7 +136,7 @@ impl CORSCache for BasicCORSCache {
|
|||
#[allow(dead_code)]
|
||||
fn clear (&mut self, request: CacheRequestDetails) {
|
||||
let BasicCORSCache(buf) = self.clone();
|
||||
let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
||||
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
||||
*self = BasicCORSCache(new_buf);
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ impl CORSCache for BasicCORSCache {
|
|||
fn cleanup(&mut self) {
|
||||
let BasicCORSCache(buf) = self.clone();
|
||||
let now = time::now().to_timespec();
|
||||
let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect();
|
||||
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect();
|
||||
*self = BasicCORSCache(new_buf);
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ pub struct Request {
|
|||
pub manual_redirect: bool,
|
||||
pub redirect_count: uint,
|
||||
pub response_tainting: ResponseTainting,
|
||||
pub cache: Option<Box<CORSCache>>
|
||||
pub cache: Option<Box<CORSCache+'static>>
|
||||
}
|
||||
|
||||
impl Request {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use url::Url;
|
||||
use http::status::{Status, UnregisteredStatus};
|
||||
use StatusOk = http::status::Ok;
|
||||
use http::status::Ok as StatusOk;
|
||||
use http::headers::HeaderEnum;
|
||||
use http::headers::response::HeaderCollection;
|
||||
use std::ascii::OwnedStrAsciiExt;
|
||||
|
|
|
@ -69,7 +69,7 @@ fn load(load_data: LoadData, start_chan: Sender<LoadResponse>) {
|
|||
|
||||
// Preserve the `host` header set automatically by RequestWriter.
|
||||
let host = writer.headers.host.clone();
|
||||
writer.headers = box load_data.headers.clone();
|
||||
writer.headers = load_data.headers.clone();
|
||||
writer.headers.host = host;
|
||||
if writer.headers.accept_encoding.is_none() {
|
||||
// We currently don't support HTTP Compression (FIXME #2587)
|
||||
|
@ -130,7 +130,7 @@ fn load(load_data: LoadData, start_chan: Sender<LoadResponse>) {
|
|||
|
||||
let mut metadata = Metadata::default(url);
|
||||
metadata.set_content_type(&response.headers.content_type);
|
||||
metadata.headers = Some(*response.headers.clone());
|
||||
metadata.headers = Some(response.headers.clone());
|
||||
metadata.status = response.status.clone();
|
||||
|
||||
let progress_chan = match start_sending_opt(start_chan, metadata) {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use std::iter::range_step;
|
||||
use stb_image = stb_image::image;
|
||||
use stb_image::image as stb_image;
|
||||
use png;
|
||||
|
||||
// FIXME: Images must not be copied every frame. Instead we should atomically
|
||||
|
|
|
@ -76,7 +76,7 @@ impl<E, S: Encoder<E>> Encodable<S, E> for ImageCacheTask {
|
|||
}
|
||||
}
|
||||
|
||||
type DecoderFactory = fn() -> proc(&[u8]) -> Option<Image>;
|
||||
type DecoderFactory = fn() -> (proc(&[u8]) : 'static -> Option<Image>);
|
||||
|
||||
impl ImageCacheTask {
|
||||
pub fn new(resource_task: ResourceTask) -> ImageCacheTask {
|
||||
|
@ -464,7 +464,7 @@ fn load_image_data(url: Url, resource_task: ResourceTask) -> Result<Vec<u8>, ()>
|
|||
image_data.push_all(data.as_slice());
|
||||
}
|
||||
resource_task::Done(result::Ok(..)) => {
|
||||
return Ok(image_data.move_iter().collect());
|
||||
return Ok(image_data.into_iter().collect());
|
||||
}
|
||||
resource_task::Done(result::Err(..)) => {
|
||||
return Err(());
|
||||
|
|
|
@ -14,7 +14,7 @@ extern crate png;
|
|||
#[phase(plugin, link)]
|
||||
extern crate log;
|
||||
extern crate serialize;
|
||||
extern crate servo_util = "util";
|
||||
extern crate "util" as servo_util;
|
||||
extern crate stb_image;
|
||||
extern crate sync;
|
||||
extern crate time;
|
||||
|
|
|
@ -12,12 +12,12 @@ use http_loader;
|
|||
use std::comm::{channel, Receiver, Sender};
|
||||
use std::task::TaskBuilder;
|
||||
use http::headers::content_type::MediaType;
|
||||
use ResponseHeaderCollection = http::headers::response::HeaderCollection;
|
||||
use RequestHeaderCollection = http::headers::request::HeaderCollection;
|
||||
use http::headers::response::HeaderCollection as ResponseHeaderCollection;
|
||||
use http::headers::request::HeaderCollection as RequestHeaderCollection;
|
||||
use http::method::{Method, Get};
|
||||
use url::Url;
|
||||
|
||||
use StatusOk = http::status::Ok;
|
||||
use http::status::Ok as StatusOk;
|
||||
use http::status::Status;
|
||||
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ use std::str::StrSlice;
|
|||
use time;
|
||||
use time::{now, Timespec};
|
||||
|
||||
use ResponseHeaderCollection = http::headers::response::HeaderCollection;
|
||||
use RequestHeaderCollection = http::headers::request::HeaderCollection;
|
||||
use RequestHeader = http::headers::request::Header;
|
||||
use http::headers::response::HeaderCollection as ResponseHeaderCollection;
|
||||
use http::headers::request::HeaderCollection as RequestHeaderCollection;
|
||||
use http::headers::request::Header as RequestHeader;
|
||||
|
||||
use http::client::{RequestWriter, NetworkStream};
|
||||
use http::headers::{HeaderConvertible, HeaderEnum, HeaderValueByteIterator};
|
||||
|
@ -146,7 +146,7 @@ impl CORSRequest {
|
|||
};
|
||||
|
||||
let host = writer.headers.host.clone();
|
||||
writer.headers = box preflight.headers.clone();
|
||||
writer.headers = preflight.headers.clone();
|
||||
writer.headers.host = host;
|
||||
let response = match writer.read_response() {
|
||||
Ok(r) => r,
|
||||
|
@ -158,19 +158,19 @@ impl CORSRequest {
|
|||
200 .. 299 => {}
|
||||
_ => return error
|
||||
}
|
||||
cors_response.headers = *response.headers.clone();
|
||||
cors_response.headers = response.headers.clone();
|
||||
// Substeps 1-3 (parsing rules: http://fetch.spec.whatwg.org/#http-new-header-syntax)
|
||||
fn find_header(headers: &ResponseHeaderCollection, name: &str) -> Option<String> {
|
||||
headers.iter().find(|h| h.header_name().as_slice()
|
||||
.eq_ignore_ascii_case(name))
|
||||
.map(|h| h.header_value())
|
||||
}
|
||||
let methods_string = match find_header(&*response.headers, "Access-Control-Allow-Methods") {
|
||||
let methods_string = match find_header(&response.headers, "Access-Control-Allow-Methods") {
|
||||
Some(s) => s,
|
||||
_ => return error
|
||||
};
|
||||
let methods = methods_string.as_slice().split(',');
|
||||
let headers_string = match find_header(&*response.headers, "Access-Control-Allow-Headers") {
|
||||
let headers_string = match find_header(&response.headers, "Access-Control-Allow-Headers") {
|
||||
Some(s) => s,
|
||||
_ => return error
|
||||
};
|
||||
|
@ -197,7 +197,7 @@ impl CORSRequest {
|
|||
}
|
||||
}
|
||||
// Substep 7, 8
|
||||
let max_age: uint = find_header(&*response.headers, "Access-Control-Max-Age")
|
||||
let max_age: uint = find_header(&response.headers, "Access-Control-Max-Age")
|
||||
.and_then(|h| FromStr::from_str(h.as_slice())).unwrap_or(0);
|
||||
// Substep 9: Impose restrictions on max-age, if any (unimplemented)
|
||||
// Substeps 10-12: Add a cache (partially implemented, XXXManishearth)
|
||||
|
@ -315,7 +315,7 @@ impl CORSCache {
|
|||
#[allow(dead_code)]
|
||||
fn clear (&mut self, request: &CORSRequest) {
|
||||
let CORSCache(buf) = self.clone();
|
||||
let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
||||
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| e.origin == request.origin && request.destination == e.url).collect();
|
||||
*self = CORSCache(new_buf);
|
||||
}
|
||||
|
||||
|
@ -323,7 +323,7 @@ impl CORSCache {
|
|||
fn cleanup(&mut self) {
|
||||
let CORSCache(buf) = self.clone();
|
||||
let now = time::now().to_timespec();
|
||||
let new_buf: Vec<CORSCacheEntry> = buf.move_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect();
|
||||
let new_buf: Vec<CORSCacheEntry> = buf.into_iter().filter(|e| now.sec > e.created.sec + e.max_age as i64).collect();
|
||||
*self = CORSCache(new_buf);
|
||||
}
|
||||
|
||||
|
@ -332,7 +332,7 @@ impl CORSCache {
|
|||
self.cleanup();
|
||||
let CORSCache(ref mut buf) = *self;
|
||||
// Credentials are not yet implemented here
|
||||
let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||
e.origin.host() == request.origin.host() &&
|
||||
e.origin.port() == request.origin.port() &&
|
||||
e.url == request.destination &&
|
||||
|
@ -353,7 +353,7 @@ impl CORSCache {
|
|||
self.cleanup();
|
||||
let CORSCache(ref mut buf) = *self;
|
||||
// Credentials are not yet implemented here
|
||||
let entry = buf.mut_iter().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||
let entry = buf.iter_mut().find(|e| e.origin.scheme == request.origin.scheme &&
|
||||
e.origin.host() == request.origin.host() &&
|
||||
e.origin.port() == request.origin.port() &&
|
||||
e.url == request.destination &&
|
||||
|
|
|
@ -121,7 +121,7 @@ pub fn WrapCallThisObject<T: Reflectable>(cx: *mut JSContext,
|
|||
|
||||
unsafe {
|
||||
if JS_WrapObject(cx, &mut obj) == 0 {
|
||||
return ptr::mut_null();
|
||||
return ptr::null_mut();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1757,6 +1757,7 @@ class CGAbstractMethod(CGThing):
|
|||
decorators.append('#[inline(always)]')
|
||||
|
||||
if self.extern:
|
||||
decorators.append('unsafe')
|
||||
decorators.append('extern')
|
||||
|
||||
if self.pub:
|
||||
|
@ -1797,7 +1798,7 @@ let obj = with_compartment(aCx, proto, || {
|
|||
NewProxyObject(aCx, handler,
|
||||
&private,
|
||||
proto, %s,
|
||||
ptr::mut_null(), ptr::mut_null())
|
||||
ptr::null_mut(), ptr::null_mut())
|
||||
});
|
||||
assert!(obj.is_not_null());
|
||||
|
||||
|
@ -3665,7 +3666,7 @@ if expando.is_not_null() {
|
|||
}
|
||||
}
|
||||
""" + namedGet + """
|
||||
(*desc).obj = ptr::mut_null();
|
||||
(*desc).obj = ptr::null_mut();
|
||||
return true;"""
|
||||
|
||||
def definition_body(self):
|
||||
|
@ -4302,11 +4303,11 @@ class CGDictionary(CGThing):
|
|||
return string.Template(
|
||||
"impl<'a, 'b> ${selfName}<'a, 'b> {\n"
|
||||
" pub fn empty() -> ${selfName}<'a, 'b> {\n"
|
||||
" ${selfName}::new(ptr::mut_null(), NullValue()).unwrap()\n"
|
||||
" ${selfName}::new(ptr::null_mut(), NullValue()).unwrap()\n"
|
||||
" }\n"
|
||||
" pub fn new(cx: *mut JSContext, val: JSVal) -> Result<${selfName}<'a, 'b>, ()> {\n"
|
||||
" let object = if val.is_null_or_undefined() {\n"
|
||||
" ptr::mut_null()\n"
|
||||
" ptr::null_mut()\n"
|
||||
" } else if val.is_object() {\n"
|
||||
" val.to_object()\n"
|
||||
" } else {\n"
|
||||
|
@ -4538,7 +4539,6 @@ class CGBindingRoot(CGThing):
|
|||
'dom::bindings::conversions::{Default, Empty}',
|
||||
'dom::bindings::codegen::*',
|
||||
'dom::bindings::codegen::Bindings::*',
|
||||
'dom::bindings::codegen::RegisterBindings',
|
||||
'dom::bindings::codegen::UnionTypes::*',
|
||||
'dom::bindings::error::{FailureUnknown, Fallible, Error, ErrorResult}',
|
||||
'dom::bindings::error::throw_dom_exception',
|
||||
|
@ -4914,7 +4914,7 @@ class CGCallback(CGClass):
|
|||
# the private method.
|
||||
argnames = [arg.name for arg in args]
|
||||
argnamesWithThis = ["s.GetContext()", "thisObjJS"] + argnames
|
||||
argnamesWithoutThis = ["s.GetContext()", "ptr::mut_null()"] + argnames
|
||||
argnamesWithoutThis = ["s.GetContext()", "ptr::null_mut()"] + argnames
|
||||
# Now that we've recorded the argnames for our call to our private
|
||||
# method, insert our optional argument for deciding whether the
|
||||
# CallSetup should re-throw exceptions on aRv.
|
||||
|
@ -5477,12 +5477,12 @@ class GlobalGenRoots():
|
|||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn from_ref<'a, T: ${fromBound}>(derived: JSRef<'a, T>) -> JSRef<'a, Self> {
|
||||
fn from_ref<'a, T: ${fromBound}+Reflectable>(derived: JSRef<'a, T>) -> JSRef<'a, Self> {
|
||||
unsafe { derived.transmute() }
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn from_borrowed_ref<'a, 'b, T: ${fromBound}>(derived: &'a JSRef<'b, T>) -> &'a JSRef<'b, Self> {
|
||||
fn from_borrowed_ref<'a, 'b, T: ${fromBound}+Reflectable>(derived: &'a JSRef<'b, T>) -> &'a JSRef<'b, Self> {
|
||||
unsafe { derived.transmute_borrowed() }
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ static ERROR_FORMAT_STRING: JSErrorFormatString = JSErrorFormatString {
|
|||
};
|
||||
|
||||
/// Callback used to throw `TypeError`s.
|
||||
extern fn get_error_message(_user_ref: *mut libc::c_void,
|
||||
unsafe extern fn get_error_message(_user_ref: *mut libc::c_void,
|
||||
_locale: *const libc::c_char,
|
||||
error_number: libc::c_uint) -> *const JSErrorFormatString
|
||||
{
|
||||
|
@ -109,6 +109,6 @@ extern fn get_error_message(_user_ref: *mut libc::c_void,
|
|||
pub fn throw_type_error(cx: *mut JSContext, error: &str) {
|
||||
let error = error.to_c_str();
|
||||
unsafe {
|
||||
JS_ReportErrorNumber(cx, Some(get_error_message), ptr::mut_null(), 0, error.as_ptr());
|
||||
JS_ReportErrorNumber(cx, Some(get_error_message), ptr::null_mut(), 0, error.as_ptr());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -255,7 +255,7 @@ impl<T> Assignable<T> for JS<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, T> Assignable<T> for JSRef<'a, T> {
|
||||
impl<'a, T: Reflectable> Assignable<T> for JSRef<'a, T> {
|
||||
unsafe fn get_js(&self) -> JS<T> {
|
||||
self.unrooted()
|
||||
}
|
||||
|
|
|
@ -26,11 +26,10 @@ use std::mem::size_of;
|
|||
|
||||
static JSPROXYSLOT_EXPANDO: u32 = 0;
|
||||
|
||||
pub extern fn getPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObject,
|
||||
pub unsafe extern fn getPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObject,
|
||||
id: jsid, set: bool,
|
||||
desc: *mut JSPropertyDescriptor)
|
||||
-> bool {
|
||||
unsafe {
|
||||
let handler = GetProxyHandler(proxy);
|
||||
if !InvokeGetOwnPropertyDescriptor(handler, cx, proxy, id, set, desc) {
|
||||
return false;
|
||||
|
@ -42,19 +41,17 @@ pub extern fn getPropertyDescriptor(cx: *mut JSContext, proxy: *mut JSObject,
|
|||
//let proto = JS_GetPrototype(proxy);
|
||||
let proto = GetObjectProto(proxy);
|
||||
if proto.is_null() {
|
||||
(*desc).obj = ptr::mut_null();
|
||||
(*desc).obj = ptr::null_mut();
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_GetPropertyDescriptorById(cx, proto, id, JSRESOLVE_QUALIFIED, desc) != 0
|
||||
}
|
||||
}
|
||||
|
||||
pub fn defineProperty_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
||||
pub unsafe fn defineProperty_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
||||
desc: *mut JSPropertyDescriptor) -> bool {
|
||||
static JSMSG_GETTER_ONLY: libc::c_uint = 160;
|
||||
|
||||
unsafe {
|
||||
//FIXME: Workaround for https://github.com/mozilla/rust/issues/13385
|
||||
let setter: *const libc::c_void = mem::transmute((*desc).setter);
|
||||
let setter_stub: *const libc::c_void = mem::transmute(JS_StrictPropertyStub);
|
||||
|
@ -62,7 +59,7 @@ pub fn defineProperty_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
|||
return JS_ReportErrorFlagsAndNumber(cx,
|
||||
JSREPORT_WARNING | JSREPORT_STRICT |
|
||||
JSREPORT_STRICT_MODE_ERROR,
|
||||
Some(RUST_js_GetErrorMessage), ptr::mut_null(),
|
||||
Some(RUST_js_GetErrorMessage), ptr::null_mut(),
|
||||
JSMSG_GETTER_ONLY) != 0;
|
||||
}
|
||||
|
||||
|
@ -73,24 +70,21 @@ pub fn defineProperty_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
|||
|
||||
return JS_DefinePropertyById(cx, expando, id, (*desc).value, (*desc).getter,
|
||||
(*desc).setter, (*desc).attrs) != 0;
|
||||
}
|
||||
}
|
||||
|
||||
pub extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
||||
pub unsafe extern fn defineProperty(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
||||
desc: *mut JSPropertyDescriptor) -> bool {
|
||||
defineProperty_(cx, proxy, id, desc)
|
||||
}
|
||||
|
||||
pub extern fn delete_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
||||
pub unsafe extern fn delete_(cx: *mut JSContext, proxy: *mut JSObject, id: jsid,
|
||||
bp: *mut bool) -> bool {
|
||||
unsafe {
|
||||
let expando = EnsureExpandoObject(cx, proxy);
|
||||
if expando.is_null() {
|
||||
return false;
|
||||
}
|
||||
|
||||
return delete_property_by_id(cx, expando, id, &mut *bp);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn _obj_toString(cx: *mut JSContext, className: *const libc::c_char) -> *mut JSString {
|
||||
|
@ -99,7 +93,7 @@ pub fn _obj_toString(cx: *mut JSContext, className: *const libc::c_char) -> *mut
|
|||
let nchars = "[object ]".len() + name.len();
|
||||
let chars: *mut jschar = JS_malloc(cx, (nchars + 1) as libc::size_t * (size_of::<jschar>() as libc::size_t)) as *mut jschar;
|
||||
if chars.is_null() {
|
||||
return ptr::mut_null();
|
||||
return ptr::null_mut();
|
||||
}
|
||||
|
||||
let result = format!("[object {}]", name);
|
||||
|
@ -121,7 +115,7 @@ pub fn GetExpandoObject(obj: *mut JSObject) -> *mut JSObject {
|
|||
assert!(is_dom_proxy(obj));
|
||||
let val = GetProxyExtra(obj, JSPROXYSLOT_EXPANDO);
|
||||
if val.is_undefined() {
|
||||
ptr::mut_null()
|
||||
ptr::null_mut()
|
||||
} else {
|
||||
val.to_object()
|
||||
}
|
||||
|
@ -133,11 +127,11 @@ pub fn EnsureExpandoObject(cx: *mut JSContext, obj: *mut JSObject) -> *mut JSObj
|
|||
assert!(is_dom_proxy(obj));
|
||||
let mut expando = GetExpandoObject(obj);
|
||||
if expando.is_null() {
|
||||
expando = JS_NewObjectWithGivenProto(cx, ptr::mut_null(),
|
||||
ptr::mut_null(),
|
||||
expando = JS_NewObjectWithGivenProto(cx, ptr::null_mut(),
|
||||
ptr::null_mut(),
|
||||
GetObjectParent(obj));
|
||||
if expando.is_null() {
|
||||
return ptr::mut_null();
|
||||
return ptr::null_mut();
|
||||
}
|
||||
|
||||
SetProxyExtra(obj, JSPROXYSLOT_EXPANDO, ObjectValue(&*expando));
|
||||
|
|
|
@ -129,7 +129,7 @@ pub fn unwrap_jsmanaged<T: Reflectable>(mut obj: *mut JSObject,
|
|||
let dom_class = get_dom_class(obj).or_else(|_| {
|
||||
if IsWrapper(obj) == 1 {
|
||||
debug!("found wrapper");
|
||||
obj = UnwrapObject(obj, /* stopAtOuter = */ 0, ptr::mut_null());
|
||||
obj = UnwrapObject(obj, /* stopAtOuter = */ 0, ptr::null_mut());
|
||||
if obj.is_null() {
|
||||
debug!("unwrapping security wrapper failed");
|
||||
Err(())
|
||||
|
@ -421,7 +421,7 @@ fn CreateInterfacePrototypeObject(cx: *mut JSContext, global: *mut JSObject,
|
|||
|
||||
/// A throwing constructor, for those interfaces that have neither
|
||||
/// `NoInterfaceObject` nor `Constructor`.
|
||||
pub extern fn ThrowingConstructor(cx: *mut JSContext, _argc: c_uint, _vp: *mut JSVal) -> JSBool {
|
||||
pub unsafe extern fn ThrowingConstructor(cx: *mut JSContext, _argc: c_uint, _vp: *mut JSVal) -> JSBool {
|
||||
throw_type_error(cx, "Illegal constructor.");
|
||||
return 0;
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ impl Reflector {
|
|||
/// Create an uninitialized `Reflector`.
|
||||
pub fn new() -> Reflector {
|
||||
Reflector {
|
||||
object: Cell::new(ptr::mut_null()),
|
||||
object: Cell::new(ptr::null_mut()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ pub fn get_dictionary_property(cx: *mut JSContext,
|
|||
pub fn HasPropertyOnPrototype(cx: *mut JSContext, proxy: *mut JSObject, id: jsid) -> bool {
|
||||
// MOZ_ASSERT(js::IsProxy(proxy) && js::GetProxyHandler(proxy) == handler);
|
||||
let mut found = false;
|
||||
return !GetPropertyOnPrototype(cx, proxy, id, &mut found, ptr::mut_null()) || found;
|
||||
return !GetPropertyOnPrototype(cx, proxy, id, &mut found, ptr::null_mut()) || found;
|
||||
}
|
||||
|
||||
/// Returns whether `obj` can be converted to a callback interface per IDL.
|
||||
|
@ -626,9 +626,9 @@ pub fn IsConvertibleToCallbackInterface(cx: *mut JSContext, obj: *mut JSObject)
|
|||
/// Create a DOM global object with the given class.
|
||||
pub fn CreateDOMGlobal(cx: *mut JSContext, class: *const JSClass) -> *mut JSObject {
|
||||
unsafe {
|
||||
let obj = JS_NewGlobalObject(cx, class, ptr::mut_null());
|
||||
let obj = JS_NewGlobalObject(cx, class, ptr::null_mut());
|
||||
if obj.is_null() {
|
||||
return ptr::mut_null();
|
||||
return ptr::null_mut();
|
||||
}
|
||||
with_compartment(cx, obj, || {
|
||||
JS_InitStandardClasses(cx, obj);
|
||||
|
@ -639,18 +639,14 @@ pub fn CreateDOMGlobal(cx: *mut JSContext, class: *const JSClass) -> *mut JSObje
|
|||
}
|
||||
|
||||
/// Callback to outerize windows when wrapping.
|
||||
pub extern fn wrap_for_same_compartment(cx: *mut JSContext, obj: *mut JSObject) -> *mut JSObject {
|
||||
unsafe {
|
||||
pub unsafe extern fn wrap_for_same_compartment(cx: *mut JSContext, obj: *mut JSObject) -> *mut JSObject {
|
||||
JS_ObjectToOuterObject(cx, obj)
|
||||
}
|
||||
}
|
||||
|
||||
/// Callback to outerize windows before wrapping.
|
||||
pub extern fn pre_wrap(cx: *mut JSContext, _scope: *mut JSObject,
|
||||
pub unsafe extern fn pre_wrap(cx: *mut JSContext, _scope: *mut JSObject,
|
||||
obj: *mut JSObject, _flags: c_uint) -> *mut JSObject {
|
||||
unsafe {
|
||||
JS_ObjectToOuterObject(cx, obj)
|
||||
}
|
||||
}
|
||||
|
||||
/// Callback to outerize windows.
|
||||
|
@ -664,7 +660,7 @@ pub extern fn outerize_global(_cx: *mut JSContext, obj: JSHandleObject) -> *mut
|
|||
IDLInterface::get_prototype_depth(None::<window::Window>))
|
||||
.unwrap()
|
||||
.root();
|
||||
win.deref().browser_context.deref().borrow().get_ref().window_proxy()
|
||||
win.deref().browser_context.deref().borrow().as_ref().unwrap().window_proxy()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -675,12 +671,12 @@ pub fn global_object_for_js_object(obj: *mut JSObject) -> GlobalField {
|
|||
let global = GetGlobalForObjectCrossCompartment(obj);
|
||||
let clasp = JS_GetClass(global);
|
||||
assert!(((*clasp).flags & (JSCLASS_IS_DOMJSCLASS | JSCLASS_IS_GLOBAL)) != 0);
|
||||
match FromJSValConvertible::from_jsval(ptr::mut_null(), ObjectOrNullValue(global), ()) {
|
||||
match FromJSValConvertible::from_jsval(ptr::null_mut(), ObjectOrNullValue(global), ()) {
|
||||
Ok(window) => return WindowField(window),
|
||||
Err(_) => (),
|
||||
}
|
||||
|
||||
match FromJSValConvertible::from_jsval(ptr::mut_null(), ObjectOrNullValue(global), ()) {
|
||||
match FromJSValConvertible::from_jsval(ptr::null_mut(), ObjectOrNullValue(global), ()) {
|
||||
Ok(worker) => return WorkerField(worker),
|
||||
Err(_) => (),
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ impl BrowserContext {
|
|||
let mut context = BrowserContext {
|
||||
history: vec!(SessionHistoryEntry::new(document)),
|
||||
active_index: 0,
|
||||
window_proxy: Traceable::new(ptr::mut_null()),
|
||||
window_proxy: Traceable::new(ptr::null_mut()),
|
||||
};
|
||||
context.create_window_proxy();
|
||||
context
|
||||
|
@ -53,11 +53,11 @@ impl BrowserContext {
|
|||
let page = win.deref().page();
|
||||
let js_info = page.js_info();
|
||||
|
||||
let handler = js_info.get_ref().dom_static.windowproxy_handler;
|
||||
let handler = js_info.as_ref().unwrap().dom_static.windowproxy_handler;
|
||||
assert!(handler.deref().is_not_null());
|
||||
|
||||
let parent = win.deref().reflector().get_jsobject();
|
||||
let cx = js_info.get_ref().js_context.deref().deref().ptr;
|
||||
let cx = js_info.as_ref().unwrap().js_context.deref().deref().ptr;
|
||||
let wrapper = with_compartment(cx, parent, || unsafe {
|
||||
WrapperNew(cx, parent, *handler.deref())
|
||||
});
|
||||
|
|
|
@ -127,7 +127,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
assert!(JS_ReadStructuredClone(
|
||||
js_context.ptr, data as *const u64, nbytes,
|
||||
JS_STRUCTURED_CLONE_VERSION, &mut message,
|
||||
ptr::null(), ptr::mut_null()) != 0);
|
||||
ptr::null(), ptr::null_mut()) != 0);
|
||||
}
|
||||
|
||||
MessageEvent::dispatch_jsval(target, &Worker(scope), message);
|
||||
|
@ -152,11 +152,11 @@ impl DedicatedWorkerGlobalScope {
|
|||
|
||||
impl<'a> DedicatedWorkerGlobalScopeMethods for JSRef<'a, DedicatedWorkerGlobalScope> {
|
||||
fn PostMessage(self, cx: *mut JSContext, message: JSVal) {
|
||||
let mut data = ptr::mut_null();
|
||||
let mut data = ptr::null_mut();
|
||||
let mut nbytes = 0;
|
||||
unsafe {
|
||||
assert!(JS_WriteStructuredClone(cx, message, &mut data, &mut nbytes,
|
||||
ptr::null(), ptr::mut_null()) != 0);
|
||||
ptr::null(), ptr::null_mut()) != 0);
|
||||
}
|
||||
|
||||
let ScriptChan(ref sender) = self.parent_sender;
|
||||
|
|
|
@ -356,12 +356,14 @@ impl<'a> PrivateDocumentHelpers for JSRef<'a, Document> {
|
|||
}
|
||||
|
||||
fn get_html_element(self) -> Option<Temporary<HTMLHtmlElement>> {
|
||||
self.GetDocumentElement().root().filtered(|root| {
|
||||
match self.GetDocumentElement().root() {
|
||||
Some(ref root) if {
|
||||
let root: JSRef<Node> = NodeCast::from_ref(**root);
|
||||
root.type_id() == ElementNodeTypeId(HTMLHtmlElementTypeId)
|
||||
}).map(|elem| {
|
||||
Temporary::from_rooted(HTMLHtmlElementCast::to_ref(*elem).unwrap())
|
||||
})
|
||||
} => Some(Temporary::from_rooted(HTMLHtmlElementCast::to_ref(**root).unwrap())),
|
||||
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,7 +373,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
if self.implementation.get().is_none() {
|
||||
self.implementation.assign(Some(DOMImplementation::new(self)));
|
||||
}
|
||||
Temporary::new(self.implementation.get().get_ref().clone())
|
||||
Temporary::new(self.implementation.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-document-url
|
||||
|
@ -751,7 +753,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
let filter = box ImagesFilter;
|
||||
self.images.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||
}
|
||||
Temporary::new(self.images.get().get_ref().clone())
|
||||
Temporary::new(self.images.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Embeds(self) -> Temporary<HTMLCollection> {
|
||||
|
@ -761,7 +763,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
let filter = box EmbedsFilter;
|
||||
self.embeds.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||
}
|
||||
Temporary::new(self.embeds.get().get_ref().clone())
|
||||
Temporary::new(self.embeds.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Plugins(self) -> Temporary<HTMLCollection> {
|
||||
|
@ -775,7 +777,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
let filter = box LinksFilter;
|
||||
self.links.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||
}
|
||||
Temporary::new(self.links.get().get_ref().clone())
|
||||
Temporary::new(self.links.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Forms(self) -> Temporary<HTMLCollection> {
|
||||
|
@ -785,7 +787,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
let filter = box FormsFilter;
|
||||
self.forms.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||
}
|
||||
Temporary::new(self.forms.get().get_ref().clone())
|
||||
Temporary::new(self.forms.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Scripts(self) -> Temporary<HTMLCollection> {
|
||||
|
@ -795,7 +797,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
let filter = box ScriptsFilter;
|
||||
self.scripts.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||
}
|
||||
Temporary::new(self.scripts.get().get_ref().clone())
|
||||
Temporary::new(self.scripts.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Anchors(self) -> Temporary<HTMLCollection> {
|
||||
|
@ -805,7 +807,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
let filter = box AnchorsFilter;
|
||||
self.anchors.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||
}
|
||||
Temporary::new(self.anchors.get().get_ref().clone())
|
||||
Temporary::new(self.anchors.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Applets(self) -> Temporary<HTMLCollection> {
|
||||
|
@ -816,7 +818,7 @@ impl<'a> DocumentMethods for JSRef<'a, Document> {
|
|||
let filter = box AppletsFilter;
|
||||
self.applets.assign(Some(HTMLCollection::create(*window, root, filter)));
|
||||
}
|
||||
Temporary::new(self.applets.get().get_ref().clone())
|
||||
Temporary::new(self.applets.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Location(self) -> Temporary<Location> {
|
||||
|
|
|
@ -581,7 +581,7 @@ impl<'a> ElementMethods for JSRef<'a, Element> {
|
|||
let window = doc.deref().window.root();
|
||||
let list = NamedNodeMap::new(*window, self);
|
||||
self.attr_list.assign(Some(list));
|
||||
Temporary::new(self.attr_list.get().get_ref().clone())
|
||||
Temporary::new(self.attr_list.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-element-getattribute
|
||||
|
@ -830,7 +830,7 @@ pub fn get_attribute_parts<'a>(name: &'a str) -> (Option<&'a str>, &'a str) {
|
|||
//FIXME: Throw for XML-invalid names
|
||||
//FIXME: Throw for XMLNS-invalid names
|
||||
let (prefix, local_name) = if name.contains(":") {
|
||||
let mut parts = name.splitn(':', 1);
|
||||
let mut parts = name.splitn(1, ':');
|
||||
(Some(parts.next().unwrap()), parts.next().unwrap())
|
||||
} else {
|
||||
(None, name)
|
||||
|
|
|
@ -185,7 +185,7 @@ impl<'a> EventTargetHelpers for JSRef<'a, EventTarget> {
|
|||
let source: Vec<u16> = source.as_slice().utf16_units().collect();
|
||||
let handler = unsafe {
|
||||
JS_CompileUCFunction(cx,
|
||||
ptr::mut_null(),
|
||||
ptr::null_mut(),
|
||||
name.as_ptr(),
|
||||
nargs,
|
||||
&arg_names as *const *const i8 as *mut *const i8,
|
||||
|
@ -254,7 +254,7 @@ impl<'a> EventTargetMethods for JSRef<'a, EventTarget> {
|
|||
Some(listener) => {
|
||||
let mut handlers = self.handlers.deref().borrow_mut();
|
||||
let mut entry = handlers.find_mut(&ty);
|
||||
for entry in entry.mut_iter() {
|
||||
for entry in entry.iter_mut() {
|
||||
let phase = if capture { Capturing } else { Bubbling };
|
||||
let old_entry = EventListenerEntry {
|
||||
phase: phase,
|
||||
|
|
|
@ -73,7 +73,7 @@ impl<'a> FormDataMethods for JSRef<'a, FormData> {
|
|||
|
||||
fn Get(self, name: DOMString) -> Option<FileOrString> {
|
||||
if self.data.deref().borrow().contains_key_equiv(&name) {
|
||||
match self.data.deref().borrow().get(&name)[0].clone() {
|
||||
match (*self.data.deref().borrow())[name][0].clone() {
|
||||
StringData(ref s) => Some(eString(s.clone())),
|
||||
FileData(ref f) => {
|
||||
Some(eFile(f.clone()))
|
||||
|
|
|
@ -23,7 +23,7 @@ pub trait CollectionFilter {
|
|||
fn filter(&self, elem: JSRef<Element>, root: JSRef<Node>) -> bool;
|
||||
}
|
||||
|
||||
impl<S: Encoder<E>, E> Encodable<S, E> for Box<CollectionFilter> {
|
||||
impl<S: Encoder<E>, E> Encodable<S, E> for Box<CollectionFilter+'static> {
|
||||
fn encode(&self, _s: &mut S) -> Result<(), E> {
|
||||
Ok(())
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ impl<S: Encoder<E>, E> Encodable<S, E> for Box<CollectionFilter> {
|
|||
#[must_root]
|
||||
pub enum CollectionTypeId {
|
||||
Static(Vec<JS<Element>>),
|
||||
Live(JS<Node>, Box<CollectionFilter>)
|
||||
Live(JS<Node>, Box<CollectionFilter+'static>)
|
||||
}
|
||||
|
||||
#[deriving(Encodable)]
|
||||
|
@ -59,7 +59,7 @@ impl HTMLCollection {
|
|||
|
||||
impl HTMLCollection {
|
||||
pub fn create(window: JSRef<Window>, root: JSRef<Node>,
|
||||
filter: Box<CollectionFilter>) -> Temporary<HTMLCollection> {
|
||||
filter: Box<CollectionFilter+'static>) -> Temporary<HTMLCollection> {
|
||||
HTMLCollection::new(window, Live(JS::from_rooted(root), filter))
|
||||
}
|
||||
|
||||
|
|
|
@ -78,8 +78,8 @@ impl<'a> HTMLOptionElementMethods for JSRef<'a, HTMLOptionElement> {
|
|||
}
|
||||
|
||||
// http://www.whatwg.org/html/#dom-option-text
|
||||
fn Text(&self) -> DOMString {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
||||
fn Text(self) -> DOMString {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||
let mut content = String::new();
|
||||
collect_text(&node, &mut content);
|
||||
let v: Vec<&str> = split_html_space_chars(content.as_slice()).collect();
|
||||
|
@ -87,8 +87,8 @@ impl<'a> HTMLOptionElementMethods for JSRef<'a, HTMLOptionElement> {
|
|||
}
|
||||
|
||||
// http://www.whatwg.org/html/#dom-option-text
|
||||
fn SetText(&self, value: DOMString) {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(*self);
|
||||
fn SetText(self, value: DOMString) {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(self);
|
||||
node.SetTextContent(Some(value))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -657,7 +657,7 @@ impl<'m, 'n> NodeHelpers<'m, 'n> for JSRef<'n, Node> {
|
|||
}
|
||||
|
||||
fn owner_doc(&self) -> Temporary<Document> {
|
||||
Temporary::new(self.owner_doc.get().get_ref().clone())
|
||||
Temporary::new(self.owner_doc.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn set_owner_doc(&self, document: JSRef<Document>) {
|
||||
|
@ -869,7 +869,7 @@ impl<'a> Iterator<JSRef<'a, Node>> for AncestorIterator<'a> {
|
|||
}
|
||||
|
||||
// FIXME: Do we need two clones here?
|
||||
let x = self.current.get_ref().clone();
|
||||
let x = self.current.as_ref().unwrap().clone();
|
||||
self.current = x.parent_node().map(|node| (*node.root()).clone());
|
||||
Some(x)
|
||||
}
|
||||
|
@ -1236,7 +1236,7 @@ impl Node {
|
|||
|
||||
// Step 7: mutation records.
|
||||
// Step 8.
|
||||
for node in nodes.mut_iter() {
|
||||
for node in nodes.iter_mut() {
|
||||
parent.add_child(*node, child);
|
||||
let is_in_doc = parent.is_in_doc();
|
||||
for kid in node.traverse_preorder() {
|
||||
|
@ -1571,7 +1571,7 @@ impl<'a> NodeMethods for JSRef<'a, Node> {
|
|||
let window = doc.deref().window.root();
|
||||
let child_list = NodeList::new_child_list(*window, self);
|
||||
self.child_list.assign(Some(child_list));
|
||||
Temporary::new(self.child_list.get().get_ref().clone())
|
||||
Temporary::new(self.child_list.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
// http://dom.spec.whatwg.org/#dom-node-firstchild
|
||||
|
@ -2023,12 +2023,12 @@ impl Reflectable for Node {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn document_from_node<T: NodeBase>(derived: JSRef<T>) -> Temporary<Document> {
|
||||
pub fn document_from_node<T: NodeBase+Reflectable>(derived: JSRef<T>) -> Temporary<Document> {
|
||||
let node: JSRef<Node> = NodeCast::from_ref(derived);
|
||||
node.owner_doc()
|
||||
}
|
||||
|
||||
pub fn window_from_node<T: NodeBase>(derived: JSRef<T>) -> Temporary<Window> {
|
||||
pub fn window_from_node<T: NodeBase+Reflectable>(derived: JSRef<T>) -> Temporary<Window> {
|
||||
let document = document_from_node(derived).root();
|
||||
Temporary::new(document.deref().window.clone())
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use dom::bindings::utils::{Reflectable, Reflector, reflect_dom_object};
|
|||
use servo_util::str::DOMString;
|
||||
|
||||
use encoding::all::UTF_8;
|
||||
use encoding::types::{Encoding, EncodeReplace};
|
||||
use encoding::types::{EncodingRef, EncodeReplace};
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::collections::hashmap::HashMap;
|
||||
|
@ -93,14 +93,14 @@ impl Reflectable for URLSearchParams {
|
|||
}
|
||||
|
||||
pub trait URLSearchParamsHelpers {
|
||||
fn serialize(&self, encoding: Option<&'static Encoding>) -> Vec<u8>;
|
||||
fn serialize(&self, encoding: Option<EncodingRef>) -> Vec<u8>;
|
||||
fn update_steps(&self);
|
||||
}
|
||||
|
||||
impl URLSearchParamsHelpers for URLSearchParams {
|
||||
fn serialize(&self, encoding: Option<&'static Encoding>) -> Vec<u8> {
|
||||
fn serialize(&self, encoding: Option<EncodingRef>) -> Vec<u8> {
|
||||
// http://url.spec.whatwg.org/#concept-urlencoded-serializer
|
||||
fn serialize_string(value: &DOMString, encoding: &'static Encoding) -> Vec<u8> {
|
||||
fn serialize_string(value: &DOMString, encoding: EncodingRef) -> Vec<u8> {
|
||||
// http://url.spec.whatwg.org/#concept-urlencoded-byte-serializer
|
||||
|
||||
let value = value.as_slice();
|
||||
|
@ -126,7 +126,7 @@ impl URLSearchParamsHelpers for URLSearchParams {
|
|||
}
|
||||
buf
|
||||
}
|
||||
let encoding = encoding.unwrap_or(UTF_8 as &'static Encoding);
|
||||
let encoding = encoding.unwrap_or(UTF_8 as EncodingRef);
|
||||
let mut buf = vec!();
|
||||
let mut first_pair = true;
|
||||
for (k, v) in self.data.deref().borrow().iter() {
|
||||
|
|
|
@ -138,82 +138,82 @@ pub trait VirtualMethods {
|
|||
/// method call on the trait object will invoke the corresponding method on the
|
||||
/// concrete type, propagating up the parent hierarchy unless otherwise
|
||||
/// interrupted.
|
||||
pub fn vtable_for<'a>(node: &'a JSRef<Node>) -> &'a VirtualMethods {
|
||||
pub fn vtable_for<'a>(node: &'a JSRef<'a, Node>) -> &'a VirtualMethods + 'a {
|
||||
match node.type_id() {
|
||||
ElementNodeTypeId(HTMLAnchorElementTypeId) => {
|
||||
let element: &JSRef<HTMLAnchorElement> = HTMLAnchorElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLAnchorElement> = HTMLAnchorElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLAreaElementTypeId) => {
|
||||
let element: &JSRef<HTMLAreaElement> = HTMLAreaElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLAreaElement> = HTMLAreaElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLBodyElementTypeId) => {
|
||||
let element: &JSRef<HTMLBodyElement> = HTMLBodyElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLBodyElement> = HTMLBodyElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLButtonElementTypeId) => {
|
||||
let element: &JSRef<HTMLButtonElement> = HTMLButtonElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLButtonElement> = HTMLButtonElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLCanvasElementTypeId) => {
|
||||
let element: &JSRef<HTMLCanvasElement> = HTMLCanvasElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLCanvasElement> = HTMLCanvasElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLFieldSetElementTypeId) => {
|
||||
let element: &JSRef<HTMLFieldSetElement> = HTMLFieldSetElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLFieldSetElement> = HTMLFieldSetElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLImageElementTypeId) => {
|
||||
let element: &JSRef<HTMLImageElement> = HTMLImageElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLImageElement> = HTMLImageElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLIFrameElementTypeId) => {
|
||||
let element: &JSRef<HTMLIFrameElement> = HTMLIFrameElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLIFrameElement> = HTMLIFrameElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLInputElementTypeId) => {
|
||||
let element: &JSRef<HTMLInputElement> = HTMLInputElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLInputElement> = HTMLInputElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLLinkElementTypeId) => {
|
||||
let element: &JSRef<HTMLLinkElement> = HTMLLinkElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLLinkElement> = HTMLLinkElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLObjectElementTypeId) => {
|
||||
let element: &JSRef<HTMLObjectElement> = HTMLObjectElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLObjectElement> = HTMLObjectElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLOptGroupElementTypeId) => {
|
||||
let element: &JSRef<HTMLOptGroupElement> = HTMLOptGroupElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLOptGroupElement> = HTMLOptGroupElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLOptionElementTypeId) => {
|
||||
let element: &JSRef<HTMLOptionElement> = HTMLOptionElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLOptionElement> = HTMLOptionElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLSelectElementTypeId) => {
|
||||
let element: &JSRef<HTMLSelectElement> = HTMLSelectElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLSelectElement> = HTMLSelectElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLStyleElementTypeId) => {
|
||||
let element: &JSRef<HTMLStyleElement> = HTMLStyleElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLStyleElement> = HTMLStyleElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(HTMLTextAreaElementTypeId) => {
|
||||
let element: &JSRef<HTMLTextAreaElement> = HTMLTextAreaElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLTextAreaElement> = HTMLTextAreaElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(ElementTypeId) => {
|
||||
let element: &JSRef<Element> = ElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, Element> = ElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
ElementNodeTypeId(_) => {
|
||||
let element: &JSRef<HTMLElement> = HTMLElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &VirtualMethods
|
||||
let element: &'a JSRef<'a, HTMLElement> = HTMLElementCast::to_borrowed_ref(node).unwrap();
|
||||
element as &'a VirtualMethods + 'a
|
||||
}
|
||||
_ => {
|
||||
node as &VirtualMethods
|
||||
node as &'a VirtualMethods + 'a
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ use std::hash::{Hash, sip};
|
|||
use std::io::timer::Timer;
|
||||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
use std::time::duration::Duration;
|
||||
use time;
|
||||
|
||||
#[deriving(PartialEq, Encodable, Eq)]
|
||||
|
@ -85,7 +86,7 @@ pub struct Window {
|
|||
pub image_cache_task: ImageCacheTask,
|
||||
pub active_timers: Traceable<RefCell<HashMap<TimerId, TimerHandle>>>,
|
||||
next_timer_handle: Traceable<Cell<i32>>,
|
||||
pub compositor: Untraceable<Box<ScriptListener>>,
|
||||
pub compositor: Untraceable<Box<ScriptListener+'static>>,
|
||||
pub browser_context: Traceable<RefCell<Option<BrowserContext>>>,
|
||||
pub page: Rc<Page>,
|
||||
performance: Cell<Option<JS<Performance>>>,
|
||||
|
@ -97,7 +98,7 @@ pub struct Window {
|
|||
impl Window {
|
||||
pub fn get_cx(&self) -> *mut JSContext {
|
||||
let js_info = self.page().js_info();
|
||||
(**js_info.get_ref().js_context).ptr
|
||||
(**js_info.as_ref().unwrap().js_context).ptr
|
||||
}
|
||||
|
||||
pub fn page<'a>(&'a self) -> &'a Page {
|
||||
|
@ -111,7 +112,7 @@ impl Window {
|
|||
#[unsafe_destructor]
|
||||
impl Drop for Window {
|
||||
fn drop(&mut self) {
|
||||
for (_, timer_handle) in self.active_timers.borrow_mut().mut_iter() {
|
||||
for (_, timer_handle) in self.active_timers.borrow_mut().iter_mut() {
|
||||
timer_handle.cancel();
|
||||
}
|
||||
}
|
||||
|
@ -214,7 +215,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
|
||||
fn Document(self) -> Temporary<Document> {
|
||||
let frame = self.page().frame();
|
||||
Temporary::new(frame.get_ref().document.clone())
|
||||
Temporary::new(frame.as_ref().unwrap().document.clone())
|
||||
}
|
||||
|
||||
fn Location(self) -> Temporary<Location> {
|
||||
|
@ -223,7 +224,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
let location = Location::new(self, page);
|
||||
self.location.assign(Some(location));
|
||||
}
|
||||
Temporary::new(self.location.get().get_ref().clone())
|
||||
Temporary::new(self.location.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Console(self) -> Temporary<Console> {
|
||||
|
@ -231,7 +232,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
let console = Console::new(&global::Window(self));
|
||||
self.console.assign(Some(console));
|
||||
}
|
||||
Temporary::new(self.console.get().get_ref().clone())
|
||||
Temporary::new(self.console.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Navigator(self) -> Temporary<Navigator> {
|
||||
|
@ -239,7 +240,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
let navigator = Navigator::new(self);
|
||||
self.navigator.assign(Some(navigator));
|
||||
}
|
||||
Temporary::new(self.navigator.get().get_ref().clone())
|
||||
Temporary::new(self.navigator.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn SetTimeout(self, _cx: *mut JSContext, callback: JSVal, timeout: i32) -> i32 {
|
||||
|
@ -287,7 +288,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
let performance = Performance::new(self);
|
||||
self.performance.assign(Some(performance));
|
||||
}
|
||||
Temporary::new(self.performance.get().get_ref().clone())
|
||||
Temporary::new(self.performance.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn GetOnclick(self) -> Option<EventHandlerNonNull> {
|
||||
|
@ -335,7 +336,7 @@ impl<'a> WindowMethods for JSRef<'a, Window> {
|
|||
let screen = Screen::new(self);
|
||||
self.screen.assign(Some(screen));
|
||||
}
|
||||
Temporary::new(self.screen.get().get_ref().clone())
|
||||
Temporary::new(self.screen.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Debug(self, message: DOMString) {
|
||||
|
@ -444,7 +445,7 @@ impl<'a> WindowHelpers for JSRef<'a, Window> {
|
|||
let mut rval = NullValue();
|
||||
unsafe {
|
||||
JS_CallFunctionValue(cx, this_value, *data.funval,
|
||||
0, ptr::mut_null(), &mut rval);
|
||||
0, ptr::null_mut(), &mut rval);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -473,10 +474,11 @@ impl<'a> PrivateWindowHelpers for JSRef<'a, Window> {
|
|||
};
|
||||
spawn_named(spawn_name, proc() {
|
||||
let mut tm = tm;
|
||||
let duration = Duration::milliseconds(timeout as i64);
|
||||
let timeout_port = if is_interval {
|
||||
tm.periodic(timeout)
|
||||
tm.periodic(duration)
|
||||
} else {
|
||||
tm.oneshot(timeout)
|
||||
tm.oneshot(duration)
|
||||
};
|
||||
let cancel_port = cancel_port;
|
||||
|
||||
|
@ -519,7 +521,7 @@ impl Window {
|
|||
page: Rc<Page>,
|
||||
script_chan: ScriptChan,
|
||||
control_chan: ScriptControlChan,
|
||||
compositor: Box<ScriptListener>,
|
||||
compositor: Box<ScriptListener+'static>,
|
||||
image_cache_task: ImageCacheTask)
|
||||
-> Temporary<Window> {
|
||||
let win = box Window {
|
||||
|
|
|
@ -89,7 +89,7 @@ impl Worker {
|
|||
assert!(JS_ReadStructuredClone(
|
||||
global.root_ref().get_cx(), data as *const u64, nbytes,
|
||||
JS_STRUCTURED_CLONE_VERSION, &mut message,
|
||||
ptr::null(), ptr::mut_null()) != 0);
|
||||
ptr::null(), ptr::null_mut()) != 0);
|
||||
}
|
||||
|
||||
let target: JSRef<EventTarget> = EventTargetCast::from_ref(*worker);
|
||||
|
@ -131,11 +131,11 @@ impl Worker {
|
|||
|
||||
impl<'a> WorkerMethods for JSRef<'a, Worker> {
|
||||
fn PostMessage(self, cx: *mut JSContext, message: JSVal) {
|
||||
let mut data = ptr::mut_null();
|
||||
let mut data = ptr::null_mut();
|
||||
let mut nbytes = 0;
|
||||
unsafe {
|
||||
assert!(JS_WriteStructuredClone(cx, message, &mut data, &mut nbytes,
|
||||
ptr::null(), ptr::mut_null()) != 0);
|
||||
ptr::null(), ptr::null_mut()) != 0);
|
||||
}
|
||||
|
||||
self.addref();
|
||||
|
|
|
@ -88,12 +88,12 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
|||
let location = WorkerLocation::new(self, self.worker_url.deref().clone());
|
||||
self.location.assign(Some(location));
|
||||
}
|
||||
Temporary::new(self.location.get().get_ref().clone())
|
||||
Temporary::new(self.location.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn ImportScripts(self, url_strings: Vec<DOMString>) -> ErrorResult {
|
||||
let mut urls = Vec::with_capacity(url_strings.len());
|
||||
for url in url_strings.move_iter() {
|
||||
for url in url_strings.into_iter() {
|
||||
let url = UrlParser::new().base_url(&*self.worker_url)
|
||||
.parse(url.as_slice());
|
||||
match url {
|
||||
|
@ -102,7 +102,7 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
|||
};
|
||||
}
|
||||
|
||||
for url in urls.move_iter() {
|
||||
for url in urls.into_iter() {
|
||||
let (url, source) = match load_whole_resource(&*self.resource_task, url) {
|
||||
Err(_) => return Err(Network),
|
||||
Ok((metadata, bytes)) => {
|
||||
|
@ -128,7 +128,7 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
|||
let navigator = WorkerNavigator::new(self);
|
||||
self.navigator.assign(Some(navigator));
|
||||
}
|
||||
Temporary::new(self.navigator.get().get_ref().clone())
|
||||
Temporary::new(self.navigator.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Console(self) -> Temporary<Console> {
|
||||
|
@ -136,7 +136,7 @@ impl<'a> WorkerGlobalScopeMethods for JSRef<'a, WorkerGlobalScope> {
|
|||
let console = Console::new(&global::Worker(self));
|
||||
self.console.assign(Some(console));
|
||||
}
|
||||
Temporary::new(self.console.get().get_ref().clone())
|
||||
Temporary::new(self.console.get().as_ref().unwrap().clone())
|
||||
}
|
||||
|
||||
fn Btoa(self, btoa: DOMString) -> Fallible<DOMString> {
|
||||
|
|
|
@ -28,8 +28,8 @@ use encoding::all::UTF_8;
|
|||
use encoding::label::encoding_from_whatwg_label;
|
||||
use encoding::types::{DecodeReplace, Encoding, EncodingRef, EncodeReplace};
|
||||
|
||||
use ResponseHeaderCollection = http::headers::response::HeaderCollection;
|
||||
use RequestHeaderCollection = http::headers::request::HeaderCollection;
|
||||
use http::headers::response::HeaderCollection as ResponseHeaderCollection;
|
||||
use http::headers::request::HeaderCollection as RequestHeaderCollection;
|
||||
use http::headers::content_type::MediaType;
|
||||
use http::headers::{HeaderEnum, HeaderValueByteIterator};
|
||||
use http::headers::request::Header;
|
||||
|
@ -56,6 +56,8 @@ use std::io::{BufReader, MemWriter, Timer};
|
|||
use std::from_str::FromStr;
|
||||
use std::path::BytesContainer;
|
||||
use std::task::TaskBuilder;
|
||||
use std::time::duration::Duration;
|
||||
use std::num::Zero;
|
||||
use time;
|
||||
use url::{Url, UrlParser};
|
||||
|
||||
|
@ -538,7 +540,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
|
|||
referer_url.serialize_host().map(|ref h| buf.push_str(h.as_slice()));
|
||||
referer_url.port().as_ref().map(|&p| {
|
||||
buf.push_str(":".as_slice());
|
||||
buf.push_str(p);
|
||||
buf.push_str(format!("{:u}", p).as_slice());
|
||||
});
|
||||
referer_url.serialize_path().map(|ref h| buf.push_str(h.as_slice()));
|
||||
self.request_headers.deref().borrow_mut().referer = Some(buf);
|
||||
|
@ -888,7 +890,8 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
|||
fn set_timeout(self, timeout: u32) {
|
||||
// Sets up the object to timeout in a given number of milliseconds
|
||||
// This will cancel all previous timeouts
|
||||
let oneshot = self.timer.deref().borrow_mut().oneshot(timeout as u64);
|
||||
let oneshot = self.timer.deref().borrow_mut()
|
||||
.oneshot(Duration::milliseconds(timeout as i64));
|
||||
let addr = unsafe {
|
||||
self.to_trusted() // This will increment the pin counter by one
|
||||
};
|
||||
|
@ -923,7 +926,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
|
|||
self.release_once();
|
||||
}
|
||||
// oneshot() closes the previous channel, canceling the timeout
|
||||
self.timer.deref().borrow_mut().oneshot(0);
|
||||
self.timer.deref().borrow_mut().oneshot(Zero::zero());
|
||||
}
|
||||
fn text_response(self) -> DOMString {
|
||||
let mut encoding = UTF_8 as EncodingRef;
|
||||
|
|
|
@ -519,7 +519,7 @@ pub fn parse_html(page: &Page,
|
|||
let load_response = load_response.unwrap();
|
||||
match load_response.metadata.content_type {
|
||||
Some((ref t, _)) if t.as_slice().eq_ignore_ascii_case("image") => {
|
||||
let page = format!("<html><body><img src='{:s}' /></body></html>", base_url.get_ref().serialize());
|
||||
let page = format!("<html><body><img src='{:s}' /></body></html>", base_url.as_ref().unwrap().serialize());
|
||||
parser.parse_chunk(page.into_bytes().as_slice());
|
||||
},
|
||||
_ => loop {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#![feature(globs, macro_rules, struct_variant, phase, unsafe_destructor)]
|
||||
|
||||
#![deny(unused_imports, unused_variable)]
|
||||
#![allow(non_snake_case_functions)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
#![doc="The script crate contains all matters DOM."]
|
||||
|
||||
|
@ -33,12 +33,12 @@ extern crate time;
|
|||
extern crate canvas;
|
||||
extern crate script_traits;
|
||||
#[phase(plugin)]
|
||||
extern crate servo_macros = "macros";
|
||||
extern crate servo_net = "net";
|
||||
extern crate servo_util = "util";
|
||||
extern crate "macros" as servo_macros;
|
||||
extern crate "net" as servo_net;
|
||||
extern crate "util" as servo_util;
|
||||
extern crate style;
|
||||
extern crate sync;
|
||||
extern crate servo_msg = "msg";
|
||||
extern crate "msg" as servo_msg;
|
||||
extern crate url;
|
||||
extern crate uuid;
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ pub struct Page {
|
|||
pub layout_chan: Untraceable<LayoutChan>,
|
||||
|
||||
/// A handle to perform RPC calls into the layout, quickly.
|
||||
layout_rpc: Untraceable<Box<LayoutRPC>>,
|
||||
layout_rpc: Untraceable<Box<LayoutRPC+'static>>,
|
||||
|
||||
/// The port that we will use to join layout. If this is `None`, then layout is not running.
|
||||
pub layout_join_port: Untraceable<RefCell<Option<Receiver<()>>>>,
|
||||
|
@ -169,8 +169,8 @@ impl Page {
|
|||
let damaged = self.damage.borrow().is_some();
|
||||
if damaged {
|
||||
let frame = self.frame();
|
||||
let window = frame.get_ref().window.root();
|
||||
self.reflow(goal, window.control_chan.clone(), *window.compositor);
|
||||
let window = frame.as_ref().unwrap().window.root();
|
||||
self.reflow(goal, window.control_chan.clone(), &**window.compositor);
|
||||
} else {
|
||||
self.avoided_reflows.set(self.avoided_reflows.get() + 1);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ impl Page {
|
|||
// doing a query reflow.
|
||||
self.flush_layout(ReflowForDisplay);
|
||||
self.join_layout(); //FIXME: is this necessary, or is layout_rpc's mutex good enough?
|
||||
let layout_rpc: &LayoutRPC = *self.layout_rpc;
|
||||
let layout_rpc: &LayoutRPC = &**self.layout_rpc;
|
||||
layout_rpc
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ impl Page {
|
|||
self.children
|
||||
.deref()
|
||||
.borrow_mut()
|
||||
.mut_iter()
|
||||
.iter_mut()
|
||||
.enumerate()
|
||||
.find(|&(_idx, ref page_tree)| {
|
||||
// FIXME: page_tree has a lifetime such that it's unusable for anything.
|
||||
|
@ -204,7 +204,7 @@ impl Page {
|
|||
match remove_idx {
|
||||
Some(idx) => return Some(self.children.deref().borrow_mut().remove(idx).unwrap()),
|
||||
None => {
|
||||
for page_tree in self.children.deref().borrow_mut().mut_iter() {
|
||||
for page_tree in self.children.deref().borrow_mut().iter_mut() {
|
||||
match page_tree.remove(id) {
|
||||
found @ Some(_) => return found,
|
||||
None => (), // keep going...
|
||||
|
@ -292,7 +292,7 @@ impl Page {
|
|||
}
|
||||
|
||||
pub fn get_url(&self) -> Url {
|
||||
self.url().get_ref().ref0().clone()
|
||||
self.url().as_ref().unwrap().ref0().clone()
|
||||
}
|
||||
|
||||
// FIXME(cgaebel): join_layout is racey. What if the compositor triggers a
|
||||
|
@ -393,7 +393,7 @@ impl Page {
|
|||
|
||||
/// Attempt to find a named element in this page's document.
|
||||
pub fn find_fragment_node(&self, fragid: DOMString) -> Option<Temporary<Element>> {
|
||||
let document = self.frame().get_ref().document.root();
|
||||
let document = self.frame().as_ref().unwrap().document.root();
|
||||
match document.deref().GetElementById(fragid.to_string()) {
|
||||
Some(node) => Some(node),
|
||||
None => {
|
||||
|
@ -412,7 +412,7 @@ impl Page {
|
|||
|
||||
pub fn hit_test(&self, point: &Point2D<f32>) -> Option<UntrustedNodeAddress> {
|
||||
let frame = self.frame();
|
||||
let document = frame.get_ref().document.root();
|
||||
let document = frame.as_ref().unwrap().document.root();
|
||||
let root = document.deref().GetDocumentElement().root();
|
||||
if root.is_none() {
|
||||
return None;
|
||||
|
@ -433,7 +433,7 @@ impl Page {
|
|||
|
||||
pub fn get_nodes_under_mouse(&self, point: &Point2D<f32>) -> Option<Vec<UntrustedNodeAddress>> {
|
||||
let frame = self.frame();
|
||||
let document = frame.get_ref().document.root();
|
||||
let document = frame.as_ref().unwrap().document.root();
|
||||
let root = document.deref().GetDocumentElement().root();
|
||||
if root.is_none() {
|
||||
return None;
|
||||
|
|
|
@ -163,7 +163,7 @@ pub struct ScriptTask {
|
|||
/// For communicating load url messages to the constellation
|
||||
constellation_chan: ConstellationChan,
|
||||
/// A handle to the compositor for communicating ready state messages.
|
||||
compositor: Box<ScriptListener>,
|
||||
compositor: Box<ScriptListener+'static>,
|
||||
|
||||
/// For providing instructions to an optional devtools server.
|
||||
devtools_chan: Option<DevtoolsControlChan>,
|
||||
|
@ -243,7 +243,7 @@ impl ScriptTaskFactory for ScriptTask {
|
|||
box pair.sender() as Box<Any+Send>
|
||||
}
|
||||
|
||||
fn create<C:ScriptListener + Send>(
|
||||
fn create<C:ScriptListener + Send + 'static>(
|
||||
_phantom: Option<&mut ScriptTask>,
|
||||
id: PipelineId,
|
||||
compositor: Box<C>,
|
||||
|
@ -284,7 +284,7 @@ impl ScriptTaskFactory for ScriptTask {
|
|||
impl ScriptTask {
|
||||
/// Creates a new script task.
|
||||
pub fn new(id: PipelineId,
|
||||
compositor: Box<ScriptListener>,
|
||||
compositor: Box<ScriptListener+'static>,
|
||||
layout_chan: LayoutChan,
|
||||
port: Receiver<ScriptMsg>,
|
||||
chan: ScriptChan,
|
||||
|
@ -376,7 +376,7 @@ impl ScriptTask {
|
|||
}
|
||||
|
||||
pub fn get_cx(&self) -> *mut JSContext {
|
||||
(**self.js_context.borrow().get_ref()).ptr
|
||||
(**self.js_context.borrow().as_ref().unwrap()).ptr
|
||||
}
|
||||
|
||||
/// Starts the script task. After calling this method, the script task will loop receiving
|
||||
|
@ -412,7 +412,7 @@ impl ScriptTask {
|
|||
}
|
||||
}
|
||||
|
||||
for (id, size) in resizes.move_iter() {
|
||||
for (id, size) in resizes.into_iter() {
|
||||
self.handle_event(id, ResizeEvent(size));
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ impl ScriptTask {
|
|||
}
|
||||
|
||||
// Process the gathered events.
|
||||
for msg in sequential.move_iter() {
|
||||
for msg in sequential.into_iter() {
|
||||
match msg {
|
||||
// TODO(tkuehn) need to handle auxiliary layouts for iframes
|
||||
FromConstellation(AttachLayoutMsg(_)) => fail!("should have handled AttachLayoutMsg already"),
|
||||
|
@ -605,7 +605,7 @@ impl ScriptTask {
|
|||
window_size,
|
||||
parent_page.resource_task.deref().clone(),
|
||||
self.constellation_chan.clone(),
|
||||
self.js_context.borrow().get_ref().clone())
|
||||
self.js_context.borrow().as_ref().unwrap().clone())
|
||||
};
|
||||
parent_page.children.deref().borrow_mut().push(Rc::new(new_page));
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ impl ScriptTask {
|
|||
let page = page.find(id).expect("ScriptTask: received fire timer msg for a
|
||||
pipeline ID not associated with this script task. This is a bug.");
|
||||
let frame = page.frame();
|
||||
let window = frame.get_ref().window.root();
|
||||
let window = frame.as_ref().unwrap().window.root();
|
||||
window.handle_fire_timer(timer_id, self.get_cx());
|
||||
}
|
||||
|
||||
|
@ -638,7 +638,7 @@ impl ScriptTask {
|
|||
if page.pending_reflows.get() > 0 {
|
||||
page.pending_reflows.set(0);
|
||||
page.damage(MatchSelectorsDocumentDamage);
|
||||
page.reflow(ReflowForDisplay, self.control_chan.clone(), self.compositor);
|
||||
page.reflow(ReflowForDisplay, self.control_chan.clone(), &*self.compositor);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -718,7 +718,7 @@ impl ScriptTask {
|
|||
*page.mut_url() = Some((loaded.clone(), false));
|
||||
if needs_reflow {
|
||||
page.damage(ContentChangedDocumentDamage);
|
||||
page.reflow(ReflowForDisplay, self.control_chan.clone(), self.compositor);
|
||||
page.reflow(ReflowForDisplay, self.control_chan.clone(), &*self.compositor);
|
||||
}
|
||||
return;
|
||||
},
|
||||
|
@ -729,7 +729,7 @@ impl ScriptTask {
|
|||
let last_url = last_loaded_url.map(|(ref loaded, _)| loaded.clone());
|
||||
|
||||
let cx = self.js_context.borrow();
|
||||
let cx = cx.get_ref();
|
||||
let cx = cx.as_ref().unwrap();
|
||||
// Create the window and document objects.
|
||||
let window = Window::new(cx.deref().ptr,
|
||||
page.clone(),
|
||||
|
@ -742,7 +742,7 @@ impl ScriptTask {
|
|||
Some(url) => Some(url.clone()),
|
||||
None => Url::parse("about:blank").ok(),
|
||||
};
|
||||
*page.mut_url() = Some((doc_url.get_ref().clone(), true));
|
||||
*page.mut_url() = Some((doc_url.as_ref().unwrap().clone(), true));
|
||||
doc_url
|
||||
} else {
|
||||
Some(url.clone())
|
||||
|
@ -879,7 +879,7 @@ impl ScriptTask {
|
|||
let frame = page.frame();
|
||||
if frame.is_some() {
|
||||
page.damage(ReflowDocumentDamage);
|
||||
page.reflow(ReflowForDisplay, self.control_chan.clone(), self.compositor)
|
||||
page.reflow(ReflowForDisplay, self.control_chan.clone(), &*self.compositor)
|
||||
}
|
||||
|
||||
let mut fragment_node = page.fragment_node.get();
|
||||
|
@ -919,7 +919,7 @@ impl ScriptTask {
|
|||
page.pending_reflows.set(page.pending_reflows.get() + 1);
|
||||
} else {
|
||||
page.damage(MatchSelectorsDocumentDamage);
|
||||
page.reflow(ReflowForDisplay, self.control_chan.clone(), self.compositor)
|
||||
page.reflow(ReflowForDisplay, self.control_chan.clone(), &*self.compositor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -974,7 +974,7 @@ impl ScriptTask {
|
|||
let mouse_over_targets = &mut *self.mouse_over_targets.borrow_mut();
|
||||
match *mouse_over_targets {
|
||||
Some(ref mut mouse_over_targets) => {
|
||||
for node in mouse_over_targets.mut_iter() {
|
||||
for node in mouse_over_targets.iter_mut() {
|
||||
let node = node.root();
|
||||
node.deref().set_hover_state(false);
|
||||
}
|
||||
|
@ -1018,7 +1018,7 @@ impl ScriptTask {
|
|||
if target_compare {
|
||||
if mouse_over_targets.is_some() {
|
||||
page.damage(MatchSelectorsDocumentDamage);
|
||||
page.reflow(ReflowForDisplay, self.control_chan.clone(), self.compositor);
|
||||
page.reflow(ReflowForDisplay, self.control_chan.clone(), &*self.compositor);
|
||||
}
|
||||
*mouse_over_targets = Some(target_list);
|
||||
}
|
||||
|
|
|
@ -9,10 +9,9 @@
|
|||
|
||||
extern crate devtools_traits;
|
||||
extern crate geom;
|
||||
extern crate servo_msg = "msg";
|
||||
extern crate servo_net = "net";
|
||||
extern crate "msg" as servo_msg;
|
||||
extern crate "net" as servo_net;
|
||||
extern crate url;
|
||||
extern crate std;
|
||||
extern crate serialize;
|
||||
|
||||
// This module contains traits in script used generically
|
||||
|
|
|
@ -29,3 +29,5 @@ git = "https://github.com/servo/rust-cssparser"
|
|||
[dependencies.encoding]
|
||||
git = "https://github.com/lifthrasiir/rust-encoding"
|
||||
|
||||
[dependencies.lazy_static]
|
||||
git = "https://github.com/Kimundi/lazy-static.rs"
|
||||
|
|
|
@ -70,7 +70,7 @@ pub fn parse_font_face_rule(rule: AtRule, parent_rules: &mut Vec<CSSRule>, base_
|
|||
let mut maybe_family = None;
|
||||
let mut maybe_sources = None;
|
||||
|
||||
for item in ErrorLoggerIterator(parse_declaration_list(block.move_iter())) {
|
||||
for item in ErrorLoggerIterator(parse_declaration_list(block.into_iter())) {
|
||||
match item {
|
||||
DeclAtRule(rule) => log_css_error(
|
||||
rule.location, format!("Unsupported at-rule in declaration list: @{:s}", rule.name).as_slice()),
|
||||
|
|
|
@ -22,10 +22,10 @@ extern crate url;
|
|||
|
||||
extern crate cssparser;
|
||||
extern crate encoding;
|
||||
|
||||
#[phase(plugin)]
|
||||
extern crate servo_macros = "macros";
|
||||
extern crate servo_util = "util";
|
||||
extern crate lazy_static;
|
||||
|
||||
extern crate "util" as servo_util;
|
||||
|
||||
|
||||
// Public API
|
||||
|
|
|
@ -59,7 +59,7 @@ pub fn parse_media_rule(rule: AtRule, parent_rules: &mut Vec<CSSRule>,
|
|||
}
|
||||
};
|
||||
let mut rules = vec!();
|
||||
for rule in ErrorLoggerIterator(parse_rule_list(block.move_iter())) {
|
||||
for rule in ErrorLoggerIterator(parse_rule_list(block.into_iter())) {
|
||||
match rule {
|
||||
QualifiedRule(rule) => parse_style_rule(rule, &mut rules, namespaces, base_url),
|
||||
AtRule(rule) => parse_nested_at_rule(
|
||||
|
@ -94,13 +94,13 @@ pub fn parse_media_query_list(input: &[ComponentValue]) -> MediaQueryList {
|
|||
};
|
||||
match iter.next() {
|
||||
None => {
|
||||
for mq in mq.move_iter() {
|
||||
for mq in mq.into_iter() {
|
||||
queries.push(mq);
|
||||
}
|
||||
return MediaQueryList{ media_queries: queries }
|
||||
},
|
||||
Some(&Comma) => {
|
||||
for mq in mq.move_iter() {
|
||||
for mq in mq.into_iter() {
|
||||
queries.push(mq);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -71,11 +71,11 @@ pub fn parse_comma_separated<T>(iter: ParserIter,
|
|||
parse_one: |ParserIter| -> Result<T, ()>)
|
||||
-> Result<Vec<T>, ()> {
|
||||
let mut values = vec![try!(parse_one(iter))];
|
||||
for component_value in iter {
|
||||
match component_value {
|
||||
&Comma => values.push(try!(parse_one(iter))),
|
||||
_ => return Err(())
|
||||
loop {
|
||||
match iter.next() {
|
||||
Some(&Comma) => values.push(try!(parse_one(iter))),
|
||||
Some(_) => return Err(()),
|
||||
None => return Ok(values),
|
||||
}
|
||||
}
|
||||
Ok(values)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ pub mod specified {
|
|||
use cssparser::ast;
|
||||
use cssparser::ast::*;
|
||||
use super::{Au, CSSFloat};
|
||||
pub use CSSColor = cssparser::Color;
|
||||
pub use cssparser::Color as CSSColor;
|
||||
|
||||
#[deriving(Clone)]
|
||||
pub enum Length {
|
||||
|
@ -204,11 +204,10 @@ pub mod specified {
|
|||
}
|
||||
|
||||
pub mod computed {
|
||||
pub use CSSColor = cssparser::Color;
|
||||
pub use compute_CSSColor = super::super::longhands::computed_as_specified;
|
||||
pub use cssparser::Color as CSSColor;
|
||||
pub use super::super::longhands::computed_as_specified as compute_CSSColor;
|
||||
use super::*;
|
||||
use super::super::longhands;
|
||||
pub use servo_util::geometry::Au;
|
||||
|
||||
pub struct Context {
|
||||
pub inherited_font_weight: longhands::font_weight::computed_value::T,
|
||||
|
@ -230,14 +229,14 @@ pub mod computed {
|
|||
// TODO, as needed: root font size, viewport size, etc.
|
||||
}
|
||||
|
||||
#[allow(non_snake_case_functions)]
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn compute_Au(value: specified::Length, context: &Context) -> Au {
|
||||
compute_Au_with_font_size(value, context.font_size)
|
||||
}
|
||||
|
||||
/// A special version of `compute_Au` used for `font-size`.
|
||||
#[allow(non_snake_case_functions)]
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn compute_Au_with_font_size(value: specified::Length, reference_font_size: Au) -> Au {
|
||||
match value {
|
||||
|
@ -255,7 +254,7 @@ pub mod computed {
|
|||
LP_Length(Au),
|
||||
LP_Percentage(CSSFloat),
|
||||
}
|
||||
#[allow(non_snake_case_functions)]
|
||||
#[allow(non_snake_case)]
|
||||
pub fn compute_LengthOrPercentage(value: specified::LengthOrPercentage, context: &Context)
|
||||
-> LengthOrPercentage {
|
||||
match value {
|
||||
|
@ -270,7 +269,7 @@ pub mod computed {
|
|||
LPA_Percentage(CSSFloat),
|
||||
LPA_Auto,
|
||||
}
|
||||
#[allow(non_snake_case_functions)]
|
||||
#[allow(non_snake_case)]
|
||||
pub fn compute_LengthOrPercentageOrAuto(value: specified::LengthOrPercentageOrAuto,
|
||||
context: &Context) -> LengthOrPercentageOrAuto {
|
||||
match value {
|
||||
|
@ -286,7 +285,7 @@ pub mod computed {
|
|||
LPN_Percentage(CSSFloat),
|
||||
LPN_None,
|
||||
}
|
||||
#[allow(non_snake_case_functions)]
|
||||
#[allow(non_snake_case)]
|
||||
pub fn compute_LengthOrPercentageOrNone(value: specified::LengthOrPercentageOrNone,
|
||||
context: &Context) -> LengthOrPercentageOrNone {
|
||||
match value {
|
||||
|
|
|
@ -189,13 +189,13 @@ pub mod longhands {
|
|||
values="${values}"
|
||||
experimental="${experimental}">
|
||||
// The computed value is the same as the specified value.
|
||||
pub use to_computed_value = super::computed_as_specified;
|
||||
pub use super::computed_as_specified as to_computed_value;
|
||||
</%self:single_keyword_computed>
|
||||
</%def>
|
||||
|
||||
<%def name="predefined_type(name, type, initial_value, parse_method='parse')">
|
||||
<%self:single_component_value name="${name}">
|
||||
pub use to_computed_value = super::super::common_types::computed::compute_${type};
|
||||
pub use super::super::common_types::computed::compute_${type} as to_computed_value;
|
||||
pub type SpecifiedValue = specified::${type};
|
||||
pub mod computed_value {
|
||||
pub type T = super::super::computed::${type};
|
||||
|
@ -425,12 +425,7 @@ pub mod longhands {
|
|||
</%self:single_component_value>
|
||||
|
||||
<%self:longhand name="-servo-minimum-line-height" derived_from="line-height">
|
||||
use super::Au;
|
||||
use super::super::common_types::DEFAULT_LINE_HEIGHT;
|
||||
use super::super::longhands::display;
|
||||
use super::super::longhands::line_height;
|
||||
|
||||
pub use to_computed_value = super::computed_as_specified;
|
||||
pub use super::computed_as_specified as to_computed_value;
|
||||
|
||||
pub type SpecifiedValue = line_height::SpecifiedValue;
|
||||
|
||||
|
@ -534,7 +529,7 @@ pub mod longhands {
|
|||
${switch_to_style_struct("Box")}
|
||||
|
||||
<%self:longhand name="content">
|
||||
pub use to_computed_value = super::computed_as_specified;
|
||||
pub use super::computed_as_specified as to_computed_value;
|
||||
pub mod computed_value {
|
||||
#[deriving(PartialEq, Clone)]
|
||||
pub enum Content {
|
||||
|
@ -585,7 +580,7 @@ pub mod longhands {
|
|||
|
||||
<%self:single_component_value name="background-image">
|
||||
// The computed value is the same as the specified value.
|
||||
pub use to_computed_value = super::computed_as_specified;
|
||||
pub use super::computed_as_specified as to_computed_value;
|
||||
pub mod computed_value {
|
||||
pub use url::Url;
|
||||
pub type T = Option<Url>;
|
||||
|
@ -609,8 +604,6 @@ pub mod longhands {
|
|||
</%self:single_component_value>
|
||||
|
||||
<%self:longhand name="background-position">
|
||||
use super::super::common_types::specified;
|
||||
|
||||
pub mod computed_value {
|
||||
use super::super::super::common_types::computed::LengthOrPercentage;
|
||||
|
||||
|
@ -723,7 +716,7 @@ pub mod longhands {
|
|||
${new_style_struct("Color", is_inherited=True)}
|
||||
|
||||
<%self:raw_longhand name="color">
|
||||
pub use to_computed_value = super::computed_as_specified;
|
||||
pub use super::computed_as_specified as to_computed_value;
|
||||
pub type SpecifiedValue = RGBA;
|
||||
pub mod computed_value {
|
||||
pub type T = super::SpecifiedValue;
|
||||
|
@ -746,7 +739,7 @@ pub mod longhands {
|
|||
${new_style_struct("Font", is_inherited=True)}
|
||||
|
||||
<%self:longhand name="font-family">
|
||||
pub use to_computed_value = super::computed_as_specified;
|
||||
pub use super::computed_as_specified as to_computed_value;
|
||||
pub mod computed_value {
|
||||
#[deriving(PartialEq, Clone)]
|
||||
pub enum FontFamily {
|
||||
|
@ -790,16 +783,17 @@ pub mod longhands {
|
|||
}
|
||||
_ => return Err(())
|
||||
};
|
||||
for component_value in iter {
|
||||
match component_value {
|
||||
&Ident(ref value) => {
|
||||
loop {
|
||||
match iter.next() {
|
||||
Some(&Ident(ref value)) => {
|
||||
idents.push(value.as_slice());
|
||||
iter.next();
|
||||
},
|
||||
_ => {
|
||||
}
|
||||
Some(component_value) => {
|
||||
iter.push_back(component_value);
|
||||
break
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
Ok(FamilyName(idents.connect(" ")))
|
||||
|
@ -947,7 +941,7 @@ pub mod longhands {
|
|||
${new_style_struct("Text", is_inherited=False)}
|
||||
|
||||
<%self:longhand name="text-decoration">
|
||||
pub use to_computed_value = super::computed_as_specified;
|
||||
pub use super::computed_as_specified as to_computed_value;
|
||||
#[deriving(PartialEq, Clone)]
|
||||
pub struct SpecifiedValue {
|
||||
pub underline: bool,
|
||||
|
@ -999,10 +993,7 @@ pub mod longhands {
|
|||
|
||||
<%self:longhand name="-servo-text-decorations-in-effect"
|
||||
derived_from="display text-decoration">
|
||||
use super::RGBA;
|
||||
use super::super::longhands::display;
|
||||
|
||||
pub use to_computed_value = super::computed_as_specified;
|
||||
pub use super::computed_as_specified as to_computed_value;
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
pub struct SpecifiedValue {
|
||||
|
@ -1447,17 +1438,17 @@ mod property_bit_field {
|
|||
self.storage[bit / uint::BITS] &= !(1 << (bit % uint::BITS))
|
||||
}
|
||||
% for i, property in enumerate(LONGHANDS):
|
||||
#[allow(non_snake_case_functions)]
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn get_${property.ident}(&self) -> bool {
|
||||
self.get(${i})
|
||||
}
|
||||
#[allow(non_snake_case_functions)]
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn set_${property.ident}(&mut self) {
|
||||
self.set(${i})
|
||||
}
|
||||
#[allow(non_snake_case_functions)]
|
||||
#[allow(non_snake_case)]
|
||||
#[inline]
|
||||
pub fn clear_${property.ident}(&mut self) {
|
||||
self.clear(${i})
|
||||
|
@ -1493,7 +1484,7 @@ pub fn parse_property_declaration_list<I: Iterator<Node>>(input: I, base_url: &U
|
|||
let mut normal_seen = PropertyBitField::new();
|
||||
let items: Vec<DeclarationListItem> =
|
||||
ErrorLoggerIterator(parse_declaration_list(input)).collect();
|
||||
for item in items.move_iter().rev() {
|
||||
for item in items.into_iter().rev() {
|
||||
match item {
|
||||
DeclAtRule(rule) => log_css_error(
|
||||
rule.location, format!("Unsupported at-rule in declaration list: @{:s}", rule.name).as_slice()),
|
||||
|
@ -1831,7 +1822,7 @@ fn get_writing_mode(inheritedbox_style: &style_structs::InheritedBox) -> Writing
|
|||
|
||||
|
||||
/// The initial values for all style structs as defined by the specification.
|
||||
lazy_init! {
|
||||
lazy_static! {
|
||||
static ref INITIAL_VALUES: ComputedValues = ComputedValues {
|
||||
% for style_struct in STYLE_STRUCTS:
|
||||
${style_struct.ident}: Arc::new(style_structs::${style_struct.name} {
|
||||
|
@ -1857,7 +1848,7 @@ fn initial_writing_mode_is_empty() {
|
|||
trait ArcExperimental<T> {
|
||||
fn make_unique_experimental<'a>(&'a mut self) -> &'a mut T;
|
||||
}
|
||||
impl<T: Send + Share + Clone> ArcExperimental<T> for Arc<T> {
|
||||
impl<T: Send + Sync + Clone> ArcExperimental<T> for Arc<T> {
|
||||
#[inline]
|
||||
#[allow(experimental)]
|
||||
fn make_unique_experimental<'a>(&'a mut self) -> &'a mut T {
|
||||
|
@ -2209,10 +2200,10 @@ pub fn cascade_anonymous(parent_style: &ComputedValues) -> ComputedValues {
|
|||
// Only re-export the types for computed values.
|
||||
pub mod computed_values {
|
||||
% for property in LONGHANDS:
|
||||
pub use ${property.ident} = super::longhands::${property.ident}::computed_value;
|
||||
pub use super::longhands::${property.ident}::computed_value as ${property.ident};
|
||||
% endfor
|
||||
// Don't use a side-specific name needlessly:
|
||||
pub use border_style = super::longhands::border_top_style::computed_value;
|
||||
pub use super::longhands::border_top_style::computed_value as border_style;
|
||||
|
||||
pub use cssparser::RGBA;
|
||||
pub use super::common_types::computed::{
|
||||
|
|
|
@ -140,7 +140,7 @@ impl SelectorMap {
|
|||
shareable);
|
||||
|
||||
// Sort only the rules we just added.
|
||||
sort::quicksort_by(matching_rules_list.vec_mut_slice_from(init_len), compare);
|
||||
sort::quicksort_by(matching_rules_list.vec_slice_from_mut(init_len), compare);
|
||||
|
||||
fn compare(a: &DeclarationBlock, b: &DeclarationBlock) -> Ordering {
|
||||
(a.specificity, a.source_order).cmp(&(b.specificity, b.source_order))
|
||||
|
@ -1006,7 +1006,7 @@ mod tests {
|
|||
let namespaces = NamespaceMap::new();
|
||||
css_selectors.iter().enumerate().map(|(i, selectors)| {
|
||||
parse_selector_list(tokenize(*selectors).map(|(c, _)| c), &namespaces)
|
||||
.unwrap().move_iter().map(|s| {
|
||||
.unwrap().into_iter().map(|s| {
|
||||
Rule {
|
||||
selector: s.compound_selectors.clone(),
|
||||
declarations: DeclarationBlock {
|
||||
|
|
|
@ -436,7 +436,7 @@ fn parse_qualified_name<I: Iterator<ComponentValue>>(
|
|||
|
||||
fn parse_attribute_selector(content: Vec<ComponentValue>, namespaces: &NamespaceMap)
|
||||
-> Result<SimpleSelector, ()> {
|
||||
let iter = &mut content.move_iter().peekable();
|
||||
let iter = &mut content.into_iter().peekable();
|
||||
let attr = match try!(parse_qualified_name(iter, /* in_attr_selector = */ true, namespaces)) {
|
||||
None => return Err(()),
|
||||
Some((_, None)) => fail!("Implementation error, this should not happen."),
|
||||
|
@ -537,7 +537,7 @@ fn parse_pseudo_element(name: String) -> Result<PseudoElement, ()> {
|
|||
/// Level 3: Parse **one** simple_selector
|
||||
fn parse_negation(arguments: Vec<ComponentValue>, namespaces: &NamespaceMap)
|
||||
-> Result<SimpleSelector, ()> {
|
||||
let iter = &mut arguments.move_iter().peekable();
|
||||
let iter = &mut arguments.into_iter().peekable();
|
||||
match try!(parse_type_selector(iter, namespaces)) {
|
||||
Some(type_selector) => Ok(Negation(type_selector)),
|
||||
None => {
|
||||
|
|
|
@ -129,10 +129,10 @@ pub fn parse_style_rule(rule: QualifiedRule, parent_rules: &mut Vec<CSSRule>,
|
|||
let QualifiedRule{location: location, prelude: prelude, block: block} = rule;
|
||||
// FIXME: avoid doing this for valid selectors
|
||||
let serialized = prelude.iter().to_css();
|
||||
match selectors::parse_selector_list(prelude.move_iter(), namespaces) {
|
||||
match selectors::parse_selector_list(prelude.into_iter(), namespaces) {
|
||||
Ok(selectors) => parent_rules.push(CSSStyleRule(StyleRule{
|
||||
selectors: selectors,
|
||||
declarations: properties::parse_property_declaration_list(block.move_iter(), base_url)
|
||||
declarations: properties::parse_property_declaration_list(block.into_iter(), base_url)
|
||||
})),
|
||||
Err(()) => log_css_error(location, format!(
|
||||
"Invalid/unsupported selector: {}", serialized).as_slice()),
|
||||
|
|
|
@ -18,7 +18,6 @@ path = "../../support/rust-task_info"
|
|||
|
||||
[dependencies.string_cache]
|
||||
git = "https://github.com/servo/string-cache"
|
||||
branch = "pre-rustup"
|
||||
|
||||
[dependencies.url]
|
||||
git = "https://github.com/servo/rust-url"
|
|
@ -262,7 +262,7 @@ impl BloomFilter {
|
|||
/// on every element.
|
||||
pub fn clear(&mut self) {
|
||||
self.number_of_insertions = 0;
|
||||
for x in self.buf.as_mut_slice().mut_iter() {
|
||||
for x in self.buf.as_mut_slice().iter_mut() {
|
||||
*x = 0u;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,7 +238,7 @@ impl<K:Clone+PartialEq+Hash,V:Clone> Cache<K,V> for SimpleHashCache<K,V> {
|
|||
}
|
||||
|
||||
fn evict_all(&mut self) {
|
||||
for slot in self.entries.mut_iter() {
|
||||
for slot in self.entries.iter_mut() {
|
||||
*slot = None
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ extern crate serialize;
|
|||
extern crate sync;
|
||||
#[cfg(target_os="macos")]
|
||||
extern crate task_info;
|
||||
extern crate std_time = "time";
|
||||
extern crate "time" as std_time;
|
||||
extern crate string_cache;
|
||||
extern crate url;
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@ use std::io::File;
|
|||
use std::mem::size_of;
|
||||
#[cfg(target_os="linux")]
|
||||
use std::os::page_size;
|
||||
use std::ptr::mut_null;
|
||||
use std::ptr::null_mut;
|
||||
use std::time::duration::Duration;
|
||||
use task::spawn_named;
|
||||
#[cfg(target_os="macos")]
|
||||
use task_info::task_basic_info::{virtual_size,resident_size};
|
||||
|
@ -41,7 +42,7 @@ impl MemoryProfiler {
|
|||
let (chan, port) = channel();
|
||||
match period {
|
||||
Some(period) => {
|
||||
let period = (period * 1000f64) as u64;
|
||||
let period = Duration::milliseconds((period * 1000f64) as i64);
|
||||
let chan = chan.clone();
|
||||
spawn_named("Memory profiler timer", proc() {
|
||||
loop {
|
||||
|
@ -154,7 +155,7 @@ fn get_jemalloc_stat(name: &'static str) -> Option<u64> {
|
|||
let mut oldlen = size_of::<size_t>() as size_t;
|
||||
let rv: c_int;
|
||||
unsafe {
|
||||
rv = je_mallctl(c_name.unwrap(), oldp, &mut oldlen, mut_null(), 0);
|
||||
rv = je_mallctl(c_name.unwrap(), oldp, &mut oldlen, null_mut(), 0);
|
||||
}
|
||||
if rv == 0 { Some(old as u64) } else { None }
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
//! Small vectors in various sizes. These store a certain number of elements inline and fall back
|
||||
//! to the heap for larger allocations.
|
||||
|
||||
use i = std::mem::init;
|
||||
use std::mem::init as i;
|
||||
use std::cmp;
|
||||
use std::intrinsics;
|
||||
use std::kinds::marker::ContravariantLifetime;
|
||||
|
@ -21,12 +21,12 @@ pub trait VecLike<T> {
|
|||
fn vec_len(&self) -> uint;
|
||||
fn vec_push(&mut self, value: T);
|
||||
|
||||
fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T];
|
||||
fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T];
|
||||
|
||||
#[inline]
|
||||
fn vec_mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] {
|
||||
fn vec_slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] {
|
||||
let len = self.vec_len();
|
||||
self.vec_mut_slice(start, len)
|
||||
self.vec_slice_mut(start, len)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,8 @@ impl<T> VecLike<T> for Vec<T> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
||||
self.mut_slice(start, end)
|
||||
fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
||||
self.slice_mut(start, end)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ trait SmallVecPrivate<T> {
|
|||
unsafe fn set_ptr(&mut self, new_ptr: *mut T);
|
||||
}
|
||||
|
||||
pub trait SmallVec<T> : SmallVecPrivate<T> {
|
||||
pub trait SmallVec<T> : SmallVecPrivate<T> where T: 'static {
|
||||
fn inline_size(&self) -> uint;
|
||||
fn len(&self) -> uint;
|
||||
fn cap(&self) -> uint;
|
||||
|
@ -102,7 +102,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
|
|||
|
||||
/// NB: For efficiency reasons (avoiding making a second copy of the inline elements), this
|
||||
/// actually clears out the original array instead of moving it.
|
||||
fn move_iter<'a>(&'a mut self) -> SmallVecMoveIterator<'a,T> {
|
||||
fn into_iter<'a>(&'a mut self) -> SmallVecMoveIterator<'a,T> {
|
||||
unsafe {
|
||||
let iter = mem::transmute(self.iter());
|
||||
let ptr_opt = if self.spilled() {
|
||||
|
@ -136,7 +136,7 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
|
|||
}
|
||||
|
||||
fn push_all_move<V:SmallVec<T>>(&mut self, mut other: V) {
|
||||
for value in other.move_iter() {
|
||||
for value in other.into_iter() {
|
||||
self.push(value)
|
||||
}
|
||||
}
|
||||
|
@ -219,12 +219,12 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
|
|||
self.slice(0, self.len())
|
||||
}
|
||||
|
||||
fn as_mut_slice<'a>(&'a mut self) -> &'a mut [T] {
|
||||
fn as_slice_mut<'a>(&'a mut self) -> &'a mut [T] {
|
||||
let len = self.len();
|
||||
self.mut_slice(0, len)
|
||||
self.slice_mut(0, len)
|
||||
}
|
||||
|
||||
fn mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
||||
fn slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
||||
assert!(start <= end);
|
||||
assert!(end <= self.len());
|
||||
unsafe {
|
||||
|
@ -235,9 +235,9 @@ pub trait SmallVec<T> : SmallVecPrivate<T> {
|
|||
}
|
||||
}
|
||||
|
||||
fn mut_slice_from<'a>(&'a mut self, start: uint) -> &'a mut [T] {
|
||||
fn slice_from_mut<'a>(&'a mut self, start: uint) -> &'a mut [T] {
|
||||
let len = self.len();
|
||||
self.mut_slice(start, len)
|
||||
self.slice_mut(start, len)
|
||||
}
|
||||
|
||||
fn fail_bounds_check(&self, index: uint) {
|
||||
|
@ -300,7 +300,7 @@ pub struct SmallVecMoveIterator<'a,T> {
|
|||
lifetime: ContravariantLifetime<'a>,
|
||||
}
|
||||
|
||||
impl<'a,T> Iterator<T> for SmallVecMoveIterator<'a,T> {
|
||||
impl<'a, T: 'static> Iterator<T> for SmallVecMoveIterator<'a,T> {
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<T> {
|
||||
unsafe {
|
||||
|
@ -317,7 +317,7 @@ impl<'a,T> Iterator<T> for SmallVecMoveIterator<'a,T> {
|
|||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl<'a,T> Drop for SmallVecMoveIterator<'a,T> {
|
||||
impl<'a, T: 'static> Drop for SmallVecMoveIterator<'a,T> {
|
||||
fn drop(&mut self) {
|
||||
// Destroy the remaining elements.
|
||||
for _ in *self {}
|
||||
|
@ -350,7 +350,7 @@ macro_rules! def_small_vector(
|
|||
data: [T, ..$size],
|
||||
}
|
||||
|
||||
impl<T> SmallVecPrivate<T> for $name<T> {
|
||||
impl<T: 'static> SmallVecPrivate<T> for $name<T> {
|
||||
unsafe fn set_len(&mut self, new_len: uint) {
|
||||
self.len = new_len
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ macro_rules! def_small_vector(
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> SmallVec<T> for $name<T> {
|
||||
impl<T: 'static> SmallVec<T> for $name<T> {
|
||||
fn inline_size(&self) -> uint {
|
||||
$size
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ macro_rules! def_small_vector(
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> VecLike<T> for $name<T> {
|
||||
impl<T: 'static> VecLike<T> for $name<T> {
|
||||
#[inline]
|
||||
fn vec_len(&self) -> uint {
|
||||
self.len()
|
||||
|
@ -400,12 +400,12 @@ macro_rules! def_small_vector(
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn vec_mut_slice<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
||||
self.mut_slice(start, end)
|
||||
fn vec_slice_mut<'a>(&'a mut self, start: uint, end: uint) -> &'a mut [T] {
|
||||
self.slice_mut(start, end)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> $name<T> {
|
||||
impl<T: 'static> $name<T> {
|
||||
#[inline]
|
||||
pub fn new() -> $name<T> {
|
||||
unsafe {
|
||||
|
@ -432,7 +432,7 @@ def_small_vector!(SmallVec32, 32)
|
|||
macro_rules! def_small_vector_drop_impl(
|
||||
($name:ident, $size:expr) => (
|
||||
#[unsafe_destructor]
|
||||
impl<T> Drop for $name<T> {
|
||||
impl<T: 'static> Drop for $name<T> {
|
||||
fn drop(&mut self) {
|
||||
if !self.spilled() {
|
||||
return
|
||||
|
@ -467,7 +467,7 @@ def_small_vector_drop_impl!(SmallVec32, 32)
|
|||
|
||||
macro_rules! def_small_vector_clone_impl(
|
||||
($name:ident) => (
|
||||
impl<T:Clone> Clone for $name<T> {
|
||||
impl<T:Clone+'static> Clone for $name<T> {
|
||||
fn clone(&self) -> $name<T> {
|
||||
let mut new_vector = $name::new();
|
||||
for element in self.iter() {
|
||||
|
|
|
@ -91,7 +91,7 @@ pub mod test {
|
|||
let len: uint = rng.gen();
|
||||
let mut v: Vec<int> = rng.gen_iter::<int>().take((len % 32) + 1).collect();
|
||||
fn compare_ints(a: &int, b: &int) -> Ordering { a.cmp(b) }
|
||||
sort::quicksort_by(v.as_mut_slice(), compare_ints);
|
||||
sort::quicksort_by(v.as_slice_mut(), compare_ints);
|
||||
for i in range(0, v.len() - 1) {
|
||||
assert!(v.get(i) <= v.get(i + 1))
|
||||
}
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче