mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-10 01:51:03 +09:00
![]() Previously, we would just assign the UnresolvedStyleValue to each
longhand, which was completely wrong but happened to work if it was a
ShorthandStyleValue (because that's basically a list of "set property X
to Y", and doesn't care which property it's the value of).
For example, the included `var-in-margin-shorthand.html` test would:
1. Set `margin-top` to `var(--a) 10px`
2. Resolve it to `margin-top: 5px 10px`
3. Reject that as invalid
What now happens is:
1. Set `margin-top` to a PendingSubstitutionValue
2. Resolve `margin` to `5px 10px`
3. Expand that out into its longhands
4. `margin-top` is `5px` 🎉
In order to support this, `for_each_property_expanding_shorthands()` now
runs the callback for the shorthand too if it's an unresolved or
pending-substitution value. This is so that we can store those in the
CascadedProperties until they can be resolved - otherwise, by the time
we want to resolve them, we don't have them any more.
`cascade_declarations()` has an unfortunate hack: it tracks, for each
declaration, which properties have already been given values, so that
it can avoid overwriting an actual value with a pending one. This is
necessary because of the unfortunate way that CSSStyleProperties holds
expanded longhands, and not just the original declarations. The spec
disagrees with itself about this, but we do need to do that expansion
for `element.style` to work correctly. This HashTable is unfortunate
but it does solve the problem until a better solution can be found.
|
||
---|---|---|
.. | ||
Assets | ||
Crash | ||
Fixtures | ||
Layout | ||
Ref | ||
Screenshot | ||
Text | ||
add_libweb_test.py | ||
CMakeLists.txt | ||
TestConfig.ini | ||
TestCSSIDSpeed.cpp | ||
TestCSSInheritedProperty.cpp | ||
TestCSSPixels.cpp | ||
TestCSSTokenStream.cpp | ||
TestFetchInfrastructure.cpp | ||
TestFetchURL.cpp | ||
TestHTMLTokenizer.cpp | ||
TestHTMLTokenizerSwift.swift | ||
TestLibWebSwiftBindings.swift | ||
TestMicrosyntax.cpp | ||
TestMimeSniff.cpp | ||
TestNumbers.cpp | ||
TestStrings.cpp | ||
tokenizer-test.html |