Skip to content

Truly independent web browser

LibWeb: Return an empty queryCommandValue for commands without a value

Andreas Kling9d435902412b
diff --git a/Libraries/LibWeb/Editing/ExecCommand.cpp b/Libraries/LibWeb/Editing/ExecCommand.cpp
index 0af64b00ec8..47af1b8dbea 100644
--- a/Libraries/LibWeb/Editing/ExecCommand.cpp
+++ b/Libraries/LibWeb/Editing/ExecCommand.cpp
@@ -526,9 +526,9 @@ WebIDL::ExceptionOr<Utf16String> Document::query_command_value(Utf16FlyString co
if (!optional_command.has_value())
return Utf16String {};
auto const& command_definition = optional_command.release_value();
- auto value_override = command_value_override(command_definition.command);
- if (!command_definition.value && !value_override.has_value())
+ if (!command_definition.value)
return Utf16String {};
+ auto value_override = command_value_override(command_definition.command);
// 2. If command is "fontSize" and its value override is set, convert the value override to an
// integer number of pixels and return the legacy font size for the result.
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]
index 1123c526817..14d63a64d6c 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]
@@ -2,8 +2,8 @@ Harness status: OK
Found 1000 tests
-979 Pass
-21 Fail
+988 Pass
+12 Fail
Pass [["backcolor","#00FFFF"],["indent",""],["inserttext","a"]] "foo[]bar" queryCommandIndeterm("indent") before
Pass [["backcolor","#00FFFF"],["indent",""],["inserttext","a"]] "foo[]bar" queryCommandState("indent") before
Pass [["backcolor","#00FFFF"],["indent",""],["inserttext","a"]] "foo[]bar" queryCommandValue("indent") before
@@ -548,7 +548,7 @@ Pass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar
Pass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandIndeterm("formatblock") before
Pass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandState("formatblock") before
Pass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandValue("formatblock") before
@@ -626,7 +626,7 @@ Pass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCom
Pass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandIndeterm("indent") before
Pass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandState("indent") before
Pass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandValue("indent") before
@@ -665,7 +665,7 @@ Pass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[
Pass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandIndeterm("inserthorizontalrule") before
Pass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandState("inserthorizontalrule") before
Pass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandValue("inserthorizontalrule") before
@@ -704,7 +704,7 @@ Pass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo
Pass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandIndeterm("inserthtml") before
Pass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandState("inserthtml") before
Pass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandValue("inserthtml") before
@@ -743,7 +743,7 @@ Pass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "
Pass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandIndeterm("insertimage") before
Pass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandState("insertimage") before
Pass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandValue("insertimage") before
@@ -821,7 +821,7 @@ Pass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]ba
Pass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandIndeterm("insertorderedlist") before
Pass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandState("insertorderedlist") before
Pass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandValue("insertorderedlist") before
@@ -899,7 +899,7 @@ Pass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]
Pass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandIndeterm("insertunorderedlist") before
Pass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandState("insertunorderedlist") before
Pass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandValue("insertunorderedlist") before
@@ -938,7 +938,7 @@ Pass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" q
Pass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandIndeterm("justifycenter") before
Pass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandState("justifycenter") before
Pass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandValue("justifycenter") before
@@ -977,7 +977,7 @@ Pass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" que
Pass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandIndeterm("justifyfull") before
Pass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandState("justifyfull") before
Pass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandValue("justifyfull") before
diff --git a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected] b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]
index a6bb3e11ee1..0eb1cdb71c2 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]
+++ b/Tests/LibWeb/Text/expected/wpt-import/editing/run/[email protected]
@@ -2,8 +2,8 @@ Harness status: OK
Found 1000 tests
-968 Pass
-32 Fail
+971 Pass
+29 Fail
Pass [["createlink","http://www.google.com/"],["justifyfull",""],["inserttext","a"]] "foo[]bar" queryCommandIndeterm("inserttext") after
Pass [["createlink","http://www.google.com/"],["justifyfull",""],["inserttext","a"]] "foo[]bar" queryCommandState("inserttext") after
Pass [["createlink","http://www.google.com/"],["justifyfull",""],["inserttext","a"]] "foo[]bar" queryCommandValue("inserttext") after
@@ -16,7 +16,7 @@ Pass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" que
Pass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandIndeterm("justifyleft") before
Pass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandState("justifyleft") before
Pass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandValue("justifyleft") before
@@ -55,7 +55,7 @@ Pass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" qu
Pass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandIndeterm("justifyright") before
Pass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandState("justifyright") before
Pass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandValue("justifyright") before
@@ -94,7 +94,7 @@ Pass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCo
Pass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandValue("createlink") before
Pass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandIndeterm("createlink") after
Pass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandState("createlink") after
-Fail [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandValue("createlink") after
+Pass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandValue("createlink") after
Pass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandIndeterm("outdent") before
Pass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandState("outdent") before
Pass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandValue("outdent") before