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.cppindex 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 coif (!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: OKFound 1000 tests-979 Pass-21 Fail+988 Pass+12 FailPass [["backcolor","#00FFFF"],["indent",""],["inserttext","a"]] "foo[]bar" queryCommandIndeterm("indent") beforePass [["backcolor","#00FFFF"],["indent",""],["inserttext","a"]] "foo[]bar" queryCommandState("indent") beforePass [["backcolor","#00FFFF"],["indent",""],["inserttext","a"]] "foo[]bar" queryCommandValue("indent") before@@ -548,7 +548,7 @@ Pass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]barPass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandValue("createlink") beforePass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandIndeterm("formatblock") beforePass [["createlink","http://www.google.com/"],["formatblock","<div>"]] "foo[]bar" queryCommandState("formatblock") beforePass [["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" queryComPass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandValue("createlink") beforePass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandIndeterm("indent") beforePass [["createlink","http://www.google.com/"],["indent",""]] "foo[]bar" queryCommandState("indent") beforePass [["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") beforePass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandIndeterm("inserthorizontalrule") beforePass [["createlink","http://www.google.com/"],["inserthorizontalrule",""]] "foo[]bar" queryCommandState("inserthorizontalrule") beforePass [["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"]] "fooPass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandValue("createlink") beforePass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandIndeterm("inserthtml") beforePass [["createlink","http://www.google.com/"],["inserthtml","ab<b>c</b>d"]] "foo[]bar" queryCommandState("inserthtml") beforePass [["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") beforePass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandIndeterm("insertimage") beforePass [["createlink","http://www.google.com/"],["insertimage","/img/lion.svg"]] "foo[]bar" queryCommandState("insertimage") beforePass [["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[]baPass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandValue("createlink") beforePass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandIndeterm("insertorderedlist") beforePass [["createlink","http://www.google.com/"],["insertorderedlist",""]] "foo[]bar" queryCommandState("insertorderedlist") beforePass [["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") beforePass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandIndeterm("insertunorderedlist") beforePass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandState("insertunorderedlist") beforePass [["createlink","http://www.google.com/"],["insertunorderedlist",""]] "foo[]bar" queryCommandValue("insertunorderedlist") before@@ -938,7 +938,7 @@ Pass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" qPass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandValue("createlink") beforePass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandIndeterm("justifycenter") beforePass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandState("justifycenter") beforePass [["createlink","http://www.google.com/"],["justifycenter",""]] "foo[]bar" queryCommandValue("justifycenter") before@@ -977,7 +977,7 @@ Pass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" quePass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandValue("createlink") beforePass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandIndeterm("justifyfull") beforePass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandState("justifyfull") beforePass [["createlink","http://www.google.com/"],["justifyfull",""]] "foo[]bar" queryCommandValue("justifyfull") beforediff --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: OKFound 1000 tests-968 Pass-32 Fail+971 Pass+29 FailPass [["createlink","http://www.google.com/"],["justifyfull",""],["inserttext","a"]] "foo[]bar" queryCommandIndeterm("inserttext") afterPass [["createlink","http://www.google.com/"],["justifyfull",""],["inserttext","a"]] "foo[]bar" queryCommandState("inserttext") afterPass [["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" quePass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandValue("createlink") beforePass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandIndeterm("justifyleft") beforePass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandState("justifyleft") beforePass [["createlink","http://www.google.com/"],["justifyleft",""]] "foo[]bar" queryCommandValue("justifyleft") before@@ -55,7 +55,7 @@ Pass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" quPass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandValue("createlink") beforePass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandIndeterm("justifyright") beforePass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandState("justifyright") beforePass [["createlink","http://www.google.com/"],["justifyright",""]] "foo[]bar" queryCommandValue("justifyright") before@@ -94,7 +94,7 @@ Pass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCoPass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandValue("createlink") beforePass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandIndeterm("createlink") afterPass [["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") afterPass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandIndeterm("outdent") beforePass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandState("outdent") beforePass [["createlink","http://www.google.com/"],["outdent",""]] "foo[]bar" queryCommandValue("outdent") before