about summary refs log tree commit diff stats
path: root/src/render
Commit message (Collapse)AuthorAgeFilesLines
* Separate ANSI text decoding from main binarybptato2024-02-252-558/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling text/plain as ANSI colored text was problematic for two reasons: * You couldn't actually look at the real source of HTML pages or text files that used ANSI colors in the source. In general, I only want ANSI colors when piping something into my pager, not when viewing any random file. * More importantly, it introduced a separate rendering mode for plaintext documents, which resulted in the problem that only some buffers had DOMs. This made it impossible to add functionality that would operate on the buffer's DOM, to e.g. implement w3m's MARK_URL. Also, it locked us into the horribly inefficient line-based rendering model of entire documents. Now we solve the problem in two separate parts: * text/x-ansi is used automatically for documents received through stdin. A text/x-ansi handler ansi2html converts ANSI formatting to HTML. text/x-ansi is also used for .ans, .asc file extensions. * text/plain is a separate input mode in buffer, which places all text in a single <plaintext> tag. Crucially, this does not invoke the HTML parser; that would eat NUL characters, which we should avoid. One blind spot still remains: copiousoutput used to display ANSI colors, and now it doesn't. To solve this, users can put the x-ansioutput extension field to their mailcap entries, which behaves like x-htmloutput except it first pipes the output into ansi2html.
* Allow non-RGB colors in CSSbptato2024-02-241-16/+16
| | | | | | | | | | | The -cha-ansi color type now sets ANSI colors in CSS. Also, color correction etc. has been improved a bit: * don't completely reset output state in processFormat for new colors * defaultColor is now separated from ANSI color type 0 * bright ANSI colors are no longer replaced with bold + dark variant * replaced ANSI color map to match xterm defaults
* Replace Chakasu with Chagashibptato2024-02-221-68/+11
| | | | | | The API is horrid :( but at least it copies less. TODO: think of a better API.
* More bgcolor fixesbptato2024-02-171-10/+7
| | | | | | * fix accidental dependency on previously chosen bgcolor (ouch) * also draw empty background boxes for bgcolor-is-canvas boxes * remove unused variable
* layout: use html/body bgcolor as canvas bgcolorbptato2024-02-171-12/+21
| | | | | | This is required by the standard. (Without this, lots of websites have incorrect background colors, because they set the body height to 100% of the viewport.)
* Various refactorings & fixesbptato2024-02-141-2/+9
| | | | | | | | * disallow Stream interface usage on non-blocking PosixStreams * do not read estream of forkserver byte-by-byte (it's slow) * do not call writeData with a zero len in formdata * do not quote numbers in mailcap quoteFile * remove some unused stuff
* buffer: improve style invalidationbptato2024-02-141-1/+1
|
* loader: fixes & improvementsbptato2024-02-131-10/+8
| | | | | | | | * factor out pushBuffer to make loadFromCache async * fix incorrect cache path * replace rewind with loadFromCache (it does the same thing except actually works) * remove rewindImpl callback, rewind in buffer instead
* Remove CLONE BufferSource; cache document sources in tmpdirbptato2024-02-121-4/+7
| | | | | | | | | | | | | | | | | | | | | | | At last all BufferSources are unified. To achieve the same effect as the previous CLONE source type, we now use the "fromcache" flag in Request. This *forces* the document to be streamed from the disk; if the file no longer exists for some reason, an error is returned (i.e. the document is not re-downloaded). For a document to be cached, it has to be the main document of the buffer (i.e. no additional resources requested with fetch()), and also not an x-htmloutput HTML file (for those, the original source is saved). The result is that toggleSource now always returns the actual source for e.g. markdown files, not the HTML-transformed version. Also, it is now possible to view the source of a document that is still being downloaded. buffer.sstream has almost been eliminated; it still exists, but only as a pseudo-buffer to interface with EncoderStream and DecoderStream. It no longer holds the entire source of a buffer at any point, and is cleared as soon as the buffer is completely loaded.
* layout: consider inline positioning for absolute blocksbptato2024-01-291-59/+87
| | | | | When an absolute block is a descendant of an inline box, its positioned ancestor must be set to that box.
* Remove newFormatbptato2024-01-231-4/+4
| | | | Pointless; it just returned a default zero-initialized object.
* rendertext: add support for backspace overstrike, misc fixesbptato2024-01-231-46/+124
| | | | | * parse manpage output styled ugly backspace overstrike formatting * fix broken charset detection for large files
* Use std/* imports everywherebptato2024-01-072-4/+4
|
* break up twtstr somewhatbptato2023-12-132-1/+2
| | | | | Avoid computing e.g. charwidth data for http which does not need it at all.
* layout: rewrite inline box handlingbptato2023-11-271-159/+179
| | | | | | | | | | | 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
* renderdocument: avoid setText with zero-width stringbptato2023-11-211-9/+10
| | | | This can happen e.g. if the word is fully outside the canvas.
* renderdocument: fix regression in d20fc30bptato2023-11-201-12/+0
| | | | | The reasoning for using early returns was wrong, and they should be unnecessary anyway.
* renderdocument, cell: fix FormatCell bugsbptato2023-11-201-17/+31
| | | | | | | * No more zero width FormatCells messing up buffer display (yay!) * Assert on setText width a zero-length string * Remove unnecessary FormatCell added to every line on paintBackground start
* layout: refactor flow margin propagation, sizingbptato2023-11-121-5/+5
| | | | | | | | | * 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
* buffer: remove viewport referencebptato2023-10-281-3/+3
| | | | | Viewport at this point is basically just the layout state, so it makes no sense to store it in buffer.
* renderdocument: slightly refactor, optimize addLinesbptato2023-10-261-35/+12
|
* layout/engine: refactor inline atoms etc.bptato2023-10-261-21/+16
|
* WindowAttributes: refactorbptato2023-10-191-1/+1
| | | | | | * rename module (window -> winattrs, to avoid conflict with env/window) * do not use result * remove unused cell_ratio
* move around more modulesbptato2023-09-142-3/+3
| | | | | | | | | | * ips -> io/ * loader related stuff -> loader/ * tempfile -> extern/ * buffer, forkserver -> server/ * lineedit, window -> display/ * cell -> types/ * opt -> types/
* Move HTML parsing into Chamebptato2023-08-151-1/+2
| | | | Operation "modularize Chawan somewhat" part 2
* Move charsets into chakasubptato2023-08-141-2/+3
| | | | Operation "modularize Chawan somewhat" part 1
* htmlparser: decouple from DOMbptato2023-07-091-0/+1
| | | | | Instead of directly appending nodes to the DOM, use a DOMBuilder interface.
* Add popup menu for select elementbptato2023-07-051-1/+1
| | | | | | | Replaces the weird CSS implementation we have had until now with a searchable popup menu similar to that of w3m. (The previous implementation broke on websites that do not expect <select> to expand on click, had no separate search, and was ugly.)
* calculateErrorY: fix regression by using intbptato2023-07-041-2/+2
| | | | Obviously we can't calculate rounding error without rounding.
* Use LayoutUnit in layoutbptato2023-07-041-18/+36
| | | | Reduces ugly rendering caused by rounding errors.
* rendertext: do not rewind if no other charsets are availablebptato2023-06-251-1/+1
| | | | Fixes crash when the decoder fails to decode all given charsets.
* Revert "renderdocument: bgcolor blending"bptato2023-06-151-13/+16
| | | | | This reverts commit c13a4cf4e144f7ab36167ebbb1333f7faeed11b3. Clearly it's broken. Needs a fix.
* renderdocument: bgcolor blendingbptato2023-06-131-16/+13
|
* Fix various layout bugs, prepare for image supportbptato2023-06-121-9/+17
|
* Add support for visibilitybptato2023-06-071-21/+23
|
* Add display/output encodingbptato2023-05-191-0/+2
| | | | Some encodings are still missing
* Refactor config, add charset optsbptato2023-05-161-3/+30
| | | | Only document-charset supported for now.
* Working position: absolute, some other fixesbptato2023-05-131-8/+17
| | | | | | | | 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.
* renderdocument: fix img positionbptato2023-04-121-5/+5
|
* renderdocument: fix failing assertionbptato2023-01-071-0/+8
| | | | | I'm not sure if it was actually causing other issues, but better safe than sorry: formatting is no longer inserted for negative x coordinates.
* css/values, parser, ...: fix background-imagebptato2023-01-061-24/+24
|
* layout/engine: fix non-inheritable values for inline boxbptato2023-01-061-4/+14
| | | | | Also, a hack for inline box background-color. It doesn't work very well, but good enough for now.
* renderdocument: add StyledNodes to backgroundsbptato2023-01-031-10/+17
| | | | | | This makes it possible to e.g. click on this: <a href=x style="display: inline-block; width: 5em; height: 5em; background-color: red"></a>
* renderdocument: fix crash for image textbptato2023-01-031-1/+2
| | | | We need to check if y >= 0, or it fails.
* rendertext: fix format position for non-asciibptato2023-01-011-1/+5
|
* layout/engine: table layout improvements, fix pre-wrap whitespacebptato2022-12-281-1/+1
| | | | | | | | 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
* rendertext: fix ansi escape regressionbptato2022-12-281-0/+1
|
* layout/engine: get rid of dom dependencybptato2022-12-271-1/+1
| | | | Layout should only depend on cascading.
* Proper support for tabsbptato2022-12-272-19/+5
|
* rendertext: fix tab widthbptato2022-12-271-8/+7
|