Bug 1683226 - part 2: Make `HTMLEmbedElement` and `HTMLObjectElement` stop overriding `nsIContent::GetDesiredIMEState()` r=smaug

Currently, they are never focusable when its type is "plugin".
So, making stop them returning `IMEEnabled::Plugin` won't change
anything, but it guarantees that nobody will see `IMEEnabled::Plugin`
at runtime.  This is a preparation for the following patches.

Differential Revision: https://phabricator.services.mozilla.com/D100101
This commit is contained in:
Masayuki Nakano 2020-12-21 05:52:26 +00:00
Родитель d27602eee6
Коммит d876b20aaa
7 изменённых файлов: 0 добавлений и 43 удалений

Просмотреть файл

@ -1805,20 +1805,7 @@ nsObjectLoadingContent::UpdateObjectParameters() {
if (newType != mType) { if (newType != mType) {
retval = (ParameterUpdateFlags)(retval | eParamStateChanged); retval = (ParameterUpdateFlags)(retval | eParamStateChanged);
LOG(("OBJLC [%p]: Type changed from %u -> %u", this, mType, newType)); LOG(("OBJLC [%p]: Type changed from %u -> %u", this, mType, newType));
bool updateIMEState = (mType == eType_Loading && newType == eType_Plugin);
mType = newType; mType = newType;
// The IME manager needs to know if this is a plugin so it can adjust
// input handling to an appropriate mode for plugins.
nsFocusManager* fm = nsFocusManager::GetFocusManager();
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
MOZ_ASSERT(thisContent, "should have content");
if (updateIMEState && thisContent && fm && fm->IsFocused(thisContent)) {
widget::IMEState state;
state.mEnabled = widget::IMEEnabled::Plugin;
state.mOpen = widget::IMEState::DONT_CHANGE_OPEN_STATE;
IMEStateManager::UpdateIMEState(state, thisContent, nullptr);
}
} }
if (!URIEquals(mBaseURI, newBaseURI)) { if (!URIEquals(mBaseURI, newBaseURI)) {

Просмотреть файл

@ -186,14 +186,6 @@ bool HTMLEmbedElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
return true; return true;
} }
nsIContent::IMEState HTMLEmbedElement::GetDesiredIMEState() {
if (Type() == eType_Plugin) {
return IMEState(IMEEnabled::Plugin);
}
return nsGenericHTMLElement::GetDesiredIMEState();
}
bool HTMLEmbedElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, bool HTMLEmbedElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue, const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal, nsIPrincipal* aMaybeScriptedPrincipal,

Просмотреть файл

@ -46,7 +46,6 @@ class HTMLEmbedElement final : public nsGenericHTMLElement,
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable, virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
int32_t* aTabIndex) override; int32_t* aTabIndex) override;
virtual IMEState GetDesiredIMEState() override;
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute, virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue, const nsAString& aValue,

Просмотреть файл

@ -337,14 +337,6 @@ bool HTMLObjectElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
return false; return false;
} }
nsIContent::IMEState HTMLObjectElement::GetDesiredIMEState() {
if (Type() == eType_Plugin) {
return IMEState(IMEEnabled::Plugin);
}
return nsGenericHTMLFormElement::GetDesiredIMEState();
}
NS_IMETHODIMP NS_IMETHODIMP
HTMLObjectElement::Reset() { return NS_OK; } HTMLObjectElement::Reset() { return NS_OK; }

Просмотреть файл

@ -57,7 +57,6 @@ class HTMLObjectElement final : public nsGenericHTMLFormElement,
virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable, virtual bool IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable,
int32_t* aTabIndex) override; int32_t* aTabIndex) override;
virtual IMEState GetDesiredIMEState() override;
// Overriden nsIFormControl methods // Overriden nsIFormControl methods
NS_IMETHOD Reset() override; NS_IMETHOD Reset() override;

Просмотреть файл

@ -975,12 +975,6 @@ interface nsIDOMWindowUtils : nsISupports {
*/ */
const unsigned long IME_STATUS_PASSWORD = 2; const unsigned long IME_STATUS_PASSWORD = 2;
/**
* PLUGIN means a plug-in has focus. At this time we should not touch to
* controlling the IME state.
*/
const unsigned long IME_STATUS_PLUGIN = 3;
/** /**
* Get IME status, see above IME_STATUS_* definitions. * Get IME status, see above IME_STATUS_* definitions.
*/ */

Просмотреть файл

@ -663,12 +663,6 @@ function runPluginTest() {
return; return;
} }
if (navigator.platform.indexOf("Mac") == 0) {
// XXX on mac, currently, this test isn't passed because it doesn't return
// IME_STATUS_PLUGIN by its bug.
return;
}
var plugin = document.getElementById("plugin"); var plugin = document.getElementById("plugin");
// Plugins are not supported and their elements should not accept focus; // Plugins are not supported and their elements should not accept focus;