mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 998941 - part 1-6: Make HTMLEditor set InputEvent.data when InputEvent.inputType is "fontName" r=smaug,m_kato
Although neither Chrome nor Safari does not set InputEvent.data value when InputEvent.inputType is "fontName", but it's easy to implement. Therefore, this patch implements it as declaration of Input Events. This patch uses given value as-is. Perhaps, this shouldn't cause any problems because such value can be set to Element.style.fontFamily without any changes. Note that automated test will be added into WPT later. Differential Revision: https://phabricator.services.mozilla.com/D19294 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
0d571915df
commit
135f048bdf
@ -67,6 +67,15 @@ nsresult HTMLEditor::SetInlinePropertyAsAction(nsAtom& aProperty,
|
||||
if (NS_WARN_IF(!editActionData.CanHandle())) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
switch (editActionData.GetEditAction()) {
|
||||
case EditAction::eSetFontFamilyProperty:
|
||||
MOZ_ASSERT(!aValue.IsVoid());
|
||||
// XXX Should we trim unnecessary whitespaces?
|
||||
editActionData.SetData(aValue);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
AutoTransactionBatch treatAsOneTransaction(*this);
|
||||
|
||||
@ -105,6 +114,15 @@ HTMLEditor::SetInlineProperty(const nsAString& aProperty,
|
||||
if (NS_WARN_IF(!editActionData.CanHandle())) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
switch (editActionData.GetEditAction()) {
|
||||
case EditAction::eSetFontFamilyProperty:
|
||||
MOZ_ASSERT(!aValue.IsVoid());
|
||||
// XXX Should we trim unnecessary whitespaces?
|
||||
editActionData.SetData(aValue);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return SetInlinePropertyInternal(*property, attribute, aValue);
|
||||
}
|
||||
|
||||
@ -1223,7 +1241,14 @@ nsresult HTMLEditor::RemoveInlinePropertyAsAction(nsAtom& aProperty,
|
||||
if (NS_WARN_IF(!editActionData.CanHandle())) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
switch (editActionData.GetEditAction()) {
|
||||
case EditAction::eRemoveFontFamilyProperty:
|
||||
MOZ_ASSERT(!EmptyString().IsVoid());
|
||||
editActionData.SetData(EmptyString());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
nsresult rv = RemoveInlinePropertyInternal(&aProperty, aAttribute);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
@ -1243,7 +1268,14 @@ HTMLEditor::RemoveInlineProperty(const nsAString& aProperty,
|
||||
if (NS_WARN_IF(!editActionData.CanHandle())) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
switch (editActionData.GetEditAction()) {
|
||||
case EditAction::eRemoveFontFamilyProperty:
|
||||
MOZ_ASSERT(!EmptyString().IsVoid());
|
||||
editActionData.SetData(EmptyString());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return RemoveInlinePropertyInternal(property, attribute);
|
||||
}
|
||||
|
||||
|
@ -164,6 +164,7 @@ inline bool IsDataAvailableOnHTMLEditor(EditorInputType aInputType) {
|
||||
case EditorInputType::eFormatSetBlockTextDirection:
|
||||
case EditorInputType::eFormatSetInlineTextDirection:
|
||||
case EditorInputType::eInsertLink:
|
||||
case EditorInputType::eFormatFontName:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user