Commit graph

572 commits

Author SHA1 Message Date
Andreas Kling 06d9451551 LibWeb: Don't cache property accesses on WindowProxy
Since the underlying HTML::Window can change, caching property accesses
on WindowProxy is not as simple as remembering the shape. Let's disable
caching here for now. We can come back to it in the future when we have
no low-hanging fruit left. :^)

Fixes an assertion failure on https://twinings.co.uk/
2023-07-11 00:14:50 +02:00
Andreas Kling 5955a504e0 LibWeb: Allow font-family names to start with -
We achieve this by making properties that accept a custom-ident value
skip the "someone else's vendor prefix" check for values that start with
a `-` character.

This fixes an issue where e.g `font-family: Arial, -apple-system` would
be rejected by the parser completely. We now treat `-apple-system` like
an identifier in such cases.

Also add `valid-types` metadata for the `font-family` property so this
actually works. :^)
2023-07-06 14:30:06 +02:00
Andreas Kling fb727332f9 LibWeb: Decode linked style sheets before parsing them
This fixes an issue where a BOM at the head of a style sheet would be
passed verbatim to the parser, who would then interpret it as an ident
token and (after some confusion) fail to parse the first rule, but then
carry on with the rest of the sheet.
2023-07-04 10:45:20 +02:00
Andreas Kling 5cdb394400 LibWeb: Make HTML parser flush all pending tokens in "in table text"
There were multiple bugs in the parsing algorithm for handling text
occurring inside a `table` element:

- When there was pending non-whitespace text inside a table, we only
  flushed one token instead of all pending tokens.

- Also, we didn't even flush one of the right tokens, but instead the
  token that caused the flush to happen.

- Once we started flushing the right tokens, it turned out we had not
  yet implemented character insertion points expressed as "before X".

- Finally, we were not exiting the "in table text" mode after flushing
  pending tokens, effectively getting us stuck in that mode until EOF.
2023-07-03 11:50:58 +02:00
FalseHonesty 110eeb8591 LibWeb: Support calc(...) in box-shadow's values of type Length
The CSS box-shadow property takes 2-4 properties that are `<length>`s,
those being:
  - offset-x
  - offset-y
  - blur-radius
  - spread-radius

Previously these were resolved directly to concrete Lengths at parse
time, but now they will be parsed as LengthStyleValues and/or
CalculatedStyleValues and be stored that way until styles are later
resolved.
2023-06-25 10:27:08 +01:00
Shannon Booth a92d94f4e9 LibWeb/Tests: Add basic test for ByteLengthQueuingStrategy 2023-06-23 13:27:29 +02:00
Shannon Booth b2a51e86e5 LibWeb/Tests: Add basic test for CountQueuingStrategy 2023-06-23 13:27:29 +02:00
Shannon Booth 464e428e94 LibWeb/Tests: Add basic tests for {ByteLength,Counting}QueuingStrategy 2023-06-21 12:27:04 +02:00
Andreas Kling 8a43f5a64a LibWeb: Forward media attribute from link element to loaded style sheet
Otherwise, we will treat the loaded style sheet as if it had media="all"
which is not always appropriate.
2023-06-11 06:05:03 +02:00
Timothy Flynn bf242efd1d LibWeb: Remove outdated layout/text test scripts
These are superseded by headless-browser running these tests in a single
process, and aren't used by CI anymore. It's a bit confusing having them
still around so let's be rid of them.
2023-06-09 20:36:54 +02:00
Ali Mohammad Pur 141143a1c6 LibWeb: Serialize custom properties in CSSStyleDeclaration::serialized()
Prior to this commit, PropertyOwningCSSStyleDeclaration::serialized()
did not include custom properties, which lead to an incomplete
`cssRule.cssText` result.
This commit makes that class also serialize the custom properties and
place them before the regular properties in the rule text.
2023-06-09 11:17:44 +01:00
implicitfield 71b184accf Meta+Lagom: Enable CMAKE_BUILD_WITH_INSTALL_RPATH
On macOS, CMake incorrectly tries to add and/or remove rpaths from files
that it has already processed when it performs installation. Setting the
rpaths during the build process ensures that they are only set once, and
as a bonus, makes installation slightly more performant.

Fixes #10055.
2023-06-08 17:59:53 +02:00
Andreas Kling 7f90b0cab7 LibWeb: Don't override prototype on generated iterator prototypes
Generated iterator prototypes already have the IteratorPrototype as
their prototype, but we were incorrectly hijacking them and rerouting
to ObjectPrototype.

Regressed in cfe663435e.
2023-06-08 10:05:56 +02:00
Timothy Flynn f2a28e83de LibWeb: Implement the document title attribute closer to the spec
The main differences between our current implementation and the spec
are:

    * The title element need not be a child of the head element.

    * If the title element does not exist, the default value should be
      the empty string - we currently return a null string.

    * We've since added AOs for several of the spec steps here, so we
      do not need to implement those steps inline.
2023-06-08 07:21:08 +02:00
Andreas Kling c50ce2030d LibWeb: Allow event handler attributes on HTMLLinkElement
We were neglecting to set up event handlers for these due to a missing
call to the base class in HTMLLinkElement::parse_attribute().
2023-06-06 09:06:27 +02:00
Andreas Kling b97004ea4a LibWeb: Fire "load" and "error" events for rel=preload link loads 2023-06-06 09:06:27 +02:00
Andreas Kling 3cea86632d LibWeb: Invalidate the layout tree on DOM node insertion 2023-06-06 09:06:27 +02:00
Shannon Booth a9e37be7a0 Tests/LibWeb: Add some text tests for 'parsing a legacy color value'
I was not aware of this framework back when implementing this back in
bc54560e59. Add in some basic tests for
this now that we are compliant with the specification.
2023-06-05 06:54:33 +02:00
Ali Mohammad Pur 0e3fb39a0a LibWeb: Make 'optional BufferSource' IDL arguments actually optional
Previously this was compiled to require an object despite the IDL file
specifying 'optional'.
This commit makes IDLGenerator respect this modifier, and fixes the only
affected instance.
2023-05-30 12:50:13 +02:00
Andreas Kling 58c1cb80bb Tests/LibWeb: Use the include.js helper in "basic.html" 2023-05-28 22:03:57 +02:00
Andreas Kling a98f5c7251 LibWeb: Make resolved serialization of CSS display prefer short form
Although we translate e.g `block` to `block flow` for internal use in
the engine, CSS-DISPLAY-3 tells us to use the short form in
serializations for compatibility reasons.

This adds 9 points to our score on https://html5test.com/ :^)
2023-05-27 16:43:35 +02:00
Andreas Kling edbc732785 Ladybird+Tests/LibWeb: Add very basic text-only test harness
This allows us to create "text tests" in addition to "layout tests".
Text tests work the same as layout tests, but dump the document content
as text and exit upon receiving the window "load" event.
2023-05-27 14:03:49 +02:00