Age | Commit message (Collapse) | Author |
|
Parse grid-column-start, end, and the equivalent for rows.
|
|
Add functionality to begin parsing grid-template-columns and
grid-template-rows. There are still things to be added, like parsing
functions, but I would say a couple of the major points are already
adressed like length, percentage, and flexible-length.
|
|
When a rect value is passed to the clip property via CSS, keep it in
ComputedValues so that at a later stage can make use of it.
|
|
This includes the "compat" values even though they are not strictly
necessary.
|
|
|
|
The spec grammar for `text-decoration-line` is:
`none | [ underline || overline || line-through || blink ]`
Which means that it's either `none`, or any combination of the other
values. This patch makes that parse for `text-decoration-line` and
`text-decoration`, stores the results as a Vector, and adjusts
`paint_text_decoration()` to run as a loop over all the values that are
provided.
As noted, storing a Vector of values is a bit wasteful, as they could be
stored as flags in a single `u8`. But I was getting too confused trying
to do that in a nice way.
|
|
By the time that property() gets called, we've already given every
single property a value, so we can just return it. This simplifies a
lot of places that were manually handling a lack of value
unnecessarily.
|
|
This function was written as if it returned `Optional<CSS::BoxSizing>`
but actually returned a plain `CSS::BoxSizing`, meaning if the property
was not set or was invalid, it would return whichever enum value was
first. This wasn't visible because we don't yet pay any attention to
the `box-sizing` property.
|
|
|
|
Adds support for the flex order property and a test page for it
on the browser welcome page.
|
|
|
|
|
|
The `text-shadow` property is almost identical to `box-shadow`:
> Values are interpreted as for box-shadow [CSS-BACKGROUNDS-3].
> (But note that the inset keyword are not allowed.)
So, let's use the same data structures and parsing code for both. :^)
|
|
This allows us to parse CSS "font" values that contain e.g "small-caps"
or "normal", as used on Acid3.
|
|
We don't have transform-box yet, so this applies to the border-box
for now.
This also makes us pass a couple Web Platform Tests as well :^)
For example:
https://wpt.live/css/css-transforms/css3-transform-scale-002.html
|
|
|
|
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules
"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
|
|
This commit adds the text-justify property as defined in:
https://drafts.csswg.org/css-text/#propdef-text-justify
|
|
|
|
|
|
After style computation, every StyleProperties has a value for every
PropertyID. Given this, it's simpler, faster and less memory-heavy to
use an Array instead of a HashMap. :^)
|
|
Currently only "auto" and "pixelated" values are supported.
|
|
|
|
Because why not? :^)
|
|
This patch makes the property 'text-decoration-style' known throughout
all the places in LibWeb that care.
|
|
A lot of this is quite ugly, but it should only be so until I remove
Length::Type::Percentage entirely. (Which should happen later in this
PR, otherwise, yell at me!) For now, a lot of things have to be
resolved twice, first from a LengthPercentage to a Length, and then
from a Length to a pixel one.
|
|
|
|
While right now this doesn't save much complexity, it will do once we
care about multiple background layers per node. Then, having a single
repeat value per layer will simplify things.
It also means we can remove the pseudo-property concept entirely! :^)
|
|
This API has no more clients (and the last client that I just removed
wasn't even using it right) so let's get rid of it.
|
|
No need to store opacity as Optional<float> as there's always a value
(and the default initial value is 1.)
|
|
These values are not allowed to be absent (auto/none/etc) so we don't
need to use Optional<float> for them. This simplifies some things.
|
|
|
|
Of course, we don't actually *use* the box-sizing property yet, but the
value is applied and shows up in the computed style.
|
|
Resolved style is a spec concept that refers to the weird mix of
computed style and used style reflected by getComputedStyle().
The purpose of this class is to produce the *computed* style for a given
element, so let's call it StyleComputer.
|
|
Fonts are now resolved as part of the CSS cascade.
|
|
Once we've performed the cascade on a set of values for an element,
we should have enough information to resolve/absolutize some lengths.
Basically, any CSS length that isn't "auto" or a percentage can be
turned into an absolute length (in pixels) as long as we have the
following information:
- The viewport rect
- The parent element's font
- The document element's font
- The element's own font
To ensure that we can absolutize lengths relative to the element's own
font, we now do a separate first pass where font-related properties are
defaulted (in the cascade spec sense of the word) and become usable.
There's a lot more work to do here, but this should open up a lot of
simplification in layout code, since it will no longer need to care
about relative lengths. Layout still needs to resolve percentages, since
we can't do that for some properties until the containing block
dimensions are known.
|
|
The 'C' in "CSS" is for Cascade, so let's actually implement the cascade
in LibWeb. :^)
StyleResolver::resolve_style() now begins by collecting all the matching
CSS rules for the given DOM::Element. Rules are then processed in the
spec's cascade order (instead of in the order we encounter them.)
With this, "!important" is now honored on CSS properties.
After performing the cascade, we do another pass of what the spec calls
"defaulting" where we resolve "inherit" and "initial" values.
I've left a FIXME about supporting correct "initial" values for every
property, since we're currently lacking some coverage there.
Note that this mechanism now resolves every known CSS property. This is
*not* space-efficient and we'll eventually need to come up with some
strategies to reduce memory usage around this. However, this will do
fine until we have more of the engine working correctly. :^)
|
|
This patch adds parsing support as well as all the needed stuctures all
over LibWeb to pass Transformations around.
|
|
This is in preparation for the `currentcolor` value, which needs to know
what Node it's on so it can check the `color`.
|
|
This teaches all the relevant places about 'align-items'.
|
|
|
|
The previous code assumed all font sizes were in px, but now we perform
the conversion. There is an existing bug with em sizes returning 0,
which seems to affect other places too - see
`NodeWithStyle::apply_style()`.
This also implements 'larger', 'smaller' and calc() font-sizes.
|
|
This patch spreads box-shadows around:
- The Values important to box-shadows are stored in a BoxShadowData
struct
- StyleProperties knows how to construct such a struct from a
BoxShadowStyleValue and a Node knows how to ask for it
- CalculatedValues contain BoxShadowData and expose them
|
|
|
|
|
|
They get parsed and are available to the programmer of Layouts :^)
|
|
Flex-basis accepts either 'content' or a Length.
|
|
|
|
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
|
|
Try to find a font that has at least some of the requested properties.
This makes e.g. rfcs on tools.ietf.org easier to read since their
headers are now bold.
|