Commit graph

10 commits

Author SHA1 Message Date
Sam Atkins
b5893ee115 LibWeb: Make Serialize functions infallible 2023-08-22 17:51:48 +01:00
Sam Atkins
85f3de6331 LibWeb: Port CSS/Serialize.{h,cpp} to new Strings, and propagate errors 2023-02-15 12:48:26 -05:00
martinfalisse
ce0f41b9fb LibWeb+WebContent: Use new String class in CSS::StyleValue
Converts uses of DeprecatedString to String in StyleValue, and patches
surrounding files that depend on these functions.
2023-01-09 11:09:31 +01:00
Linus Groh
6e19ab2bbc AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null
state), and while it's going to use UTF-8, the name UTF8String is a
mouthful - so let's free up the String name by renaming the existing
class.
Making the old one have an annoying name will hopefully also help with
quick adoption :^)
2022-12-06 08:54:33 +01:00
electrikmilk
fdd202259d LibWeb: Add partial serialization for CSSFontFaceRule
This partially adds serialization code for
`CSSFontFaceRule::serialized()` to spec. This is only partially
implemented as some parts of the `@font-face` rule are not implemented
yet.
2022-09-14 10:50:33 +01:00
MacDue
8603541e56 LibWeb: Add serialize_a_srgb_value()
This moves the logic from ColorStyleValue::to_string() to a standalone
function.
2022-07-17 20:11:38 +01:00
Andreas Kling
8b1108e485 Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Sam Atkins
0588db5c30 LibWeb: Make the CSS serialization functions actually output things :^)
Pro tip: If your function takes a StringBuilder by value, it doesn't
actually append anything to the caller's StringBuilder. On the plus
side, I probably won't make this mistake for a while? I hope?
2021-10-17 19:59:27 +01:00
Sam Atkins
75c9313d7d LibWeb: Implement more CSS serializers and make them more ergonomic
This implements these algorithms from the CSSOM-1 spec:
- serialize a string
- serialize a URL

Also, we now have two versions of each of the serialization functions:
One that returns a String as before, and the other that takes a
StringBuilder to write into. This saves creating extra StringBuilders
when they are not needed. :^)
2021-10-16 15:16:27 +01:00
Sam Atkins
575ce04148 LibWeb: Add CSS.escape() JS function
This is the `CSS` namespace defined in IDL here:
https://www.w3.org/TR/cssom-1/#namespacedef-css , not to be confused
with our `Web::CSS` namespace. Words are hard.

`CSS.escape()` lets you escape identifiers that can then be used to
create a CSS string.

I've also stubbed out the `CSS.supports()` function.
2021-10-08 23:02:57 +02:00