Ver Fonte

LibWeb: Use a switch to handle TextTransform values

This makes it more obvious that we're missing some of these. (And makes
it easier to find this code when searching for a specific value.)
Sam Atkins há 1 ano atrás
pai
commit
ce775ea701
1 ficheiros alterados com 11 adições e 3 exclusões
  1. 11 3
      Userland/Libraries/LibWeb/Layout/TextNode.cpp

+ 11 - 3
Userland/Libraries/LibWeb/Layout/TextNode.cpp

@@ -34,11 +34,19 @@ static bool is_all_whitespace(StringView string)
 
 static ErrorOr<DeprecatedString> apply_text_transform(DeprecatedString const& string, CSS::TextTransform text_transform)
 {
-    if (text_transform == CSS::TextTransform::Uppercase)
+    switch (text_transform) {
+    case CSS::TextTransform::Uppercase:
         return Unicode::to_unicode_uppercase_full(string);
-    if (text_transform == CSS::TextTransform::Lowercase)
+    case CSS::TextTransform::Lowercase:
         return Unicode::to_unicode_lowercase_full(string);
-    return string;
+    case CSS::TextTransform::None:
+        return string;
+    case CSS::TextTransform::Capitalize:
+    case CSS::TextTransform::FullSizeKana:
+    case CSS::TextTransform::FullWidth:
+        // FIXME: Implement these!
+        return string;
+    }
 }
 
 void TextNode::invalidate_text_for_rendering()