зеркало из https://github.com/mozilla/gecko-dev.git
Bug 738440 - Support queryCommandState("stylewithcss"); r=ehsan
This commit is contained in:
Родитель
6bd0728a3b
Коммит
770ebbde43
|
@ -90,7 +90,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=408231
|
|||
["removeformat", "exception"],
|
||||
["selectall", "exception"],
|
||||
["strikethrough", "false"],
|
||||
["styleWithCSS", "exception"],
|
||||
["styleWithCSS", "false"],
|
||||
["subscript", "false"],
|
||||
["superscript", "false"],
|
||||
["underline", "false"],
|
||||
|
@ -130,7 +130,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=408231
|
|||
["removeformat", ""],
|
||||
["selectall", ""],
|
||||
["strikethrough", ""],
|
||||
["styleWithCSS", "exception"],
|
||||
["styleWithCSS", ""],
|
||||
["subscript", ""],
|
||||
["superscript", ""],
|
||||
["underline", ""],
|
||||
|
|
|
@ -3233,6 +3233,13 @@ nsHTMLDocument::QueryCommandState(const nsAString & commandID, bool *_retval)
|
|||
if (!window)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (commandID.LowerCaseEqualsLiteral("usecss")) {
|
||||
// Per spec, state is supported for styleWithCSS but not useCSS, so we just
|
||||
// return false always.
|
||||
*_retval = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCAutoString cmdToDispatch, paramToCheck;
|
||||
bool dummy, dummy2;
|
||||
if (!ConvertToMidasInternalCommand(commandID, commandID,
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
|
||||
//defines
|
||||
#define STATE_ENABLED "state_enabled"
|
||||
#define STATE_ALL "state_all"
|
||||
#define STATE_ATTRIBUTE "state_attribute"
|
||||
#define STATE_DATA "state_data"
|
||||
|
||||
|
@ -378,7 +379,7 @@ nsSetDocumentStateCommand::GetCommandStateParams(const char *aCommandName,
|
|||
|
||||
bool isCSS;
|
||||
htmleditor->GetIsCSSEnabled(&isCSS);
|
||||
return aParams->SetBooleanValue(STATE_ATTRIBUTE, isCSS);
|
||||
return aParams->SetBooleanValue(STATE_ALL, isCSS);
|
||||
}
|
||||
|
||||
if (!nsCRT::strcmp(aCommandName, "cmd_insertBrOnReturn"))
|
||||
|
|
|
@ -50,6 +50,7 @@ _TEST_FILES = \
|
|||
test_bug389350.html \
|
||||
test_bug519928.html \
|
||||
bug678842_subframe.html \
|
||||
test_bug738440.html \
|
||||
$(NULL)
|
||||
|
||||
_CHROME_TEST_FILES = \
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
<!doctype html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=738440
|
||||
-->
|
||||
<title>Test for Bug 738440</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=738440">Mozilla Bug 738440</a>
|
||||
<div contenteditable></div>
|
||||
<script>
|
||||
|
||||
/** Test for Bug 738440 **/
|
||||
document.execCommand("stylewithcss", false, "true");
|
||||
is(document.queryCommandState("stylewithcss"), true,
|
||||
"setting stylewithcss to true should cause its state to be true");
|
||||
is(document.queryCommandState("usecss"), false,
|
||||
"usecss state should always be false");
|
||||
|
||||
document.execCommand("stylewithcss", false, "false");
|
||||
is(document.queryCommandState("stylewithcss"), false,
|
||||
"setting stylewithcss to false should cause its state to be false");
|
||||
is(document.queryCommandState("usecss"), false,
|
||||
"usecss state should always be false");
|
||||
|
||||
document.execCommand("usecss", false, "true");
|
||||
is(document.queryCommandState("stylewithcss"), false,
|
||||
"setting usecss to true should cause stylewithcss state to be false");
|
||||
is(document.queryCommandState("usecss"), false,
|
||||
"usecss state should always be false");
|
||||
|
||||
document.execCommand("usecss", false, "false");
|
||||
is(document.queryCommandState("stylewithcss"), true,
|
||||
"setting usecss to false should cause stylewithcss state to be true");
|
||||
is(document.queryCommandState("usecss"), false,
|
||||
"usecss state should always be false");
|
||||
|
||||
</script>
|
Загрузка…
Ссылка в новой задаче