Age | Commit message (Collapse) | Author |
|
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. :^)
|
|
|
|
No need to worry about inline children if children are not inline(!)
|
|
Any live layout tree always has a corresponding live Frame, as we will
never create a layout tree for a frameless document.
|
|
Just paint it like an empty box if there's no document in the frame.
|
|
Also fixes some little mistakes in the "in body" insertion mode
that I found whilst cross-referencing.
|
|
|
|
|
|
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.
|
|
Also fixes TagOpen having a seperate emit and reconsume in
ANYTHING_ELSE.
|
|
|
|
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.
|
|
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.
|
|
|
|
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.
|
|
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. :^)
|
|
|
|
Otherwise we won't get the first fully styled look until you interact
with the page (e.g via hovering an element.)
|
|
|
|
|
|
...so when we check for rel=stylesheet, we have to split it up into
parts first. :^)
|
|
|
|
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.
|
|
|
|
Let's just say that -libweb-center centers the block in its containing
block for now. We can get fancy with relative offsets later.
|
|
|
|
|
|
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. :^)
|
|
|
|
Note that align=center and align=middle both behave like the <center>
element, and not like text-align:center.
|
|
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 ' '.)
|
|
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.
|
|
We were interpreting 'A'-'F' as decimal digits which didn't work right.
|
|
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.)
|
|
More presentational attribute stuff. HN looking more and more like it's
supposed to. :^)
|
|
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.
|
|
|
|
- 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
|
|
|
|
|
|
If two rules have equal specificity, they should be applied in the
order in which we encountered them.
|
|
|
|
|
|
No need to check for presence of the href attribute as that is already
checked by enclosing_link_element().
|
|
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.
|
|
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.
|
|
This is very hackish and will be fixed by writing a proper CSS parser.
|
|
|
|
A convenient function for looking up a cell's colspan attribute.
|
|
This first version simply auto-sizes all table cells and then places
them on a horizontal line.
|