Auto merge of #18056 - cynicaldevil:remove-treesink-dep-on-dom, r=nox

End TreeBuilder's reliance on DOM.

<!-- Please describe your changes on the following line: -->

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->

Fixed h5e's TreeBuilder so that it does not use `same_tree` and `has_parent_node` methods: d8c2ea5cb6
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18056)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-08-18 16:27:05 -05:00 committed by GitHub
commit 62d0de349d
10 changed files with 156 additions and 115 deletions

38
Cargo.lock generated
View file

@ -1091,7 +1091,7 @@ dependencies = [
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"webrender_api 0.49.0 (git+https://github.com/servo/webrender)", "webrender_api 0.49.0 (git+https://github.com/servo/webrender)",
"xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"xml5ever 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -1240,12 +1240,12 @@ dependencies = [
[[package]] [[package]]
name = "html5ever" name = "html5ever"
version = "0.18.0" version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"markup5ever 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "markup5ever 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1460,7 +1460,7 @@ dependencies = [
"gfx 0.0.1", "gfx 0.0.1",
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1508,7 +1508,7 @@ dependencies = [
"gfx 0.0.1", "gfx 0.0.1",
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"layout 0.0.1", "layout 0.0.1",
"layout_traits 0.0.1", "layout_traits 0.0.1",
@ -1674,7 +1674,7 @@ dependencies = [
[[package]] [[package]]
name = "markup5ever" name = "markup5ever"
version = "0.3.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1684,7 +1684,7 @@ dependencies = [
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string_cache_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "string_cache_codegen 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tendril 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2483,7 +2483,7 @@ dependencies = [
"half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "half 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper_serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper_serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.12.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2534,7 +2534,7 @@ dependencies = [
"webrender_api 0.49.0 (git+https://github.com/servo/webrender)", "webrender_api 0.49.0 (git+https://github.com/servo/webrender)",
"webvr 0.0.1", "webvr 0.0.1",
"webvr_traits 0.0.1", "webvr_traits 0.0.1",
"xml5ever 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "xml5ever 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2549,7 +2549,7 @@ dependencies = [
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "ipc-channel 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.23 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3022,7 +3022,7 @@ dependencies = [
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3073,7 +3073,7 @@ dependencies = [
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)", "cssparser 0.19.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)",
"html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)", "html5ever 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3215,7 +3215,7 @@ dependencies = [
[[package]] [[package]]
name = "tendril" name = "tendril"
version = "0.3.1" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"futf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "futf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3630,12 +3630,12 @@ dependencies = [
[[package]] [[package]]
name = "xml5ever" name = "xml5ever"
version = "0.8.0" version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
"mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"markup5ever 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "markup5ever 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3750,7 +3750,7 @@ dependencies = [
"checksum heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "46f96d52fb1564059fc97b85ef6165728cc30198ab60073bf114c66c4c89bb5d" "checksum heapsize_derive 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "46f96d52fb1564059fc97b85ef6165728cc30198ab60073bf114c66c4c89bb5d"
"checksum heartbeats-simple 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad003ce233955e9d95f2c69cde84e68302ba9ba4a673d351c9bff93c738aadc" "checksum heartbeats-simple 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9ad003ce233955e9d95f2c69cde84e68302ba9ba4a673d351c9bff93c738aadc"
"checksum heartbeats-simple-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e1a408c0011427cc0e0049f7861c70377819aedfc006e8c901b1c70fd98fb1a4" "checksum heartbeats-simple-sys 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e1a408c0011427cc0e0049f7861c70377819aedfc006e8c901b1c70fd98fb1a4"
"checksum html5ever 0.18.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a49d5001dd1bddf042ea41ed4e0a671d50b1bf187e66b349d7ec613bdce4ad90" "checksum html5ever 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba0806f17ce2ea657c67cd28d03941166638c05153fb644aac6d5156b3033d0"
"checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d" "checksum httparse 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a6e7a63e511f9edffbab707141fbb8707d1a3098615fb2adbd5769cdfcc9b17d"
"checksum hyper 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)" = "36e108e0b1fa2d17491cbaac4bc460dc0956029d10ccf83c913dd0e5db3e7f07" "checksum hyper 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)" = "36e108e0b1fa2d17491cbaac4bc460dc0956029d10ccf83c913dd0e5db3e7f07"
"checksum hyper-openssl 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "85a372eb692590b3fe014c196c30f9f52d4c42f58cd49dd94caeee1593c9cc37" "checksum hyper-openssl 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "85a372eb692590b3fe014c196c30f9f52d4c42f58cd49dd94caeee1593c9cc37"
@ -3782,7 +3782,7 @@ dependencies = [
"checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084"
"checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
"checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" "checksum malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb"
"checksum markup5ever 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "622d7d373a68b45f4a90f4b498da40cba8ce6aff56fbddbcbbe9cf1f2a8f3df9" "checksum markup5ever 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8c787ec52b50a2ee0f15db7c18e628528964f71e113ceb864177abe866d169c9"
"checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1" "checksum matches 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efd7622e3022e1a6eaa602c4cea8912254e5582c9c692e9167714182244801b1"
"checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" "checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4"
"checksum metadeps 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829fffe7ea1d747e23f64be972991bc516b2f1ac2ae4a3b33d8bea150c410151" "checksum metadeps 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "829fffe7ea1d747e23f64be972991bc516b2f1ac2ae4a3b33d8bea150c410151"
@ -3889,7 +3889,7 @@ dependencies = [
"checksum syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13ad4762fe52abc9f4008e85c4fb1b1fe3aa91ccb99ff4826a439c7c598e1047" "checksum syntex_pos 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "13ad4762fe52abc9f4008e85c4fb1b1fe3aa91ccb99ff4826a439c7c598e1047"
"checksum syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6e0e4dbae163dd98989464c23dd503161b338790640e11537686f2ef0f25c791" "checksum syntex_syntax 0.58.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6e0e4dbae163dd98989464c23dd503161b338790640e11537686f2ef0f25c791"
"checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6" "checksum tempdir 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "87974a6f5c1dfb344d733055601650059a3363de2a6104819293baff662132d6"
"checksum tendril 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1b72f8e2f5b73b65c315b1a70c730f24b9d7a25f39e98de8acbe2bb795caea" "checksum tendril 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9de21546595a0873061940d994bbbc5c35f024ae4fd61ec5c5b159115684f508"
"checksum term 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d168af3930b369cfe245132550579d47dfd873d69470755a19c2c6568dbbd989" "checksum term 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d168af3930b369cfe245132550579d47dfd873d69470755a19c2c6568dbbd989"
"checksum term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "07b6c1ac5b3fffd75073276bca1ceed01f67a28537097a2a9539e116e50fb21a" "checksum term_size 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "07b6c1ac5b3fffd75073276bca1ceed01f67a28537097a2a9539e116e50fb21a"
"checksum thread-id 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8df7875b676fddfadffd96deea3b1124e5ede707d4884248931077518cf1f773" "checksum thread-id 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8df7875b676fddfadffd96deea3b1124e5ede707d4884248931077518cf1f773"
@ -3934,4 +3934,4 @@ dependencies = [
"checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61" "checksum xdg 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a66b7c2281ebde13cf4391d70d4c7e5946c3c25e72a7b859ca8f677dcd0b0c61"
"checksum xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12ea8eda4b1eb72f02d148402e23832d56a33f55d8c1b2d5bcdde91d79d47cb1" "checksum xi-unicode 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "12ea8eda4b1eb72f02d148402e23832d56a33f55d8c1b2d5bcdde91d79d47cb1"
"checksum xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7ec6c39eaa68382c8e31e35239402c0a9489d4141a8ceb0c716099a0b515b562" "checksum xml-rs 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7ec6c39eaa68382c8e31e35239402c0a9489d4141a8ceb0c716099a0b515b562"
"checksum xml5ever 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b55c0fe16ec63e5bb4c2e1a4f22ee982d0df940b90827689932a9b2c34782c23" "checksum xml5ever 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05d24ca1124fc3e7112b10d1979b5054bf599fcd9327da36dace83f1652d110f"

View file

@ -55,7 +55,7 @@ freetype = "0.3"
servo-fontconfig = "0.2.1" servo-fontconfig = "0.2.1"
[target.'cfg(target_os = "android")'.dependencies] [target.'cfg(target_os = "android")'.dependencies]
xml5ever = {version = "0.8", features = ["unstable"]} xml5ever = {version = "0.9"}
[target.'cfg(any(target_feature = "sse2", target_feature = "neon"))'.dependencies] [target.'cfg(any(target_feature = "sse2", target_feature = "neon"))'.dependencies]
simd = "0.2.0" simd = "0.2.0"

View file

@ -19,7 +19,7 @@ fnv = "1.0"
gfx = {path = "../gfx"} gfx = {path = "../gfx"}
gfx_traits = {path = "../gfx_traits"} gfx_traits = {path = "../gfx_traits"}
heapsize = "0.4" heapsize = "0.4"
html5ever = "0.18" html5ever = "0.19"
ipc-channel = "0.8" ipc-channel = "0.8"
libc = "0.2" libc = "0.2"
log = "0.3.5" log = "0.3.5"

View file

@ -17,7 +17,7 @@ fnv = "1.0"
gfx = {path = "../gfx"} gfx = {path = "../gfx"}
gfx_traits = {path = "../gfx_traits"} gfx_traits = {path = "../gfx_traits"}
heapsize = "0.4" heapsize = "0.4"
html5ever = "0.18" html5ever = "0.19"
ipc-channel = "0.8" ipc-channel = "0.8"
layout = {path = "../layout"} layout = {path = "../layout"}
layout_traits = {path = "../layout_traits"} layout_traits = {path = "../layout_traits"}

View file

@ -46,7 +46,7 @@ gleam = "0.4"
half = "1.0" half = "1.0"
heapsize = "0.4" heapsize = "0.4"
heapsize_derive = "0.1" heapsize_derive = "0.1"
html5ever = {version = "0.18", features = ["heap_size", "unstable"]} html5ever = {version = "0.19", features = ["heap_size"]}
hyper = "0.10" hyper = "0.10"
hyper_serde = "0.7" hyper_serde = "0.7"
image = "0.12" image = "0.12"
@ -90,7 +90,7 @@ unicode-segmentation = "1.1.0"
url = {version = "1.2", features = ["heap_size", "query_encoding"]} url = {version = "1.2", features = ["heap_size", "query_encoding"]}
utf-8 = "0.7" utf-8 = "0.7"
uuid = {version = "0.5", features = ["v4"]} uuid = {version = "0.5", features = ["v4"]}
xml5ever = {version = "0.8", features = ["unstable"]} xml5ever = {version = "0.9"}
webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]} webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
webvr = {path = "../webvr"} webvr = {path = "../webvr"}
webvr_traits = {path = "../webvr_traits"} webvr_traits = {path = "../webvr_traits"}

View file

@ -69,6 +69,7 @@ enum ParseOperation {
CreateComment { text: String, node: ParseNodeId }, CreateComment { text: String, node: ParseNodeId },
AppendBeforeSibling { sibling: ParseNodeId, node: NodeOrText }, AppendBeforeSibling { sibling: ParseNodeId, node: NodeOrText },
AppendBasedOnParentNode { element: ParseNodeId, prev_element: ParseNodeId, node: NodeOrText },
Append { parent: ParseNodeId, node: NodeOrText }, Append { parent: ParseNodeId, node: NodeOrText },
AppendDoctypeToDocument { AppendDoctypeToDocument {
@ -81,7 +82,13 @@ enum ParseOperation {
RemoveFromParent { target: ParseNodeId }, RemoveFromParent { target: ParseNodeId },
MarkScriptAlreadyStarted { node: ParseNodeId }, MarkScriptAlreadyStarted { node: ParseNodeId },
ReparentChildren { parent: ParseNodeId, new_parent: ParseNodeId }, ReparentChildren { parent: ParseNodeId, new_parent: ParseNodeId },
AssociateWithForm { target: ParseNodeId, form: ParseNodeId },
AssociateWithForm {
target: ParseNodeId,
form: ParseNodeId,
element: ParseNodeId,
prev_element: Option<ParseNodeId>
},
CreatePI { CreatePI {
node: ParseNodeId, node: ParseNodeId,
@ -113,8 +120,6 @@ enum ToTokenizerMsg {
// From Sink // From Sink
ProcessOperation(ParseOperation), ProcessOperation(ParseOperation),
IsSameTree(ParseNodeId, ParseNodeId),
HasParentNode(ParseNodeId),
} }
#[derive(HeapSizeOf)] #[derive(HeapSizeOf)]
@ -127,14 +132,6 @@ enum ToHtmlTokenizerMsg {
SetPlainTextState, SetPlainTextState,
} }
// Responses to the queries asked by the the Sink to the Tokenizer,
// using the messages types in FromSinkMsg.
#[derive(HeapSizeOf)]
enum ToSinkMsg {
IsSameTree(bool),
HasParentNode(bool),
}
fn create_buffer_queue(mut buffers: VecDeque<SendTendril<UTF8>>) -> BufferQueue { fn create_buffer_queue(mut buffers: VecDeque<SendTendril<UTF8>>) -> BufferQueue {
let mut buffer_queue = BufferQueue::new(); let mut buffer_queue = BufferQueue::new();
while let Some(st) = buffers.pop_front() { while let Some(st) = buffers.pop_front() {
@ -155,17 +152,17 @@ fn create_buffer_queue(mut buffers: VecDeque<SendTendril<UTF8>>) -> BufferQueue
// then executes the received actions. // then executes the received actions.
// //
// _____________ _______________ // _____________ _______________
// | | ToHtmlTokenizerMsg | |
// | |------------------------>| |
// | | | | // | | | |
// | | ToTokenizerMsg | HtmlTokenizer | // | | | |
// | |<------------------------| | // | | ToHtmlTokenizerMsg | |
// | Tokenizer | | | // | |------------------------>| HtmlTokenizer |
// | | ToTokenizerMsg | ________ | // | | | |
// | Tokenizer | ToTokenizerMsg | |
// | |<------------------------| ________ |
// | | | | | |
// | | ToTokenizerMsg | | Sink | |
// | |<------------------------|---| | | // | |<------------------------|---| | |
// | | | | Sink | | // | | | |________| |
// | | ToSinkMsg | | | |
// | |-------------------------|-->|________| |
// |_____________| |_______________| // |_____________| |_______________|
// //
#[derive(HeapSizeOf, JSTraceable)] #[derive(HeapSizeOf, JSTraceable)]
@ -177,7 +174,6 @@ pub struct Tokenizer {
#[ignore_heap_size_of = "Defined in std"] #[ignore_heap_size_of = "Defined in std"]
html_tokenizer_sender: Sender<ToHtmlTokenizerMsg>, html_tokenizer_sender: Sender<ToHtmlTokenizerMsg>,
#[ignore_heap_size_of = "Defined in std"] #[ignore_heap_size_of = "Defined in std"]
sink_sender: Sender<ToSinkMsg>,
nodes: HashMap<ParseNodeId, JS<Node>>, nodes: HashMap<ParseNodeId, JS<Node>>,
url: ServoUrl, url: ServoUrl,
} }
@ -190,8 +186,6 @@ impl Tokenizer {
-> Self { -> Self {
// Messages from the Tokenizer (main thread) to HtmlTokenizer (parser thread) // Messages from the Tokenizer (main thread) to HtmlTokenizer (parser thread)
let (to_html_tokenizer_sender, html_tokenizer_receiver) = channel(); let (to_html_tokenizer_sender, html_tokenizer_receiver) = channel();
// Messages from the Tokenizer (main thread) to Sink (parser thread)
let (to_sink_sender, sink_receiver) = channel();
// Messages from HtmlTokenizer and Sink (parser thread) to Tokenizer (main thread) // Messages from HtmlTokenizer and Sink (parser thread) to Tokenizer (main thread)
let (to_tokenizer_sender, tokenizer_receiver) = channel(); let (to_tokenizer_sender, tokenizer_receiver) = channel();
@ -199,13 +193,12 @@ impl Tokenizer {
document: JS::from_ref(document), document: JS::from_ref(document),
receiver: tokenizer_receiver, receiver: tokenizer_receiver,
html_tokenizer_sender: to_html_tokenizer_sender, html_tokenizer_sender: to_html_tokenizer_sender,
sink_sender: to_sink_sender,
nodes: HashMap::new(), nodes: HashMap::new(),
url: url url: url
}; };
tokenizer.insert_node(0, JS::from_ref(document.upcast())); tokenizer.insert_node(0, JS::from_ref(document.upcast()));
let mut sink = Sink::new(to_tokenizer_sender.clone(), sink_receiver); let mut sink = Sink::new(to_tokenizer_sender.clone());
let mut ctxt_parse_node = None; let mut ctxt_parse_node = None;
let mut form_parse_node = None; let mut form_parse_node = None;
let mut fragment_context_is_some = false; let mut fragment_context_is_some = false;
@ -250,18 +243,6 @@ impl Tokenizer {
loop { loop {
match self.receiver.recv().expect("Unexpected channel panic in main thread.") { match self.receiver.recv().expect("Unexpected channel panic in main thread.") {
ToTokenizerMsg::ProcessOperation(parse_op) => self.process_operation(parse_op), ToTokenizerMsg::ProcessOperation(parse_op) => self.process_operation(parse_op),
ToTokenizerMsg::IsSameTree(ref x_id, ref y_id) => {
let x = self.get_node(x_id);
let y = self.get_node(y_id);
let x = x.downcast::<Element>().expect("Element node expected");
let y = y.downcast::<Element>().expect("Element node expected");
self.sink_sender.send(ToSinkMsg::IsSameTree(x.is_in_same_home_subtree(y))).unwrap();
},
ToTokenizerMsg::HasParentNode(ref id) => {
let res = self.get_node(id).GetParentNode().is_some();
self.sink_sender.send(ToSinkMsg::HasParentNode(res)).unwrap();
},
ToTokenizerMsg::TokenizerResultDone { updated_input } => { ToTokenizerMsg::TokenizerResultDone { updated_input } => {
let buffer_queue = create_buffer_queue(updated_input); let buffer_queue = create_buffer_queue(updated_input);
*input = buffer_queue; *input = buffer_queue;
@ -283,18 +264,6 @@ impl Tokenizer {
loop { loop {
match self.receiver.recv().expect("Unexpected channel panic in main thread.") { match self.receiver.recv().expect("Unexpected channel panic in main thread.") {
ToTokenizerMsg::ProcessOperation(parse_op) => self.process_operation(parse_op), ToTokenizerMsg::ProcessOperation(parse_op) => self.process_operation(parse_op),
ToTokenizerMsg::IsSameTree(ref x_id, ref y_id) => {
let x = self.get_node(x_id);
let y = self.get_node(y_id);
let x = x.downcast::<Element>().expect("Element node expected");
let y = y.downcast::<Element>().expect("Element node expected");
self.sink_sender.send(ToSinkMsg::IsSameTree(x.is_in_same_home_subtree(y))).unwrap();
},
ToTokenizerMsg::HasParentNode(ref id) => {
let res = self.get_node(id).GetParentNode().is_some();
self.sink_sender.send(ToSinkMsg::HasParentNode(res)).unwrap();
},
ToTokenizerMsg::End => return, ToTokenizerMsg::End => return,
_ => unreachable!(), _ => unreachable!(),
}; };
@ -317,6 +286,45 @@ impl Tokenizer {
self.nodes.get(id).expect("Node not found!") self.nodes.get(id).expect("Node not found!")
} }
fn append_before_sibling(&mut self, sibling: ParseNodeId, node: NodeOrText) {
let node = match node {
NodeOrText::Node(n) => HtmlNodeOrText::AppendNode(JS::from_ref(&**self.get_node(&n.id))),
NodeOrText::Text(text) => HtmlNodeOrText::AppendText(
Tendril::from(text)
)
};
let sibling = &**self.get_node(&sibling);
let parent = &*sibling.GetParentNode().expect("append_before_sibling called on node without parent");
super::insert(parent, Some(sibling), node);
}
fn append(&mut self, parent: ParseNodeId, node: NodeOrText) {
let node = match node {
NodeOrText::Node(n) => HtmlNodeOrText::AppendNode(JS::from_ref(&**self.get_node(&n.id))),
NodeOrText::Text(text) => HtmlNodeOrText::AppendText(
Tendril::from(text)
)
};
let parent = &**self.get_node(&parent);
super::insert(parent, None, node);
}
fn has_parent_node(&self, node: ParseNodeId) -> bool {
self.get_node(&node).GetParentNode().is_some()
}
fn same_tree(&self, x: ParseNodeId, y: ParseNodeId) -> bool {
let x = self.get_node(&x);
let y = self.get_node(&y);
let x = x.downcast::<Element>().expect("Element node expected");
let y = y.downcast::<Element>().expect("Element node expected");
x.is_in_same_home_subtree(y)
}
fn process_operation(&mut self, op: ParseOperation) { fn process_operation(&mut self, op: ParseOperation) {
let document = Root::from_ref(&**self.get_node(&0)); let document = Root::from_ref(&**self.get_node(&0));
let document = document.downcast::<Document>().expect("Document node should be downcasted!"); let document = document.downcast::<Document>().expect("Document node should be downcasted!");
@ -348,27 +356,17 @@ impl Tokenizer {
self.insert_node(node, JS::from_ref(&comment.upcast())); self.insert_node(node, JS::from_ref(&comment.upcast()));
} }
ParseOperation::AppendBeforeSibling { sibling, node } => { ParseOperation::AppendBeforeSibling { sibling, node } => {
let node = match node { self.append_before_sibling(sibling, node);
NodeOrText::Node(n) => HtmlNodeOrText::AppendNode(JS::from_ref(&**self.get_node(&n.id))),
NodeOrText::Text(text) => HtmlNodeOrText::AppendText(
Tendril::from(text)
)
};
let sibling = &**self.get_node(&sibling);
let parent = &*sibling.GetParentNode().expect("append_before_sibling called on node without parent");
super::insert(parent, Some(sibling), node);
} }
ParseOperation::Append { parent, node } => { ParseOperation::Append { parent, node } => {
let node = match node { self.append(parent, node);
NodeOrText::Node(n) => HtmlNodeOrText::AppendNode(JS::from_ref(&**self.get_node(&n.id))), }
NodeOrText::Text(text) => HtmlNodeOrText::AppendText( ParseOperation::AppendBasedOnParentNode { element, prev_element, node } => {
Tendril::from(text) if self.has_parent_node(element) {
) self.append_before_sibling(element, node);
}; } else {
self.append(prev_element, node);
let parent = &**self.get_node(&parent); }
super::insert(parent, None, node);
} }
ParseOperation::AppendDoctypeToDocument { name, public_id, system_id } => { ParseOperation::AppendDoctypeToDocument { name, public_id, system_id } => {
let doctype = DocumentType::new( let doctype = DocumentType::new(
@ -400,7 +398,14 @@ impl Tokenizer {
new_parent.AppendChild(&child).unwrap(); new_parent.AppendChild(&child).unwrap();
} }
} }
ParseOperation::AssociateWithForm { target, form } => { ParseOperation::AssociateWithForm { target, form, element, prev_element } => {
let tree_node = prev_element.map_or(element, |prev| {
if self.has_parent_node(element) { element } else { prev }
});
if !self.same_tree(tree_node, form) {
return;
}
let form = self.get_node(&form); let form = self.get_node(&form);
let form = Root::downcast::<HTMLFormElement>(Root::from_ref(&**form)) let form = Root::downcast::<HTMLFormElement>(Root::from_ref(&**form))
.expect("Owner must be a form element"); .expect("Owner must be a form element");
@ -502,11 +507,10 @@ pub struct Sink {
next_parse_node_id: Cell<ParseNodeId>, next_parse_node_id: Cell<ParseNodeId>,
document_node: ParseNode, document_node: ParseNode,
sender: Sender<ToTokenizerMsg>, sender: Sender<ToTokenizerMsg>,
receiver: Receiver<ToSinkMsg>,
} }
impl Sink { impl Sink {
fn new(sender: Sender<ToTokenizerMsg>, receiver: Receiver<ToSinkMsg>) -> Sink { fn new(sender: Sender<ToTokenizerMsg>) -> Sink {
let mut sink = Sink { let mut sink = Sink {
current_line: 1, current_line: 1,
parse_node_data: HashMap::new(), parse_node_data: HashMap::new(),
@ -515,8 +519,7 @@ impl Sink {
id: 0, id: 0,
qual_name: None, qual_name: None,
}, },
sender: sender, sender: sender
receiver: receiver,
}; };
let data = ParseNodeData::default(); let data = ParseNodeData::default();
sink.insert_parse_node_data(0, data); sink.insert_parse_node_data(0, data);
@ -583,12 +586,8 @@ impl TreeSink for Sink {
target.qual_name.as_ref().expect("Expected qual name of node!").expanded() target.qual_name.as_ref().expect("Expected qual name of node!").expanded()
} }
fn same_tree(&self, x: &Self::Handle, y: &Self::Handle) -> bool { fn same_tree(&self, _: &Self::Handle, _: &Self::Handle) -> bool {
self.sender.send(ToTokenizerMsg::IsSameTree(x.id, y.id)).unwrap(); unreachable!();
match self.receiver.recv().expect("Unexpected channel panic in html parser thread.") {
ToSinkMsg::IsSameTree(result) => result,
_ => unreachable!(),
}
} }
fn create_element(&mut self, name: QualName, html_attrs: Vec<HtmlAttribute>, _flags: ElementFlags) fn create_element(&mut self, name: QualName, html_attrs: Vec<HtmlAttribute>, _flags: ElementFlags)
@ -633,18 +632,22 @@ impl TreeSink for Sink {
node node
} }
fn has_parent_node(&self, node: &Self::Handle) -> bool { fn has_parent_node(&self, _: &Self::Handle) -> bool {
self.sender.send(ToTokenizerMsg::HasParentNode(node.id)).unwrap(); unreachable!();
match self.receiver.recv().expect("Unexpected channel panic in html parser thread.") {
ToSinkMsg::HasParentNode(result) => result,
_ => unreachable!(),
}
} }
fn associate_with_form(&mut self, target: &Self::Handle, form: &Self::Handle) { fn associate_with_form(
&mut self,
target: &Self::Handle,
form: &Self::Handle,
nodes: (&Self::Handle, Option<&Self::Handle>),
) {
let (element, prev_element) = nodes;
self.send_op(ParseOperation::AssociateWithForm { self.send_op(ParseOperation::AssociateWithForm {
target: target.id, target: target.id,
form: form.id form: form.id,
element: element.id,
prev_element: prev_element.map(|p| p.id),
}); });
} }
@ -658,6 +661,23 @@ impl TreeSink for Sink {
self.send_op(ParseOperation::AppendBeforeSibling { sibling: sibling.id, node: new_node }); self.send_op(ParseOperation::AppendBeforeSibling { sibling: sibling.id, node: new_node });
} }
fn append_based_on_parent_node(
&mut self,
elem: &Self::Handle,
prev_elem: &Self::Handle,
child: HtmlNodeOrText<Self::Handle>,
) {
let child = match child {
HtmlNodeOrText::AppendNode(node) => NodeOrText::Node(node),
HtmlNodeOrText::AppendText(text) => NodeOrText::Text(String::from(text))
};
self.send_op(ParseOperation::AppendBasedOnParentNode {
element: elem.id,
prev_element: prev_elem.id,
node: child
});
}
fn parse_error(&mut self, msg: Cow<'static, str>) { fn parse_error(&mut self, msg: Cow<'static, str>) {
debug!("Parse error: {}", msg); debug!("Parse error: {}", msg);
} }

View file

@ -820,7 +820,15 @@ impl TreeSink for Sink {
node.GetParentNode().is_some() node.GetParentNode().is_some()
} }
fn associate_with_form(&mut self, target: &JS<Node>, form: &JS<Node>) { fn associate_with_form(&mut self, target: &JS<Node>, form: &JS<Node>, nodes: (&JS<Node>, Option<&JS<Node>>)) {
let (element, prev_element) = nodes;
let tree_node = prev_element.map_or(element, |prev| {
if self.has_parent_node(element) { element } else { prev }
});
if !self.same_tree(tree_node, form) {
return;
}
let node = target; let node = target;
let form = Root::downcast::<HTMLFormElement>(Root::from_ref(&**form)) let form = Root::downcast::<HTMLFormElement>(Root::from_ref(&**form))
.expect("Owner must be a form element"); .expect("Owner must be a form element");
@ -862,6 +870,19 @@ impl TreeSink for Sink {
insert(&parent, None, child); insert(&parent, None, child);
} }
fn append_based_on_parent_node(
&mut self,
elem: &JS<Node>,
prev_elem: &JS<Node>,
child: NodeOrText<JS<Node>>,
) {
if self.has_parent_node(elem) {
self.append_before_sibling(elem, child);
} else {
self.append(prev_elem, child);
}
}
fn append_doctype_to_document(&mut self, name: StrTendril, public_id: StrTendril, fn append_doctype_to_document(&mut self, name: StrTendril, public_id: StrTendril,
system_id: StrTendril) { system_id: StrTendril) {
let doc = &*self.document; let doc = &*self.document;

View file

@ -18,7 +18,7 @@ euclid = "0.15"
gfx_traits = {path = "../gfx_traits"} gfx_traits = {path = "../gfx_traits"}
heapsize = "0.4" heapsize = "0.4"
heapsize_derive = "0.1" heapsize_derive = "0.1"
html5ever = "0.18" html5ever = "0.19"
ipc-channel = "0.8" ipc-channel = "0.8"
libc = "0.2" libc = "0.2"
log = "0.3.5" log = "0.3.5"

View file

@ -45,7 +45,7 @@ heapsize = {version = "0.4", optional = true}
heapsize_derive = {version = "0.1", optional = true} heapsize_derive = {version = "0.1", optional = true}
itertools = "0.5" itertools = "0.5"
itoa = "0.3" itoa = "0.3"
html5ever = {version = "0.18", optional = true} html5ever = {version = "0.19", optional = true}
lazy_static = "0.2" lazy_static = "0.2"
log = "0.3" log = "0.3"
matches = "0.1" matches = "0.1"

View file

@ -14,7 +14,7 @@ byteorder = "1.0"
app_units = "0.5" app_units = "0.5"
cssparser = "0.19" cssparser = "0.19"
euclid = "0.15" euclid = "0.15"
html5ever = "0.18" html5ever = "0.19"
parking_lot = "0.4" parking_lot = "0.4"
rayon = "0.8" rayon = "0.8"
rustc-serialize = "0.3" rustc-serialize = "0.3"