Last active
February 14, 2019 20:56
-
-
Save pcwalton/cb4bedde82ad682bda5a0481ded32a35 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct LayoutObjectRef<T>(Arc<RwLock<LayoutObject<T>>>); | |
struct LayoutObject<T> { | |
style: Arc<ComputedValues>, | |
// position? borders? padding? margins? | |
contents: T, | |
} | |
struct BlockFormattingContext(BlockOrInline); | |
enum BlockOrInline { | |
Block(List<BlockLevel>), | |
Inline(List<InlineLevel>), | |
} | |
enum BlockLevel { | |
Normal(LayoutObjectRef<BlockOrInline>), | |
NewContext(LayoutObjectRef<FormattingContext>), | |
} | |
enum InlineLevel { | |
Text(LayoutObjectRef<Text>), | |
Inline(LayoutObjectRef<Inline>), | |
Replaced(LayoutObjectRef<FormattingContext>), | |
} | |
struct Text { | |
content: DOMString, | |
} | |
struct Inline { | |
flags: InlineFlags, | |
} | |
bitflags! { | |
flags InlineFlags: u8 { | |
const FIRST_FRAGMENT = 0x01; | |
const LAST_FRAGMENT = 0x02; | |
} | |
} | |
enum FormattingContext { | |
Flow(BlockFormattingContext), | |
Replaced, | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment