summaryrefslogtreecommitdiff
path: root/Libraries/LibHTML/Layout/LayoutText.h
AgeCommit message (Collapse)Author
2020-03-07LibWeb: Rename directory LibHTML => LibWebAndreas Kling
Let's rename this to LibWeb since it aims to provide more parts of the web platform than just HTML. :^)
2020-03-07LibWeb: Move everything into the Web namespaceAndreas Kling
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-12-18LibHTML: Insert a new linebox for every newline in "white-space: pre"Andreas Kling
2019-11-19LibHTML: Use LayoutText::text_for_rendering() in layout tree dumpsAndreas Kling
This way the fragment offsets make a lot more sense, since they assume whitespace has already been collapsed.
2019-10-15LibHTML: Add is<T> and to<T> helpers for LayoutNode class familyAndreas Kling
2019-10-09LibHTML: Collapse whitespace in LayoutText unless white-space: pre;Andreas Kling
Before breaking the Text node contents into words, collapse all of the whitespace into single space (' ') characters. This fixes broken rendering of paragraphs with newlines in them. :^)
2019-10-06LibHTML: Move font loading from LayoutText to StylePropertiesAndreas Kling
Since LayoutText inherits all of its style information from its parent Element anyway, it makes more sense to load the font at a higher level. And since the font depends only on the style and nothing else, this patch moves font loading (and caching) into StyleProperties. This could be made a lot smarter to avoid loading the same font many times, etc.
2019-10-06LibHTML: LayoutText should inherit from LayoutNode directlyAndreas Kling
There's no need for LayoutText to inherit from LayoutInline. I had the wrong idea here: I was thinking that everything that can be laid out inline should inherit from LayoutInline, but that's clearly not sufficient for something like LayoutReplaced which can be laid out in either way.
2019-10-04LibHTML: Rename LayoutNode::style_properties() to LayoutNode::style()Andreas Kling
2019-10-04LibHTML: LayoutText should always use parent's style propertiesAndreas Kling
This patch makes StyleProperties heap-allocated and ref-counted so that a LayoutNode can be without one. The ref-counting also allows anonymous blocks to share style with their parent block. LayoutText never needs a StyleProperties, since text always inherits style from its parent element. This is handled by style_properties().
2019-10-03LibHTML: Rewrite inline and text layoutAndreas Kling
Inline layout is now done by LayoutBlock. Blocks with inline children will split them into line boxes during layout. A LayoutBlock can have zero or more LineBox objects. Each LineBox represents one visual line. A LineBox can have any number of LineBoxFragment children. A fragment is an offset+length into a specific LayoutNode. To paint a LayoutBlock with inline children, we walk its line boxes, and walk their fragments, painting each fragment at a time by calling LineBoxFragment::render(), which in turn calls the LayoutNode via LayoutText::render_fragment(). Hit testing works similarly. This is very incomplete and has many bugs, but should make it easier for us to move forward with this code.
2019-09-29LibHTML: Make hit testing work for LayoutTextAndreas Kling
LayoutText can't simply rely on its LayoutNode::rect() for hit testing. Instead, we have to iterate over the individual runs and see if we're hitting any of them. Also, LayoutNode::hit_test() now always recurses into children, since we can't trust the rect() to tell the truth (inline rects are wrong.)
2019-09-28LibHTML: Implement renderingSergey Bugaev
2019-09-28LibHTML: Implement LayoutTextSergey Bugaev
2019-09-28LibHTML: Get rid of the style treeSergey Bugaev
We now create a layout tree directly from the DOM tree. This way we don't actually lose text nodes ^)
2019-07-04Libraries: Create top level directory for libraries.Andreas Kling
Things were getting a little crowded in the project root, so this patch moves the Lib*/ directories into Libraries/.