about summary refs log tree commit diff stats
path: root/src/layout/box.nim
Commit message (Collapse)AuthorAgeFilesLines
* layout: fix list-item positioningbptato2024-04-161-0/+7
| | | | we also have to move the inner box offset to the parent
* layout: remove ListItemBox, handle inline-flex correctlybptato2024-04-151-3/+0
| | | | | This allows us to unify BlockBox instantiation and block-level inner layout calls.
* layout: rework inline box area modelbptato2024-03-251-20/+10
| | | | | | | | | | | | | Specifying the background area as three LayoutUnit pairs sounds clever, but breaks down for text-align: center. * store line Y offset in LineBox - this is necessary to pass down areas we need to paint * refactor addHorizontalLine loop; remove mystery "If necessary, update ictx's width" line that used to be labeled "TODO this seems meaningless" and indeed seems meaningless now (I am prepared to deeply regret this later) * replace broken & convoluted startOffset/endOffset/size with a simple seq of offsets + sizes
* layout: improve/simplify line box error correctionbptato2024-02-281-5/+0
| | | | | | | | | | | | The previous retrofitting of the old renderdocument error correction usually worked, but it still had a horrible flaw in that it assumed that all line boxes are of equal height. So if error was lower for some line than another, it would move *all* lines by a somewhat lower error, and that resulted in overlapping lines. Now we do something much simpler: in flushLine, round each line's height downwards before moving on to the next line. This gets rid of any blanks inbetween lines, and also works much better with cleared floats.
* layout: consider inline positioning for absolute blocksbptato2024-01-291-3/+4
| | | | | When an absolute block is a descendant of an inline box, its positioned ancestor must be set to that box.
* layout: rewrite inline box handlingbptato2023-11-271-24/+33
| | | | | | | | | | | We now have real inline boxes. * Fix nesting of inline boxes * Represent inline boxes with a hierarchical RootInlineFragment -> InlineFragment tree * Get rid of inline padding hack * Get rid of ComputedFormat * Paint inline box backgrounds properly
* layout: refactor flow margin propagation, sizingbptato2023-11-121-102/+9
| | | | | | | | | * Blocks are now positioned before their text contents would be layouted * Untangle calcAvailableSpaceSizes's results from BlockBox * Move a couple of objects from box -> engine * Use Size in a few more places * Set display to block if float is not none
* layout: refactorbptato2023-10-281-44/+0
| | | | | | * remove Viewport reference from BlockBox * Viewport -> LayoutState (call it what it really is) * move more stuff from box -> engine
* buffer: remove viewport referencebptato2023-10-281-1/+1
| | | | | Viewport at this point is basically just the layout state, so it makes no sense to store it in buffer.
* layout/engine: refactor inline atoms etc.bptato2023-10-261-25/+17
|
* WindowAttributes: refactorbptato2023-10-191-1/+1
| | | | | | * rename module (window -> winattrs, to avoid conflict with env/window) * do not use result * remove unused cell_ratio
* layout: move Strut from box -> enginebptato2023-10-141-13/+0
|
* layout: remove unused InlineAtom membersbptato2023-10-141-2/+0
|
* layout: add LineBoxStatebptato2023-10-141-2/+0
| | | | Makes LineBox objects a bit smaller.
* layout: get rid of baseline, firstBaseline functionsbptato2023-10-141-0/+10
|
* fix commentbptato2023-10-131-1/+1
|
* layout: refactor InlineContextbptato2023-10-131-8/+1
| | | | | Most InlineContext members may be discarded after layout, and thus belong in InlineState.
* layout: fix table cell sizing with specified widthsbptato2023-09-201-1/+0
| | | | | | | | | | | | | | | | | | | Say we have a table <TABLE> <TR> <TD WIDTH=20>a</TD> </TR> <TR> <TD>aklsdfjaskdfjkl</TD> </TR> </TABLE> This should be 20 pixels wide, not as wide as the second row. Also, larger specified widths now always override previous widths specified on the column. (I think this was a regression, but the previous solution to this problem was an ugly hack.)
* move around more modulesbptato2023-09-141-1/+1
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* layout: make table rowspan occupy several rowsbptato2023-09-111-0/+5
| | | | | Now cells with a rowspan > 1 actually occupy several rows. The implementation is quite ugly but it should work for now.
* layout: add table rowspanbptato2023-09-091-1/+0
|
* layout: distinguish padding from spacingbptato2023-07-271-0/+3
| | | | | Re-consideration of 1e0506adb: we do need to explicitly specify padding after all, so the rendering engine knows of it too.
* layout: refactor sizingbptato2023-07-251-11/+49
| | | | | | Factor out the "shrink" variable and the (broken) isWidthSpecified into a SizeConstraint type. This should make box sizing easier to reason about.
* layout: refactor table layoutbptato2023-07-071-0/+1
| | | | Split it into smaller functions.
* Use LayoutUnit in layoutbptato2023-07-041-59/+45
| | | | Reduces ugly rendering caused by rounding errors.
* Fix various layout bugs, prepare for image supportbptato2023-06-121-10/+3
|
* layout: fix min-height/max-height handlingbptato2023-06-071-0/+2
|
* Working position: absolute, some other fixesbptato2023-05-131-3/+6
| | | | | | | | Fix margin-top being used instead of margin-bottom. Content width resolving makes somewhat more sense now. min-width, max-width doesn't completely break width calculation anymore. Finally, position: absolute is no longer implemented as a horribly broken hack.
* layout/engine: fix double positioning absolute boxesbptato2023-02-191-0/+3
| | | | | by checking if the box has been positioned before. Not a very good solution, but it works...
* layout: fix position:absolute, remove position:fixedbptato2023-01-201-1/+1
| | | | Now at least absolute should be positioned correctly.
* layout/engine: fix non-inheritable values for inline boxbptato2023-01-061-0/+6
| | | | | Also, a hack for inline box background-color. It doesn't work very well, but good enough for now.
* layout/engine: fix crash on padding-rightbptato2022-12-311-1/+0
|
* layout/engine: table layout improvements, fix pre-wrap whitespacebptato2022-12-281-3/+20
| | | | | | | | Table layout: weight calculation is no longer broken. We use maxContentWidth for this, which the first pass of a non-specified table cell layout overrides. pre-wrap: just a minor fix - include it in whitespacepre, now that we have a distinction between pre and wrapping white-space
* layout/engine: get rid of dom dependencybptato2022-12-271-1/+0
| | | | Layout should only depend on cascading.
* Proper support for tabsbptato2022-12-271-0/+1
|
* layout/engine: clean up & fix width computationbptato2022-12-251-7/+10
| | | | | Get rid of compwidth, fix some edge cases where boxes would be computed incorrectly, etc.
* layout/engine: simplify a bitbptato2022-12-211-3/+3
|
* Display text for img tag, background-imagebptato2022-12-161-2/+1
|
* layout/engine: clean up shrink attributebptato2022-12-161-4/+0
|
* layout/engine: fix a <br> bug that ate inline boxes, add broken ↵bptato2022-12-161-1/+5
| | | | | | | | | min-width/max-width min-width, max-width, min-height, max-height are mostly broken, because they aren't enforced on inline level. Though really the whole size calculation mechanism needs to be refactored, its current state is horrible.
* Add border-collapse, border-spacing; fix fd sending hackbptato2022-12-111-0/+3
| | | | | | Note that they don't actually work correctly because of rounding errors. The fd sending hack now emits C directly. Let's hope this actually works.
* Support vertical-align on tdbptato2022-12-111-1/+1
|
* Implement a proper table layoutbptato2022-12-111-3/+10
|
* Table layout improvementsbptato2022-12-111-1/+1
|
* Add multiple text-decoration, overline emulationbptato2022-12-071-1/+1
|
* Remove unused BlockBox attributebptato2022-12-071-1/+0
|
* Fix table cell reflowbptato2022-12-071-2/+4
| | | | (still not perfect...)
* Table changesbptato2022-12-061-1/+0
| | | | mostly failed attempts to improve the table layout
* Add position css property, inline block fixesbptato2022-11-281-2/+3
| | | | | More specifically, inline block white-space is no longer incorrectly determined by its computed values, but rather by its parent's values.
* Fix some table layout issuesbptato2022-11-251-1/+6
|