summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout/Node.cpp
AgeCommit message (Collapse)Author
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-18LibWeb: Also avoid setting definite size for heightTobias Christiansen
This patch patches ef22a1b to also check for is_auto() on the height property when setting definite_height.
2021-09-17LibWeb: Replace hard-coded defaults in Node::apply_style()Sam Atkins
This now uses the values in `InitialValues`, which is not ideal, but it's better to have our defaults defined in two places, than in 3. The default for `border-colors` is `currentcolor`, so we shortcut that here and just grab the value of the `color` property. As noted, this is not perfect, but it's somewhat better.
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-16LibWeb: Add for CSS `fill/stroke/stroke-color` properties for SVGSam Atkins
In the spec, `fill` and `stroke` are supposed to be a shorthands for various properties. But since the spec is still a working draft, and neither Firefox or Chrome support the `fill-color` or `stroke-color` properties, we'll stick with `fill` and `stroke` as simple colors for now. Also, note that SVG expects things in "user units", and we are assuming that 1px = 1 user unit for now.
2021-09-15LibWeb: Avoid setting definite {width,height} when "auto" is specifiedTobias Christiansen
Auto is not specified at all.
2021-09-15LibWeb: Add proper parsing of the AlignItems propertyTobias Christiansen
This teaches all the relevant places about 'align-items'.
2021-09-15LibWeb: Make Layout::Node::paint() pure virtualAndreas Kling
In the past, the base class implementation of this was used to descend into subtrees and paint children. That is now taken care of by StackingContext::paint_descendants() instead, and nothing used this.
2021-09-08LibWeb: Rename InitialContainingBlockBox => InitialContainingBlockAndreas Kling
The "Box" suffix added nothing here.
2021-09-02LibWeb: Make Node::root return a referenceLuke Wilde
The root of a node can never be null, as "the root of an object is itself, if its parent is null, or else it is the root of its parent." https://dom.spec.whatwg.org/#concept-tree-root
2021-08-18LibWeb: Calculate font-size in NodeWidthStyle::apply_style()Sam Atkins
Previously, this made the same "everything is px" assumption as in `StyleProperties::load_font()`, so I've replaced it with the calculation from there.
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-08-14LibWeb: Implement and use BorderRadiusStyleValueSam Atkins
This parses the elliptical border-radius values, though currently we only support circular ones. So, to_length() is overloaded to return the horizontal-radius. This means the code in Layout/Node.cpp does not need to change for now.
2021-08-08LibWeb: Add missing `typeinfo` includeDaniel Bertalan
Not having this header only causes an issue on Clang builds, since in libc++, `std::type_info` is only forward-declared in `cxxabi.h`.
2021-08-01LibWeb: Remove unused header includesBrian Gianforcaro
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: Draw elements with opacity in a separate stacking contextEgor Ananyin
2021-07-24LibWeb: Parse and store the opacity propertyEgor Ananyin
2021-07-19LibWeb: Add parsing for the justify-content propertyTobias Christiansen
2021-07-14LibWeb: Add missing `typeinfo` includeDaniel Bertalan
This code worked with GCC because libstdc++ pulls in `type_info`'s definition through the `cxxabi` header included by `AK/Demangle.h`. In contrast, `libc++` only forward-declares it, so this code failed to compile with it.
2021-06-24AK: Rename downcast<T> => verify_cast<T>Andreas Kling
This makes it much clearer what this cast actually does: it will VERIFY that the thing we're casting is a T (using is<T>()).
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 support for 'definite size' determinationTobias Christiansen
This is pretty naive and there are more nuances in the spec but should be enough for now.
2021-06-06LibWeb: Add parsing for flex-wrap propertyTobias Christiansen
2021-06-06LibWeb: Flex-items aren't affected by float nor clearTobias Christiansen
There are a few other things to notice, but they don't seem to be implemented yet.
2021-05-30LibWeb: Rename Web::Frame to Web::BrowsingContextAndreas Kling
Our "frame" concept very closely matches what the web specs call a "browsing context", so let's rename it to that. :^) The "main frame" becomes the "top-level browsing context", and "sub-frames" are now "nested browsing contexts".
2021-05-20LibWeb: Make border-radius attibutes accessibleTobias Christiansen
2021-05-07LibWeb: Make painting order more spec-compliantEgor Ananyin
Now our painting order inside stacking contexts is closer to the algorithm specified by CSS 2.1 (see section 9.9 and Appendix E)
2021-05-02LibGfx: Unify Rect, Point, and SizeMatthew Olsson
This commit unifies methods and method/param names between the above classes, as well as adds [[nodiscard]] and ALWAYS_INLINE where appropriate. It also renamed the various move_by methods to translate_by, as that more closely matches the transformation terminology.
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-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-12LibWeb: Set border width to zero if style is noneEgor Ananyin
2021-04-05LibWeb: Support two-value background-repeatTimothy Flynn
The background-repeat value may be specified as either one- or two-value identifiers (to be interpreted as horizontal and vertical repeat). This adds two pseudo-properties, background-repeat-x and background-repeat-y, to handle this. One-value identifiers are mapped to two-value in accordance with the spec.
2021-04-03LibWeb: Store computed CSS value of background-repeatTimothy Flynn
2021-03-02LibWeb: Return whether handle_mousewheel was handledAngus Gibson
We try scrolling a Node with the handle_mousewheel event, but if it isn't scrollable, the event should be passed back up to the page host. This is the first step in that process.
2021-02-28LibWeb: Parese the CSS "cursor" propertyAdam Hodgen
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-22LibWeb: Only scroll BlockBox on wheel event if overflow==scrollAndreas Kling
We implement this by adding a BlockBox::is_scrollable() helper, and then ignoring wheel events for non-scrollable boxes. Thanks to FireFox317 for pointing this out! :^)
2021-02-22LibWeb: Allow scrolling overflowed content with the mouse wheel :^)Andreas Kling
This is rather crude, but you can now use the mouse wheel to scroll up and down in block-level boxes with clipped overflowing content. There's no limit to how far you can scroll in either direction, since we don't yet track how much overflow there is. But it's a start. :^)
2021-02-22LibWeb: Add parsing and application of CSS "overflow" propertyAndreas Kling
We don't actually do anything with the values yet, but now they are available for layout nodes once we are ready to implement them.
2021-02-10LibWeb: Remove low-hanging LibGUI fruit from LibWebAndreas Kling
We'll want to remove the LibGUI dependency from the WebContent process. This is the first basic step of removing unnecessary LibGUI includes and swapping out GUI::Painter for Gfx::Painter.
2021-02-10LibWeb: Remove a whole bunch of unnecessary #includesAndreas Kling
2021-01-18LibWeb: Parse the CSS "flex-direction" propertyAndreas Kling
2021-01-17LibWeb: Add fast_is<T>() for some DOM and layout node subclassesAndreas Kling
The generic is<T>() uses dynamic_cast which is fine in the majority of cases, but when one of them shows up in profiles, we can make it faster by answering the is-a question manually.
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling