Commit graph

4420 commits

Author SHA1 Message Date
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
Sergey Bugaev
03cca4510a LibHTML: Fix LayoutDocument height computation 2019-09-28 18:29:42 +02:00
Sergey Bugaev
fa876320eb LibHTML: Fix LayoutBlock vertical position & height computations 2019-09-28 18:29:42 +02:00
Sergey Bugaev
c1ef63379c LibHTML: Add Document::normalize()
This method wraps the document tree in <html> and <body> elements if needed.
2019-09-28 18:29:42 +02:00
Sergey Bugaev
599edba7a3 LibHTML: Move layout tree building to Node
This also fixes another bug with inline wrappers. Namely,
we should only add inline wrappers if a block node has
both non-block (inline or text) and block children.
2019-09-28 18:29:42 +02:00
Sergey Bugaev
841ae44392 LibHTML: Implement basic style inheritance 2019-09-28 18:29:42 +02:00
Sergey Bugaev
3be897a3d5 LibHTML: Add ComputedStyle::full_margin()
This is an utility to easily get the full margin size
(the sum of margin proper, border and padding) of an
element in pixels.
2019-09-28 18:29:42 +02:00
Sergey Bugaev
a42f4c078e LibHTML: Get rid of ComputedStyle::offset()
This is redundant since we already have LayoutNode::rect().
2019-09-28 18:29:42 +02:00
Sergey Bugaev
756bdb2a42 LibHTML: Fix moving inline elements to unrelated block elements
LayoutBlock::inline_wrapper() is supposed to return an inline wrapper,
a special anonymous block element intended to wrap inline children of
a block element that also has block children. Add a check for whether
the existing block child element is anonymous (refers to a DOM node),
and if it's not create a new anonymous wrapper.
2019-09-28 18:29:42 +02:00
Sergey Bugaev
08c751d130 LibHTML: Add StyleProperties::string_or_fallback()
This is an utility to go with the existing length_or_fallback().
2019-09-28 18:29:42 +02:00
Sergey Bugaev
08d9883306 AK: Add StringBuilder::string_view() and StringBuilder::clear()
The former allows you to inspect the string while it's being built.
It's an explicit method rather than `operator StringView()` because
you must remember you can only look at it in between modifications;
appending to the StringBuilder invalidates the StringView.

The latter lets you clear the state of a StringBuilder explicitly, to
start from an empty string again.
2019-09-28 18:29:42 +02:00
Sergey Bugaev
fd0aa5dd43 LibHTML: Get rid of the style tree
We now create a layout tree directly from the DOM tree.
This way we don't actually lose text nodes ^)
2019-09-28 18:29:42 +02:00
Sergey Bugaev
a9ebd676e5 LibHTML: Add install.sh 2019-09-28 18:29:42 +02:00
Sergey Bugaev
fed96f455d Base: Write some initial man pages
It ain't much, but it's honest work!
2019-09-28 18:29:42 +02:00
Sergey Bugaev
36eea6c04b Userland: Add a man command 2019-09-28 18:29:42 +02:00
Sergey Bugaev
3089b539f0 Userland: Add an md command
This command uses LibMarkdown to parse and render Markdown documents
either for the terminal using escape sequences, or to HTML. For example,
you can now do:

$ md ReadMe.md

to read the Serenity ReadMe file ^)
2019-09-28 18:29:42 +02:00
Sergey Bugaev
2e80b2b32f Libraries: Add LibMarkdown 2019-09-28 18:29:42 +02:00
Sergey Bugaev
dd5541fefc Terminal: Add underline support 2019-09-28 18:29:42 +02:00
Sergey Bugaev
3652bec746 Kernel: Make proper use of the new keep_empty argument 2019-09-28 18:29:42 +02:00
Sergey Bugaev
127d168def AK: Add a keep_empty argument to String[View]::substring{_view} 2019-09-28 18:29:42 +02:00
Conrad Pankoff
07ca753124 Kernel: Fix BIOS date/time on hardware
It turns out some BIOS vendors don't support non-BCD date/time mode, but
we were relying on it being available. We no longer do this, but instead
check whether the BIOS claims to provide BCD or regular binary values for
its date/time data.
2019-09-28 13:59:49 +02:00
Conrad Pankoff
b03a0534e0 Userland: Add disk_benchmark program to test read/write speeds 2019-09-28 09:29:10 +02:00
Conrad Pankoff
062218b4cf Kernel: Support writing doubly-indirect ext2 blocks 2019-09-28 09:29:10 +02:00