about summary refs log tree commit diff stats
path: root/src/layout
Commit message (Collapse)AuthorAgeFilesLines
* renderdocument: handle overlapping double width charsbptato2024-06-021-1/+6
| | | | | See attached test case; previously, this would result in a missing space in visual mode and a crash in dump mode.
* layout: misc refactoringsbptato2024-06-021-209/+180
| | | | | * get rid of BlockGroup * unify BlockBox construction for flex, block, table
* layout: clean up inline tree constructionbptato2024-06-013-292/+309
| | | | | | | Much cleaner than the previous solution. Should also be somewhat less wasteful, as we no longer constantly rebuild the same tree with new branches.
* layout: dimSum -> sumbptato2024-06-011-22/+21
|
* layout: refactor resolveSizesbptato2024-06-011-140/+126
| | | | get rid of percHeight, unify min/max sizing, etc.
* layout: line box sizing fixesbptato2024-05-311-15/+11
| | | | | * do not use inline block computed values for wrapper fragment * fix minimum line box height calculation
* layout: fix a width sizing bugbptato2024-05-301-4/+1
| | | | | | | As expected, the mystery line was just hiding another bug. (In particular, indefinite containing size constraints were not denied in resolveContentWidth, so it only (accidentally) worked with stretched sizes.)
* layout: fix regressionbptato2024-05-301-0/+3
| | | | seems like this line is necessary after all
* layout: simplify percHeight handling, misc refactoringsbptato2024-05-301-67/+30
|
* layout: fix caption margin calculationbptato2024-05-301-19/+17
| | | | | | * merge caption sizing code path with layoutRootBlock * fix caption margins being disregarded * fix incorrect positioning of `caption-side: bottom'
* layout: improve baseline calculationbptato2024-05-301-56/+56
| | | | | * use current fragment's line height for percentage baselines * get rid of baseline calculating pass in verticalAlignLine
* layout: fix clear on blocks establishing new BFCsbptato2024-05-301-1/+4
| | | | | | | | | | | As per standard: > Adjoining vertical margins collapse, except: > [...] > If the top and bottom margins of an element with clearance are > adjoining, its margins collapse with the adjoining margins of > following siblings but that resulting margin does not collapse with > the bottom margin of the parent block.
* layout: misc refactoringsbptato2024-05-293-193/+205
|
* layout: get rid of InlineBoxBuilderbptato2024-05-283-109/+103
| | | | just merge it with InlineFragment
* layout: fix crash on inline tablesbptato2024-05-281-1/+1
|
* stylednode: remove `text' fieldbptato2024-05-281-5/+7
| | | | This avoids some unnecessary string copying.
* layout: remove BlockBoxBuidlerbptato2024-05-273-687/+599
| | | | | | | | | | Instead of allocating a separate object for each box, just re-use a single BlockBox on re-layouts. This means that now the (block-level) tree is built in its final form in the first pass. (Inline boxes remain the same as before for now.)
* layout: list item improvements, fix inner markersbptato2024-05-251-36/+41
| | | | | * fix list-style-position: inside * get rid of ListItemBoxBuilder
* layout: add wrapper box for table caption + misc stuffbptato2024-05-241-106/+141
| | | | | | | | | Captions are no longer positioned inside tables, yay. Also, misc: * rename some things for consistency * clamp out of bounds rgb() values * remove inherited property lookup table
* layout, layoutunit: remove some automatic convertersbptato2024-05-222-8/+6
| | | | | I wish we didn't need any, but fixing this for integers would be too involved and the float64 one was causing problems now.
* layout: simplifybptato2024-05-211-102/+76
| | | | removes elaborate table box type hierarchy that does nothing
* layout: fix inline tab expansionbptato2024-05-191-0/+1
|
* layout: fix BFC positioning in presence of floatsbptato2024-05-192-14/+59
| | | | | | | | | | | | | Previously, the following printed "2" instead of "12": <div style=float:left>1</div><div style=display:flow-root>2</div> This fixes the above problem in the laziest possible way: we relayout once in the smallest possible space the BFC fits in when floats exist. See the comment in the code for details. As a nice bonus, this also fixes tables overlapping with floated boxes, by pretending that they establish a BFC.
* css: stub overflowbptato2024-05-181-2/+3
| | | | | The renderer cannot handle it yet, but at least this fixes pages that expect overflow: hidden (etc.) to establish a new BFC.
* layout: fix maxFloatHeight checkbptato2024-05-181-5/+5
| | | | | Including our own position is a mistake, since the BFC starts from the inner box.
* layout: reuse box.positioned in positionAbsolutebptato2024-05-181-4/+4
|
* layout: relative positioning fixesbptato2024-05-182-75/+64
| | | | Fix percentage-based left/right etc.
* layout: slightly refactor table layoutbptato2024-05-181-27/+26
|
* css/values -> css/cssvaluesbptato2024-05-163-3/+3
| | | | for consistency
* luwrap: replace Nim unicode maps with libunicodebptato2024-05-091-3/+3
| | | | | | | | | | | | | | | | | Instead of using the built-in (and outdated, and buggy) tables, we now use libunicode from QJS. This shaves some bytes off the executable, though far less than I had imagined it would. Also, a surprising effect of this change: because libunicode's tables aren't glitched out, kanji properly gets classified as alpha. I found this greatly annoying because `w' in Japanese text would now jump through whole sentences. As a band-aid solution I added an extra Han category, but I wish we had a more robust solution that could differentiate between *all* scripts. TODO: I suspect that separately loading the tables for every rune in breaksViWordCat is rather inefficient. Using some context object (at least per operation) would probably be beneficial.
* layout: unify some code pathsbptato2024-05-093-246/+236
| | | | | | | Turn Offset, Size, etc. into arrays indexed by a DimensionType enum, and use it to unify code that only differs in the dimension it is computing for. (e.g. this lets us use the same code for flex row & column layouts.)
* layout: another table colwidth fixbptato2024-05-081-2/+8
| | | | | | Turns out we also have to *expand* column width, if the specified column width is too small *and* no unspecified column exists to take the rest of the place.
* layout: small cleanupbptato2024-05-081-39/+34
|
* layout: resize over-constrained table columnsbptato2024-05-081-12/+24
| | | | | | | | | If the total specified column width is larger than the table's allowed width, we now resize them proportionally to the specified width. This is quite important because many tables set the width to e.g. 50% for "give me half of the table", instead of its true meaning "give me half of the page".
* layout: table cell resizing fixesbptato2024-05-051-24/+29
|
* layout: fix float size in table cells; remove redundant positioningbptato2024-04-271-7/+14
|
* color: RGBAColor -> ARGBColorbptato2024-04-261-2/+2
|
* layout: fix image baselinebptato2024-04-261-2/+3
|
* Initial image supportbptato2024-04-253-18/+52
| | | | | | | | | | | | | | | | | * png: add missing filters, various decoder fixes * term: fix kitty response interpretation, add support for kitty image detection * buffer, pager: initial image display support Emphasis on "initial"; it only "works" with kitty output and PNG input. Also, it's excruciatingly slow, and repaints images way too often. Left undocumented intentionally it for now, until it actually becomes useful. In the meantime, adventurous users can find out themselves why: [[siteconf]] url = "https://.*" images = true
* layout: do not use parent computed values in root fragmentbptato2024-04-211-19/+11
| | | | | | * use rootProperties so the root fragment does not color its children * assert if the root gets inline blocks; this can (hopefully) no longer happen.
* layout: slightly refactor layoutInlinebptato2024-04-211-40/+42
|
* layout: flex item margin fixesbptato2024-04-201-25/+34
| | | | Still far from perfect, but it's an improvement.
* layout: fix double padding in flexbptato2024-04-201-2/+4
| | | | | | | | sizes.space regulates content-box width, in which padding is not included, so we must to subtract padding here. (Neither is margin, but margin is applied by outer layout, in this case flex itself, so it's not relevant here. Not to say it isn't broken...)
* layout: fix a list style positioning bugbptato2024-04-201-2/+2
| | | | | | If we are going to move out the child's offset, then we must also tell the child where it starts so it can behave correctly when it encounters exclusions.
* layout: float sizing fixesbptato2024-04-191-8/+21
| | | | | | | | | | | Turns out our shrink-to-fit emulation was inadequate: it assumed all floats are positioned on a separate line, which is the *opposite* of what we want, as that would be the behavior of min-content. Now we instead sum together the width of all floats and the widest non-floating child, and then clamp that to the target fitContent width. This correctly gives us max-content width in the first pass, still without having to actually position the floats.
* layout: accept inline-flex in iflushbptato2024-04-171-1/+1
|
* Update code stylebptato2024-04-172-288/+310
| | | | | | * separate params with ; (semicolon) instead of , (colon) * reduce screaming snake case use * wrap long lines
* layout: fix list-item positioningbptato2024-04-162-3/+12
| | | | we also have to move the inner box offset to the parent
* layout: remove ListItemBox, handle inline-flex correctlybptato2024-04-153-91/+65
| | | | | This allows us to unify BlockBox instantiation and block-level inner layout calls.
* layout: height fixesbptato2024-04-121-41/+22
| | | | | | * fix percHeight not being passed down properly * simplify addTableCaption; get rid of hack that turned caption outer height into inner height