Bug 1177943 - Part 3. Look up dictionary using new 10.8+ interface. r=masayuki
From 10.8+, it has new API to look up dictionary async. So I use it.
MozReview-Commit-ID: 9kWEsCib4R5
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -5448,16 +5448,27 @@ PanGestureTypeForEvent(NSEvent* aEvent)
- (NSRect)firstRectForCharacterRange:(NSRange)aRange
actualRange:(NSRangePointer)actualRange
{
NS_ENSURE_TRUE(mTextInputHandler, NSMakeRect(0.0, 0.0, 0.0, 0.0));
return mTextInputHandler->FirstRectForCharacterRange(aRange, actualRange);
}
+- (void)quickLookWithEvent:(NSEvent*)event
+{
+ // Show dictionary by current point
+ WidgetContentCommandEvent
+ contentCommandEvent(true, eContentCommandLookUpDictionary, mGeckoChild);
+ NSPoint point = [self convertPoint:[event locationInWindow] fromView:nil];
+ contentCommandEvent.mRefPoint = mGeckoChild->CocoaPointsToDevPixels(point);
+ mGeckoChild->DispatchWindowEvent(contentCommandEvent);
+ // The widget might have been destroyed.
+}
+
- (NSInteger)windowLevel
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
NS_ENSURE_TRUE(mTextInputHandler, [[self window] level]);
return mTextInputHandler->GetWindowLevel();
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(NSNormalWindowLevel);