Commit graph

13527 commits

Author SHA1 Message Date
Andreas Kling
eeffd5be07 Ext2FS: Fix block allocation ignoring the very last block group
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.
2020-10-07 13:42:17 +02:00
Andreas Kling
d1592643a6 LibJS: Make sure the HeapBlock cell storage is alignas(Cell) 2020-10-07 13:09:59 +02:00
Andreas Kling
51dbea3a0e LibWeb: Use RefPtrs more in getElementById() and getElementsByName()
Passing around Vector<Element*> is not a great idea long-term.
2020-10-07 12:47:17 +02:00
asynts
9123920a19 Welcome: Use new format functions. 2020-10-06 20:29:26 +02:00
asynts
ff3552bb14 TextEditor: Use new format functions. 2020-10-06 20:29:26 +02:00
asynts
712e348fad Terminal: Use new format functions. 2020-10-06 20:29:26 +02:00
asynts
0dec600a2a SystemMonitor: Use new format functions. 2020-10-06 20:29:26 +02:00
asynts
6ed3a4b5fe LibGUI: Add formatters for TextPosition and TextRange. 2020-10-06 20:29:26 +02:00
Nico Weber
08585bc7e9 LibGemini: Improve rendering of <pre> blocks
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/
2020-10-06 20:29:11 +02:00
Andreas Kling
48f13b7c3f LibJS: Split Heap into per-cell-size allocators
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. :^)
2020-10-06 18:50:47 +02:00
Andreas Kling
d3d3b25e1c AK: Make Vector::remove_first_matching() signal if anything was removed 2020-10-06 18:38:18 +02:00
Andreas Kling
8baacda03d LibJS: Fix weird self-including header 2020-10-06 18:37:58 +02:00
Andreas Kling
c6c0a9abcb LibWeb: Fix build after GEMINI_DEBUG oopsie 2020-10-06 17:48:42 +02:00
Andreas Kling
3dbd5c98da AK: Use StringImpl::operator== in FlyString 2020-10-06 17:43:51 +02:00
Andreas Kling
4c33209011 LibJS: Add Object::define_property_without_transition() helper
This allows us to avoid transitioning in two common cases, saving some
time during object construction.
2020-10-06 17:43:51 +02:00
Nico Weber
21ac343211 LibGemini: Fix crash on Link lines without explicit link text
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.
2020-10-06 17:16:16 +02:00
Nico Weber
fa5217ff4f LibWeb: Add debug toggle for dumping gemini documents 2020-10-06 17:16:16 +02:00
Nico Weber
c8322719c6 LibWeb: Fix variable name for gemini documents 2020-10-06 17:16:16 +02:00
asynts
f005548d56 Spreadsheet: Use new format functions.
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.
2020-10-06 15:28:39 +02:00
asynts
30ca17e78f SoundPlayer: Use new format functions. 2020-10-06 15:28:39 +02:00
asynts
97660ad46c QuickShow: Use new format functions. 2020-10-06 15:28:39 +02:00
asynts
0b29c5e41d PixelPaint: Use new format functions. 2020-10-06 15:28:39 +02:00
asynts
377afff33a Piano: Use new format functions. 2020-10-06 15:28:39 +02:00
asynts
5aadf00463 KeyboardSettings: Use new format functions. 2020-10-06 15:28:39 +02:00
asynts
da9c995a8c IRCClient: Use new format functions. 2020-10-06 15:28:39 +02:00
asynts
d2ca7ca017 AK+Format: Make it possible to format string literals as pointers.
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.)
2020-10-06 15:28:39 +02:00
asynts
7c2cd81edb AK+Format: Exclude prefix from width calculation.
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.
2020-10-06 15:28:39 +02:00
asynts
aea5fff0d1 HexEditor: Use new format functions.
I changed the formatting for some numbers when it made sense, because I
believe '0x00000020' to be more expressive than '      20' for example.
2020-10-06 15:04:37 +02:00
asynts
c776d76b71 Help: Use new format functions. 2020-10-06 15:04:37 +02:00
asynts
30b9dff5aa FontEditor: Use new format functions. 2020-10-06 15:04:37 +02:00
asynts
93d04b9f8d LibGUI: Add formatter for ModelIndex. 2020-10-06 15:04:37 +02:00
Tom
a7533eb29c LibGUI: Clear selection if right-clicking item that isn't selected
If we're right-clicking on an item that isn't currently selected, clear
the selection first.

Fixes #3665
2020-10-06 15:04:23 +02:00
Tucker Polomik
ad8284bac6 AK: check fractional string has_value() in JsonParser
Resolves #3670
2020-10-06 14:27:51 +02:00
Nico Weber
be693e95ff Services: Remove unused includes of {LibCore,WindowServer}/EventLoop.h 2020-10-05 23:48:33 +02:00
Nico Weber
f5af127887 ntpquery: Make output less verbose by default 2020-10-05 23:48:33 +02:00
Andreas Kling
f31ff86d14 IPCCompiler: Declare nested namespaces with a single "namespace" 2020-10-05 21:29:06 +02:00
Andreas Kling
148c4161d9 LibJS: Avoid work in Shape::lookup() if there are no properties 2020-10-05 20:53:00 +02:00
Andreas Kling
69bae3fd9a LibJS: Prevent object shape transitions during runtime object buildup
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. :^)
2020-10-05 20:53:00 +02:00
Andreas Kling
50ab87f651 LibJS: Make use of existing property tables when reifying new ones
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. :^)
2020-10-05 20:53:00 +02:00
Luke
52c31bb743 LibGfx+FontEditor+Fonts: Add "mean line" value to all fonts
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
2020-10-05 20:05:40 +02:00
Luke
043b31ad9a LibWeb: Add pc CSS unit 2020-10-05 20:05:40 +02:00
Linus Groh
aa71dae03c LibJS: Implement logical assignment operators (&&=, ||=, ??=)
TC39 proposal, stage 4 as of 2020-07.
https://tc39.es/proposal-logical-assignment/
2020-10-05 17:57:26 +02:00
Nico Weber
d8d00d3ac7 LibJS: Add StringOrSymbol::as_string_impl() helper 2020-10-05 17:35:27 +02:00
Nico Weber
cc765e14ca AK: Move StringImpl::operator== implementation into StringImpl 2020-10-05 17:35:27 +02:00
asynts
ee9c18c118 FileManager: Use new format functions. 2020-10-05 16:25:50 +02:00
Linus Groh
2d4cd5b49b LibJS: Evaluate AssignmentExpression LHS before RHS according to the spec
Fixes #3689.
2020-10-05 14:34:37 +02:00
asynts
7fd4646acb DisplaySettings: Use format instead of printf. 2020-10-05 14:19:24 +02:00
asynts
9efc69a6e2 Debugger: Use format instead of printf.
There was one bogus printf in a signal handler, I just left it there.
2020-10-05 14:19:24 +02:00
asynts
e1dfeef11f Calendar: Use format instead of printf.
I am not sure what this message is supposed to tell me, but I'll just
keep it around.
2020-10-05 14:19:24 +02:00
asynts
206e48abb5 Calculator: Use format instead of printf.
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.
2020-10-05 14:19:24 +02:00