This website requires JavaScript.
Explore
Help
Register
Sign In
liangsheng8708
/
ruffle
mirror of
https://mirror.ghproxy.com/https://github.com/ruffle-rs/ruffle.git
Watch
1
Star
0
Fork
You've already forked ruffle
0
Code
Issues
Packages
Projects
Releases
Wiki
Activity
7497fb7008
ruffle
/
core
/
src
/
xml.rs
7 lines
87 B
Rust
Raw
Normal View
History
Unescape
Escape
Add rudimentary custom DOM impl on top of `quick_xml`. `quick_xml` was chosen due to it's high performance and support for zero-copy use cases. However, we are not using `minidom`, which is the already-extant DOM impl that uses `quick_xml` as it's parsing provider. This is because `minidom` nodes are not amenable to garbage collection. Specifically: we want to be able to construct a new `Object` variant that holds part of an XML node. However, `minidom::Element` directly owns it's children, meaning that we can't hold references to it from within `Object` while also keeping those objects to the `'gc` lifetime. Hence, we provide a GC-exclusive DOM implementation. I ruled out solutions such as holding an entire XML tree in an `Rc` and having AVM objects that shadow them. This works for `SwfSlice` because indexing an array is cheap; but traversing a tree can get very expensive. XML is used in many places in Flash Player, so it's important that we treat it like a first-class citizen.
2019-12-20 03:19:22 +00:00
//! Garbage-collectable XML DOM impl
Add the ability to `walk` through an XML tree. This yields nodes as `Step`s. This allows keeping track of the structure of the tree as you walk through descendents, as each element will be yielded twice: both as a `Step::In` *and* as a `Step::Out`. Non-element nodes will be yielded once as a `Step::Around`. I'm adding `walk` iteration specifically to avoid having to write certain methods recursively. Existing recursive callers of `children` should probably be updated to `walk` the tree and maintain a separate `Vec` stack.
2020-01-22 04:33:47 +00:00
mod
iterators
;
Add rudimentary custom DOM impl on top of `quick_xml`. `quick_xml` was chosen due to it's high performance and support for zero-copy use cases. However, we are not using `minidom`, which is the already-extant DOM impl that uses `quick_xml` as it's parsing provider. This is because `minidom` nodes are not amenable to garbage collection. Specifically: we want to be able to construct a new `Object` variant that holds part of an XML node. However, `minidom::Element` directly owns it's children, meaning that we can't hold references to it from within `Object` while also keeping those objects to the `'gc` lifetime. Hence, we provide a GC-exclusive DOM implementation. I ruled out solutions such as holding an entire XML tree in an `Rc` and having AVM objects that shadow them. This works for `SwfSlice` because indexing an array is cheap; but traversing a tree can get very expensive. XML is used in many places in Flash Player, so it's important that we treat it like a first-class citizen.
2019-12-20 03:19:22 +00:00
mod
tree
;
chore: Appease clippy * #[derive(Collect)] should be before #[collect] * Replace redunant `&buf[..]` with `buf` * Changes most cases of UPPERCase to UpperCase * Allow upper_case_acronym on most SWF types, as they are from SWF spec/more annoying to change.
2021-02-12 13:03:17 +00:00
pub
use
tree
::
XmlNode
;