Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How does the layout work? #247

Open
konstantinjdobler opened this issue Jul 25, 2018 · 0 comments
Open

How does the layout work? #247

konstantinjdobler opened this issue Jul 25, 2018 · 0 comments
Labels

Comments

@konstantinjdobler
Copy link
Contributor

First we create a DOM-Tree from a given HTML document (meaning we have a node for each DIV, SPAN etc and if a DIV has two SPANs inside it, the DIV node will have two SPAN children). Also each node gets a collection of all CSSStyleRules that are relevant for it. This works correctly.

However this is just an abstract representation. We cannot see it. This is done in the next step, were each node goes a graphical representation we can see using Morphs.
However, all inline nodes in one line get pushed together into one single HtmlInlineMorph. (This is something were a possible refactor comes into play). Every Morph we create for a node (or set to nodes) retains an accessor to his node.

When such a Morph is created, he gets a HtmlLayoutStyles object which contains the information relevant for layouting (margin, padding etc). Morphs also have a LayoutPolicy. This LayoutPolicy then uses the information in HtmlLayoutStyles to do a correct layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant