summaryrefslogtreecommitdiff
path: root/Libraries/LibWeb/Layout/TextNode.cpp
AgeCommit message (Collapse)Author
2021-01-06LibWeb: Don't prune whitespace nodes from layout treeAndreas Kling
Various whitespace-related issues have been fixed, and support for the different CSS white-space values is improved enough that I think we can stop doing the hack where we just prune whitespace nodes from the tree and actually let them show up. This is a nice step forward for correctness with the slight downside of cluttering up layout tree dumps with tons of whitespace text nodes. But hey, that's the web we know & love. :^) Fixes #4427.
2021-01-06LibWeb: Rename Layout::Node::style() => computed_values()Andreas Kling
2021-01-06LibWeb: Store the used font in Layout::NodeWithStyleAndreas Kling
This is a step towards not having to carry the full set of specified values around with every layout node.
2021-01-06LibWeb: Simplify one kind of whitespace collapsingAndreas Kling
For a non-empty TextNode chunk that begins with collapsible whitespace, we can simply step right over the whitespace by adjusting the chunk.
2020-12-18LibWeb: Only preserve full whitspace for white-space: pre{,-wrap}Andreas Kling
2020-12-17LibWeb: Whitespace that causes a line to wrap should be hiddenAndreas Kling
We were only pruning trailing whitespace on lines. This patch makes it so we also don't add whitespace as the leading line box fragment on new lines. This logic is pretty crufty and I think we can do better, but for now I've just made it handle this extra case so we can stop having lines that start with a space character. :^)
2020-12-15LibWeb: Put final foreground/background colors in LayoutStyleAndreas Kling
This way we don't have to look them up in the CSS::StyleProperties every time we want to paint with them.
2020-12-15LibWeb: Use IdentifierStyleValue for CSS 'text-transform'Andreas Kling
2020-12-15LibWeb: Use IdentifierStyleValue for CSS 'text-decoration-line'Andreas Kling
Also 'text-decoration' is actually a shorthand, so treat it that way.
2020-12-10LibWeb: Use the surrounding text color as the caret colorAndreas Kling
This way you can always see the cursor as long (as you can see the text you are editing.)
2020-12-06LibWeb: Pass current target box to BFC::run()Andreas Kling
The BFC "context box" is now the outer box of the block formatting context. Previously the context box was always the current target box, which made it hard to reason about who was really the containing block of whom in various places. Note that IFC still has the containing block as its context box, this change only affects BFC. However, to clarify the situation in IFC, I've added a containing_block() getter than returns the context_box().
2020-12-05LibWeb: Fix off-by-one when computing available space between floatsAndreas Kling
Whoops, this explains why things were not lining up correctly. :^)
2020-12-05LibWeb: First slightly naive implementation of CSS floats :^)Andreas Kling
Boxes can now be floated left or right, which makes text within the same block formatting context flow around them. We were creating way too many block formatting contexts. As it turns out, we don't need one for every new block, but rather there's a set of rules that determines whether a given block creates a new block formatting context. Each BFC keeps track of the floating boxes within it, and IFC's can then query it to find the available space for line boxes. There's a huge hack in here where we assume all lines are the exact line-height. Making this work with vertically non-uniform lines will require some architectural changes.
2020-12-03LibWeb: Paint line box fragments during all paint phasesAndreas Kling
Fragment painting was very limited by only being called during the foreground paint phase. We now paint fragments as part of every phase (and the phase is passed to paint_fragment() of course!)
2020-11-22LibWeb: Rename LayoutNode classes and move them into Layout namespaceAndreas Kling
Bring the names of various boxes closer to spec language. This should hopefully make things easier to understand and hack on. :^) Some notable changes: - LayoutNode -> Layout::Node - LayoutBox -> Layout::Box - LayoutBlock -> Layout::BlockBox - LayoutReplaced -> Layout::ReplacedBox - LayoutDocument -> Layout::InitialContainingBlockBox - LayoutText -> Layout::TextNode - LayoutInline -> Layout::InlineNode Note that this is not strictly a "box tree" as we also hang inline/text nodes in the same tree, and they don't generate boxes. (Instead, they contribute line box fragments to their containing block!)