summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/StyleProperties.h
AgeCommit message (Collapse)Author
2022-08-25LibWeb: Parse grid-column-start and related CSS propertiesmartinfalisse
Parse grid-column-start, end, and the equivalent for rows.
2022-08-25LibWeb: Parse grid-template-columns and grid-template-rowsmartinfalisse
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.
2022-08-07LibWeb: Use rect value in CSS clip propertyTom
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.
2022-07-23LibWeb: Implement `appearance` CSS propertyMacDue
This includes the "compat" values even though they are not strictly necessary.
2022-07-12LibWeb: Honor `align-self` over `align-items` when non-auto on flex itemAndreas Kling
2022-04-14LibWeb: Allow multiple text-decoration-linesSam Atkins
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.
2022-04-14LibWeb: Make StyleProperties::property() always return a valueSam Atkins
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.
2022-04-14LibWeb: Return Optional from StyleProperties::box_sizing()Sam Atkins
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.
2022-04-09LibGfx: Move other font-related files to LibGfx/Font/Simon Wanner
2022-04-02LibWeb: Implement the flex order CSS propertyEnver Balalic
Adds support for the flex order property and a test page for it on the browser welcome page.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-24LibWeb: Parse and compute text-shadow propertySam Atkins
2022-03-24LbWeb: Rename BoxShadowFoo => ShadowFooSam Atkins
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. :^)
2022-03-23LibWeb: Parse CSS "font-variant" as part of "font"Andreas Kling
This allows us to parse CSS "font" values that contain e.g "small-caps" or "normal", as used on Acid3.
2022-03-22LibWeb: Apply the CSS transform-origin propertySimon Wanner
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
2022-03-21LibWeb: Pick up the CSS "visibility" property an honor it when paintingAndreas Kling
2022-03-17Libraries: Use default constructors/destructors in LibWebLenny Maiorani
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."
2022-03-12LibWeb: Add support for the text-justify propertysin-ack
This commit adds the text-justify property as defined in: https://drafts.csswg.org/css-text/#propdef-text-justify
2022-02-26LibWeb: Add vertical-align to ComputedValuesAndreas Kling
2022-02-25LibWeb: Compute value for `content` propertySam Atkins
2022-02-19LibWeb: Turn StyleProperties::m_property_values into an ArrayAndreas Kling
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. :^)
2022-02-19LibWeb: Add support for CSS image-rendering propertyMaciej
Currently only "auto" and "pixelated" values are supported.
2022-02-18LibWeb: Use Optional instead of undefined-lengths for widths/heightsSam Atkins
2022-02-08LibWeb: Render multiple box-shadowsSam Atkins
Because why not? :^)
2022-01-23LibWeb: Add new property 'text-decoration-style'Tobias Christiansen
This patch makes the property 'text-decoration-style' known throughout all the places in LibWeb that care.
2022-01-20LibWeb: Convert width/height and min-/max- versions to LengthPercentageSam Atkins
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.
2022-01-20LibWeb: Remove unused StyleProperties::background_repeat()Sam Atkins
2021-11-10LibWeb: Combine background-repeat-x/y pseudo-propertiesSam Atkins
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! :^)
2021-10-28LibWeb: Remove StyleProperties::set_property(PropertyID, StringView)Andreas Kling
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.
2021-10-19LibWeb: Make computed opacity always availableAndreas Kling
No need to store opacity as Optional<float> as there's always a value (and the default initial value is 1.)
2021-10-19LibWeb: Make computed flex-grow and flex-shrink always availableAndreas Kling
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.
2021-10-09LibWeb: Add initial version of pointer-events CSS propertyhuwdp
2021-10-05LibWeb: Make things aware of box-sizingSam Atkins
Of course, we don't actually *use* the box-sizing property yet, but the value is applied and shows up in the computed style.
2021-09-24LibWeb: Rename CSS::StyleResolver => StyleComputerAndreas Kling
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.
2021-09-24LibWeb: Remove on-demand font resolutionAndreas Kling
Fonts are now resolved as part of the CSS cascade.
2021-09-24LibWeb: Start absolutizing lengths after performing the CSS cascadeAndreas Kling
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.
2021-09-21LibWeb: Start implementing the CSS cascadeAndreas Kling
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. :^)
2021-09-18LibWeb: Add transform property to the systemTobias Christiansen
This patch adds parsing support as well as all the needed stuctures all over LibWeb to pass Transformations around.
2021-09-17LibWeb: Make StyleValue::to_color() take a Node instead of the DocumentSam Atkins
This is in preparation for the `currentcolor` value, which needs to know what Node it's on so it can check the `color`.
2021-09-15LibWeb: Add proper parsing of the AlignItems propertyTobias Christiansen
This teaches all the relevant places about 'align-items'.
2021-08-26LibWeb: Remove unused CSS::StyleProperties::string_or_fallback()Andreas Kling
2021-08-18LibWeb: Handle non-px font sizesSam Atkins
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.
2021-07-24LibWeb: Make box-shadow known throughout the CSS subsystemTobias Christiansen
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
2021-07-24LibWeb: Parse and store the opacity propertyEgor Ananyin
2021-07-19LibWeb: Add parsing for the justify-content propertyTobias Christiansen
2021-06-06LibWeb: Add flex-grow and flex-shrinkTobias Christiansen
They get parsed and are available to the programmer of Layouts :^)
2021-06-06LibWeb: Parse flex-basisTobias Christiansen
Flex-basis accepts either 'content' or a Length.
2021-06-06LibWeb: Add parsing for flex-wrap propertyTobias Christiansen
2021-04-23AK: Rename adopt() to adopt_ref()Andreas Kling
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
2021-04-22LibWeb: Improve fallback font selectionSimon Danner
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.