Commit graph

41 commits

Author SHA1 Message Date
MacDue
cfc9966654 LibWeb: Add scaleable checkboxes (with theme/accent-color support)
This reworks checkboxes to use a tiny 16x16 SDF for the tick icon along
with an antialiased background/border.

The checkbox now works well at any scale, shows the various checkbox
state (enabled, disabled, being pressed), and supports using the colors
from the active system theme and/or the accent-color property.
2023-03-23 08:27:51 +00:00
Srikavin Ramkumar
3c49e24977 LibWeb: Scale checkbox image instead of repeating on large checkboxes 2023-03-20 10:15:58 +00:00
Srikavin Ramkumar
def08bcfcf LibWeb: Add indeterminate checkbox styling to useragent stylesheet 2023-03-20 10:15:58 +00:00
Linus Groh
2ad9c1fd6c LibWeb: Re-implement checkbox painting using the UA stylesheet
The checkbox provided by ClassicStylePainter is not scaling-aware and
generally unflexible, instead use the UA default stylesheet with a
handful of properties, the same way we already style buttons and text
inputs.

Thanks to Xexxa for the nice checkmark image!

Co-Authored-By: Xexxa <93391300+Xexxa@users.noreply.github.com>
2023-02-12 00:15:52 +00:00
implicitfield
25af1b33f6 LibWeb: Add spec-mandated rules for embedded content to Default.css 2023-01-04 11:50:03 +01:00
Timothy Flynn
4a30446999 LibWeb: Support displaying HTMLInputElement placeholder values
This adds support for parsing the ::placeholder pseudo-element and
injecting an anonymous layout node with that element when the input
element's data is empty.
2022-12-01 11:18:11 -05:00
Luke Wilde
081a617d8d LibWeb: Use the default CSS attributes for embedded content from HTML
The main benefit of this is respecting the iframe frameborder
attribute, as frameborder="0" is a pretty common way of removing
the default <iframe> border.

For example, it's on all YouTube embeds by default and on some
ReCAPTCHA embeds.
2022-10-10 19:33:34 +02:00
Andreas Kling
8a3ca6416d LibWeb: Make labels be display: inline-block in the default UA style
This is weird, but matches the behavior we've had so far. Leaving a
FIXME about how this doesn't seem right.
2022-10-06 15:29:38 +02:00
Andreas Kling
34a2797211 LibWeb: Remove ad-hoc <hr> element rule from default UA style
This element is already covered by spec rules. :^)
2022-10-06 15:29:38 +02:00
Andreas Kling
0cd82d2da7 LibWeb: Add a little header to the top of the default UA stylesheet
Since all the spec sections are annotated with comments already, let's
also have a comment mentioning that the file starts with ad-hoc rules.
2022-10-06 15:29:38 +02:00
Andreas Kling
d1dac8695c LibWeb: Don't set initial font+color on both HTML and BODY elements
It's enough to set it on the HTML element. That way, it doesn't get
reset in content that sets its own font on HTML but not on BODY.
2022-09-15 16:16:56 +02:00
Andreas Kling
57ad99ef16 LibWeb: Don't show pointer (hand) cursor over non-linked a elements
This is already handled by the :link and :visited style.
2022-09-14 15:05:10 +02:00
Andreas Kling
d27136fcb0 LibWeb: Replace most of our default UA stylesheet with spec rules
The HTML spec provides a set of suitable default CSS rules for our UA
stylesheet, so let's use those instead of inventing our own. :^)

Note that I had to replace "foo-block-start" properties with "foo-top"
since we don't support the block/inline direction based properties yet.
2022-09-14 14:43:17 +02:00
Andreas Kling
8f0a48ef23 LibWeb: Make default CSS font settings match other browsers better
Let's make 16px the default font size instead of 10px. This makes our
layout results match those of other engines in many more cases.

Also make the h1-h6 element styles use relative (em) font sizes, also
matching other browsers.
2022-09-08 12:43:49 +02:00
Karol Kosek
a0546318f9 LibWeb: Make <th> elements bold by default 2022-07-30 22:32:29 +02:00
MacDue
9768cda634 LibWeb: Tidy up <progress> element default CSS
This is a very minor thing, but one being `background:` and
the other being `background-color:` bugged me (and not using
the named colors).
2022-07-24 13:31:01 +01:00
MacDue
226d3fba79 LibWeb: Use the palette "button text" on buttons in the default CSS
This fixes some legibility issues when using dark themes.
2022-07-24 13:31:01 +01:00
MacDue
980964d8f3 LibWeb: Add a default style for primitive progress bars
This style is the same as what is used in WebKit/Blink, it is a bit
ugly, but you're expected to override it. Adding more than a
background color here could cause some issues, as sites don't
expect to have to unset the styles.
2022-07-23 01:45:49 +02:00
Andreas Kling
f6a97ff7d5 LibWeb: Tweak padding on button elements match other engines 2022-07-11 18:57:45 +02:00
Linus Groh
1e23fd94b1 LibWeb: Use ThreedShadow1 palette color for input border in Default.css
This is a bit easier on the eye than black.
2022-03-26 01:35:39 +00:00
Daniel Lemos
3eb6016dda LibWeb: Add some default style for <textarea> elements and a test 2022-03-18 19:59:19 +01:00
Sam Atkins
c148ed50bb LibWeb: Implement the :is() selector
This lets us finally get rid of a FIXME in the default style sheet. :^)
2022-03-18 11:34:02 +01:00
Sam Atkins
aa48dda3a4 LibWeb: Add missing MEDIAQUERIES-5 media-features
This adds (or at least stubs-out) the following:
- display-mode
- dynamic-range
- environment-blending
- forced-colors
- horizontal-viewport-segments
- vertical-viewport-segments
- inverted-colors
- nav-controls
- prefers-contrast
- prefers-reduced-data
- prefers-reduced-motion
- prefers-reduced-transparency
- scripting
- video-color-gamut
- video-dynamic-range

