LibWeb: Rename "identifier" and "ValueID" to "Keyword" where correct

For a long time, we've used two terms, inconsistently:
- "Identifier" is a spec term, but refers to a sequence of alphanumeric
  characters, which may or may not be a keyword. (Keywords are a
  subset of all identifiers.)
- "ValueID" is entirely non-spec, and is directly called a "keyword" in
  the CSS specs.

So to avoid confusion as much as possible, let's align with the spec
terminology. I've attempted to change variable names as well, but
obviously we use Keywords in a lot of places in LibWeb and so I may
have missed some.

One exception is that I've not renamed "valid-identifiers" in
Properties.json... I'd like to combine that and the "valid-types" array
together eventually, so there's no benefit to doing an extra rename
now.
This commit is contained in:
Sam Atkins 2024-08-14 14:06:03 +01:00 committed by Sam Atkins
commit 6a74b01644
Notes: github-actions[bot] 2024-08-15 12:59:33 +00:00
48 changed files with 702 additions and 702 deletions

View file

@ -5,10 +5,10 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/CSS/Keyword.h>
#include <LibWeb/CSS/Parser/Parser.h>
#include <LibWeb/CSS/SelectorEngine.h>
#include <LibWeb/CSS/StyleProperties.h>
#include <LibWeb/CSS/ValueID.h>
#include <LibWeb/DOM/Attr.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
@ -606,13 +606,13 @@ static inline bool matches_pseudo_class(CSS::Selector::SimpleSelector::PseudoCla
case CSS::PseudoClass::Dir: {
// "Values other than ltr and rtl are not invalid, but do not match anything."
// - https://www.w3.org/TR/selectors-4/#the-dir-pseudo
if (!first_is_one_of(pseudo_class.identifier, CSS::ValueID::Ltr, CSS::ValueID::Rtl))
if (!first_is_one_of(pseudo_class.keyword, CSS::Keyword::Ltr, CSS::Keyword::Rtl))
return false;
switch (element.directionality()) {
case DOM::Element::Directionality::Ltr:
return pseudo_class.identifier == CSS::ValueID::Ltr;
return pseudo_class.keyword == CSS::Keyword::Ltr;
case DOM::Element::Directionality::Rtl:
return pseudo_class.identifier == CSS::ValueID::Rtl;
return pseudo_class.keyword == CSS::Keyword::Rtl;
}
VERIFY_NOT_REACHED();
}