mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Make 'sub' and 'sup' text styles mutually-exclusive, b=100825, r=jfrancis, sr=ben
This commit is contained in:
parent
2880631fe6
commit
a223374295
@ -317,7 +317,26 @@ nsStyleUpdatingCommand::ToggleState(nsIEditorShell *aEditorShell, const char* aT
|
||||
if (styleSet)
|
||||
rv = aEditorShell->RemoveTextProperty(tagName.get(), nsnull);
|
||||
else
|
||||
rv = aEditorShell->SetTextProperty(tagName.get(), nsnull, nsnull);
|
||||
{
|
||||
// Superscript and Subscript styles are mutually exclusive
|
||||
nsAutoString removeName;
|
||||
aEditorShell->BeginBatchChanges();
|
||||
|
||||
if (tagName.Equals(NS_LITERAL_STRING("sub")))
|
||||
{
|
||||
removeName.AssignWithConversion("sup");
|
||||
rv = aEditorShell->RemoveTextProperty(tagName.get(), nsnull);
|
||||
}
|
||||
else if (tagName.Equals(NS_LITERAL_STRING("sup")))
|
||||
{
|
||||
removeName.AssignWithConversion("sub");
|
||||
rv = aEditorShell->RemoveTextProperty(tagName.get(), nsnull);
|
||||
}
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = aEditorShell->SetTextProperty(tagName.get(), nsnull, nsnull);
|
||||
|
||||
aEditorShell->EndBatchChanges();
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user