Commit graph

10793 commits

Author SHA1 Message Date
Maciej Zygmanowski 48cd26f12d LibKeyboard: Don't crash when file is empty
Just return empty map, like when file error occurs.
2020-06-29 13:27:13 +02:00
Andreas Kling 53573f6fb1 LibWeb: Clamp text fragment selection to the fragment
Also add 1px of width to partial fragment selections, since that ends
up looking nicer during interactive mouse selection.
2020-06-29 12:47:21 +02:00
Nico Weber 12cbc4ad0d Everywhere: Replace some uses of fork/exec with posix_spawn
It's less code, and it's potentially more efficient once
posix_spawn is a real syscall.
2020-06-29 12:04:27 +02:00
Andreas Kling 301ac3c7e5 LibWeb: Improve hit testing on the right of line boxes
We now remember the last candidate fragment when hit testing past the
right end of text and use that as the fallback result if nothing else
matches. This makes it possible to drag-select outside the line boxes
in a way that feels mostly natural. :^)
2020-06-29 00:39:51 +02:00
Andreas Kling 9177eea8fe LibWeb: Add LayoutRange::normalized()
We use this to ensure that we're always working with a selection where
the start() is before the end() in document order. That simplifies all
the logic around this.
2020-06-29 00:39:51 +02:00
Andreas Kling 706fc3d1aa LibWeb: Paint the text selection :^)
Text selection currently works at the LayoutNode level. The root of the
layout tree has a LayoutRange selection() which in turn has two
LayoutPosition objects: start() and end().

A LayoutPosition is a LayoutNode + a text offset into that node.

We handle the selection painting in LayoutText::paint_fragment(), after
the normal painting is finished. The basic mechanism is that each
LayoutFragment is queried for its selection_rect(), and if a non-empty
rect is returned, we clip to it and paint the text once more.
2020-06-29 00:39:51 +02:00
Andreas Kling 2762e3d80a LibWeb: Rename LineBoxFragment::render() => paint()
Also LayoutText::render_fragment() => render(). This matches the names
in the rest of LibWeb.
2020-06-28 23:07:44 +02:00
Andreas Kling b2a7943b4e LibX86: Disassemble the XADD instruction
This makes functrace usable again :^)
2020-06-28 21:10:53 +02:00
Andreas Kling dcc25f7d7a LibWeb: Layout table-cell contents once again once final width is known
This makes centered and right-aligned table-cell contents position
itself correctly.
2020-06-28 20:54:45 +02:00
devashish 4924b86b2a LibGfx+JPGLoader: Print failure message for progressive JPEGs 2020-06-28 16:56:59 +02:00
Luke 2df69317f1 LibWeb: Implement almost all missing tokenizer cases 2020-06-28 16:56:26 +02:00
Andreas Kling f270f1f274 LibWeb: Give the <blockquote> element some margins in the UA style 2020-06-28 15:26:05 +02:00
Andreas Kling 7d3c8d066f LibWeb: Support "pt" length units :^) 2020-06-28 15:25:32 +02:00
Andreas Kling 7fc988b919 LibWeb: Start working on supporting fixed table layouts
Sometimes people make tables with a specific width. In those cases,
we can't just use the auto-sizing algorithm, but instead have to
respect whatever width the content specifies.

This is a bit rickety right now, since we don't implement generation
of anonymous table boxes.

The basic mechanism here is that block layout (which table-cell uses)
now has a virtual way of asking for the width of the logical containing
block. This is necessary as table-row does not produce a block-level
element and so was previously unable to provide a containing block
width for table-cell layout.