The `@media (inverted-colors)` CSS that the spec requires we add to the
UA style sheet does not actually do anything for us yet since we don't
support `filter`, but it seemed sensible to include it now to avoid
forgetting later. :^)
2022-03-16 22:07:53 +01:00
Lady Gegga
2a898a7e4a LibWeb: Add explicit color to mark element 2022-03-08 18:52:16 +01:00
Lady Gegga
2c1f5cd310 LibWeb: Add default styling to abbr, acronym, mark, strike and tt 2022-03-08 18:52:16 +01:00
Linus Groh
bc1b33eb22 LibWeb: Add border style for iframe to default UA stylesheet
Wouldn't be the true <iframe> experience if you didn't have to get rid
of the default inset border :^)
2022-03-06 23:05:18 +01:00
Karol Kosek
32bd57bdc9 LibWeb: Use monospace font for <kbd> and <samp> elements 2022-03-05 21:25:14 +01:00
Karol Kosek
049abbc417 LibWeb: Strike-through <s> and <del> elements by default 2022-03-05 21:25:14 +01:00
Linus Groh
4170fcb777 LibWeb: Also apply default button styles to <button>, not just <input> 2022-02-28 23:12:37 +00:00
Vrins
a8cfb34551 LibWeb: Allow <input type="button/submit/reset"> to be styled
Previously we used a native ui button to draw the buttons.
These buttons can however not be styled with css.
To allow these to be styled with css, we create a button with
the UA stylesheet that resembles the system ui button.
2022-02-28 15:46:06 +00:00
Karol Kosek
6a1ae4c185 LibWeb: Make i, em, address, cite, dfn and var elements italic
Although it is not said that some of the elements need to be italic,
*most* browsers mark them as such to distinguish them from the normal
text, so let's do that too!
2022-02-20 11:50:38 +01:00
Adam Hodgen
240068a48c LibWeb: Improve display of input elements
* Display input[type=reset] as a button
* Display allother input elements as text entry boxes
* Set overflow: hidden on input elements
2022-02-18 01:48:51 +01:00
Nico Weber
d670c13a3b LibWeb: Make attribute hidden have an effect; hide some other elements
This moves LibWeb to using the list of hidden elements from the spec.

Concretely, the following things are now explicitly marked
`display: none` in addition to before:

- elements with the `hidden` attribute
- area
- base
- basefont
- datalist
- param
- rp

The spec also wants `noframes` and `noembed` to be `display: none`,
but since support for frames and embeds doesn't exist yet, these
are omitted for now.

With this, everyone's favorite website http://45.33.8.238/ no longer
displays spans with attribute hidden. (Whitespace handling still
looks a bit off though.)
2022-01-22 01:28:42 +00:00
Sam Atkins
2f3e24d71e LibWeb: Add rudimentary styling to <details> and <summary> 2021-12-27 21:44:07 +01:00
Linus Groh
c2fb252ebf LibWeb: Use -libweb-palette-base-text for text color in default CSS
This makes un-styled text readable when using a dark system theme,
previously such text would be black, regardless of the theme background
color.

Fixes #7274.
2021-05-19 23:23:48 +01:00
Linus Groh
67b47013d2 LibWeb: Use list-style-type circle/square for nested unordered lists
An idea shamelessly stolen from other UAs :^)
2021-05-08 10:49:16 +01:00
Tobias Christiansen
5338708091 LibWeb: Display <ol> and respect list-style-type in <ul>
In the ListItemMarkerBox render the correct thing when painting.
This covers decimal counting for ordered lists as well as square,
disc, and circle for unordered lists. Thus all currently supported
list-style-types are displayed correctly.

This closes #2059
2021-04-20 18:29:19 +02:00
Andreas Kling
c7d1f73990 LibWeb: Make <option> elements display:none in the default CSS for now 2021-03-15 21:20:33 +01:00
Adam Hodgen
53c4be926b LibWeb: Set link cursor via the default CSS
This removes the custom handling of cursor for the link element, which
also allows overriding the cursor on a link element via CSS
2021-02-28 18:19:52 +01:00
Andreas Kling
29a2aac89a LibWeb: Start implementing <input type=text> using a shadow DOM
Text <input> fields will now generate a basic shadow DOM and attach it
to the input element.

The shadow DOM contains a <div> with some inline style, and an always-
editable text node inside it. Accessing the "value" attribute on such
an input element will get/set the value from that text node.

This is really cool, although not super stable since HTML editing is
not super stable. But it's a start! :^)
2021-02-10 19:06:20 +01:00
Andreas Kling
13d7c09125 Libraries: Move to Userland/Libraries/ 2021-01-12 12:17:46 +01:00
Renamed from Libraries/LibWeb/CSS/Default.css (Browse further)