summaryrefslogtreecommitdiff
path: root/Libraries
AgeCommit message (Collapse)Author
2020-06-14LibWeb: Reorganize layout algorithmAndreas Kling
Previously, layout recursively performed these steps (roughly): 1. Compute own width 2. Compute own position 3. Layout in-flow children 4. Compute own height 5. Layout absolutely positioned descendants However, step (2) was pretty inconsistent. Some things computed their own position, others had their parent do it for them, etc. To get closer to CSS spec language, and make things easier in general, this patch reorganizes the algorithm into: 1. Compute own width & height 2. Compute width & height of in-flow managed descendants 3. Move in-flow managed descendants to their final position 4. Layout absolutely positioned descendants Block layout is now driven by the containing block, which will iterate the descendants it's responsible for. There are a lot of inefficient patterns in this logic right now, but they can easily be replaced with better iteration functions once we settle on a long-term architecture. Since the ICB (LayoutDocument) is at (0, 0), it doesn't rely on a containing block to move it into place. This code is still evolving along with my understanding of CSS layout, so it's likely that we'll reorganize this again sooner or later. :^)
2020-06-14LibWeb: Dump layout node style properties in alphabetical orderAndreas Kling
2020-06-14LibWeb: Simplify LayoutBlock::layout_block_children() a little bitAndreas Kling
No need to worry about inline children if children are not inline(!)
2020-06-14LibWeb: Add LayoutNode::frame() reference getterAndreas Kling
Any live layout tree always has a corresponding live Frame, as we will never create a layout tree for a frameless document.
2020-06-14LibWeb: Don't choke when trying to render a document-less <iframe>Andreas Kling
Just paint it like an empty box if there's no document in the frame.
2020-06-14LibWeb: Fully implement HTML parser "in table" insertion modeLuke
Also fixes some little mistakes in the "in body" insertion mode that I found whilst cross-referencing.
2020-06-14LibWeb: Implement HTML parser "in column group" insertion modeLuke
2020-06-14LibWeb: Implement HTML parser "in caption" insertion modeLuke
2020-06-14LibWeb: Implement all CDATA tokenizer statesLuke
Even though we haven't implemented any switches to these states yet, we may as well have them ready for when we do implement the switches.
2020-06-14LibWeb: Fully implement all DOCTYPE tokenizer statesLuke
Also fixes TagOpen having a seperate emit and reconsume in ANYTHING_ELSE.
2020-06-14LibWeb: Fully implement all comment tokenizer statesLuke
2020-06-13LibWeb: Add basic <object> element supportAndreas Kling
This patch implements a simple <object> element with fallback content. If the URL from the data attribute fails to load (including 404), we render the DOM tree inside the <object> as fallback content. This works by generating a different layout tree for the <object> depending on the state and success of the data load. Since we cannot currently do incremental layout tree updates, we have to force a complete layout tree rebuild when the resource load finishes/fails.
2020-06-13LibWeb: Split out image loading logic from HTMLImageElementAndreas Kling
Since more DOM nodes are going to want to load images (<object>, ...) this patch splits out the image loading logic into an ImageLoader class and then HTMLImageElement simply has an ImageLoader. LayoutImage is then given a const ImageLoader& at construction and can then provide layout and rendering for many kinds of DOM nodes.
2020-06-13LibWeb: Add "data" to HTML::AttributeNamesAndreas Kling
2020-06-13ProtocolServer+LibProtocol: Propagate HTTP status codes to clientsAndreas Kling
Clients now receive HTTP status codes like 200, 404, etc. Note that a 404 with content is still considered a "successful" download from ProtocolServer's perspective. It's up to the client to interpret the status code. I'm not sure if this is the best API, but it'll work for now.
2020-06-13LibWeb: Fix LayoutImage stupidly painting backgrounds over itselfAndreas Kling
The good boy fix here would be to implement all of the CSS paint phases but for now, let's at least not paint a background over our image. :^)
2020-06-13LibGfx: Painter::draw_line() can just return early if alpha == 0Andreas Kling
2020-06-13LibWeb: Have DOM nodes start out in "needs style update" stateAndreas Kling
Otherwise we won't get the first fully styled look until you interact with the page (e.g via hovering an element.)
2020-06-13LibWeb: Expand background:none into background-color:transparentAndreas Kling
2020-06-13LibGfx: Add Color::Transparent as a named colorAndreas Kling
2020-06-13LibWeb: <link rel> is actually a space-separated list of tokensAndreas Kling
...so when we check for rel=stylesheet, we have to split it up into parts first. :^)
2020-06-13LibWeb: Sort style properties by name in the inspector windowAndreas Kling
2020-06-13LibGfx: Implement support for decoding interlaced PNGsPaul Roukema
This adds support for decoding the Adam7 interlacing used in some PNGs. Notably this includes many of the images (such as the eyes) used in the acid2 test :^) Note that the HTML engine still doesn't understand the <object> tag well enough to show the eyes on the test.
2020-06-13LibGfx: Fix PNG decoder handling of 16-bit RGB imagesPaul Roukema
2020-06-13LibWeb: Don't try to be clever about -libweb-center relative positionAndreas Kling
Let's just say that -libweb-center centers the block in its containing block for now. We can get fancy with relative offsets later.
2020-06-13LibGfx: Silence debug spam in the PNG decoderAndreas Kling
2020-06-13LibWeb: Remove some unused functions in LayoutTableRowAndreas Kling
2020-06-13LibGfx: Don't keep an unused GIF decoder plugin in failed ImageDecodersAndreas Kling
If we can't decode the input data, just have a null decoder. In this state we simply return a null bitmap and whatever empty values make sense for each API. This way, we don't try to decode the same thing over and over since it's not gonna work anyway. :^)
2020-06-13LibWeb: Silence debug spam about reuse of cached resourcesAndreas Kling
2020-06-13LibWeb: Turn <td align> into CSS text-alignAndreas Kling
Note that align=center and align=middle both behave like the <center> element, and not like text-align:center.
2020-06-13LibWeb: Teach line layout to collapse whitespace across fragmentsAndreas Kling
This kind of HTML now produces a single piece of whitespace: <span> </span> <span> </span> <span> </span> We achieve this by checking if the last fragment on the last line ends in whitespace. If so, we either don't add a fragment at all (for the current chunk) or we simply skip over all whitespace at the head of the current chunk (instead of collapsing it to a single ' '.)
2020-06-13LibIPC: Only start responsiveness timer after sending client a messageAndreas Kling
Instead of always running the responsiveness timer for IPC clients, we now only start it after sending a message. This avoids waking up otherwise idle clients to do ping/pong busywork.
2020-06-13LibWeb: Fix broken tokenization of hexadecimal character referencesAndreas Kling
We were interpreting 'A'-'F' as decimal digits which didn't work right.
2020-06-13LibWeb: Implement <center> as -libweb-centerAndreas Kling
To get the expected behavior for <center>, we needed a special text alignment mode that centers block-level elements (and not just line box fragments.)
2020-06-13LibWeb: Turn <table bgcolor> into CSS background-colorAndreas Kling
More presentational attribute stuff. HN looking more and more like it's supposed to. :^)
2020-06-13LibWeb: Tweak UA style to reset text-align on table elementsAndreas Kling
I think maybe this is only supposed to happen in quirks mode but I'm not entirely sure. This makes "<center><table>..." behave as expected.
2020-06-13LibJS: Add JSON.parseMatthew Olsson
2020-06-13AK: JsonParser improvementsMatthew Olsson
- Parsing invalid JSON no longer asserts Instead of asserting when coming across malformed JSON, JsonParser::parse now returns an Optional<JsonValue>. - Disallow trailing commas in JSON objects and arrays - No longer parse 'undefined', as that is a purely JS thing - No longer allow non-whitespace after anything consumed by the initial parse() call. Examples of things that were valid and no longer are: - undefineddfz - {"foo": 1}abcd - [1,2,3]4 - JsonObject.for_each_member now iterates in original insertion order
2020-06-13LibJS: Add JSON.stringifyMatthew Olsson
2020-06-13LibKeyboard: Move character map from Kernel to LibKeyboardHüseyin ASLITÜRK
2020-06-13LibWeb: Sort matched style rules by specificity, document orderAndreas Kling
If two rules have equal specificity, they should be applied in the order in which we encountered them.
2020-06-13LibWeb: Fix broken Specificity::operator==Andreas Kling
2020-06-13LibWeb: Include selector pseudo-class in style sheet dumpsAndreas Kling
2020-06-13LibWeb: Simplify Node::is_link()Andreas Kling
No need to check for presence of the href attribute as that is already checked by enclosing_link_element().
2020-06-13LibWeb: Parse and match the :visited pseudo-class (always fails)Andreas Kling
If we don't do this, something like "a:visited" is parsed as "a" which may then take precedence over a previous "a:link" etc.
2020-06-13LibWeb: More work on table layoutAndreas Kling
Table row layout is now split into two phases: 1. Compute all the column widths (even taking colspan into account!) 2. Place all cells at the correct x,y offsets based on column widths. Both phases visit all rows and all cells.
2020-06-13LibWeb: Allow url("foo") and url('foo') in CSS background-image valuesAndreas Kling
This is very hackish and will be fixed by writing a proper CSS parser.
2020-06-13LibWeb: Add "colspan" to HTML::AttributeNamesAndreas Kling
2020-06-13LibWeb: Add LayoutTableCell::colspan()Andreas Kling
A convenient function for looking up a cell's colspan attribute.
2020-06-12LibWeb: First cut of extremely naive table row layoutAndreas Kling
This first version simply auto-sizes all table cells and then places them on a horizontal line.