Commit Graph

12 Commits

Author SHA1 Message Date
Andreas Kling
f970578cd4 LibDraw: Rename ImageLoader => ImageDecoder
ImageLoader was not the right name for this, as there is no loading
happening, only decoding. :^)
2019-10-19 20:54:47 +02:00
Andreas Kling
a5f3f332ed LibHTML: Ignore completed image loads for already-destroyed <img>'s
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-19 09:43:05 +02:00
Andreas Kling
18fa662eb2 LibHTML: Use ImageLoader for <img> elements to defer bitmap decoding
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-15 21:53:08 +02:00
Andreas Kling
f4f5ede10a LibHTML: Simplify Node::create_layout_node()
There's no need to pass the StyleResolver to this function. Nodes that
need it can just get it from the document.
2019-10-15 15:06:16 +02:00
Andreas Kling
667b31746a LibHTML: Rename Document's invalidate_{style,layout}() to update_foo() 2019-10-14 17:57:06 +02:00
Andreas Kling
3be6d1aff0 LibHTML: Add ResourceLoader to support protocol-agnostic URL loading
We now support loading both file:// and http:// URLs. Feel free to
visit http://www.serenityos.org/ and enjoy the fancy good times. :^)
2019-10-08 19:37:15 +02:00
Andreas Kling
31ac19543a LibHTML: Use an enum for CSS property ID's
Instead of using string everywhere, have the CSS parser produce enum
values, since they are a lot nicer to work with.

In the future we should generate most of this code based on a list of
supported CSS properties.
2019-10-08 15:35:05 +02:00
Conrad Pankoff
b240500107 LibHTML: Support width/height attributes on images 2019-10-06 14:33:00 +02:00
Conrad Pankoff
1ef53be2f3 LibHTML: Load image resource when src attribute is set 2019-10-06 14:33:00 +02:00
Andreas Kling
958b395418 LibHTML: Support rendering <img src> with file:// URLs
We can now show images loaded from local file:// URLs. Pretty neat :^)
2019-10-05 23:41:14 +02:00
Andreas Kling
ee567cdc3d LibHTML: Implement basic layout for inline <img alt>
LayoutReplaced objects can now participate in inline layout.

It's very hackish, but basically LayoutReplaced will just add itself to
the last line in the containing block.

This patch gets rid of the idea that only LayoutInline subclasses can
be split into lines, by moving the split_into_lines() virtual up to
LayoutNode and overriding it in LayoutReplaced.
2019-10-05 23:29:01 +02:00
Andreas Kling
09dccb3224 LibHTML: Flesh out <img> element with LayoutImage and LayoutReplaced
This patch adds parsing of <img> into HTMLImageElement objects.
It also adds LayoutImage and its parent class LayoutReplaced, which is
going to represent CSS "replaced elements."
2019-10-05 23:29:01 +02:00