summaryrefslogtreecommitdiff
path: root/Libraries
AgeCommit message (Collapse)Author
2019-10-19LibDraw: Store emojis in a HashMap<u32, RefPtr<GraphicsBitmap>>Andreas Kling
Get rid of the dedicated Emoji class to make it easier to store a null value signifying a failed lookup. This allows us to remember failed lookups, making subsequent failures for the same codepoint much faster. :^)
2019-10-19LibHTML: Add TreeNode<T>::for_each_in_subtree(callback)Andreas Kling
This helper invokes a callback for the node and each of its descendants in pre-order.
2019-10-19LibDraw: Have the PNGImageLoaderPlugin remember if it failed to decodeAndreas Kling
Instead of trying again when asked repeatedly, just remember if it didn't work out the first time.
2019-10-19LibHTML: Skip over CSS @media rules for nowAndreas Kling
2019-10-19LibHTML: Use the correct inherited color for LayoutListItemMarkerAndreas Kling
2019-10-19LibHTML: Implement basic tiled background image supportAndreas Kling
It's now possible to set a page background image via <body background>. Also, HtmlView now officially handles rendering the body element's background (color, image or both.) LayoutBox is responsible for all other background rendering. Note that it's not yet possible to use CSS background-image properties directly, since we can't parse them yet. :^)
2019-10-19LibDraw: Rename Painter::blit_tiled() => draw_tiled_bitmap()Andreas Kling
Also change the API to take a destination rect instead of a source rect since internally it was basically creating a destination rect from the source rect anyway. It was a little confusing.
2019-10-19LibHTML: Replaced elements should not break lines at start of lineAndreas Kling
If the current line box already has zero width, there's no point in inserting a line break to make space, since we'll just be at x=0 after breaking as well. This removes an ugly unnecessary line break before images wider than their containing block. :^)
2019-10-19LibHTML: Ignore completed image loads for already-destroyed <img>'sAndreas Kling
Capture a weak pointer to the element and pass that to the load finish callback in HTMLImageElement::load_image(). This allows us to ignore completed loads if the <img> element is no longer around.
2019-10-19LibHTML: Make TreeNode inherit from Weakable by defaultAndreas Kling
This makes Node and LayoutNode weakable. Frame was already weakable.
2019-10-19LibHTML: Allow loading of PNG's directly into the HtmlViewAndreas Kling
When loading a URL that ends in ".png", we now construct a simple DOM document to contain the image. It also shows the image dimensions in the document title. Because we use <img src> to load the image into the synthetic document, we end up loading the image resource twice. This issue will go away once we have a smarter, caching, loader mechanism.
2019-10-18LibHTML: Add a simple font cacheAndreas Kling
The FontCache caches the result of font lookups. The cache key is a simple object called FontSelector which consists of the font family and font weight (both strings.) This drastically reduces time spent in font lookup.
2019-10-18LibHTML: Preserve UTF-8 codepoints when collapsing whitespaceAndreas Kling
This is extremely awkward and I'm sure there are many better ways to achieve this..
2019-10-18LibHTML: CSS parser should trim whitespace from valuesAndreas Kling
This makes sure that values like "auto !important" don't have a space character after "auto".
2019-10-18LibHTML: Add LayoutNode::first_ancestor_of_type<T>()Andreas Kling
2019-10-18LibHTML: Add typed child/sibling traversal helpers for LayoutNodeAndreas Kling
Also add some special variants for the table classes, to make it a bit more pleasant to write table code. :^)
2019-10-17LibHTML: Only accumulate Text children's content in inline stylesheetsAndreas Kling
Some inline stylesheets use HTML comments like "<!--blah blah-->". The HTML parser currently generates a comment child node of the <style> element whenever this happens, and we don't want the comment itself to be interpreted as part of the stylesheet.
2019-10-17LibHTML: Don't assert when encountering an unknown font-weightAndreas Kling
2019-10-17LibHTML: Hard-code LayoutTable to never have inline childrenAndreas Kling
This is a total hack to get around the auto-detection mechanism for whether a block has inline or block children. We'll say that tables never have inline children for now, and then anything that actually turns out to be an inline child will just be ignored by layout.
2019-10-17LibHTML: Add is<T> helpers for the table-related LayoutNode subclassesAndreas Kling
2019-10-17LibHTML: Make "children are inline" flag imperativeAndreas Kling
Instead of computing whether a block's children are inline based on the first child, make it an imperatively-set flag. This gives us some flexibility to ignore things like text nodes inside a <table>, for example. I'm still unsure what the "correct" way to deal with those will be. We'll find out sooner or later. :^)
2019-10-17LibHTML: Add stub classes for basic table layoutAndreas Kling
This class introduces LayoutTable, LayoutTableRow and LayoutTableCell. These are produced by "display" values table, table-row and table-cell respectively. Note that there's no layout happening yet, I'm just adding the classes.
2019-10-17LibHTML: Use is_inline() instead of !is_block() when building treeAndreas Kling
2019-10-17LibHTML: Add basic keyboard navigation (up/down/pgdn/pgup/home/end/etc)Andreas Kling
2019-10-17LibC: Better strtok implementation (string.h)Jonah Alligood
2019-10-17LibC: strtok is now implemented (string.h)Jonah Alligood
2019-10-17LibM: Implement various functions.Andreas Kling
Path from Anonymous.
2019-10-17LibC: sys_errlist should be const char* constAndreas Kling
Patch from Anonymous.
2019-10-16LibHTML: Add the <center> elementAndreas Kling
This is really just "center { display: block; text-align: center; }" in the default stylesheet, but it totally works!
2019-10-16LibHTML: Implement CSS text-align: left/center/rightAndreas Kling
This was easier than I imagined; we just shift each line box to the left based on the alignment and the remaining space on each line. :^)
2019-10-16LibDraw: Teach PNGLoader to only decode enough of learn the image sizeAndreas Kling
2019-10-16LibAudio: Fixed stuttery playback of audioTill Mayer
When playing an ABuffer, the count of samples were determined by the size of the SharedBuffer. This caused small pauses of up to 512 samples during the playback, when the size of the shared buffer was rounded up to a multiple of 4096. This problem was amplified by the fact that the AResampleHelper was created every time a new chunk of audio was to be processed, causing inconsistencies in the playback of wav files.
2019-10-16LibC: Remove debug spam in gethostbyname()Andreas Kling
2019-10-15LibHTML: LayoutBlock::hit_test() was calling the wrong parent classAndreas Kling
Oops, we now need to call LayoutBox instead of LayoutNode for blocks with non-inline children.
2019-10-15LibHTML: Use ImageLoader for <img> elements to defer bitmap decodingAndreas Kling
We now wait until the pixels are actually needed before fully decoding images in <img> elements. This needs some more work and is currently a bit memory-wasteful since we'll hang on to the raw image data forever.
2019-10-15LibHTML: Add the currently visible viewport rect to RenderingContextAndreas Kling
This will allow rendering code to skip various things sometimes. :^)
2019-10-15LibDraw: Add ImageLoader, a simple abstraction for image loadingAndreas Kling
An ImageLoader is a generic interface for loading encoded image data of any supported format. It has an ImageLoaderPlugin internally that does all the work. This patch adds an initial PNGImageLoaderPlugin that knows how to retrieve the size of a PNG, and the bitmap. The API is divided into size() and bitmap() to facilitate geometry-only decoding. This will be useful in places like LibHTML where we need dimensions for layout purposes but can wait with the bitmap until later.
2019-10-15LibHTML: LayoutNode::set_needs_display() needs to invalidate fragmentsAndreas Kling
If a LayoutNode is split into line box fragments, we need to walk our fragments and invalidate them. It was not enough to do this only for LayoutBox nodes.
2019-10-15LibCore: Put HTTP debug spam behind FOO_DEBUG macrosAndreas Kling
2019-10-15LibHTML: Fix missing backgrounds an borders after LayoutBox refactoringAndreas Kling
The render() implementation in both LayoutBlock and LayoutBox need to be calling the immediate parent class. :^)
2019-10-15LibHTML: Introduce LayoutBox and LayoutNodeWithStyleAndBoxModelMetricsAndreas Kling
To streamline the layout tree and remove irrelevant data from classes that don't need it, this patch adds two new LayoutNode subclasses. LayoutNodeWithStyleAndBoxModelMetrics should be inherited by any layout node that cares about box model metrics (margin, border, and padding.) LayoutBox should be inherited by any layout node that can have a rect. This makes LayoutText significantly smaller (from 140 to 40 bytes) and clarifies a lot of things about the layout tree. I'm also adding next_sibling() and previous_sibling() overloads to LayoutBlock that return a LayoutBlock*. This is okay since blocks only ever have block siblings. Do also note that the semantics of is<T> slightly change in this patch: is<T>(nullptr) now returns true, to facilitate allowing to<T>(nullptr).
2019-10-15LibHTML: Simplify Node::create_layout_node()Andreas Kling
There's no need to pass the StyleResolver to this function. Nodes that need it can just get it from the document.
2019-10-15LibHTML: Move layout tree building to a LayoutTreeBuilder classAndreas Kling
Building a whole layout tree shouldn't be a concern of Node, so this patch moves it to a separate class.
2019-10-15LibHTML: Add is<T> and to<T> helpers for LayoutNode class familyAndreas Kling
2019-10-15LibC: syslog and lots of compat stuff for itCalvin Buckley
This is an implementation of syslog with some OpenBSD extensions. There is no syslogd support (so it only logs to dbgprintf/stderr), but otherwise is functional. Many weird defines are always present, because some syslog users in the wild check for their existence.
2019-10-14LibCore: Don't crash in IPC client/server on EAGAINAndreas Kling
Instead, just sched_yield() and try again. This makes the WindowServer not fall apart whenever clients take a bit too long to respond. Fixes #656.
2019-10-14LibHTML: Implement basic partial style invalidationAndreas Kling
This patch makes it possible to call Node::invalidate_style() and have that node and all of its ancestors recompute their style. We then figure out if the new style is visually different from the old style, and if so do a paint invalidation with set_needs_display(). Note that the "are they visually different" code is very incomplete! Use this to make hover effects a lot more efficient. They no longer cause a full relayout+repaint, but only a style invalidation. Style invalidations are still quite heavy though, and there's a lot of room for improvement there. :^)
2019-10-14LibHTML: Rename Document's invalidate_{style,layout}() to update_foo()Andreas Kling
2019-10-14LibHTML: Implement basic :hover pseudo-class supportAndreas Kling
This is currently very aggressive. Whenever the Document's hovered node changes, we invalidate all style and do a full relayout. It does look cool though. So cool that I'm adding it to the default stylesheet. :^)
2019-10-14LibHTML: Parse the :link and :hover CSS pseudo-classesAndreas Kling
We don't actually do anything with these yet, but now the values will be there for the selector engine to look at when it feels ready. :^)