If the table has a non-auto specified width, we now interpret that as
a request to use fixed table layout. This will evolve over time. :^)
2020-06-28 15:13:56 +02:00
Andreas Kling daa88448e1 LibWeb: Add Length::is_undefined_or_auto()
Quite often, we want the same behavior in both cases. This allows us
to express that with a single method.
2020-06-28 15:08:37 +02:00
sppmacd abdf36b171 SystemMenu: Fix shutdown dialog
It was shutting down even if selected Restart.
2020-06-28 14:32:17 +02:00
Andreas Kling b8dc1fc195 LibWeb: Turn <td width> into a CSS width property 2020-06-28 14:30:37 +02:00
Andreas Kling 38d6cc8598 LibWeb: Convert uppercase selector tag names to lowercase internally
This is necessary for some older content to work correctly. There's
probably a nicer (and correct-er) way to do this. Deferring to the
new CSS parser.
2020-06-28 12:58:04 +02:00
Andreas Kling fd32f24753 LibWeb: Tweak default style for <hr> to use em units for margin values 2020-06-28 12:57:42 +02:00
Andreas Kling 9e642827fc LibWeb: Don't tolerate unit-less lengths (except 0) in standards mode
"width: 500" is not a valid CSS property in standards mode and should
be ignored.

To plumb the quirks-mode flag into CSS parsing, this patch adds a new
CSS::ParsingContext object that must be passed to the CSS parser.
Currently it only allows you to check the quirks-mode flag. In the
future it will be a good place to put additional information needed
for things like relative URL resolution, etc.

This narrows <div class=parser> on ACID2 to the correct width. :^)
2020-06-28 12:46:40 +02:00
Andreas Kling c1acf67715 LibWeb: Use length units and shorthands in the default UA style sheet 2020-06-28 12:12:01 +02:00
Andreas Kling 9576f6b1d4 LibWeb: Collapse top and bottom margin of empty sibling blocks
Margin collapsing is a bit confusing, but if I understand correctly,
when collapsing a box's top margin with the vertically adjacent
sibling box above, we should "skip over" empty (0-height) boxes and
collapse their margin with *their* vertically adjacent sibling box
above, etc. Iterating until we hit the first non-empty in-flow block.

This pulls up the bottom part of the face on ACID2. :^)
2020-06-28 11:20:15 +02:00
Andreas Kling e50fa413cb WindowServer: Move window title bar icons 1px to the right
This makes wider icons look better, since they no longer rub up against
the left edge.
2020-06-28 00:09:01 +02:00
Andrew Kaster 4f71bd54a7 Documentation: Add filesystem note to WSL2 notes
WSL2 is now available in non-insider builds of Windows, starting
with version 2004.

Add a filesystem note regarding use of /mnt/c et al from WSL2 for
compiling serenity. Namely, recommend against it as the performance
across the 9p file system protocol is terrible for IO heavy jobs.
2020-06-28 00:06:27 +02:00
devashish 9f58624802 DisplaySettings: Allow setting wallpapers from outside /res/wallpapers
Ideally, we would copy the file to `/res/wallpapers`, add an entry to
`ComboBox` model and set the index to this entry. I didn't want to
touch anything outside of `DisplaySettings`, so this is more of a
workaround :^)
2020-06-28 00:06:09 +02:00
Andrew Kaster 3a4e121904 Browser: Add right-click context menu to tabs
Right clicking on a position in the PageView of a tab will open a
context menu with common actions like back, forward, reload, view
source and inspect DOM. :^)
2020-06-28 00:05:08 +02:00
Andrew Kaster cc675cbe24 LibWeb: Add Page context menu request
Pages can request a context menu on right click. This is plumbed
through the PageClient.
2020-06-28 00:05:08 +02:00
Hüseyin ASLITÜRK d28a824d4c
QuickShow: Fix for zooming with mouse wheel (#2650)
Fixes #2648.
2020-06-28 00:04:11 +02:00
Andreas Kling 8d2194bdbd LibWeb: Make DOM timers cancellable and stop leaking them
This patch adds a Web::Timer object that represents a single timer
registration made with window.setTimeout() or window.setInterval().
All live timers are owned by the DOM Window object.

The timers can be stopped via clearTimeout() or clearInterval().
Note that those API's are actually interchangeable, but we have to
support both.
2020-06-27 20:02:04 +02:00
Peter Elliott e1aef94a40 Kernel: Make Random work on CPUs without rdrand
- If rdseed is not available, fallback to rdrand.
- If rdrand is not available, block for entropy, or use insecure prng
  depending on if user wants fast or good random.
2020-06-27 19:40:33 +02:00
devashish 1eb338ab71 LibGfx+JPGLoader: Fix decoding outside of LibWeb
The DC reset interval was initialized to garbage :)
2020-06-27 18:33:11 +02:00
devashish 58a5af1dcd LaunchServer: Associate JPEG files with QuickShow 2020-06-27 18:33:11 +02:00
AnotherTest 880c3fb83f Userland: Add a 'test' utility
This adds an incomplete implementation of the test util, missing some
user/group checks, and `-l STRING`.
It also symlinks '[' to 'test'.
2020-06-27 16:08:52 +02:00
AnotherTest a6fd969d93 LibLine: Support multiline editing
This commit also updates Shell, which uses actual_rendered_length.
2020-06-27 15:39:03 +02:00
Kevin Meyer 22b20c381f LibWeb: Implement remaining missing tokenizer EOF cases 2020-06-27 13:27:10 +02:00
Hüseyin ASLITÜRK b05fd9b15b Base: Test web page and images for PGM image file type 2020-06-27 13:01:27 +02:00
Hüseyin ASLITÜRK dc5b73c43a LibGfx: Add PGM image file type support 2020-06-27 13:01:27 +02:00
Hüseyin ASLITÜRK 57ef3b27ec Base: Add PGM file type to QuickShow file type list 2020-06-27 13:01:27 +02:00
Hüseyin ASLITÜRK 0f7a651adc LibWeb: Add "image/x‑portable‑graymap" mime type for pgm file extension 2020-06-27 13:01:27 +02:00
Hüseyin ASLITÜRK a8b0ad5cc6 LibGUI: Fix image preview size in FilePicker for large images
Image preview widget overflow to other widgets in FilePicker dialog when image is larger than 160px.  Also change the ImagePreview widget variable name for align to naming standards.
2020-06-27 12:57:30 +02:00
3541 4fa6301523 Kernel: Add g_cpu_supports_rdseed
CPUs which support RDRAND do not necessarily support RDSEED. This
introduces a flag g_cpu_supports_rdseed which is set appropriately
by CPUID. This causes Haswell CPUs in particular (and probably a lot
of AMD chips) to now fail to boot with #2634, rather than an illegal
instruction.

