mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Merge remote-tracking branch 'origin/master' into custom
This commit is contained in:
commit
1a197351cd
42 changed files with 582 additions and 590 deletions
|
|
@ -457,6 +457,9 @@ NS_EVENT_MESSAGE(eVisibilityChange)
|
|||
// Details element events.
|
||||
NS_EVENT_MESSAGE(eToggle)
|
||||
|
||||
// Dialog element events.
|
||||
NS_EVENT_MESSAGE(eClose)
|
||||
|
||||
#ifdef UNDEF_NS_EVENT_MESSAGE_FIRST_LAST
|
||||
#undef UNDEF_NS_EVENT_MESSAGE_FIRST_LAST
|
||||
#undef NS_EVENT_MESSAGE_FIRST_LAST
|
||||
|
|
|
|||
|
|
@ -300,6 +300,10 @@ struct InputContext final
|
|||
* compatibility with webapps relying on key listeners. */
|
||||
bool mMayBeIMEUnaware;
|
||||
|
||||
/* Whether the owning document of the input element has been loaded
|
||||
* in private browsing mode. */
|
||||
bool mInPrivateBrowsing;
|
||||
|
||||
bool IsOriginMainProcess() const
|
||||
{
|
||||
return mOrigin == ORIGIN_MAIN;
|
||||
|
|
|
|||
|
|
@ -1355,7 +1355,9 @@ TSFTextStore::Init(nsWindowBase* aWidget,
|
|||
return false;
|
||||
}
|
||||
|
||||
SetInputScope(aContext.mHTMLInputType, aContext.mHTMLInputInputmode);
|
||||
SetInputScope(aContext.mHTMLInputType,
|
||||
aContext.mHTMLInputInputmode,
|
||||
aContext.mInPrivateBrowsing);
|
||||
|
||||
// Create document manager
|
||||
RefPtr<ITfThreadMgr> threadMgr = sThreadMgr;
|
||||
|
|
@ -3205,9 +3207,15 @@ TSFTextStore::InsertEmbedded(DWORD dwFlags,
|
|||
|
||||
void
|
||||
TSFTextStore::SetInputScope(const nsString& aHTMLInputType,
|
||||
const nsString& aHTMLInputInputMode)
|
||||
const nsString& aHTMLInputInputMode,
|
||||
bool aInPrivateBrowsing)
|
||||
{
|
||||
mInputScopes.Clear();
|
||||
|
||||
if (aInPrivateBrowsing) {
|
||||
mInputScopes.AppendElement(IS_PRIVATE);
|
||||
}
|
||||
|
||||
if (aHTMLInputType.IsEmpty() || aHTMLInputType.EqualsLiteral("text")) {
|
||||
if (aHTMLInputInputMode.EqualsLiteral("url")) {
|
||||
mInputScopes.AppendElement(IS_URL);
|
||||
|
|
@ -5688,7 +5696,8 @@ TSFTextStore::SetInputContext(nsWindowBase* aWidget,
|
|||
if (sEnabledTextStore) {
|
||||
RefPtr<TSFTextStore> textStore(sEnabledTextStore);
|
||||
textStore->SetInputScope(aContext.mHTMLInputType,
|
||||
aContext.mHTMLInputInputmode);
|
||||
aContext.mHTMLInputInputmode,
|
||||
aContext.mInPrivateBrowsing);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,7 +355,8 @@ protected:
|
|||
ULONG aFilterCount,
|
||||
const TS_ATTRID* aFilterAttrs);
|
||||
void SetInputScope(const nsString& aHTMLInputType,
|
||||
const nsString& aHTMLInputInputmode);
|
||||
const nsString& aHTMLInputInputmode,
|
||||
bool aInPrivateBrowsing);
|
||||
|
||||
// Creates native caret over our caret. This method only works on desktop
|
||||
// application. Otherwise, this does nothing.
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ IMEHandler::OnDestroyWindow(nsWindow* aWindow)
|
|||
if (!sIsInTSFMode) {
|
||||
// MSDN says we need to set IS_DEFAULT to avoid memory leak when we use
|
||||
// SetInputScopes API. Use an empty string to do this.
|
||||
SetInputScopeForIMM32(aWindow, EmptyString(), EmptyString());
|
||||
SetInputScopeForIMM32(aWindow, EmptyString(), EmptyString(), false);
|
||||
}
|
||||
#endif // #ifdef NS_ENABLE_TSF
|
||||
AssociateIMEContext(aWindow, true);
|
||||
|
|
@ -481,8 +481,10 @@ IMEHandler::SetInputContext(nsWindow* aWindow,
|
|||
}
|
||||
} else {
|
||||
// Set at least InputScope even when TextStore is not available.
|
||||
SetInputScopeForIMM32(aWindow, aInputContext.mHTMLInputType,
|
||||
aInputContext.mHTMLInputInputmode);
|
||||
SetInputScopeForIMM32(aWindow,
|
||||
aInputContext.mHTMLInputType,
|
||||
aInputContext.mHTMLInputInputmode,
|
||||
aInputContext.mInPrivateBrowsing);
|
||||
}
|
||||
#endif // #ifdef NS_ENABLE_TSF
|
||||
|
||||
|
|
@ -583,82 +585,64 @@ IMEHandler::OnKeyboardLayoutChanged()
|
|||
void
|
||||
IMEHandler::SetInputScopeForIMM32(nsWindow* aWindow,
|
||||
const nsAString& aHTMLInputType,
|
||||
const nsAString& aHTMLInputInputmode)
|
||||
const nsAString& aHTMLInputInputmode,
|
||||
bool aInPrivateBrowsing)
|
||||
{
|
||||
if (sIsInTSFMode || !sSetInputScopes || aWindow->Destroyed()) {
|
||||
return;
|
||||
}
|
||||
UINT arraySize = 0;
|
||||
const InputScope* scopes = nullptr;
|
||||
AutoTArray<InputScope, 3> scopes;
|
||||
|
||||
if (aInPrivateBrowsing) {
|
||||
scopes.AppendElement(IS_PRIVATE);
|
||||
}
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html
|
||||
if (aHTMLInputType.IsEmpty() || aHTMLInputType.EqualsLiteral("text")) {
|
||||
if (aHTMLInputInputmode.EqualsLiteral("url")) {
|
||||
static const InputScope inputScopes[] = { IS_URL };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_URL);
|
||||
} else if (aHTMLInputInputmode.EqualsLiteral("email")) {
|
||||
static const InputScope inputScopes[] = { IS_EMAIL_SMTPEMAILADDRESS };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_EMAIL_SMTPEMAILADDRESS);
|
||||
} else if (aHTMLInputInputmode.EqualsLiteral("tel")) {
|
||||
static const InputScope inputScopes[] =
|
||||
{IS_TELEPHONE_LOCALNUMBER, IS_TELEPHONE_FULLTELEPHONENUMBER};
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_TELEPHONE_LOCALNUMBER);
|
||||
scopes.AppendElement(IS_TELEPHONE_FULLTELEPHONENUMBER);
|
||||
} else if (aHTMLInputInputmode.EqualsLiteral("numeric")) {
|
||||
static const InputScope inputScopes[] = { IS_NUMBER };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_NUMBER);
|
||||
} else {
|
||||
static const InputScope inputScopes[] = { IS_DEFAULT };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_DEFAULT);
|
||||
}
|
||||
} else if (aHTMLInputType.EqualsLiteral("url")) {
|
||||
static const InputScope inputScopes[] = { IS_URL };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_URL);
|
||||
} else if (aHTMLInputType.EqualsLiteral("search")) {
|
||||
static const InputScope inputScopes[] = { IS_SEARCH };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_SEARCH);
|
||||
} else if (aHTMLInputType.EqualsLiteral("email")) {
|
||||
static const InputScope inputScopes[] = { IS_EMAIL_SMTPEMAILADDRESS };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_EMAIL_SMTPEMAILADDRESS);
|
||||
} else if (aHTMLInputType.EqualsLiteral("password")) {
|
||||
static const InputScope inputScopes[] = { IS_PASSWORD };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_PASSWORD);
|
||||
} else if (aHTMLInputType.EqualsLiteral("datetime") ||
|
||||
aHTMLInputType.EqualsLiteral("datetime-local")) {
|
||||
static const InputScope inputScopes[] = {
|
||||
IS_DATE_FULLDATE, IS_TIME_FULLTIME };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_DATE_FULLDATE);
|
||||
scopes.AppendElement(IS_TIME_FULLTIME);
|
||||
} else if (aHTMLInputType.EqualsLiteral("date") ||
|
||||
aHTMLInputType.EqualsLiteral("month") ||
|
||||
aHTMLInputType.EqualsLiteral("week")) {
|
||||
static const InputScope inputScopes[] = { IS_DATE_FULLDATE };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_DATE_FULLDATE);
|
||||
} else if (aHTMLInputType.EqualsLiteral("time")) {
|
||||
static const InputScope inputScopes[] = { IS_TIME_FULLTIME };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_TIME_FULLTIME);
|
||||
} else if (aHTMLInputType.EqualsLiteral("tel")) {
|
||||
static const InputScope inputScopes[] = {
|
||||
IS_TELEPHONE_FULLTELEPHONENUMBER, IS_TELEPHONE_LOCALNUMBER };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_TELEPHONE_FULLTELEPHONENUMBER);
|
||||
scopes.AppendElement(IS_TELEPHONE_LOCALNUMBER);
|
||||
} else if (aHTMLInputType.EqualsLiteral("number")) {
|
||||
static const InputScope inputScopes[] = { IS_NUMBER };
|
||||
scopes = &inputScopes[0];
|
||||
arraySize = ArrayLength(inputScopes);
|
||||
scopes.AppendElement(IS_NUMBER);
|
||||
}
|
||||
if (scopes && arraySize > 0) {
|
||||
sSetInputScopes(aWindow->GetWindowHandle(), scopes, arraySize, nullptr, 0,
|
||||
nullptr, nullptr);
|
||||
if (!scopes.IsEmpty()) {
|
||||
sSetInputScopes(aWindow->GetWindowHandle(),
|
||||
scopes.Elements(),
|
||||
scopes.Length(),
|
||||
nullptr,
|
||||
0,
|
||||
nullptr,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -144,7 +144,8 @@ private:
|
|||
static decltype(SetInputScopes)* sSetInputScopes;
|
||||
static void SetInputScopeForIMM32(nsWindow* aWindow,
|
||||
const nsAString& aHTMLInputType,
|
||||
const nsAString& aHTMLInputInputmode);
|
||||
const nsAString& aHTMLInputInputmode,
|
||||
bool aInPrivateBrowsing);
|
||||
static bool sIsInTSFMode;
|
||||
// If sIMMEnabled is false, any IME messages are not handled in TSF mode.
|
||||
// Additionally, IME context is always disassociated from focused window.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue