Commit Graph

4492 Commits

Author SHA1 Message Date
Andreas Kling
e38b454e11 LibGUI: Fix crash in GAboutDialog::show()
It needed some updating to the new ref-counted CObject ways.
2019-09-29 20:37:02 +02:00
Andreas Kling
61bc597b2d Demos: Remove useless PaintTest program 2019-09-29 19:54:30 +02:00
Andreas Kling
c9bab8b870 LibHTML: Reduce debug spam in HtmlView mouse event handlers 2019-09-29 18:10:39 +02:00
Andreas Kling
17c06d7c9a Base: Move HTML test pages into /home/anon/html
Also add a simple test page for inline style sheets.
2019-09-29 18:07:36 +02:00
Andreas Kling
37a37accd4 LibHTML: Implement basic support for background-color 2019-09-29 18:05:37 +02:00
Andreas Kling
a4fccc02ec LibHTML: Add a simple <style> element for inline CSS 2019-09-29 17:45:42 +02:00
Andreas Kling
7912592f89 LibHTML: Add inserted_into() and removed_from() TreeNode callbacks
These will be called when a Node or LayoutNode is inserted or removed
from a tree. They get the parent node as an argument.
2019-09-29 17:40:39 +02:00
Andreas Kling
402c6de5c9 LibHTML: Make <div> elements display: block 2019-09-29 17:26:52 +02:00
Andreas Kling
830e18e486 LibHTML: Fix broken parsing of ID and class selectors
We were forgetting to consume the '#' and '.' characters.
2019-09-29 17:26:05 +02:00
Andreas Kling
ed39e0f6f7 LibHTML: Non-element (Text) Nodes should get style from their parent
Text nodes don't have style of their own, so just inherit all the style
from the parent element.
2019-09-29 17:22:44 +02:00
Andreas Kling
8d822ff82b html: Set the window title based on the HTML document's title
If the loaded document has a <title>, we now show that in the app's
window title bar! :^)
2019-09-29 16:26:28 +02:00
Andreas Kling
b94c7665a9 LibHTML: Add a way to get a Document's title
You can now query Document::title() to get a String containing whatever
is inside the document's <title> tag.

In support of this, this patch adds the <html>, <head> and <title>
elements.
2019-09-29 16:24:57 +02:00
Andreas Kling
0c6af2d5b4 LibHTML: Add Node::text_content()
This returns a String built from all of a Node's text descendants,
including itself.
2019-09-29 16:23:09 +02:00
Andreas Kling
93230386f7 Build: Add Libraries/LibHTML/ to the library search paths
This makes my hacky incremental rebuild commands work for LibHTML.
2019-09-29 16:20:54 +02:00
Andreas Kling
99fc7033b5 AK: Add StringBuilder::length() and trim(int)
Sometimes you want to trim a byte or two off the end.
2019-09-29 16:20:09 +02:00
Andreas Kling
b5c587a106 Base: Add some title attributes to the small HTML test file :^) 2019-09-29 12:26:15 +02:00
Andreas Kling
5b942b519c LibHTML: Add HTMLHeadingElement for <h1> through <h6> 2019-09-29 12:26:15 +02:00
Andreas Kling
f38b0f667e LibHTML: Implement basic HTMLElement.title support
We now show a tooltip for the hovered node's enclosing HTML element's
title attribute, if one is present.

This patch also adds HTMLHeadingElement. The tags h1-h6 will now create
the right kind of objects.
2019-09-29 12:26:13 +02:00
Andreas Kling
92aae72025 LibHTML: Detect link clicks
Clicking on a link in an HtmlView will now call on_link_click(String)
if present, allowing you to implement basic hypertext navigation. :^)
2019-09-29 12:04:02 +02:00
Andreas Kling
b477aff843 LibHTML: Detect hovering over links
HtmlView now calls Node::enclosing_link_element() to find the nearest
ancestor <a> element.