It seems like the KernelRng needs either an initial reseed call or
more random events added before the first call to get_good_random,
but I don't feel qualified to make that kind of change.
2020-06-27 12:57:03 +02:00
Kevin Meyer ebbcef926a Base: Fix sendfd's man page return section 2020-06-27 11:50:31 +02:00
Andreas Kling 85ac7dc1b1 TextEditor: Add live preview for HTML documents :^)
This allows you to edit HTML and see the changes live. This feature is
possibly my favorite feature in the world right now.
2020-06-26 22:47:29 +02:00
Andreas Kling 8e6522d034 LibWeb: Implement some missing tokenizer cases for EOF handling 2020-06-26 22:47:07 +02:00
Andreas Kling 9d8565cf9a LibWeb: Add CanvasRenderingContext2D.rotate()
This is pretty limited since we don't have wholesale mapping through
the context transform, but we have to start somewhere. :^)
2020-06-26 18:27:12 +02:00
Andreas Kling dc22e59a1a LibGfx: Teach AffineTransform how to rotate and multiply 2020-06-26 18:27:12 +02:00
Andreas Kling ba76a72422 LibWeb: Skip over floating elements when collapsing margins
Two sibling blocks are not vertically adjacent if one is float:left
and the other is float:none. Respect this when collapsing margins.
2020-06-26 18:27:12 +02:00
Andreas Kling 62daa6f73c LibWeb: Add the 'float' CSS property to LayoutStyle
Note that we don't use the property for anything yet, as I'm still
wrapping my head around how to implement floats.
2020-06-26 18:27:12 +02:00
Matthew Olsson 53f1090b86 LibJS: run-test.sh emits test output if it is not "PASS"
Previously, debugging a test with console.log statements was impossible,
because it would just cause the test to fail with no additional output.
Now, if the output of a test is not "PASS", the output will be printed
under the line where the test failed.

Empty output will have a special message attached to it -- useful when
a test author has forgotten to include `console.log("PASS")` at the end
of a test.
2020-06-26 12:40:07 +02:00
Andreas Kling 981f403287 IRCClient: Remove duplicate <div> wrapper around colored messages 2020-06-26 11:59:04 +02:00