forked from servo/html5ever
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.rs
93 lines (83 loc) · 2.22 KB
/
types.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// Copyright 2014 The html5ever Project Developers. See the
// COPYRIGHT file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! Types used within the tree builder code. Not exported to users.
use tokenizer::Tag;
use tokenizer::states::RawKind;
use tendril::StrTendril;
pub use self::InsertionMode::*;
pub use self::SplitStatus::*;
pub use self::Token::*;
pub use self::ProcessResult::*;
pub use self::FormatEntry::*;
pub use self::InsertionPoint::*;
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum InsertionMode {
Initial,
BeforeHtml,
BeforeHead,
InHead,
InHeadNoscript,
AfterHead,
InBody,
Text,
InTable,
InTableText,
InCaption,
InColumnGroup,
InTableBody,
InRow,
InCell,
InSelect,
InSelectInTable,
InTemplate,
AfterBody,
InFrameset,
AfterFrameset,
AfterAfterBody,
AfterAfterFrameset,
}
#[derive(PartialEq, Eq, Copy, Clone, Debug)]
pub enum SplitStatus {
NotSplit,
Whitespace,
NotWhitespace,
}
/// A subset/refinement of `tokenizer::Token`. Everything else is handled
/// specially at the beginning of `process_token`.
#[derive(PartialEq, Eq, Clone, Debug)]
pub enum Token {
TagToken(Tag),
CommentToken(StrTendril),
CharacterTokens(SplitStatus, StrTendril),
NullCharacterToken,
EOFToken,
}
pub enum ProcessResult<Handle> {
Done,
DoneAckSelfClosing,
SplitWhitespace(StrTendril),
Reprocess(InsertionMode, Token),
ReprocessForeign(Token),
Script(Handle),
ToPlaintext,
ToRawData(RawKind),
}
pub enum FormatEntry<Handle> {
Element(Handle, Tag),
Marker,
}
pub enum InsertionPoint<Handle> {
/// Holds the parent
LastChild(Handle),
/// Holds the sibling before which the node will be inserted
/// TODO: Is the parent node needed? Is there a problem with using
/// the sibling to find if the form element is in the same home
/// subtree?
BeforeSibling(Handle)
}