Diff
Modified: trunk/Source/WebCore/ChangeLog (175813 => 175814)
--- trunk/Source/WebCore/ChangeLog 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebCore/ChangeLog 2014-11-10 19:19:52 UTC (rev 175814)
@@ -1,3 +1,29 @@
+2014-11-10 Beth Dakin <bda...@apple.com>
+
+ WK1: Support default actions for read-only text
+ https://bugs.webkit.org/show_bug.cgi?id=138552
+ -and corresponding-
+ rdar://problem/18877483
+
+ Reviewed by Tim Horton.
+
+ WK1 now needs to do a lot of dictionary lookup operations that it did not
+ previously have to handle. So this patch takes a lot of that functionality, which
+ was implemented as static functions in WebPageMac for WK2 and moves it into
+ WebCore.
+
+ * WebCore.exp.in:
+ * WebCore.xcodeproj/project.pbxproj:
+ * editing/DictionaryLookup.h: Added.
+ * editing/DictionaryLookup.mm: Added.
+ (WebCore::isPositionInRange):
+ (WebCore::shouldUseSelection):
+ (WebCore::rangeExpandedAroundPositionByCharacters):
+ (WebCore::rangeForDictionaryLookupForSelection):
+ (WebCore::rangeForDictionaryLookupAtHitTestResult):
+ * platform/mac/WebCoreSystemInterface.h:
+ * platform/mac/WebCoreSystemInterface.mm:
+
2014-11-10 Myles C. Maxfield <mmaxfi...@apple.com>
[OSX] Some words are placed on top of each other in complex text layout
Modified: trunk/Source/WebCore/WebCore.exp.in (175813 => 175814)
--- trunk/Source/WebCore/WebCore.exp.in 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-11-10 19:19:52 UTC (rev 175814)
@@ -316,7 +316,9 @@
__ZN7WebCore13HitTestResultC1ERKNS_11LayoutPointEjjjj
__ZN7WebCore13HitTestResultC1ERKNS_15HitTestLocationE
__ZN7WebCore13HitTestResultC1ERKS0_
+__ZN7WebCore13HitTestResultC1Ev
__ZN7WebCore13HitTestResultD1Ev
+__ZN7WebCore13HitTestResultaSERKS0_
__ZN7WebCore13IdentifierRep3getEPKc
__ZN7WebCore13IdentifierRep3getEi
__ZN7WebCore13JSHTMLElement6s_infoE
@@ -1097,6 +1099,8 @@
__ZN7WebCore37WidgetHierarchyUpdatesSuspensionScope35s_widgetHierarchyUpdateSuspendCountE
__ZN7WebCore37computeFreshnessLifetimeForHTTPFamilyERKNS_16ResourceResponseEd
__ZN7WebCore38updateResponseHeadersAfterRevalidationERNS_16ResourceResponseERKS0_
+__ZN7WebCore39rangeExpandedAroundPositionByCharactersERKNS_15VisiblePositionEi
+__ZN7WebCore39rangeForDictionaryLookupAtHitTestResultERKNS_13HitTestResultEPP12NSDictionary
__ZN7WebCore3URL10invalidateEv
__ZN7WebCore3URL11setProtocolERKN3WTF6StringE
__ZN7WebCore3URL7setPathERKN3WTF6StringE
@@ -2373,6 +2377,7 @@
__ZN7WebCore35contextMenuItemTagShowSpellingPanelEb
__ZN7WebCore35contextMenuItemTagShowSubstitutionsEb
__ZN7WebCore35contextMenuItemTagSubstitutionsMenuEv
+__ZN7WebCore36rangeForDictionaryLookupForSelectionERKNS_16VisibleSelectionEPP12NSDictionary
__ZN7WebCore37contextMenuItemTagTransformationsMenuEv
__ZN7WebCore38contextMenuItemTagWritingDirectionMenuEv
__ZN7WebCore42contextMenuItemTagCheckGrammarWithSpellingEv
@@ -2436,6 +2441,7 @@
_wkDrawMediaSliderTrack
_wkDrawMediaUIPart
_wkExecutableWasLinkedOnOrBeforeSnowLeopard
+_wkExtractWordDefinitionTokenRangeFromContextualString
_wkGetAXTextMarkerRangeTypeID
_wkGetAXTextMarkerTypeID
_wkGetBytesFromAXTextMarker
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (175813 => 175814)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2014-11-10 19:19:52 UTC (rev 175814)
@@ -3271,6 +3271,8 @@
9362640B0DE1137D009D5A00 /* CSSReflectionDirection.h in Headers */ = {isa = PBXBuildFile; fileRef = 9362640A0DE1137D009D5A00 /* CSSReflectionDirection.h */; settings = {ATTRIBUTES = (Private, ); }; };
9370918D1416D86B00477333 /* textarearesizecor...@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 9370918C1416D86B00477333 /* textarearesizecor...@2x.png */; };
9377ABA015DEFEEF0031FD04 /* Pagination.h in Headers */ = {isa = PBXBuildFile; fileRef = 9377AB9F15DEFEEF0031FD04 /* Pagination.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 937FF3D51A1012D6008EBA31 /* DictionaryLookup.h in Headers */ = {isa = PBXBuildFile; fileRef = 937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 937FF3D71A10131B008EBA31 /* DictionaryLookup.mm in Sources */ = {isa = PBXBuildFile; fileRef = 937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */; };
9380F47309A11AB4001FDB34 /* Widget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9380F47109A11AB4001FDB34 /* Widget.cpp */; };
9380F47409A11AB4001FDB34 /* Widget.h in Headers */ = {isa = PBXBuildFile; fileRef = 9380F47209A11AB4001FDB34 /* Widget.h */; settings = {ATTRIBUTES = (Private, ); }; };
9380F47809A11ACC001FDB34 /* WidgetMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9380F47709A11ACC001FDB34 /* WidgetMac.mm */; };
@@ -10431,6 +10433,8 @@
936DD03A09CEAC270056AE8C /* Range.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Range.idl; sourceTree = "<group>"; };
9370918C1416D86B00477333 /* textarearesizecor...@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "textarearesizecor...@2x.png"; sourceTree = "<group>"; };
9377AB9F15DEFEEF0031FD04 /* Pagination.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Pagination.h; sourceTree = "<group>"; };
+ 937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictionaryLookup.h; sourceTree = "<group>"; };
+ 937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DictionaryLookup.mm; sourceTree = "<group>"; };
9380F47109A11AB4001FDB34 /* Widget.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Widget.cpp; sourceTree = "<group>"; };
9380F47209A11AB4001FDB34 /* Widget.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Widget.h; sourceTree = "<group>"; };
9380F47709A11ACC001FDB34 /* WidgetMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WidgetMac.mm; sourceTree = "<group>"; };
@@ -21990,6 +21994,8 @@
children = (
CE7B2DAF1586ABAD0098B3FA /* AlternativeTextUIController.h */,
CE7B2DB01586ABAD0098B3FA /* AlternativeTextUIController.mm */,
+ 937FF3D41A1012D6008EBA31 /* DictionaryLookup.h */,
+ 937FF3D61A10131B008EBA31 /* DictionaryLookup.mm */,
ED501DC50B249F2900AE18D9 /* EditorMac.mm */,
4A8C96EA0BE69032004EEFF0 /* FrameSelectionMac.mm */,
CE7B2DB11586ABAD0098B3FA /* TextAlternativeWithRange.h */,
@@ -26707,6 +26713,7 @@
9380F47409A11AB4001FDB34 /* Widget.h in Headers */,
51A9D9EA195B931F001B2B5C /* GamepadManager.h in Headers */,
1411DCB1164C39A800D49BC1 /* WidthCache.h in Headers */,
+ 937FF3D51A1012D6008EBA31 /* DictionaryLookup.h in Headers */,
939B02EF0EA2DBC400C54570 /* WidthIterator.h in Headers */,
BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */,
7E99AF530B13846468FB01A5 /* WindowFocusAllowedIndicator.h in Headers */,
@@ -27140,6 +27147,7 @@
49E912AC0EFAC906009D0CAF /* AnimationList.cpp in Sources */,
93309DD6099E64920056E581 /* AppendNodeCommand.cpp in Sources */,
1A8F6BBC0DB55CDC001DB794 /* ApplicationCache.cpp in Sources */,
+ 937FF3D71A10131B008EBA31 /* DictionaryLookup.mm in Sources */,
1A8F6BBE0DB55CDC001DB794 /* ApplicationCacheGroup.cpp in Sources */,
24F54EAC101FE914000AE741 /* ApplicationCacheHost.cpp in Sources */,
1A8F6BC00DB55CDC001DB794 /* ApplicationCacheResource.cpp in Sources */,
Added: trunk/Source/WebCore/editing/DictionaryLookup.h (0 => 175814)
--- trunk/Source/WebCore/editing/DictionaryLookup.h (rev 0)
+++ trunk/Source/WebCore/editing/DictionaryLookup.h 2014-11-10 19:19:52 UTC (rev 175814)
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef DictionaryLookup_h
+#define DictionaryLookup_h
+
+#include <wtf/PassRefPtr.h>
+
+@class NSDictionary;
+
+namespace WebCore {
+
+class HitTestResult;
+class Range;
+class VisiblePosition;
+class VisibleSelection;
+
+// FIXME: Some of these functions should probably be in a more generic class.
+// https://bugs.webkit.org/show_bug.cgi?id=138567
+bool isPositionInRange(const VisiblePosition&, Range*);
+bool shouldUseSelection(const VisiblePosition&, const VisibleSelection&);
+
+PassRefPtr<Range> rangeExpandedAroundPositionByCharacters(const VisiblePosition&, int numberOfCharactersToExpand);
+PassRefPtr<Range> rangeForDictionaryLookupForSelection(const VisibleSelection&, NSDictionary **options);
+PassRefPtr<Range> rangeForDictionaryLookupAtHitTestResult(const HitTestResult&, NSDictionary **options);
+
+} // namespace WebCore
+
+#endif // DictionaryLookup_h
Added: trunk/Source/WebCore/editing/DictionaryLookup.mm (0 => 175814)
--- trunk/Source/WebCore/editing/DictionaryLookup.mm (rev 0)
+++ trunk/Source/WebCore/editing/DictionaryLookup.mm 2014-11-10 19:19:52 UTC (rev 175814)
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "DictionaryLookup.h"
+
+#import "Document.h"
+#import "FocusController.h"
+#import "Frame.h"
+#import "FrameSelection.h"
+#import "HTMLConverter.h"
+#import "HitTestResult.h"
+#import "Page.h"
+#import "Range.h"
+#import "RenderObject.h"
+#import "TextIterator.h"
+#import "VisiblePosition.h"
+#import "VisibleSelection.h"
+#import "VisibleUnits.h"
+#import "WebCoreSystemInterface.h"
+#import "htmlediting.h"
+#import <wtf/RefPtr.h>
+
+namespace WebCore {
+
+bool isPositionInRange(const VisiblePosition& position, Range* range)
+{
+ RefPtr<Range> positionRange = makeRange(position, position);
+
+ ExceptionCode ec = 0;
+ range->compareBoundaryPoints(Range::START_TO_START, positionRange.get(), ec);
+ if (ec)
+ return false;
+
+ if (!range->isPointInRange(positionRange->startContainer(), positionRange->startOffset(), ec))
+ return false;
+ if (ec)
+ return false;
+
+ return true;
+}
+
+bool shouldUseSelection(const VisiblePosition& position, const VisibleSelection& selection)
+{
+ if (!selection.isRange())
+ return false;
+
+ RefPtr<Range> selectedRange = selection.toNormalizedRange();
+ if (!selectedRange)
+ return false;
+
+ return isPositionInRange(position, selectedRange.get());
+}
+
+PassRefPtr<Range> rangeExpandedAroundPositionByCharacters(const VisiblePosition& position, int numberOfCharactersToExpand)
+{
+ Position start = position.deepEquivalent();
+ Position end = position.deepEquivalent();
+ for (int i = 0; i < numberOfCharactersToExpand; ++i) {
+ if (directionOfEnclosingBlock(start) == LTR)
+ start = start.previous(Character);
+ else
+ start = start.next(Character);
+
+ if (directionOfEnclosingBlock(end) == LTR)
+ end = end.next(Character);
+ else
+ end = end.previous(Character);
+ }
+
+ return makeRange(start, end);
+}
+
+PassRefPtr<Range> rangeForDictionaryLookupForSelection(const VisibleSelection& selection, NSDictionary **options)
+{
+ RefPtr<Range> selectedRange = selection.toNormalizedRange();
+ if (!selectedRange)
+ return nullptr;
+
+ VisiblePosition selectionStart = selection.visibleStart();
+ VisiblePosition selectionEnd = selection.visibleEnd();
+
+ // As context, we are going to use the surrounding paragraphs of text.
+ VisiblePosition paragraphStart = startOfParagraph(selectionStart);
+ VisiblePosition paragraphEnd = endOfParagraph(selectionEnd);
+
+ int lengthToSelectionStart = TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get());
+ int lengthToSelectionEnd = TextIterator::rangeLength(makeRange(paragraphStart, selectionEnd).get());
+ NSRange rangeToPass = NSMakeRange(lengthToSelectionStart, lengthToSelectionEnd - lengthToSelectionStart);
+
+ String fullPlainTextString = plainText(makeRange(paragraphStart, paragraphEnd).get());
+
+ // Since we already have the range we want, we just need to grab the returned options.
+ wkExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, options);
+
+ return selectedRange.release();
+}
+
+PassRefPtr<Range> rangeForDictionaryLookupAtHitTestResult(const HitTestResult& hitTestResult, NSDictionary **options)
+{
+ Node* node = hitTestResult.innerNonSharedNode();
+ if (!node)
+ return nullptr;
+
+ auto renderer = node->renderer();
+ if (!renderer)
+ return nullptr;
+
+ Frame* frame = node->document().frame();
+ if (!frame)
+ return nullptr;
+
+ // Don't do anything if there is no character at the point.
+ if (!frame->rangeForPoint(hitTestResult.roundedPointInInnerNodeFrame()))
+ return nullptr;
+
+ VisiblePosition position = renderer->positionForPoint(hitTestResult.localPoint(), nullptr);
+ if (position.isNull())
+ position = firstPositionInOrBeforeNode(node);
+
+ VisibleSelection selection = frame->page()->focusController().focusedOrMainFrame().selection().selection();
+ if (shouldUseSelection(position, selection))
+ return rangeForDictionaryLookupForSelection(selection, options);
+
+ // As context, we are going to use 250 characters of text before and after the point.
+ RefPtr<Range> fullCharacterRange = rangeExpandedAroundPositionByCharacters(position, 250);
+ if (!fullCharacterRange)
+ return nullptr;
+
+ NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(fullCharacterRange->startPosition(), position).get()), 0);
+
+ String fullPlainTextString = plainText(fullCharacterRange.get());
+
+ NSRange extractedRange = wkExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, options);
+
+ // This function sometimes returns {NSNotFound, 0} if it was unable to determine a good string.
+ if (extractedRange.location == NSNotFound)
+ return nullptr;
+
+ return TextIterator::subrange(fullCharacterRange.get(), extractedRange.location, extractedRange.length);
+}
+
+}
Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h (175813 => 175814)
--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h 2014-11-10 19:19:52 UTC (rev 175814)
@@ -103,6 +103,7 @@
OBJC_CLASS NSCursor;
OBJC_CLASS NSData;
OBJC_CLASS NSDate;
+OBJC_CLASS NSDictionary;
OBJC_CLASS NSEvent;
OBJC_CLASS NSFont;
OBJC_CLASS NSHTTPCookie;
@@ -260,6 +261,8 @@
extern bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
+extern NSRange (*wkExtractWordDefinitionTokenRangeFromContextualString)(NSString *contextString, NSRange range, NSDictionary **options);
+
extern CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
extern NSCursor *(*wkCursor)(const char*);
Modified: trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm (175813 => 175814)
--- trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm 2014-11-10 19:19:52 UTC (rev 175814)
@@ -124,6 +124,8 @@
bool (*wkExecutableWasLinkedOnOrBeforeSnowLeopard)(void);
+NSRange (*wkExtractWordDefinitionTokenRangeFromContextualString)(NSString *contextString, NSRange range, NSDictionary **options);
+
CFStringRef (*wkCopyDefaultSearchProviderDisplayName)(void);
NSCursor *(*wkCursor)(const char*);
Modified: trunk/Source/WebKit/mac/ChangeLog (175813 => 175814)
--- trunk/Source/WebKit/mac/ChangeLog 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebKit/mac/ChangeLog 2014-11-10 19:19:52 UTC (rev 175814)
@@ -1,3 +1,57 @@
+2014-11-10 Beth Dakin <bda...@apple.com>
+
+ WK1: Support default actions for read-only text
+ https://bugs.webkit.org/show_bug.cgi?id=138552
+ -and corresponding-
+ rdar://problem/18877483
+
+ Reviewed by Tim Horton.
+
+ New WKSystemInterface functions that WebCore needs to use.
+ * WebCoreSupport/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+
+ WebActionMenuController now keeps an ivar for the WebCore::HitTestResult. This
+ makes a lot of things easier.
+ * WebView/WebActionMenuController.h:
+ * WebView/WebActionMenuController.mm:
+
+ Perform the hit test ourselves instead of calling into WebView so that we can more
+ easily save the WebCore::HitTestResult for ourselves.
+ (-[WebActionMenuController performHitTestAtPoint:]):
+
+ Clear selection for non-text menus.
+ (-[WebActionMenuController prepareForMenu:withEvent:]):
+
+ Re-set the _type here just to be safe.
+ (-[WebActionMenuController didCloseMenu:withEvent:]):
+
+ Moving this method to be next to the link actions so they can be within a pragma
+ mark.
+ (-[WebActionMenuController _defaultMenuItemsForLink:]):
+
+ New method for default text actions — lookup and copy.
+ (-[WebActionMenuController _defaultMenuItemsForText:]):
+ (-[WebActionMenuController _copySelection:]):
+ (-[WebActionMenuController _lookupText:]):
+
+ If there is not already a selection, invoking the action menu on text should
+ select the lookup text.
+ (-[WebActionMenuController _selectLookupText]):
+ (performDictionaryLookupForSelection):
+ (performDictionaryLookupForRange):
+
+ Handle text now.
+ (-[WebActionMenuController _createActionMenuItemForTag:withHitTestResult:]):
+ (-[WebActionMenuController _defaultMenuItemsForHitTestResult:]):
+
+ New enum values.
+ * WebView/WebUIDelegatePrivate.h:
+
+ Pass didCloseMenu on to the controller.
+ * WebView/WebView.mm:
+ (-[WebView didCloseMenu:withEvent:]):
+
2014-11-09 Chris Dumez <cdu...@apple.com>
Add a more correct way to compare floating point numbers and use it
Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm (175813 => 175814)
--- trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm 2014-11-10 19:19:52 UTC (rev 175814)
@@ -146,6 +146,7 @@
#if !PLATFORM(IOS)
INIT(RecommendedScrollerStyle);
INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
+ INIT(ExtractWordDefinitionTokenRangeFromContextualString);
INIT(CopyDefaultSearchProviderDisplayName);
INIT(Cursor);
#endif
Modified: trunk/Source/WebKit/mac/WebView/WebActionMenuController.h (175813 => 175814)
--- trunk/Source/WebKit/mac/WebView/WebActionMenuController.h 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebKit/mac/WebView/WebActionMenuController.h 2014-11-10 19:19:52 UTC (rev 175814)
@@ -24,6 +24,7 @@
*/
#import "WebUIDelegatePrivate.h"
+#import <WebCore/HitTestResult.h>
@class WebView;
@@ -31,10 +32,12 @@
@private
WebView *_webView;
WebActionMenuType _type;
+ WebCore::HitTestResult _hitTestResult;
}
- (id)initWithWebView:(WebView *)webView;
- (void)webViewClosed;
- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
+- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
@end
Modified: trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm (175813 => 175814)
--- trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm 2014-11-10 19:19:52 UTC (rev 175814)
@@ -27,13 +27,26 @@
#import "DOMElementInternal.h"
#import "DOMNodeInternal.h"
+#import "WebDocumentInternal.h"
+#import "WebElementDictionary.h"
+#import "WebFrameInternal.h"
+#import "WebHTMLView.h"
+#import "WebHTMLViewInternal.h"
+#import "WebSystemInterface.h"
#import "WebUIDelegatePrivate.h"
#import "WebViewInternal.h"
+#import <WebCore/DictionaryLookup.h>
#import <WebCore/Element.h>
+#import <WebCore/EventHandler.h>
#import <WebCore/Frame.h>
#import <WebCore/FrameView.h>
+#import <WebCore/HTMLConverter.h>
#import <WebCore/NSViewSPI.h>
+#import <WebCore/Page.h>
+#import <WebCore/Range.h>
+#import <WebCore/RenderObject.h>
#import <WebCore/SoftLinking.h>
+#import <WebKitSystemInterface.h>
#import <objc/objc-class.h>
#import <objc/objc.h>
@@ -52,6 +65,12 @@
using namespace WebCore;
+struct DictionaryPopupInfo {
+ NSPoint origin;
+ RetainPtr<NSDictionary> options;
+ RetainPtr<NSAttributedString> attributedString;
+};
+
@implementation WebActionMenuController
- (id)initWithWebView:(WebView *)webView
@@ -70,6 +89,20 @@
_webView = nil;
}
+- (WebElementDictionary *)performHitTestAtPoint:(NSPoint)windowPoint
+{
+ WebHTMLView *documentView = [[[_webView _selectedOrMainFrame] frameView] documentView];
+ NSPoint point = [documentView convertPoint:windowPoint fromView:nil];
+
+ Frame* coreFrame = core([documentView _frame]);
+ if (!coreFrame)
+ return nil;
+ HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active;
+ _hitTestResult = coreFrame->eventHandler().hitTestResultAtPoint(IntPoint(point), hitType);
+
+ return [[[WebElementDictionary alloc] initWithHitTestResult:_hitTestResult] autorelease];
+}
+
- (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event
{
if (!_webView)
@@ -81,10 +114,12 @@
[actionMenu removeAllItems];
- NSDictionary *hitTestResult = [_webView elementAtPoint:[_webView convertPoint:event.locationInWindow fromView:nil]];
-
+ WebElementDictionary *hitTestResult = [self performHitTestAtPoint:[_webView convertPoint:event.locationInWindow fromView:nil]];
NSArray *menuItems = [self _defaultMenuItemsForHitTestResult:hitTestResult];
+ if (_type != WebActionMenuReadOnlyText)
+ [[_webView _selectedOrMainFrame] _clearSelection];
+
// Allow clients to customize the menu items.
if ([[_webView UIDelegate] respondsToSelector:@selector(_webView:actionMenuItemsForHitTestResult:withType:defaultActionMenuItems:)])
menuItems = [[_webView UIDelegate] _webView:_webView actionMenuItemsForHitTestResult:hitTestResult withType:_type defaultActionMenuItems:menuItems];
@@ -93,6 +128,16 @@
[actionMenu addItem:item];
}
+- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event
+{
+ if (menu != _webView.actionMenu)
+ return;
+
+ _type = WebActionMenuNone;
+}
+
+#pragma mark Link actions
+
- (void)_openURLFromActionMenu:(id)sender
{
if (!_webView)
@@ -174,8 +219,124 @@
[bubble showPreviewItem:url itemFrame:itemFrame];
}
-- (RetainPtr<NSMenuItem>)_createActionMenuItemForTag:(uint32_t)tag withHitTestResult:(NSDictionary *)hitTestResult
+- (NSArray *)_defaultMenuItemsForLink:(WebElementDictionary *)hitTestResult
{
+ NSURL *url = "" objectForKey:WebElementLinkURLKey];
+ if (!url)
+ return @[ ];
+
+ if (!WebCore::protocolIsInHTTPFamily([url absoluteString]))
+ return @[ ];
+
+ RetainPtr<NSMenuItem> openLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagOpenLinkInDefaultBrowser withHitTestResult:hitTestResult];
+ RetainPtr<NSMenuItem> previewLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPreviewLink withHitTestResult:hitTestResult];
+ RetainPtr<NSMenuItem> readingListItem = [self _createActionMenuItemForTag:WebActionMenuItemTagAddLinkToSafariReadingList withHitTestResult:hitTestResult];
+
+ return @[ openLinkItem.get(), previewLinkItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];
+}
+
+#pragma mark Text actions
+
+- (NSArray *)_defaultMenuItemsForText:(WebElementDictionary *)hitTestResult
+{
+ RetainPtr<NSMenuItem> copyTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyText withHitTestResult:hitTestResult];
+ RetainPtr<NSMenuItem> lookupTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagLookupText withHitTestResult:hitTestResult];
+
+ return @[ copyTextItem.get(), lookupTextItem.get() ];
+}
+
+- (void)_copySelection:(id)sender
+{
+ [_webView _executeCoreCommandByName:@"copy" value:nil];
+}
+
+- (void)_lookupText:(id)sender
+{
+ Frame* frame = core([_webView _selectedOrMainFrame]);
+ if (!frame)
+ return;
+
+ DictionaryPopupInfo popupInfo = performDictionaryLookupForSelection(frame, frame->selection().selection());
+ if (!popupInfo.attributedString)
+ return;
+
+ NSPoint textBaselineOrigin = popupInfo.origin;
+
+ // Convert to screen coordinates.
+ textBaselineOrigin = [_webView convertPoint:textBaselineOrigin toView:nil];
+ textBaselineOrigin = [_webView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
+
+ WKShowWordDefinitionWindow(popupInfo.attributedString.get(), textBaselineOrigin, popupInfo.options.get());
+}
+
+- (BOOL)_selectLookupText
+{
+ NSDictionary *options = nil;
+ RefPtr<Range> lookupRange = rangeForDictionaryLookupAtHitTestResult(_hitTestResult, &options);
+ if (!lookupRange)
+ return false;
+
+ Frame* frame = _hitTestResult.innerNode()->document().frame();
+ if (!frame)
+ return false;
+
+ frame->selection().setSelectedRange(lookupRange.get(), DOWNSTREAM, true);
+ return true;
+}
+
+static DictionaryPopupInfo performDictionaryLookupForSelection(Frame* frame, const VisibleSelection& selection)
+{
+ NSDictionary *options = nil;
+ DictionaryPopupInfo popupInfo;
+ RefPtr<Range> selectedRange = rangeForDictionaryLookupForSelection(selection, &options);
+ if (selectedRange)
+ popupInfo = performDictionaryLookupForRange(frame, *selectedRange, options);
+ return popupInfo;
+}
+
+static DictionaryPopupInfo performDictionaryLookupForRange(Frame* frame, Range& range, NSDictionary *options)
+{
+ DictionaryPopupInfo popupInfo;
+ if (range.text().stripWhiteSpace().isEmpty())
+ return popupInfo;
+
+ RenderObject* renderer = range.startContainer()->renderer();
+ const RenderStyle& style = renderer->style();
+
+ Vector<FloatQuad> quads;
+ range.textQuads(quads);
+ if (quads.isEmpty())
+ return popupInfo;
+
+ IntRect rangeRect = frame->view()->contentsToWindow(quads[0].enclosingBoundingBox());
+
+ popupInfo.origin = NSMakePoint(rangeRect.x(), rangeRect.y() + (style.fontMetrics().descent() * frame->page()->pageScaleFactor()));
+ popupInfo.options = options;
+
+ NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range);
+ RetainPtr<NSMutableAttributedString> scaledNSAttributedString = adoptNS([[NSMutableAttributedString alloc] initWithString:[nsAttributedString string]]);
+ NSFontManager *fontManager = [NSFontManager sharedFontManager];
+
+ [nsAttributedString enumerateAttributesInRange:NSMakeRange(0, [nsAttributedString length]) options:0 usingBlock:^(NSDictionary *attributes, NSRange range, BOOL *stop) {
+ RetainPtr<NSMutableDictionary> scaledAttributes = adoptNS([attributes mutableCopy]);
+
+ NSFont *font = [scaledAttributes objectForKey:NSFontAttributeName];
+ if (font) {
+ font = [fontManager convertFont:font toSize:[font pointSize] * frame->page()->pageScaleFactor()];
+ [scaledAttributes setObject:font forKey:NSFontAttributeName];
+ }
+
+ [scaledNSAttributedString addAttributes:scaledAttributes.get() range:range];
+ }];
+
+ popupInfo.attributedString = scaledNSAttributedString.get();
+ return popupInfo;
+}
+
+#pragma mark Menu Items
+
+- (RetainPtr<NSMenuItem>)_createActionMenuItemForTag:(uint32_t)tag withHitTestResult:(WebElementDictionary *)hitTestResult
+{
SEL selector = nullptr;
NSString *title = nil;
NSImage *image = nil;
@@ -204,6 +365,18 @@
representedObject = [hitTestResult objectForKey:WebElementLinkURLKey];
break;
+ case WebActionMenuItemTagCopyText:
+ selector = @selector(_copySelection:);
+ title = @"Copy";
+ image = [NSImage imageNamed:@"NSActionMenuCopy"];
+ break;
+
+ case WebActionMenuItemTagLookupText:
+ selector = @selector(_lookupText:);
+ title = @"Look Up";
+ image = [NSImage imageNamed:@"NSActionMenuLookup"];
+ break;
+
default:
ASSERT_NOT_REACHED();
return nil;
@@ -222,31 +395,24 @@
return [[NSBundle bundleForClass:NSClassFromString(@"WKView")] imageForResource:name];
}
-- (NSArray *)_defaultMenuItemsForLink:(NSDictionary *)hitTestResult
+- (NSArray *)_defaultMenuItemsForHitTestResult:(WebElementDictionary *)hitTestResult
{
NSURL *url = "" objectForKey:WebElementLinkURLKey];
- if (!url)
- return @[ ];
-
- if (!WebCore::protocolIsInHTTPFamily([url absoluteString]))
- return @[ ];
-
- RetainPtr<NSMenuItem> openLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagOpenLinkInDefaultBrowser withHitTestResult:hitTestResult];
- RetainPtr<NSMenuItem> previewLinkItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPreviewLink withHitTestResult:hitTestResult];
- RetainPtr<NSMenuItem> readingListItem = [self _createActionMenuItemForTag:WebActionMenuItemTagAddLinkToSafariReadingList withHitTestResult:hitTestResult];
-
- return @[ openLinkItem.get(), previewLinkItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];
-}
-
-- (NSArray *)_defaultMenuItemsForHitTestResult:(NSDictionary *)hitTestResult
-{
- NSURL *url = "" objectForKey:WebElementLinkURLKey];
-
if (url) {
_type = WebActionMenuLink;
return [self _defaultMenuItemsForLink:hitTestResult];
}
+ Node* node = _hitTestResult.innerNode();
+ if (node && node->isTextNode()) {
+ if (![[hitTestResult objectForKey:WebElementIsSelectedKey] boolValue]) {
+ if (![self _selectLookupText])
+ return @[ ];
+ }
+ _type = WebActionMenuReadOnlyText;
+ return [self _defaultMenuItemsForText:hitTestResult];
+ }
+
_type = WebActionMenuNone;
return @[ ];
}
Modified: trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h (175813 => 175814)
--- trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h 2014-11-10 19:19:52 UTC (rev 175814)
@@ -116,12 +116,15 @@
WebActionMenuItemTagNoAction = 0,
WebActionMenuItemTagOpenLinkInDefaultBrowser,
WebActionMenuItemTagPreviewLink,
- WebActionMenuItemTagAddLinkToSafariReadingList
+ WebActionMenuItemTagAddLinkToSafariReadingList,
+ WebActionMenuItemTagCopyText,
+ WebActionMenuItemTagLookupText
};
typedef enum {
WebActionMenuNone = 0,
- WebActionMenuLink
+ WebActionMenuLink,
+ WebActionMenuReadOnlyText
} WebActionMenuType;
// Message Sources.
Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (175813 => 175814)
--- trunk/Source/WebKit/mac/WebView/WebView.mm 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm 2014-11-10 19:19:52 UTC (rev 175814)
@@ -8543,6 +8543,14 @@
[_private->actionMenuController prepareForMenu:menu withEvent:event];
}
+
+- (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event
+{
+ if (menu != self.actionMenu)
+ return;
+
+ [_private->actionMenuController didCloseMenu:menu withEvent:event];
+}
#endif
@end
Modified: trunk/Source/WebKit2/ChangeLog (175813 => 175814)
--- trunk/Source/WebKit2/ChangeLog 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebKit2/ChangeLog 2014-11-10 19:19:52 UTC (rev 175814)
@@ -1,3 +1,27 @@
+2014-11-10 Beth Dakin <bda...@apple.com>
+
+ WK1: Support default actions for read-only text
+ https://bugs.webkit.org/show_bug.cgi?id=138552
+ -and corresponding-
+ rdar://problem/18877483
+
+ Reviewed by Tim Horton.
+
+ WK1 now needs to do a lot of dictionary lookup operations that it did not
+ previously have to handle. So this patch takes a lot of that functionality, which
+ was implemented as static functions in WebPageMac for WK2 and moves it into
+ WebCore.
+
+ * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
+ (InitWebCoreSystemInterface):
+ * WebProcess/WebPage/mac/WebPageMac.mm:
+ (WebKit::WebPage::performDictionaryLookupForRange):
+ (WebKit::isPositionInRange): Deleted.
+ (WebKit::shouldUseSelection): Deleted.
+ (WebKit::rangeExpandedAroundPositionByCharacters): Deleted.
+ (WebKit::rangeForDictionaryLookupForSelection): Deleted.
+ (WebKit::rangeForDictionaryLookupAtHitTestResult): Deleted.
+
2014-11-10 Dan Bernstein <m...@apple.com>
iOS build fix.
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (175813 => 175814)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm 2014-11-10 19:19:52 UTC (rev 175814)
@@ -136,6 +136,7 @@
#if !PLATFORM(IOS)
INIT(RecommendedScrollerStyle);
INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard);
+ INIT(ExtractWordDefinitionTokenRangeFromContextualString);
INIT(CopyDefaultSearchProviderDisplayName);
INIT(Cursor);
INIT(WindowSetScaledFrame);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (175813 => 175814)
--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2014-11-10 18:55:08 UTC (rev 175813)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm 2014-11-10 19:19:52 UTC (rev 175814)
@@ -57,6 +57,7 @@
#import <WebCore/AXObjectCache.h>
#import <WebCore/BackForwardController.h>
#import <WebCore/DataDetectorsSPI.h>
+#import <WebCore/DictionaryLookup.h>
#import <WebCore/EventHandler.h>
#import <WebCore/FocusController.h>
#import <WebCore/FrameLoader.h>
@@ -476,123 +477,6 @@
send(Messages::WebPageProxy::AttributedStringForCharacterRangeCallback(result, EditingRange(editingRange.location, [result.string length]), callbackID));
}
-static bool isPositionInRange(const VisiblePosition& position, Range* range)
-{
- RefPtr<Range> positionRange = makeRange(position, position);
-
- ExceptionCode ec = 0;
- range->compareBoundaryPoints(Range::START_TO_START, positionRange.get(), ec);
- if (ec)
- return false;
-
- if (!range->isPointInRange(positionRange->startContainer(), positionRange->startOffset(), ec))
- return false;
- if (ec)
- return false;
-
- return true;
-}
-
-static bool shouldUseSelection(const VisiblePosition& position, const VisibleSelection& selection)
-{
- if (!selection.isRange())
- return false;
-
- RefPtr<Range> selectedRange = selection.toNormalizedRange();
- if (!selectedRange)
- return false;
-
- return isPositionInRange(position, selectedRange.get());
-}
-
-static PassRefPtr<Range> rangeExpandedAroundPositionByCharacters(const VisiblePosition& position, int numberOfCharactersToExpand)
-{
- Position start = position.deepEquivalent();
- Position end = position.deepEquivalent();
- for (int i = 0; i < numberOfCharactersToExpand; ++i) {
- if (directionOfEnclosingBlock(start) == LTR)
- start = start.previous(Character);
- else
- start = start.next(Character);
-
- if (directionOfEnclosingBlock(end) == LTR)
- end = end.next(Character);
- else
- end = end.previous(Character);
- }
-
- return makeRange(start, end);
-}
-
-static PassRefPtr<Range> rangeForDictionaryLookupForSelection(const VisibleSelection& selection, NSDictionary **options)
-{
- RefPtr<Range> selectedRange = selection.toNormalizedRange();
- if (!selectedRange)
- return nullptr;
-
- VisiblePosition selectionStart = selection.visibleStart();
- VisiblePosition selectionEnd = selection.visibleEnd();
-
- // As context, we are going to use the surrounding paragraphs of text.
- VisiblePosition paragraphStart = startOfParagraph(selectionStart);
- VisiblePosition paragraphEnd = endOfParagraph(selectionEnd);
-
- int lengthToSelectionStart = TextIterator::rangeLength(makeRange(paragraphStart, selectionStart).get());
- int lengthToSelectionEnd = TextIterator::rangeLength(makeRange(paragraphStart, selectionEnd).get());
- NSRange rangeToPass = NSMakeRange(lengthToSelectionStart, lengthToSelectionEnd - lengthToSelectionStart);
-
- String fullPlainTextString = plainText(makeRange(paragraphStart, paragraphEnd).get());
-
- // Since we already have the range we want, we just need to grab the returned options.
- WKExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, options);
-
- return selectedRange.release();
-}
-
-static PassRefPtr<Range> rangeForDictionaryLookupAtHitTestResult(const HitTestResult& hitTestResult, NSDictionary **options)
-{
- Node* node = hitTestResult.innerNonSharedNode();
- if (!node)
- return nullptr;
-
- auto renderer = node->renderer();
- if (!renderer)
- return nullptr;
-
- Frame* frame = node->document().frame();
- if (!frame)
- return nullptr;
-
- // Don't do anything if there is no character at the point.
- if (!frame->rangeForPoint(hitTestResult.roundedPointInInnerNodeFrame()))
- return nullptr;
-
- VisiblePosition position = renderer->positionForPoint(hitTestResult.localPoint(), nullptr);
- if (position.isNull())
- position = firstPositionInOrBeforeNode(node);
-
- VisibleSelection selection = frame->page()->focusController().focusedOrMainFrame().selection().selection();
- if (shouldUseSelection(position, selection))
- return rangeForDictionaryLookupForSelection(selection, options);
-
- // As context, we are going to use 250 characters of text before and after the point.
- RefPtr<Range> fullCharacterRange = rangeExpandedAroundPositionByCharacters(position, 250);
- if (!fullCharacterRange)
- return nullptr;
-
- NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(fullCharacterRange->startPosition(), position).get()), 0);
-
- String fullPlainTextString = plainText(fullCharacterRange.get());
-
- NSRange extractedRange = WKExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, options);
-
- // This function sometimes returns {NSNotFound, 0} if it was unable to determine a good string.
- if (extractedRange.location == NSNotFound)
- return nullptr;
-
- return TextIterator::subrange(fullCharacterRange.get(), extractedRange.location, extractedRange.length);
-}
-
void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
{
if (PluginView* pluginView = pluginViewForFrame(&m_page->mainFrame())) {
@@ -640,7 +524,7 @@
return;
IntRect rangeRect = frame->view()->contentsToWindow(quads[0].enclosingBoundingBox());
-
+
DictionaryPopupInfo dictionaryPopupInfo;
dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y() + (style.fontMetrics().ascent() * pageScaleFactor()));
dictionaryPopupInfo.options = (CFDictionaryRef)options;