1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:37:35 +00:00

LibWeb+LibIDL: Fix (or paper over) various const-correctness issues

There's definitely stuff to iterate on here, but this takes care of
making the libraries compile with stricter RP and NNRP.
This commit is contained in:
Andreas Kling 2023-02-20 18:56:08 +01:00
parent 68b5df6bf1
commit f11899f885
22 changed files with 210 additions and 186 deletions

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022-2023, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -64,11 +64,21 @@ DeprecatedString MediaList::item(u32 index) const
// https://www.w3.org/TR/cssom-1/#dom-medialist-appendmedium
void MediaList::append_medium(DeprecatedString medium)
{
// 1. Let m be the result of parsing the given value.
auto m = parse_media_query({}, medium);
// 2. If m is null, then return.
if (!m)
return;
if (m_media.contains_slow(*m))
return;
// 3. If comparing m with any of the media queries in the collection of media queries returns true, then return.
auto serialized = m->to_string().release_value_but_fixme_should_propagate_errors();
for (auto& existing_medium : m_media) {
if (existing_medium.to_string().release_value_but_fixme_should_propagate_errors() == serialized)
return;
}
// 4. Append m to the collection of media queries.
m_media.append(m.release_nonnull());
}