summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-10-08LibWeb: Implement `@supports` rule :^)Sam Atkins
The main thing missing is that we don't serialize the supports clause, but for actually using a `@supports (something: cool) {}` rule in CSS, it works!
2021-10-08LibWeb: Make style-rule iteration aware of CSSMediaRuleSam Atkins
The logic is handled by `CSSGroupingRule` and `CSSConditionRule`, so `CSSMediaRule` only has to report if its condition matches. Right now, that condition is always false because we do not evaluate the media query.
2021-10-08LibWeb: Move CSSRule iteration to CSSRuleListSam Atkins
CSSStyleSheet is no longer the only class that contains a list of rules, so this will save duplicating the logic in multiple places.
2021-10-08LibWeb: Implement `CSS.supports(string)` function :^)Sam Atkins
Websites being able to query whether we support a given CSS feature should prevent them from loading unnecessary polyfills for things we already support! Or at least, that's the nice theory. :^)
2021-10-08LibWeb: Parse CSS `Supports`Sam Atkins
... according to https://www.w3.org/TR/css-conditional-3/#typedef-supports-condition This works very similarly to `@media`, but is different enough to require its own parsing. (Though, the draft of Conditional-4 currently mentions combining the two into a `@when` rule.) Made some small changes to parsing code to make this work. Notably, making `consume_a_declaration()` fail gracefully instead of `VERIFY()`ing.
2021-10-08LibWeb: Add CSS 'Supports' classSam Atkins
The name is a little awkward, but this corresponds to the condition of a `@supports` rule or the `CSS.supports("")` function. A supports query only gets evaluated once, since its condition cannot change during runtime. (We either support something or we don't, and the spec specifically mentions that user preferences that disable features do not affect the result here.) We keep a representation of it around though, so that it can be serialized if needed. This is a little awkward since we hold onto a `StyleDeclarationRule` which should be an internal Parser class. This means making some Parser functions more public. Potentially we could evaluate the Supports inside the Parser, and have it only store a String representation of itself. But this works for now. :^)
2021-10-08Base: Add CSS.supports / `@supports {}` test-pageSam Atkins
2021-10-08LibWeb: Implement 2-argument version of CSS.supports()Sam Atkins
This version takes a property name and value as separate parameters.
2021-10-08LibWeb: Add CSS.escape() JS functionSam Atkins
This is the `CSS` namespace defined in IDL here: https://www.w3.org/TR/cssom-1/#namespacedef-css , not to be confused with our `Web::CSS` namespace. Words are hard. `CSS.escape()` lets you escape identifiers that can then be used to create a CSS string. I've also stubbed out the `CSS.supports()` function.
2021-10-08LibWeb: Add DOMRectReadOnly and make DOMRect inherit from itAndreas Kling
This matches the class hierarchy of the CSS Geometry Interfaces Module.
2021-10-08AK: Always inline the RefCountedBase functionsAndreas Kling
2021-10-08LibJS: Prune WeakContainers before freeing HeapBlocksAndreas Kling
WeakContainers need to look at the Cell::State bits to know if their weak pointees got swept by garbage collection. So we must do this before potentially freeing one or more HeapBlocks by notifying the allocator that a block became empty.
2021-10-08LibJS: Partially revert 12b283fAli Mohammad Pur
This commit partially reverts "LibJS: Make accessing the current function's arguments cheaper". While the change passed all the currently passing test262 tests, it seems to have _some_ flaw that silently breaks with some real-world websites. As the speedup with negligible at best, let's just revert it until we can implement it more correctly.
2021-10-08LibJS: Elide some declarative environments in ECMAScript function callsAndreas Kling
By spec, calling an ECMAScript function object in non-strict mode should always create a new top-level declarative environment, even if there are no lexically scoped bindings (let/const) that belong in it. This is used for scope disambiguation in direct eval() calls. However, if there are no direct eval() calls within the function, and no lexically scoped bindings, we can simply not allocate the extra environment and save ourselves the trouble.
2021-10-08LibJS: Propagate "contains direct call to eval()" flag from parserAndreas Kling
We now propagate this flag to FunctionDeclaration, and then also into ECMAScriptFunctionObject. This will be used to disable optimizations that aren't safe in the presence of direct eval().
2021-10-08LibJS: Make accessing the current function's arguments cheaperAli Mohammad Pur
Instead of going through an environment record, make arguments of the currently executing function generate references via the argument index, which can later be resolved directly through the ExecutionContext.
2021-10-08LibJS: Treat the Catch binding identifier as a var bindingAli Mohammad Pur
2021-10-08LibJS: Remove redundant const_castAli Mohammad Pur
The accessed field is mutable, so there's no need for this const_cast.
2021-10-08AK: Calculate CircularQueue::end() correctly (for real this time)Peter Elliott
Both my approach and the previous approach were wrong for different cases. I've changed the Iterators index from storage-relative to queue-relative, and it's much simpler and more obviously correct. fixes #10383
2021-10-08LibJS: Add ScopeNode accessors for declaration countsAndreas Kling
2021-10-08LibJS: Add missing initializer for ParserState::m_current_scope_pusherAndreas Kling
2021-10-08LibJS: Pre-size a HashTable in function_declaration_instantiation()Andreas Kling
The dynamic resizing of this hash table was showing up in profiles. Since we have an idea of how big it will get, use ensure_capacity().
2021-10-08LibJS: Avoid a FlyString copy in ECMAScriptFunctionObjectAndreas Kling
2021-10-08LibWeb: Make sure that root of style updates is marked cleanAndreas Kling
The recursive style update function was written a bit strangely and would only mark descendants of the style update root as not needing a style update. With this patch, all nodes in the subtree now have clean style after a style update finishes.
2021-10-08LibWeb: Update style (if needed) before updating layoutAndreas Kling
Layout depends on style (and not the other way around), so if the document has dirty style when we enter update_layout(), make sure we call update_style() before proceeding with the layout work. This has the pleasant effect of coalescing some redundant layouts.
2021-10-08LibJS: Make BlockAllocator cache reuse blocks in random orderAndreas Kling
2021-10-08LibJS: Increase GC heap BlockAllocator cache sizeAndreas Kling
Let's accept keeping up to 8 MiB of HeapBlock memory cached. This allows the GC allocator to reuse memory instead of asking the kernel for more.
2021-10-08LibJS: Add fast_is<T>() for FunctionDeclarationAndreas Kling
2021-10-08CrashDaemon: Stop automatically compressing coredumpsAndreas Kling
This was a nice idea in theory, but in practice it makes big crashes (e.g WebContent) even more CPU intensive. Let's disable this for now (but keep the ability for CrashReporter to open compressed coredumps.)
2021-10-07Documentation: Fix one more path for GRUB netbootingTim Schumacher
2021-10-07Documentation: Install pxelinux into the root of TFTPTim Schumacher
pxelinux doesn't appear to allow switching to the parent directory, and absolute paths don't seem to work as expected either.
2021-10-07Documentation: Update NetworkBoot to include PrekernelTim Schumacher
2021-10-07Kernel: Use find_largest_not_above in VirtualRangeAllocatorIdan Horowitz
Instead of iterating over the regions in the tree which is O(n), we can just use RedBlackTree's find_largest_not_above method, which is O(logn)
2021-10-07Kernel: Note if the page fault address is a destroyed smart pointerLuke Wilde
While I was working on LibWeb, I got a page fault at 0xe0e0e0e4. This indicates a destroyed RefPtr if compiled with SANITIZE_PTRS defined. However, the page fault handler didn't print out this indication. This makes the page fault handler print out a note if the faulting address looks like a recently destroyed RefPtr, OwnPtr, NonnullRefPtr, NonnullOwnPtr, ThreadSafeRefPtr or ThreadSafeNonnullRefPtr. It will only do this if SANITIZE_PTRS is defined, as smart pointers don't get scrubbed without it being defined.
2021-10-07ResourceGraph: Use /proc/stat instead of /proc/all for CPU usage statsIdan Horowitz
This results in a quite large speedup, as generating /proc/all takes a very long time.
2021-10-07Kernel: Add the /proc/stat ProcFS componentIdan Horowitz
This exposes a small subset of the information exposed by the Linux equivalent, and will be used to optimize applications that would like to know the current CPU usage statistics, but don't want to read all of the unrelated information in /proc/all
2021-10-07Kernel: Add Processor::time_spent_idle()Idan Horowitz
2021-10-07Meta: Disable -Wmaybe-uninitialized for LagomIdan Horowitz
2021-10-07LibJS: Take advantage of Value::Type::Int32 in a bunch of functionsAndreas Kling
If a JS::Value has type Int32, we know it's a finite, 32-bit integer. Use this information to avoid converting it to a double if possible.
2021-10-07AK+Kernel: Make automatically locking RefPtr & co a kernel-only thingAndreas Kling
Some time ago, automatic locking was added to the AK smart pointers to paper over various race conditions in the kernel. Until we've actually solved the issues in the kernel, we're stuck with the locking. However, we don't need to punish single-threaded userspace programs with the high cost of locking. This patch moves the thread-safe variants of RefPtr, NonnullRefPtr, WeakPtr and RefCounted into Kernel/Library/.
2021-10-07Base: Use requestAnimationFrame in Game of Life WASM demoLuke Wilde
Since OOPWV now supports RAF, we can use it in the GOL WASM demo :^)
2021-10-07PixelPaint: Close tab now prompts for a saveAlex Major
2021-10-07Meta: Warn on `rebuild-toolchain i686 clang`Nico Weber
It's "Clang" (capitalized). Silently building gcc if the toolchain isn't know seems a bit unfriendly. So print a warning for this (and for other unknown toolchains).
2021-10-07PixelPaint: Use reorderable tabsLuke Wilde
2021-10-07LibJS: Use round_number_to_increment(double) in round_time()Linus Groh
Much nicer :^)
2021-10-07LibJS: Add non-BigInt overload of round_number_to_increment()Linus Groh
Unlike the spec we chose BigInt for the input and output types here as it was being used with ℝ(ns), ns being of type BigInt, in one place and a conversion to double would not be safe. Since in many places we'll have double input values, let's add a double overload of this function to avoid awkward conversions and expensive allocations.
2021-10-07Browser: Use reorderable tabsPeter Elliott
2021-10-07LibGUI: Support drag-to-reorder in TabWidgetPeter Elliott
2021-10-07LibJS: Add fast_is<T>() for FunctionExpression and ClassExpressionAndreas Kling
Spotted RTTI for these two above 1% in a profile.
2021-10-07LibJS: Fast non-local variable access :^)Andreas Kling
This patch introduces the "environment coordinate" concept, which encodes the distance from a variable access to the binding it ends up resolving to. EnvironmentCoordinate has two fields: - hops: The number of hops up the lexical environment chain we have to make before getting to the resolved binding. - index: The index of the resolved binding within its declarative environment record. Whenever a variable lookup resolves somewhere inside a declarative environment, we now cache the coordinates and reuse them in subsequent lookups. This is achieved via a coordinate cache in JS::Identifier. Note that non-strict direct eval() breaks this optimization and so it will not be performed if the resolved environment has been permanently screwed by eval(). This makes variable access *significantly* faster. :^)