summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
Diffstat (limited to 'widget')
-rw-r--r--widget/cocoa/nsChildView.mm52
-rw-r--r--widget/nsIdleService.cpp12
-rw-r--r--widget/windows/InProcessWinCompositorWidget.cpp25
-rw-r--r--widget/windows/InProcessWinCompositorWidget.h4
-rw-r--r--widget/windows/TSFTextStore.cpp10
5 files changed, 43 insertions, 60 deletions
diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
index 8f72a81be..1a257d899 100644
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -425,13 +425,6 @@ nsChildView::Create(nsIWidget* aParent,
if (!gChildViewMethodsSwizzled) {
nsToolkit::SwizzleMethods([NSView class], @selector(mouseDownCanMoveWindow),
@selector(nsChildView_NSView_mouseDownCanMoveWindow));
-#ifdef __LP64__
- nsToolkit::SwizzleMethods([NSEvent class], @selector(addLocalMonitorForEventsMatchingMask:handler:),
- @selector(nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:handler:),
- true);
- nsToolkit::SwizzleMethods([NSEvent class], @selector(removeMonitor:),
- @selector(nsChildView_NSEvent_removeMonitor:), true);
-#endif
gChildViewMethodsSwizzled = true;
}
@@ -6513,48 +6506,3 @@ static const CGEventField kCGWindowNumberField = (const CGEventField) 51;
}
@end
-
-#ifdef __LP64__
-// When using blocks, at least on OS X 10.7, the OS sometimes calls
-// +[NSEvent removeMonitor:] more than once on a single event monitor, which
-// causes crashes. See bug 678607. We hook these methods to work around
-// the problem.
-@interface NSEvent (MethodSwizzling)
-+ (id)nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:(unsigned long long)mask handler:(id)block;
-+ (void)nsChildView_NSEvent_removeMonitor:(id)eventMonitor;
-@end
-
-// This is a local copy of the AppKit frameworks sEventObservers hashtable.
-// It only stores "local monitors". We use it to ensure that +[NSEvent
-// removeMonitor:] is never called more than once on the same local monitor.
-static NSHashTable *sLocalEventObservers = nil;
-
-@implementation NSEvent (MethodSwizzling)
-
-+ (id)nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:(unsigned long long)mask handler:(id)block
-{
- if (!sLocalEventObservers) {
- sLocalEventObservers = [[NSHashTable hashTableWithOptions:
- NSHashTableStrongMemory | NSHashTableObjectPointerPersonality] retain];
- }
- id retval =
- [self nsChildView_NSEvent_addLocalMonitorForEventsMatchingMask:mask handler:block];
- if (sLocalEventObservers && retval && ![sLocalEventObservers containsObject:retval]) {
- [sLocalEventObservers addObject:retval];
- }
- return retval;
-}
-
-+ (void)nsChildView_NSEvent_removeMonitor:(id)eventMonitor
-{
- if (sLocalEventObservers && [eventMonitor isKindOfClass: ::NSClassFromString(@"_NSLocalEventObserver")]) {
- if (![sLocalEventObservers containsObject:eventMonitor]) {
- return;
- }
- [sLocalEventObservers removeObject:eventMonitor];
- }
- [self nsChildView_NSEvent_removeMonitor:eventMonitor];
-}
-
-@end
-#endif // #ifdef __LP64__
diff --git a/widget/nsIdleService.cpp b/widget/nsIdleService.cpp
index a1a2566df..f9904d39c 100644
--- a/widget/nsIdleService.cpp
+++ b/widget/nsIdleService.cpp
@@ -46,6 +46,10 @@ using namespace mozilla;
// Number of seconds in a day.
#define SECONDS_PER_DAY 86400
+// MAX_DELTA_SEC * 1000 should be less than UINT32_MAX to prevent overflow on
+// converting from sec to msec
+#define MAX_DELTA_SEC (SECONDS_PER_DAY * 10)
+
static PRLogModuleInfo *sLog = nullptr;
#define LOG_TAG "GeckoIdleService"
@@ -391,7 +395,7 @@ nsIdleService::GetInstance()
nsIdleService::nsIdleService() : mCurrentlySetToTimeoutAt(TimeStamp()),
mIdleObserverCount(0),
- mDeltaToNextIdleSwitchInS(UINT32_MAX),
+ mDeltaToNextIdleSwitchInS(MAX_DELTA_SEC),
mLastUserInteraction(TimeStamp::Now())
{
if (sLog == nullptr)
@@ -544,7 +548,7 @@ nsIdleService::ResetIdleTimeOut(uint32_t idleDeltaInMS)
// Mark all idle services as non-idle, and calculate the next idle timeout.
nsCOMArray<nsIObserver> notifyList;
- mDeltaToNextIdleSwitchInS = UINT32_MAX;
+ mDeltaToNextIdleSwitchInS = MAX_DELTA_SEC;
// Loop through all listeners, and find any that have detected idle.
for (uint32_t i = 0; i < mArrayListeners.Length(); i++) {
@@ -717,7 +721,7 @@ nsIdleService::IdleTimerCallback(void)
}
// We need to initialise the time to the next idle switch.
- mDeltaToNextIdleSwitchInS = UINT32_MAX;
+ mDeltaToNextIdleSwitchInS = MAX_DELTA_SEC;
// Create list of observers that should be notified.
nsCOMArray<nsIObserver> notifyList;
@@ -839,7 +843,7 @@ void
nsIdleService::ReconfigureTimer(void)
{
// Check if either someone is idle, or someone will become idle.
- if ((mIdleObserverCount == 0) && UINT32_MAX == mDeltaToNextIdleSwitchInS) {
+ if ((mIdleObserverCount == 0) && MAX_DELTA_SEC == mDeltaToNextIdleSwitchInS) {
// If not, just let any existing timers run to completion
// And bail out.
MOZ_LOG(sLog, LogLevel::Debug,
diff --git a/widget/windows/InProcessWinCompositorWidget.cpp b/widget/windows/InProcessWinCompositorWidget.cpp
index 685eaf5ca..a11790b32 100644
--- a/widget/windows/InProcessWinCompositorWidget.cpp
+++ b/widget/windows/InProcessWinCompositorWidget.cpp
@@ -23,6 +23,31 @@ InProcessWinCompositorWidget::InProcessWinCompositorWidget(const CompositorWidge
MOZ_ASSERT(mWindow);
}
+void
+InProcessWinCompositorWidget::OnDestroyWindow()
+{
+ EnterPresentLock();
+ WinCompositorWidget::OnDestroyWindow();
+ LeavePresentLock();
+}
+
+void
+InProcessWinCompositorWidget::UpdateTransparency(nsTransparencyMode aMode)
+{
+ EnterPresentLock();
+ WinCompositorWidget::UpdateTransparency(aMode);
+ LeavePresentLock();
+}
+
+void
+InProcessWinCompositorWidget::ClearTransparentWindow()
+{
+ EnterPresentLock();
+ WinCompositorWidget::ClearTransparentWindow();
+ LeavePresentLock();
+}
+
+
nsIWidget*
InProcessWinCompositorWidget::RealWidget()
{
diff --git a/widget/windows/InProcessWinCompositorWidget.h b/widget/windows/InProcessWinCompositorWidget.h
index 2ce6ba0be..afe5a7f53 100644
--- a/widget/windows/InProcessWinCompositorWidget.h
+++ b/widget/windows/InProcessWinCompositorWidget.h
@@ -22,6 +22,10 @@ class InProcessWinCompositorWidget final : public WinCompositorWidget
public:
InProcessWinCompositorWidget(const CompositorWidgetInitData& aInitData, nsWindow* aWindow);
+ void OnDestroyWindow() override;
+ void UpdateTransparency(nsTransparencyMode aMode) override;
+ void ClearTransparentWindow() override;
+
void ObserveVsync(VsyncObserver* aObserver) override;
nsIWidget* RealWidget() override;
diff --git a/widget/windows/TSFTextStore.cpp b/widget/windows/TSFTextStore.cpp
index 7224126b8..c80de831c 100644
--- a/widget/windows/TSFTextStore.cpp
+++ b/widget/windows/TSFTextStore.cpp
@@ -4247,14 +4247,14 @@ TSFTextStore::InsertTextAtSelectionInternal(const nsAString& aInsertStr,
TS_SELECTION_ACP oldSelection = contentForTSF.Selection().ACP();
if (!mComposition.IsComposing()) {
// Use a temporary composition to contain the text
- PendingAction* compositionStart = mPendingActions.AppendElement();
+ PendingAction* compositionStart = mPendingActions.AppendElements(2);
+ PendingAction* compositionEnd = compositionStart + 1;
compositionStart->mType = PendingAction::COMPOSITION_START;
compositionStart->mSelectionStart = oldSelection.acpStart;
compositionStart->mSelectionLength =
oldSelection.acpEnd - oldSelection.acpStart;
compositionStart->mAdjustSelection = false;
- PendingAction* compositionEnd = mPendingActions.AppendElement();
compositionEnd->mType = PendingAction::COMPOSITION_END;
compositionEnd->mData = aInsertStr;
@@ -4455,10 +4455,12 @@ TSFTextStore::RecordCompositionEndAction()
}
// When only setting selection is necessary, we should append it.
if (pendingAction.mAdjustSelection) {
+ LONG selectionStart = pendingAction.mSelectionStart;
+ LONG selectionLength = pendingAction.mSelectionLength;
PendingAction* setSelection = mPendingActions.AppendElement();
setSelection->mType = PendingAction::SET_SELECTION;
- setSelection->mSelectionStart = pendingAction.mSelectionStart;
- setSelection->mSelectionLength = pendingAction.mSelectionLength;
+ setSelection->mSelectionStart = selectionStart;
+ setSelection->mSelectionLength = selectionLength;
setSelection->mSelectionReversed = false;
}
// Remove the redundant pending composition.