mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 835262 Add an option making nsTextStateManager keep alive even while our process is deactive r=smaug+emk
This commit is contained in:
parent
956a001c8a
commit
a2828099bf
@ -68,6 +68,10 @@ public:
|
||||
nsIContent* aContent);
|
||||
void Destroy(void);
|
||||
bool IsManaging(nsPresContext* aPresContext, nsIContent* aContent);
|
||||
bool KeepAliveDuringDeactive() const
|
||||
{
|
||||
return !!(mObserving & nsIMEUpdatePreference::NOTIFY_DURING_DEACTIVE);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWidget> mWidget;
|
||||
nsCOMPtr<nsISelection> mSel;
|
||||
@ -226,6 +230,7 @@ nsIMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
if (sTextStateObserver &&
|
||||
(aPresContext || !sTextStateObserver->KeepAliveDuringDeactive()) &&
|
||||
!sTextStateObserver->IsManaging(aPresContext, aContent)) {
|
||||
DestroyTextStateManager();
|
||||
}
|
||||
|
@ -214,6 +214,8 @@ enum nsTopLevelWidgetZPlacement { // for PlaceBehind()
|
||||
* If the IME implementation on a particular platform doesn't care about
|
||||
* NotifyIMEOfTextChange() and/or NotifyIME(NOTIFY_IME_OF_SELECTION_CHANGE),
|
||||
* they should set mWantUpdates to NOTIFY_NOTHING to avoid the cost.
|
||||
* If the IME implementation needs notifications even while our process is
|
||||
* deactive, it should also set NOTIFY_DURING_DEACTIVE.
|
||||
*
|
||||
* If mWantHints is true, PuppetWidget will forward the content of text fields
|
||||
* to the chrome process to be cached. This way we return the cached content
|
||||
@ -224,13 +226,14 @@ enum nsTopLevelWidgetZPlacement { // for PlaceBehind()
|
||||
*/
|
||||
struct nsIMEUpdatePreference {
|
||||
|
||||
typedef int8_t Notifications;
|
||||
typedef uint8_t Notifications;
|
||||
|
||||
enum
|
||||
{
|
||||
NOTIFY_NOTHING = 0x0000,
|
||||
NOTIFY_SELECTION_CHANGE = 0x0001,
|
||||
NOTIFY_TEXT_CHANGE = 0x0002
|
||||
NOTIFY_NOTHING = 0x00,
|
||||
NOTIFY_SELECTION_CHANGE = 0x01,
|
||||
NOTIFY_TEXT_CHANGE = 0x02,
|
||||
NOTIFY_DURING_DEACTIVE = 0x80
|
||||
};
|
||||
|
||||
nsIMEUpdatePreference()
|
||||
|
@ -3046,13 +3046,15 @@ nsTextStore::OnFocusChange(bool aGotFocus,
|
||||
nsIMEUpdatePreference
|
||||
nsTextStore::GetIMEUpdatePreference()
|
||||
{
|
||||
int8_t notifications = nsIMEUpdatePreference::NOTIFY_NOTHING;
|
||||
nsIMEUpdatePreference::Notifications notifications =
|
||||
nsIMEUpdatePreference::NOTIFY_NOTHING;
|
||||
if (sTsfThreadMgr && sTsfTextStore && sTsfTextStore->mDocumentMgr) {
|
||||
nsRefPtr<ITfDocumentMgr> docMgr;
|
||||
sTsfThreadMgr->GetFocus(getter_AddRefs(docMgr));
|
||||
if (docMgr == sTsfTextStore->mDocumentMgr) {
|
||||
notifications = (nsIMEUpdatePreference::NOTIFY_SELECTION_CHANGE |
|
||||
nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE);
|
||||
nsIMEUpdatePreference::NOTIFY_TEXT_CHANGE |
|
||||
nsIMEUpdatePreference::NOTIFY_DURING_DEACTIVE);
|
||||
}
|
||||
}
|
||||
return nsIMEUpdatePreference(notifications, false);
|
||||
|
Loading…
Reference in New Issue
Block a user