This patch also adds HTMLElement and HTMLAnchorElement.
2019-09-29 11:59:38 +02:00
Andreas Kling
88de955073 LibHTML: Have Document track its hovered Node
This gets set from HtmlView::mousemove_event() at the moment.
2019-09-29 11:50:35 +02:00
Andreas Kling
754e6e0f67 LibHTML: Add LayoutNode::document() for easy access
Every LayoutNode indirectly belongs to some Document. For anonymous
LayoutNodes, we simply traverse the parent chain until we find someone
with a Node from which we can get a Document&.
2019-09-29 11:43:33 +02:00
Andreas Kling
1b8509a0c9 LibHTML: Make sure every DOM Node belongs to a Document 2019-09-29 11:43:07 +02:00
Andreas Kling
13860e4dd8 LibHTML: Make hit testing work for LayoutText
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-29 11:32:00 +02:00
Brandon Scott
aac8b091a4 LibDraw: Implemented support for more PNG formats (#614)
- Implemented support for more PNG formats including 16-bit per channel
  and 8-bit indexed with palette.
- Made the library a little more resistant to crashes by returning
  false for known but unsupported formats.
2019-09-29 09:55:28 +02:00
Andreas Kling
dba74abe93 Base: Fix minor typos in man pages 2019-09-28 23:06:22 +02:00
Andreas Kling
3de4b99dc3 LibHTML: Implement naive hit testing
We don't have proper line boxes yet, so we can't easily hit test
inline text.
2019-09-28 23:04:59 +02:00
Andreas Kling
3ed41abba4 Base: Add a little hyperlink to the small HTML test page
This will be useful for testing rendering, hit testing, etc.
2019-09-28 23:00:47 +02:00
Andreas Kling
fb4702dd49 LibHTML: Add virtual Node::tag_name()
This is analogous to the DOM's Node.tagName and makes it easy to ask
"hey, what kinda thing is this Node?"
2019-09-28 22:59:16 +02:00
Andreas Kling
a768724270 LibHTML: Make <a> tags blue and underline by default
In the future, this should only apply to "a:link", but since we don't
have pseudo-classes yet, all "a" tags will do for now.
2019-09-28 22:57:46 +02:00
Andreas Kling
8271ad40a5 LibHTML: Implement basic support for "text-decoration: underline" 2019-09-28 22:57:46 +02:00
Andreas Kling
62cbaa74f3 LibHTML: Respect the CSS "color" property for text
Also remove the color values from the ComputedStyle object and get them
via StyleProperties instead.

At the moment, we only handle colors that Color::from_string() parses.
2019-09-28 22:57:46 +02:00
Andreas Kling
b8cab2a934 Meta: Tweak the Qt Creator project updater a bit 2019-09-28 22:57:46 +02:00
Larkin Nickle
ab67f74588 TelnetServer: Accept arbitrary command with -c
For example, this allows you to do something like
`TelnetServer -c /usr/bin/nyancat` to have the TelnetServer run
`/usr/bin/nyancat` instead of `/bin/Shell`.
2019-09-28 22:37:14 +02:00
Sergey Bugaev
801fe7beac SystemMonitor: Display whether an fd is cloexec and blocking 2019-09-28 22:27:45 +02:00
Sergey Bugaev
9a41dda029 Kernel: Expose blocking and cloexec fd flags in ProcFS 2019-09-28 22:27:45 +02:00
Andreas Kling
eb18825fce Base: Add man pages for create_shared_buffer() and share_buffer_with() 2019-09-28 21:16:26 +02:00
Andreas Kling
d43c7d55f4 LibMarkdown: Support escaping of special characters
This allows you to escape function\_names\_like\_this() :^)
2019-09-28 20:51:46 +02:00
Andreas Kling
83f643d43c LibHTML: Make h1 and h2 tags use Pebbleton Bold by default :^) 2019-09-28 19:14:36 +02:00
Andreas Kling
5673ff3694 Base: Add a bold variant of the Pebbleton 11px font 2019-09-28 19:14:23 +02:00
Andreas Kling
09ad58f837 Help: Don't crash on startup when non-md man pages are present :^) 2019-09-28 18:38:27 +02:00
Sergey Bugaev
02ee8cbbe2 Applications: Add a new Help app
This is a neat simple app that can display the Serenity manual ^)
2019-09-28 18:29:42 +02:00
Sergey Bugaev
6ec625d6f3 Userland+LibHTML: Add the html command
This is a simple command that can be used to display HTML from a given
file, or from the standard input, in an HtmlView. It replaces the `tho`
(test HTML output) command.
2019-09-28 18:29:42 +02:00
Sergey Bugaev
b9493ba783 LibHTML: Introduce the HtmlView widget
This is a GWidget that can display contents of an HTML document.
It replaces the Frame class.
2019-09-28 18:29:42 +02:00
Sergey Bugaev
8a2beaf52b LibHTML: Tweak the default CSS style 2019-09-28 18:29:42 +02:00
Sergey Bugaev
db8a1a6aba LibHTML: Parse HTML escape sequences 2019-09-28 18:29:42 +02:00
Sergey Bugaev
6491493e26 LibHTML: Hide debugging output unless HTML_DEBUG is defined 2019-09-28 18:29:42 +02:00
Sergey Bugaev
235dee8c42 LibHTML: Implement rendering 2019-09-28 18:29:42 +02:00
Sergey Bugaev
93003bfda1 LibHTML: Implement LayoutText 2019-09-28 18:29:42 +02:00
Sergey Bugaev
9f8d776c70 LibHTML: Implement LayoutInline::layout()
This currently uses a gross hack where it subtracts 11px from the
previous sibling bottom to calculate its top. This should be fixed
by switching to a proper two-phase line layouting model, were we
first distribute inline elements into lines and figure out their
horizontal positions and heights; then compute the needed line
heights and position inline elements there vertically.
2019-09-28 18:29:42 +02:00