summaryrefslogtreecommitdiff
path: root/Userland/Libraries
AgeCommit message (Collapse)Author
2022-02-22LibSoftGPU: Use `fabsf` instead of `fabs` for `float`Jelle Raaijmakers
Let's not do a `float -> double -> float` roundtrip. :^)
2022-02-22LibGL: Allow all primitives in `glBegin()`Jelle Raaijmakers
We check for primitive support in `glEnd()`, so we do not need to preemptively reject the mode in `glBegin()`. This allows `glBegin()` to be invoked with `GL_POINTS`, for example.
2022-02-23LibTest+Spreadsheet: Add some basic spreadsheet runtime behaviour testsAli Mohammad Pur
As there's a somewhat active development going on, let's keep the expected behaviour under tests to make sure nothing blows up :^)
2022-02-23LibJS: Print the expected and received value on expect.toEqual() failureAli Mohammad Pur
'ExpectationError' is hardly an actionable error message.
2022-02-21LibWeb: Support CSSStyleDeclaration.cssFloatAndreas Kling
Unlike all the other CSS properties, 'float' is special, and can only be accessed via 'cssFloat' on CSSStyleDeclaration. So this patch adds support for that. 1 point on ACID3! :^)
2022-02-21LibWeb: Implement Node.removeChild() in terms of "pre-remove"Andreas Kling
This is what the spec wants us to do.
2022-02-21LibWeb: Make document.write() work while document is parsingAndreas Kling
This necessitated making HTMLParser ref-counted, and having it register itself with Document when created. That makes it possible for scripts to add new input at the current parser insertion point. There is now a reference cycle between Document and HTMLParser. This cycle is explicitly broken by calling Document::detach_parser() at the end of HTMLParser::run(). This is a huge progression on ACID3, from 31% to 49%! :^)
2022-02-21LibWeb: Use correct coordinate space when measuring space between floatsAndreas Kling
When calculating how much space is available for inline content between left and right floated elements, we have to use coordinates in the containing block's coordinate space, since that's what floats use. This fixes an issue where text would sometimes overlap floats.
2022-02-21LibWeb: Calculate edge of containing block correctly when floating rightAndreas Kling
2022-02-21LibWeb: Don't shift right-floated boxes too much to the leftAndreas Kling
We were subtracting the content width of right-floated boxes from their X position for no reason. Removing this makes floats snuggle up to each other on the right side. :^)
2022-02-21LibWeb: Fix floating boxes getting stacked on top of each otherAndreas Kling
This was caused by the freestanding margin_box_rect() using 0 for the content height instead of the actual content height.
2022-02-21LibWeb: Compute table cell height after doing its inside layoutAndreas Kling
2022-02-21LibWeb: Rename FormattingState::ensure() -> get_mutable()Andreas Kling
This makes it much more obvious what the difference between get() and get_mutable() is.
2022-02-21LibWeb: Add hack to avoid crashing on !child_display.is_flow_inside()Andreas Kling
When encountering a box that claims to have block-level children, but its CSS display type isn't actually "flow" inside, we would previously crash due to a VERIFY() failure. However, many sites choke on this due to freestanding table-related boxes like those created by "table-row" and "table-row-group". We're supposed to fix those up by wrapping them in a full set of table boxes during layout tree construction, but that algorithm obviously isn't working correctly in all cases. So let's work around the crashes for now, allowing many more sites to load (even if visually incorrect.) This is a rather monstrous hack, and we should get rid of it as soon as it's not needed anymore.
2022-02-21LibWeb: Respect font-size specified by CSS in "em" length calculationsAndreas Kling
"5em" means 5*font-size, but by forcing "em" to mean the presentation size of the bitmap font actually used, we broke a bunch of layouts that depended on a correct interpretation of "em". This means that "em" units will no longer be relative to the exact size of the bitmap font in use, but I think that's a compromise we'll have to make, since accurate layouts are more important. This yields a visual progression on both ACID2 and ACID3. :^)
2022-02-21LibWeb: Store overflow data in the FormattingStateAndreas Kling
2022-02-21LibWeb: Create list-item markers during layout tree constructionAndreas Kling
Previously, these were added during layout. This didn't fit into the new world where layout doesn't mutate the tree incrementally, so this patch adds logic to Layout::TreeBuilder for adding a marker to each list-item box after its children have been constructed.
2022-02-21LibWeb: Start making our layout system "transactional"Andreas Kling
This patch adds a map of Layout::Node to FormattingState::NodeState. Instead of updating layout nodes incrementally as layout progresses through the formatting contexts, all updates are now written to the corresponding NodeState instead. At the end of layout, FormattingState::commit() is called, which transfers all the values from the NodeState objects to the Node. This will soon allow us to perform completely non-destructive layouts which don't affect the tree. Note that there are many imperfections here, and still many places where we assign to the NodeState, but later read directly from the Node instead. I'm just committing at this stage to make subsequent diffs easier to understand.
2022-02-21LibWeb: Add Layout::FormattingStateAndreas Kling
The purpose of this new object will be to keep track of various states during an ongoing layout. Until now, we've been updating layout tree nodes as we go during layout, which adds an invisible layer of implicit serialization to the whole layout system. My idea with FormattingState is that running layout will produce a result entirely contained within the FormattingState object. At the end of layout, it can then be applied to the layout tree, or simply queried for some metrics we were trying to determine. When doing subtree layouts to determine intrinsic sizes, we will eventually be able to clone the current FormattingState, and run the subtree layout in isolation, opening up opportunities for parallelism. This first patch doesn't go very far though, it merely adds the object as a skeleton class, and makes sure the root BFC has one. :^)
2022-02-21LibWeb: Assign correct viewport dimensions when making style for ICBAndreas Kling
The ICB (initial containing block) gets its style from StyleComputer's create_document_style(). It's basically a generic style for the root of the layout tree. With this patch, we now assign the width and height of the viewport rect as two CSS "px" lengths to the "width" and "height" properties of the ICB style. (Previously they were just defaulting to "auto" and we assigned override dimensions during layout.) This fixes an issue where position:absolute elements with relative width and/or height were not dimensioned correctly, since the values were relative to the width and/or height of the ICB style.
2022-02-21LibWeb: Add basic support for dynamic markup insertionLorenz Steinert
This implements basic support for dynamic markup insertion, adding * Document::open() * Document::write(Vector<String> const&) * Document::writeln(Vector<String> const&) * Document::close() The HTMLParser is modified to make it possible to create a script-created parser which initially only contains a HTMLTokenizer without any data. Aditionally the HTMLParser::run method gains an overload which does not modify the Document and does not run HTMLParser::the_end() so that we can reenter the parser at a later time. Furthermore all FIXMEs that consern the insertion point are implemented wich is defined in the HTMLTokenizer. Additionally the following member-variables of the HTMLParser are now exposed by getter funcions: * m_tokenizer * m_aborted * m_script_nesting_level The HTMLTokenizer is modified so that it contains an insertion point which keeps track of where the next input from the Document::write functions will be inserted. The insertion point is implemented as the charakter offset into m_decoded_input and a boolean describing if the insertion point is defined. Functions to update, check and {re}store the insertion point are also added. The function HTMLTokenizer::insert_eof is added to tell a script-created parser that document::close was called and HTMLParser::the_end() should be called. Lastly an explicit default constructor is added to HTMLTokenizer to create a empty HTMLTokenizer into which data can be inserted.
2022-02-21LibJS: Define the Intl.Collator's compare function name to be emptyTimothy Flynn
2022-02-21LibWeb: SVG parse signed numbers in eliptical arcSimon Danner
2022-02-21LibGUI: Add 'remove_all_actions' method to 'Menu'Marco Cutecchia
2022-02-21LibWeb: Fix 'Comment end state' in HTML TokenizerAdam Hodgen
Also, update the expected hash in the LibWeb TestHTMLTokenizer regression test. This is due to the "This comment has a few too many dashes." comment token being updated.
2022-02-21LibWeb: Implement tokenization newline preprocessingAdam Hodgen
Newline normalization will replace \r and \r\n with \n. The spec specifically states > Before the tokenization stage, the input stream must be preprocessed > by normalizing newlines. wheras this is implemented the processing during the tokenization itself. This should still exhibit the same behaviour, while keeping the tokenization logic in the same place.
2022-02-21LibWeb: Fix off by one error in HTML TokenizerAdam Hodgen
In 'NamedCharacterReference' we attempt to lookup the code point by a identifier, eg apos; becomes ' This is done by passing the entire rest of the document to the `HTML::code_points_from_entity` function. However, before this change we didn't sent the final character which meant if the document ended in a named character reference the lookup would fail.
2022-02-21LibWeb: Implement `Node.nodeValue` DOM attributeAdam Hodgen
2022-02-20LibJS: Re-implement String.localeCompare using the StringCompare AOIdan Horowitz
This follows the ECMA402 spec and means String.prototype.localeCompare will automatically become actually locale aware once StringCompare is actually implemented based on UTS #10.
2022-02-20LibJS: Implement get Intl.Collator.prototype.compareIdan Horowitz
2022-02-20LibJS: Add an initial implementation of Collator Compare FunctionsIdan Horowitz
This commit adds an initial implementation (without any real locale support) of Collator Compare Functions, as well as the matching CompareStrings AO. These two are used to implement the ECMA402 version of String.localeCompare() and Int.Collator.compare().
2022-02-20LibJS: Capture values as handles in Promise.prototype.finally callbacksLinus Groh
2022-02-20LibJS: Use new NativeFunction::create() in most placesLinus Groh
Resolves one FIXME where we can now pass a realm, and sets the length correctly in a bunch of places that previously didn't. Also reduces the number of "format function name string from arbitrary PropertyKey" implementations, although two more remain present in the AST (used with ECMAScriptFunctionObjects, which is a different beast).
2022-02-20LibJS: Add NativeFunction::create() overload for CreateBuiltinFunctionLinus Groh
Also take a length argument and set the name and length properties internally, instead of at the call site. Additionally, allow passing a realm, prototype, and prefix.
2022-02-20LibJS: Add [[InitialName]] and use it in Function.prototype.toString()Linus Groh
2022-02-20LibAudio: Simplify empty Audio::Buffer state to be truly emptyAndrew Kaster
The old FIXME asserting that Core::AnonymousBuffer cannot be invalid or zero-sized is no longer accurate. Add a default constructor for Audio::Buffer that has all invalid state instead of going to the OS to allocate a 1 sample buffer for the "no more samples" states in the WAV and FLAC plugins.
2022-02-20LibJS: Remove unused FunctionNode::set_name()Linus Groh
2022-02-20LibJS: Remove unused BoundFunction.h include from FunctionObject.cppLinus Groh
2022-02-20LibRegex: Make codegen+optimisation for alternatives much fasterAli Mohammad Pur
Just a little thinking outside the box, and we can now parse and optimise a million copies of "a|" chained together in just a second :^)
2022-02-20LibRegex: Make parse_disjunction() consume all disjunctions in one frameAli Mohammad Pur
This helps us not blow up when too many disjunctions are chained togther in the regex we're parsing. Fixes #12615.
2022-02-20LibRegex: Allow quantifiers after quantifiable assertionsAli Mohammad Pur
While quantifying assertions is very much meaningless, the specification allows them with annex B's extended grammar for browsers, so read and apply the quantifiers. Fixes #12373.
2022-02-20LibWeb: Make i, em, address, cite, dfn and var elements italicKarol Kosek
Although it is not said that some of the elements need to be italic, *most* browsers mark them as such to distinguish them from the normal text, so let's do that too!
2022-02-20LibWeb+Base: Parse font-style CSS propertyKarol Kosek
2022-02-20LibWeb: Handle markers when reconstructing active formatting elements Luke Wilde
The entry we get from the active formatting elements list during the Rewind step of "reconstruct the active formatting elements" can be a marker. Previously we assumed it was not a marker, which can trigger an assertion failure with certain malformed HTML. If the entry in this step is a marker, the spec simply ignores it. This is step 6 of the algorithm. This also makes the index unsigned, as this algorithm is a no-op if the list is empty. Additionally, this also adds spec comments to this algorithm. Fixes #12668.
2022-02-20LibWeb: Add default padding around contents of text <input> elementsKenneth Myhra
This patch adds a default padding around the contents of text <input> elements. It adds these defaults to the existing style attribute in 'HTMLInputElement::create_shadow_tree_if_needed()'. Use a default padding for text <input> elements: - padding-top and padding-bottom: 1px - padding-left and padding-right: 2px These values seems to align with what other browsers do.
2022-02-20LibWeb: Add key code 'Esc' to ignored Keydown Events in EventHandlerKenneth Myhra
This filters out the key code 'Esc' so it won't be printed to editable text nodes, e.g. text <input> elements.
2022-02-20LibWeb: Add support for navigating text <input> with End keyKenneth Myhra
2022-02-20LibWeb: Add support for navigating text <input> with Home keyKenneth Myhra
2022-02-20LibWeb: Add support for the options variant of {add,remove}EventListenerLuke Wilde
This also adds a variant of {add,remove}_event_listener called {add,remove}_event_listener_with_options. This is used internally to perform {add,remove}_event_listener with a default constructed options struct. It was done like this because default constructing the Variant with the options struct requires the struct defintions to be present, which requires us to include AbortSignal.h, which would cause a circular include as AbortSignal.h includes EventTarget.h.
2022-02-19LibJS: Trim all types of whitespace characters before parsing numbersIdan Horowitz