summaryrefslogtreecommitdiff
path: root/Userland/Libraries
AgeCommit message (Collapse)Author
2022-02-14LibJS: Add missing include for 'u32' to CanonicalIndex.hLinus Groh
2022-02-14LibJS: Get rid of unnecessary work from canonical_numeric_index_stringAnonymous
The spec version of canonical_numeric_index_string is absurdly complex, and ends up converting from a string to a number, and then back again which is both slow and also requires a few allocations and a string compare. Instead this patch moves away from using Values to represent canonical a canonical index. In most cases all we need to know is whether a PropertyKey is an integer between 0 and 2^^32-2, which we already compute when we construct a PropertyKey so the existing is_number() check is sufficient. The more expensive case is handling strings containing numbers that don't roundtrip through string conversion. In most cases these turn into regular string properties, but for TypedArray access these property names are not treated as normal named properties. TypedArrays treat these numeric properties as magic indexes that are ignored on read and are not stored (but are evaluated) on assignment. For that reason there's now a mode flag on canonical_numeric_index_string so that only TypedArrays take the cost of the ToString round trip test. In order to improve the performance of this path this patch includes some early returns to avoid conversion in cases where we can quickly know whether a property can round trip.
2022-02-14LibWeb: Add stacking contexts to Node::for_each_child_in_paint_orderSteven Schmoll
The existing implementation, which is used by Node::hit_test() and sub-classes, does not include stacking contexts which prevents hit testing from returning elements contained by those stacking contexts in some situations. This is quite rough and definitely not optimal. The stacking contexts are not retrieved in the correct order. They should be sorted by z-index then tree order. This change makes DuckDuckGo technically usable with all the absolute and relative positioning they use.
2022-02-14LibGfx/PNG: Respect the tRNS chunk transparency with color type 2Andreas Kling
For PNG color type 2 (TrueColor), if there's a tRNS chunk, it specifies an R/G/B triplet in the image bit depth. This triplet acts as the transparency value, and should yield transparent pixels wherever that specific color value is present. We now support this. :^)
2022-02-14LibGfx/PNG: Collect tRNS (transparency chunk) info for all color typesAndreas Kling
The tRNS metadata is valid for color types 0, 2 and 3, so let's collect it in each of those cases. This ensures that we produce a bitmap with an alpha channel if needed.
2022-02-14LibGfx: Remove unnecessary includes from PNGLoader.cppAndreas Kling
2022-02-14LibGfx: Make Bitmap::has_alpha_channel() return true for RGBA8888Andreas Kling
2022-02-14LibWeb: Paint inline-level and replaced elements on top of floatsAndreas Kling
This matches CSS 2.1 appendix E, and fixes an instance of red face border on ACID2. :^)
2022-02-14LibWeb: Support inline-level padding and border properlyAndreas Kling
Here's roughly how this works: - InlineLevelIterator keeps a nesting stack of inline-level nodes with box model metrics. - When entering a node with box model metrics, we add them to the current "leading metrics". - When exiting a node with box model metrics, we add them to the current "trailing metrics". - Pending leading metrics are consumed by the first fragment added to the line. - Pending trailing metrics are consumed by the last fragment added to the line. Like before, the position of a line box fragment is the top left of its content box. However, fragments are placed horizontally along the line with space inserted for padding and border. InlineNode::paint() now expands the content rect as appropriate when painting background and borders. Note that margins and margin collapsing is not yet implemented. This makes the eyes on ACID2 horizontally centered. :^)
2022-02-14LibWeb: Always assign box model metrics in IFC::dimension_box_on_line()Andreas Kling
Replaced elements have box model metrics, too. We shouldn't only assign them to inline-block elements.
2022-02-14WindowServer+Userland: Pass wallpapers as `Gfx::Bitmap` instead of pathJames Puleo
The WindowServer _really_ does not need to know the filesystem path to it's wallpaper, and allows setting arbitrary wallpapers (those outside of `/res/wallpapers`). The GUI::Desktop will keep track of the path to the wallpaper (if any), and save it to config if desired (to be persisted). This avoids the need to `unveil` paths to the wallpaper, fixing #11158
2022-02-14LibGfx: Support color blending in Painter::draw_bitmapSteven Schmoll
This method is commonly used by bitmap text rendering. Adding support for color blending enables support in the browser for text opacity using their color property.
2022-02-14LibGUI+PixelPaint: Move fit_image_to_view to AbstractZoomPanWidgetMustafa Quraish
We often want to zoom and fit the content of the widget into the visible frame (or some rect within the frame), and it makes sense to move this functionality into the AbstractZoomPanWidget to minimize the amount of coordinate math derived classes need to do. This commit moves the code that implements this functionality from `PixelPaint::ImageEditor` into `AbstractZoomPanWidget` so that we can also use it for other applications (such as ImageViewer!)
2022-02-14LibCore: Remove Core::Socket :^)sin-ack
This class is one of the last users of Core::IODevice and is no longer used itself.
2022-02-14LibCore: Implement System::fchownsin-ack
2022-02-14LibCore+Tests: Remove Core::UDPSocket :^)sin-ack
2022-02-14LibCore: Add a timeout option to UDPSocket::connectsin-ack
This allows us to set a timeout during connection and during receive and send operations. I didn't add this to the other connect calls as it's not used anywhere else for the time being.
2022-02-14LibCoredump: Respect coredump's LD_LIBRARY_PATH when searching librariesSviatoslav Peleshko
Previously, we would only resolve libraries from `/usr/lib`, which is not the only path from which the crashed process could've loaded the libraries from.
2022-02-14LibWeb: Add support for the record variant of URLSearchParamsLuke Wilde
2022-02-14LibRegex: Correct the alternative matching order when one is emptyAli Mohammad Pur
Previously we were compiling `/a|/` into what effectively would be `/|a`, which is clearly incorrect.
2022-02-14LibWeb: Don't emit current token on EOF in HTML TokenizerKarol Kosek
Emitting tokens on EOF caused an infinite loop, freezing the app, which could be a bit annoying when writing an HTML comment at the end of the file in Text Editor. :^)
2022-02-14LibWeb: Fix highlighting HTML commentsKarol Kosek
Commit b193351a99 caused the HTML comments to flash when changing the text cursor. Also, when double-clicking on a comment, the selection started from the beginning of the file instead. The following message was displaying when `TOKENIZER_TRACE_DEBUG` was enabled: (Tokenizer::nth_last_position) Invalid position requested: 4th-last of 4. Returning (0-0). Changing the `nth_last_position` to 3 fixes this. I'm guessing that's because the parser is at that moment on the second hyphen of the `<!--` string, so it has to go back only by three characters.
2022-02-13LibCore: Allow event loops on other threads to wake upkleines Filmröllchen
Because the wake pipe is thread-local, it was previously not possible to wake an event loop across a thread. Therefore, this commit rearchitects event loop waking by making the wake function a member of the event loop itself and having it keep a pointer to its thread's wake pipe. The global wake() function calls wake on the current thread's event loop. This also fixes a bug in BackgroundAction: it should wake the event loop it was created on, instead of the current thread's event loop.
2022-02-13LibCore: Fix event loop stacks on non-main threadskleines Filmröllchen
Previously, event loop stacks on non-main threads would always crash because the condition for "am I the lowest-stacked loop" was still "am I the main loop", which of course is no longer sensible. A simple switch to `is_instantiated` fixes this.
2022-02-13LibVT: Fix triple click behaviorbrapru
When triple clicking a line in the terminal the selection will span the whole line. However, after dragging down to lines above/below the selection will stop at the cursor. Instead, the expected functionality of triple clicking and dragging is to select the whole line and any whole lines dragged to after the triple click. Previously, the triple line counter would get reset as soon as the whole line was selected. This patch resets the m_triple_click_timer in the mouse up event, so that the triple click selecting functionality is maintained during the entire click event and terminated when the event is over.
2022-02-13AK+Kernel: Rename try_make_weak_ptr to make_weak_ptr_if_nonnullIdan Horowitz
This matches the likes of the adopt_{own, ref}_if_nonnull family and also frees up the name to allow us to eventually add OOM-fallible versions of these functions.
2022-02-13LibSQL: Convert binary SQL operations to be fallibleTimothy Flynn
Now that expression evaluation can use TRY, we can allow binary operator methods to fail as well. This also fixes a few instances of converting a Value to a double when we meant to convert to an integer.
2022-02-13LibSQL: Short-circuit single-element tuple comparisonsTimothy Flynn
If a tuple has a single value, perform a comparison using that singular value. This allows, for example, comparisons of the form "(1) < 4", where (1) is a single element tuple.
2022-02-13LibSQL: Implement converting float and tuple values to a booleanTimothy Flynn
2022-02-13LibSQL: Use absolute value when comparing against floating point epsilonTimothy Flynn
Otherwise, any value that is less than another value would be considered about equal by mistake.
2022-02-13LibSQL: Return a not-yet-implemented error for unimplemented expressionsTimothy Flynn
Easier to debug than returning a NULL value.
2022-02-13LibJS: Add spec comments to ArrayBuffer.prototype.byteLengthJamie Mansfield
2022-02-13LibJS: Add spec comments to ArrayBuffer.prototype.sliceJamie Mansfield
2022-02-13LibGfx: Allow changing the default font pathFiliph Sandström
2022-02-13LibCore: Add Darwin anon_create supportFiliph Sandström
2022-02-13LibTLS: Add SHA-384 as supported certificate signing algorithmJoaquim Monteiro
2022-02-13Revert "LibJS: Get rid of unnecessary work from canonical_numeric_index_string"Andreas Kling
This reverts commit 3a184f784186ad1c5a9704b05ab0902d577d5748. This broke a number of test262 tests under "TypedArrayConstructors". The issue is that the CanonicalNumericIndexString AO should not fail for inputs like "1.1", despite them not being integral indices.
2022-02-13LibWeb: Fix off-by-one in HTMLTokenizer::restore_to()MacDue
The difference should be between m_utf8_iterator and the the new position, if m_prev_utf8_iterator is used one fewer source position is popped than required. This issue was not apparent on most pages since restore_to used for tokens such <!doctype> that are normally followed by a newline that resets the column to zero, but it can be seen on pages with minified HTML.
2022-02-13LibJS: More properly implement scoping rules in bytecode codegenAli Mohammad Pur
Now we emit CreateVariable and SetVariable with the appropriate initialization/environment modes, much closer to the spec. This makes a whole lot of things like let/const variables, function and variable hoisting and some other things work :^)
2022-02-13LibJS: Implement ClassExpression::generate_bytecode()Ali Mohammad Pur
...and use that in ClassDeclaration::generate_bytecode().
2022-02-13LibJS: Make ASTNode::generate_bytecode() fallibleAli Mohammad Pur
Instead of crashing on the spot, return a descriptive error that will eventually continue its days as a javascript "InternalError" exception. This should make random crashes with BC less likely.
2022-02-13LibJS: Don't emit a LeaveUnwindContext after a successful handlerAli Mohammad Pur
The handler already comes with a nice and shiny FinishUnwind, doubling up will leave two contexts instead.
2022-02-13LibJS: Implement the NewClass opcodeAli Mohammad Pur
2022-02-13LibJS/Tests: Rename snake_case identifiers in string-basic.jsLinus Groh
2022-02-13LibJS: Correct receiver value in GetValue's [[Get]] callLinus Groh
2022-02-13LibJS: Add spec comments to more Reference AOsLinus Groh
2022-02-13LibJS+LibLine: Run clang-formatAndreas Kling
2022-02-13LibJS: Always inline Lexer::current_code_point()Andreas Kling
This gives a ~1% speedup when parsing the largest Discord JS file.
2022-02-13LibJS: Make more use of Token::flystring_value()Andreas Kling
This patch makes check_identifier_name_for_assignment_validity() take a FlyString instead of a StringView. We then exploit this by passing FlyString in more places via flystring_value(). This gives a ~1% speedup when parsing the largest Discord JS file.
2022-02-13LibJS: Add Token::flystring_value() to produce FlyString directlyAndreas Kling
When parsing identifiers, we ultimately want to sink the token string into a FlyString anyway, and since Token may have a FlyString already inside it, this allows us to bypass the costly FlyString(StringView). This gives a ~3% speedup when parsing the largest Discord JS file.