The block group indices are 1-based for some reason. Because of that,
we were forgetting to check in the very last block group when doing
block allocation. This caused block allocation to fail even when the
superblock indicated that we had free blocks.
Fixes#3674.
For
```foo
asdf
jkl;
```bar
we would previously generate
<pre>foo
f
;
</pre>
```bar
Now we generate
<pre>
asdf
jkl;
</pre>
* no longer cut off the first 3 characters on most lines.
* don't include the closing ``` line in the output. in addition to
omitting the '```', this also honors "Any text following the leading
"```" of a preformat toggle line which toggles preformatted mode off
MUST be ignored by clients." from the spec
* ignore the alt text after the toggle-on text. the spec leaves it to
the client what to do with that alt text, but it tends to be metadata,
and omitting it is simplest for the implementation, so do that.
Improves ascii art on many gemini pages, e.g. gemini://carcosa.net/
Instead of keeping all the HeapBlocks in one big list, we now split it
into two levels:
- Heap has a set of Allocators, each with a specific cell size.
- Allocators have two lists of blocks, "full" and "usable".
Allocating a new cell no longer has to scan the entire set of blocks,
but instead just needs to find the right allocator and then pop a cell
from its freelist. If all the blocks in the allocator are full, a new
block will be created.
Blocks are moved from the "full" to "usable" list after sweeping has
determined that they are not completely empty and not completely full.
There are certainly many ways we can improve on this. This patch is
mostly about getting the new allocator architecture in place. :^)
Link::Link() does:
if (m_name.is_null())
m_name = m_url.to_string();
This tries to set the link text to the link url if there's no
explicit link text, but m_url.to_string() returns a temporary
string object, and m_name was a StringView, so this ended
pointing to invalid memory. This made the converted HTML
contain garbage data as link text, which made LibWeb crash.
(LibWeb probably shouldn't crash on links with garbage link
text, but in this case it helped identify a bug, so let's keep
that crash around since real web pages won't trigger it and
it's kind of useful to find bugs like this one.)
Makes gemini://rawtext.club/ no longer crash Browser.
In a few places I also simplified a few format strings:
-outln("{} item{}", items, items.size() == 1 ? ' ' : 's');
+outln("{} item(s)", items);
In my opinion this is more readable and in some places it incorrectly
wrote '0 item' which is "fixed" now. In other places the placeholder
space looked weird.
String literals are just pointers to a constant character. It should be
possible to format them as such. (The default is to print them as
strings still.)
When we write the format specifier '{:#08x}' we are asking for eight
significant digits, zero padding and the prefix '0x'.
However, previously we got only six significant digits because the
prefix counted towards the width. (The number '8' here is the total
width and not the number of significant digits.)
Both fmtlib and printf shared this behaviour. However, I am introducing
a special case here because when we do zero padding we really only care
about the digits and not the width.
Notice that zero padding is a special case anyways, because zero padding
goes after the prefix as opposed to any other padding which goes before
it.
While initialization common runtime objects like functions, prototypes,
etc, we don't really care about tracking transitions for each and every
property added to them.
This patch puts objects into a "disable transitions" mode while we call
initialize() on them. After that, adding more properties will cause new
transitions to be generated and added to the chain.
This gives a ~10% speed-up on test-js. :^)
When reifying a shape transition chain, look for the nearest previous
shape in the transition chain that has a property table already, and
use that as the starting point.
This achieves two things:
1. We do less work when reifying property tables that already have
partial property tables earlier in the chain.
2. This enables adding properties to a shape without performing a
transition. This will be useful for initializing runtime objects
with way fewer allocations. See next patch. :^)
The main inspiration behind this was to have a correct ex CSS unit.
The mean line is based off what it shows in the CSS Values and Units
Level 4 specification, section 6.1.1.
https://www.w3.org/TR/css-values-4/#font-relative-lengths
This also fixes a graphical bug where the decimal point was always
rendered. The number four was represented as '4.' instead of '4'. Now
the decimal point is only shown when there are decimal places.