Size of text in popup menu doesn't match size of text in <select> itself in WebKit2
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Feb 2011 19:19:02 +0000 (19:19 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Feb 2011 19:19:02 +0000 (19:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=48234

Reviewed by Darin Adler.

* Shared/TextInfo.cpp: Removed.
* Shared/TextInfo.h: Removed.
Replace this with the more appropriately DictionaryPopupInfo.

* Shared/DictionaryPopupInfo.cpp: Copied from Source/WebKit2/Shared/TextInfo.cpp.
(WebKit::DictionaryPopupInfo::encode):
(WebKit::DictionaryPopupInfo::decode):
* Shared/DictionaryPopupInfo.h: Copied from Source/WebKit2/Shared/TextInfo.h.
(WebKit::DictionaryPopupInfo::DictionaryPopupInfo):
Replace individual font related fields with FontInfo.

* Shared/FontInfo.cpp: Added.
(WebKit::FontInfo::FontInfo):
(WebKit::FontInfo::encode):
(WebKit::FontInfo::decode):
* Shared/FontInfo.h: Added.
Add class to encapsulate passing a font description over the wire.

* Shared/PlatformPopupMenuData.cpp:
(WebKit::PlatformPopupMenuData::encode):
(WebKit::PlatformPopupMenuData::decode):
* Shared/PlatformPopupMenuData.h:
Add FontInfo as extra data for the Mac.

* UIProcess/API/mac/PageClientImpl.h:
* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::didPerformDictionaryLookup):
* UIProcess/PageClient.h:
Add scaleFactor and use it to construct a font at the right size.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::showPopupMenu):
(WebKit::WebPageProxy::didPerformDictionaryLookup):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/WebPopupMenuProxy.h:
* UIProcess/mac/WebPopupMenuProxyMac.h:
(WebKit::WebPopupMenuProxyMac::create):
* UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::WebPopupMenuProxyMac):
(WebKit::WebPopupMenuProxyMac::populate):
(WebKit::WebPopupMenuProxyMac::showPopupMenu):
* UIProcess/qt/WebPopupMenuProxyQt.cpp:
(WebKit::WebPopupMenuProxyQt::showPopupMenu):
* UIProcess/qt/WebPopupMenuProxyQt.h:
* UIProcess/win/WebPopupMenuProxyWin.cpp:
(WebKit::WebPopupMenuProxyWin::showPopupMenu):
* UIProcess/win/WebPopupMenuProxyWin.h:
* WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm:
(WebKit::WebPopupMenu::setUpPlatformData):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performDictionaryLookupAtLocation):
Pass scale factor through and rename TextInfo -> DictionaryPopupInfo.

* WebKit2.pro:
* WebKit2.xcodeproj/project.pbxproj:
* win/WebKit2.vcproj:
Add new files.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@79886 268f45cc-cd09-0410-ab3c-d52691b4dbfc

25 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/DictionaryPopupInfo.cpp [new file with mode: 0644]
Source/WebKit2/Shared/DictionaryPopupInfo.h [new file with mode: 0644]
Source/WebKit2/Shared/FontInfo.cpp [moved from Source/WebKit2/Shared/TextInfo.cpp with 78% similarity]
Source/WebKit2/Shared/FontInfo.h [moved from Source/WebKit2/Shared/TextInfo.h with 85% similarity]
Source/WebKit2/Shared/PlatformPopupMenuData.cpp
Source/WebKit2/Shared/PlatformPopupMenuData.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.h
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/UIProcess/WebPopupMenuProxy.h
Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.h
Source/WebKit2/UIProcess/mac/WebPopupMenuProxyMac.mm
Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.cpp
Source/WebKit2/UIProcess/qt/WebPopupMenuProxyQt.h
Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.cpp
Source/WebKit2/UIProcess/win/WebPopupMenuProxyWin.h
Source/WebKit2/WebKit2.pro
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
Source/WebKit2/win/WebKit2.vcproj

index 1c3510f..2a93d04 100644 (file)
@@ -1,3 +1,69 @@
+2011-02-28  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Darin Adler.
+
+        Size of text in popup menu doesn't match size of text in <select> itself in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=48234
+
+        * Shared/TextInfo.cpp: Removed.
+        * Shared/TextInfo.h: Removed.
+        Replace this with the more appropriately DictionaryPopupInfo.
+
+        * Shared/DictionaryPopupInfo.cpp: Copied from Source/WebKit2/Shared/TextInfo.cpp.
+        (WebKit::DictionaryPopupInfo::encode):
+        (WebKit::DictionaryPopupInfo::decode):
+        * Shared/DictionaryPopupInfo.h: Copied from Source/WebKit2/Shared/TextInfo.h.
+        (WebKit::DictionaryPopupInfo::DictionaryPopupInfo):
+        Replace individual font related fields with FontInfo.
+
+        * Shared/FontInfo.cpp: Added.
+        (WebKit::FontInfo::FontInfo):
+        (WebKit::FontInfo::encode):
+        (WebKit::FontInfo::decode):
+        * Shared/FontInfo.h: Added.
+        Add class to encapsulate passing a font description over the wire.
+
+        * Shared/PlatformPopupMenuData.cpp:
+        (WebKit::PlatformPopupMenuData::encode):
+        (WebKit::PlatformPopupMenuData::decode):
+        * Shared/PlatformPopupMenuData.h:
+        Add FontInfo as extra data for the Mac.
+
+        * UIProcess/API/mac/PageClientImpl.h:
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::didPerformDictionaryLookup):
+        * UIProcess/PageClient.h:
+        Add scaleFactor and use it to construct a font at the right size.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::showPopupMenu):
+        (WebKit::WebPageProxy::didPerformDictionaryLookup):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/WebPopupMenuProxy.h:
+        * UIProcess/mac/WebPopupMenuProxyMac.h:
+        (WebKit::WebPopupMenuProxyMac::create):
+        * UIProcess/mac/WebPopupMenuProxyMac.mm:
+        (WebKit::WebPopupMenuProxyMac::WebPopupMenuProxyMac):
+        (WebKit::WebPopupMenuProxyMac::populate):
+        (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+        * UIProcess/qt/WebPopupMenuProxyQt.cpp:
+        (WebKit::WebPopupMenuProxyQt::showPopupMenu):
+        * UIProcess/qt/WebPopupMenuProxyQt.h:
+        * UIProcess/win/WebPopupMenuProxyWin.cpp:
+        (WebKit::WebPopupMenuProxyWin::showPopupMenu):
+        * UIProcess/win/WebPopupMenuProxyWin.h:
+        * WebProcess/WebCoreSupport/mac/WebPopupMenuMac.mm:
+        (WebKit::WebPopupMenu::setUpPlatformData):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::performDictionaryLookupAtLocation):
+        Pass scale factor through and rename TextInfo -> DictionaryPopupInfo.
+
+        * WebKit2.pro:
+        * WebKit2.xcodeproj/project.pbxproj:
+        * win/WebKit2.vcproj:
+        Add new files.
+
 2011-02-28  Adam Roben  <aroben@apple.com>
 
         One more rename as a followup to r79868
diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.cpp b/Source/WebKit2/Shared/DictionaryPopupInfo.cpp
new file mode 100644 (file)
index 0000000..7b9a706
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 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.
+ */
+
+#include "config.h"
+#include "DictionaryPopupInfo.h"
+
+#include "WebCoreArgumentCoders.h"
+
+namespace WebKit {
+
+void DictionaryPopupInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
+{
+    encoder->encode(origin);
+    encoder->encode(fontInfo);
+}
+
+bool DictionaryPopupInfo::decode(CoreIPC::ArgumentDecoder* decoder, DictionaryPopupInfo& result)
+{
+    if (!decoder->decode(result.origin))
+        return false;
+    if (!decoder->decode(result.fontInfo))
+        return false;
+    return true;
+}
+
+} // namespace WebKit
diff --git a/Source/WebKit2/Shared/DictionaryPopupInfo.h b/Source/WebKit2/Shared/DictionaryPopupInfo.h
new file mode 100644 (file)
index 0000000..6498ba3
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2011 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 DictionaryPopupInfo_h
+#define DictionaryPopupInfo_h
+
+#include "FontInfo.h"
+#include <WebCore/FloatPoint.h>
+
+namespace CoreIPC {
+    class ArgumentDecoder;
+    class ArgumentEncoder;
+}
+
+namespace WebKit {
+
+struct DictionaryPopupInfo {
+    void encode(CoreIPC::ArgumentEncoder*) const;
+    static bool decode(CoreIPC::ArgumentDecoder*, DictionaryPopupInfo&);
+
+    WebCore::FloatPoint origin;
+    FontInfo fontInfo;
+};
+
+} // namespace WebKit
+
+#endif // DictionaryPopupInfo_h
similarity index 78%
rename from Source/WebKit2/Shared/TextInfo.cpp
rename to Source/WebKit2/Shared/FontInfo.cpp
index c9cf711..d4ab78e 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "TextInfo.h"
+#include "FontInfo.h"
 
 #include "WebCoreArgumentCoders.h"
 
 
 namespace WebKit {
 
-void TextInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
+void FontInfo::encode(CoreIPC::ArgumentEncoder* encoder) const
 {
-    encoder->encode(baselineOrigin);
 #if PLATFORM(MAC)
     CoreIPC::encode(encoder, fontAttributeDictionary.get());
-    encoder->encode(fontOverrideSize);
 #endif
 }
 
-bool TextInfo::decode(CoreIPC::ArgumentDecoder* decoder, TextInfo& result)
-{
-    if (!decoder->decode(result.baselineOrigin))
-        return false;
+bool FontInfo::decode(CoreIPC::ArgumentDecoder* decoder, FontInfo& fontInfo)
+{    
 #if PLATFORM(MAC)
-    if (!CoreIPC::decode(decoder, result.fontAttributeDictionary))
-        return false;
-    if (!decoder->decode(result.fontOverrideSize))
+    if (!CoreIPC::decode(decoder, fontInfo.fontAttributeDictionary))
         return false;
 #endif
+    
     return true;
 }
 
similarity index 85%
rename from Source/WebKit2/Shared/TextInfo.h
rename to Source/WebKit2/Shared/FontInfo.h
index 05b65f2..23ea945 100644 (file)
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef TextInfo_h
-#define TextInfo_h
+#ifndef FontInfo_h
+#define FontInfo_h
 
-#include <WebCore/FloatPoint.h>
+#if PLATFORM(MAC)
 #include <wtf/RetainPtr.h>
+#endif
 
 namespace CoreIPC {
     class ArgumentDecoder;
@@ -35,21 +36,16 @@ namespace CoreIPC {
 }
 
 namespace WebKit {
-
-class TextInfo {
-public:
-    TextInfo() { }
-
+    
+struct FontInfo {
     void encode(CoreIPC::ArgumentEncoder*) const;
-    static bool decode(CoreIPC::ArgumentDecoder*, TextInfo&);
-
-    WebCore::FloatPoint baselineOrigin;
+    static bool decode(CoreIPC::ArgumentDecoder*, FontInfo&);
+    
 #if PLATFORM(MAC)
     RetainPtr<CFDictionaryRef> fontAttributeDictionary;
-    double fontOverrideSize;
 #endif
 };
-
+    
 } // namespace WebKit
 
-#endif // TextInfo_h
+#endif // FontInfo_h
index 51e0e6c..a5ebb45 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -60,40 +60,43 @@ void PlatformPopupMenuData::encode(CoreIPC::ArgumentEncoder* encoder) const
     SharedMemory::Handle selectedBackingStoreHandle;
     m_selectedBackingStore->createHandle(selectedBackingStoreHandle);
     encoder->encode(selectedBackingStoreHandle);
+#elif PLATFORM(MAC)
+    encoder->encode(fontInfo);
 #endif
 }
 
 bool PlatformPopupMenuData::decode(CoreIPC::ArgumentDecoder* decoder, PlatformPopupMenuData& data)
 {
 #if PLATFORM(WIN)
-    PlatformPopupMenuData d;
-    if (!decoder->decode(d.m_clientPaddingLeft))
+    if (!decoder->decode(data.m_clientPaddingLeft))
         return false;
-    if (!decoder->decode(d.m_clientPaddingRight))
+    if (!decoder->decode(data.m_clientPaddingRight))
         return false;
-    if (!decoder->decode(d.m_clientInsetLeft))
+    if (!decoder->decode(data.m_clientInsetLeft))
         return false;
-    if (!decoder->decode(d.m_clientInsetRight))
+    if (!decoder->decode(data.m_clientInsetRight))
         return false;
-    if (!decoder->decode(d.m_popupWidth))
+    if (!decoder->decode(data.m_popupWidth))
         return false;
-    if (!decoder->decode(d.m_itemHeight))
+    if (!decoder->decode(data.m_itemHeight))
         return false;
-    if (!decoder->decode(d.m_backingStoreSize))
+    if (!decoder->decode(data.m_backingStoreSize))
         return false;
 
     SharedMemory::Handle notSelectedBackingStoreHandle;
     if (!decoder->decode(notSelectedBackingStoreHandle))
         return false;
-    d.m_notSelectedBackingStore = ShareableBitmap::create(d.m_backingStoreSize, notSelectedBackingStoreHandle);
+    data.m_notSelectedBackingStore = ShareableBitmap::create(data.m_backingStoreSize, notSelectedBackingStoreHandle);
 
     SharedMemory::Handle selectedBackingStoreHandle;
     if (!decoder->decode(selectedBackingStoreHandle))
         return false;
-    d.m_selectedBackingStore = ShareableBitmap::create(d.m_backingStoreSize, selectedBackingStoreHandle);
-
-    data = d;
+    data.m_selectedBackingStore = ShareableBitmap::create(data.m_backingStoreSize, selectedBackingStoreHandle);
+#elif PLATFORM(MAC)
+    if (!decoder->decode(data.fontInfo))
+        return false;
 #endif
+    
     return true;
 }
 
index 88e03fc..f79b4b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,6 +26,7 @@
 #ifndef PlatformPopupMenuData_h
 #define PlatformPopupMenuData_h
 
+#include "FontInfo.h"
 #include "ShareableBitmap.h"
 #include <wtf/text/WTFString.h>
 
@@ -38,7 +39,7 @@ namespace WebKit {
 
 struct PlatformPopupMenuData {
     PlatformPopupMenuData();
-    
+
     void encode(CoreIPC::ArgumentEncoder*) const;
     static bool decode(CoreIPC::ArgumentDecoder*, PlatformPopupMenuData&);
 
@@ -52,6 +53,8 @@ struct PlatformPopupMenuData {
     WebCore::IntSize m_backingStoreSize;
     RefPtr<ShareableBitmap> m_notSelectedBackingStore;
     RefPtr<ShareableBitmap> m_selectedBackingStore;
+#elif PLATFORM(MAC)
+    FontInfo fontInfo;
 #endif
 };
 
index da50dc4..7d53eb8 100644 (file)
@@ -102,7 +102,7 @@ private:
 
     virtual void flashBackingStoreUpdates(const Vector<WebCore::IntRect>& updateRects);
 
-    virtual void didPerformDictionaryLookup(const String&, const TextInfo&);
+    virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&);
 
     WKView* m_wkView;
     RetainPtr<WebEditorUndoTargetObjC> m_undoTarget;
index c1e793c..bdcefd5 100644 (file)
@@ -27,9 +27,9 @@
 #import "PageClientImpl.h"
 
 #import "DataReference.h"
+#import "DictionaryPopupInfo.h"
 #import "FindIndicator.h"
 #import "NativeWebKeyboardEvent.h"
-#import "TextInfo.h"
 #import "WKAPICast.h"
 #import "WKStringCF.h"
 #import "WKViewInternal.h"
@@ -413,16 +413,17 @@ void PageClientImpl::flashBackingStoreUpdates(const Vector<IntRect>&)
     notImplemented();
 }
 
-void PageClientImpl::didPerformDictionaryLookup(const String& text, const TextInfo& textInfo)
+void PageClientImpl::didPerformDictionaryLookup(const String& text, double scaleFactor, const DictionaryPopupInfo& dictionaryPopupInfo)
 {
-    NSFontDescriptor *fontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:(NSDictionary *)textInfo.fontAttributeDictionary.get()];
-    NSFont *font = [NSFont fontWithDescriptor:fontDescriptor size:textInfo.fontOverrideSize];
+    NSFontDescriptor *fontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:(NSDictionary *)dictionaryPopupInfo.fontInfo.fontAttributeDictionary.get()];
+    NSFont *font = [NSFont fontWithDescriptor:fontDescriptor size:((scaleFactor != 1) ? [fontDescriptor pointSize] * scaleFactor : 0)];
 
     RetainPtr<NSMutableAttributedString> attributedString(AdoptNS, [[NSMutableAttributedString alloc] initWithString:nsStringFromWebCoreString(text)]);
     [attributedString.get() addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, [attributedString.get() length])];
 
-    NSPoint textBaselineOrigin = textInfo.baselineOrigin;
-
+    NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
+    textBaselineOrigin.y += [font ascender];
+    
     NSDictionary *options = [NSDictionary dictionaryWithObject:NSDefinitionPresentationTypeOverlay forKey:NSDefinitionPresentationTypeKey];
     [m_wkView showDefinitionForAttributedString:attributedString.get() range:NSMakeRange(0, [attributedString.get() length]) options:options baselineOriginProvider:^(NSRange adjustedRange) { return (NSPoint)textBaselineOrigin; }];
 }
index ffca258..281c1a1 100644 (file)
@@ -128,10 +128,8 @@ public:
 #if PLATFORM(MAC)
     virtual void setComplexTextInputEnabled(uint64_t pluginComplexTextInputIdentifier, bool complexTextInputEnabled) = 0;
     virtual void setAutodisplay(bool) = 0;
-
     virtual CGContextRef containingWindowGraphicsContext() = 0;
-
-    virtual void didPerformDictionaryLookup(const String&, const TextInfo&) = 0;
+    virtual void didPerformDictionaryLookup(const String&, double scaleFactor, const DictionaryPopupInfo&) = 0;
 #endif
 
     virtual void didChangeScrollbarsForMainFrame() const = 0;
index bd1af7e..b2309e6 100644 (file)
@@ -39,7 +39,6 @@
 #include "StringPairVector.h"
 #include "TextChecker.h"
 #include "TextCheckerState.h"
-#include "TextInfo.h"
 #include "WKContextPrivate.h"
 #include "WebBackForwardList.h"
 #include "WebBackForwardListItem.h"
 #include "WebProtectionSpace.h"
 #include "WebSecurityOrigin.h"
 #include "WebURLRequest.h"
+#include <WebCore/DragData.h>
+#include <WebCore/FloatRect.h>
+#include <WebCore/MIMETypeRegistry.h>
+#include <WebCore/WindowFeatures.h>
+#include <stdio.h>
+
+#if PLATFORM(MAC)
+#include "DictionaryPopupInfo.h"
+#endif
+
 #if PLATFORM(WIN)
 #include "WebDragSource.h"
 #include <WebCore/BitmapInfo.h>
 #include <WebCore/WCDataObject.h>
 #include <shlobj.h>
 #endif
-#include <WebCore/DragData.h>
-#include <WebCore/FloatRect.h>
-#include <WebCore/MIMETypeRegistry.h>
-#include <WebCore/WindowFeatures.h>
-#include <stdio.h>
 
 #ifndef NDEBUG
 #include <wtf/RefCountedLeakCounter.h>
@@ -2076,7 +2080,7 @@ void WebPageProxy::showPopupMenu(const IntRect& rect, uint64_t textDirection, co
 
     RefPtr<WebPopupMenuProxy> protectedActivePopupMenu = m_activePopupMenu;
 
-    protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), items, data, selectedIndex);
+    protectedActivePopupMenu->showPopupMenu(rect, static_cast<TextDirection>(textDirection), m_viewScaleFactor, items, data, selectedIndex);
     protectedActivePopupMenu->invalidate();
     protectedActivePopupMenu = 0;
 }
@@ -2450,9 +2454,9 @@ void WebPageProxy::computedPagesCallback(const Vector<WebCore::IntRect>& pageRec
 }
 
 #if PLATFORM(MAC)
-void WebPageProxy::didPerformDictionaryLookup(const String& text, const TextInfo& textInfo)
+void WebPageProxy::didPerformDictionaryLookup(const String& text, const DictionaryPopupInfo& dictionaryPopupInfo)
 {
-    m_pageClient->didPerformDictionaryLookup(text, textInfo);
+    m_pageClient->didPerformDictionaryLookup(text, m_viewScaleFactor, dictionaryPopupInfo);
 }
     
 void WebPageProxy::registerWebProcessAccessibilityToken(const CoreIPC::DataReference& data)
index e1949df..f05383b 100644 (file)
@@ -83,12 +83,12 @@ namespace WebCore {
 
 namespace WebKit {
 
+class DictionaryPopupInfo;
 class DrawingAreaProxy;
 class NativeWebKeyboardEvent;
 class PageClient;
 class PlatformCertificateInfo;
 class StringPairVector;
-class TextInfo;
 class WebBackForwardList;
 class WebBackForwardListItem;
 class WebContextMenuProxy;
@@ -542,14 +542,14 @@ private:
     // Context Menu.
     void showContextMenu(const WebCore::IntPoint& menuLocation, const ContextMenuState&, const Vector<WebContextMenuItemData>&, CoreIPC::ArgumentDecoder*);
 
-    // Speech.
 #if PLATFORM(MAC)
+    // Speech.
     void getIsSpeaking(bool&);
     void speak(const String&);
     void stopSpeaking();
 
     // Dictionary.
-    void didPerformDictionaryLookup(const String&, const TextInfo&);
+    void didPerformDictionaryLookup(const String&, const DictionaryPopupInfo&);
 #endif
 
     // Spelling and grammar.
index 8d6fc48..0e1917e 100644 (file)
@@ -125,7 +125,7 @@ messages -> WebPageProxy {
 
 #if PLATFORM(MAC)
     # Dictionary support.
-    DidPerformDictionaryLookup(WTF::String text, WebKit::TextInfo textInfo)
+    DidPerformDictionaryLookup(WTF::String text, WebKit::DictionaryPopupInfo dictionaryPopupInfo)
 
     # Keyboard support messages
     InterpretKeyEvent(uint32_t type) -> (Vector<WebCore::KeypressCommand> commandName, uint32_t selectionStart, uint32_t selectionEnd, Vector<WebCore::CompositionUnderline> underlines)
index 78dad64..96901fb 100644 (file)
@@ -57,7 +57,7 @@ public:
     {
     }
 
-    virtual void showPopupMenu(const WebCore::IntRect& rect, WebCore::TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) = 0;
+    virtual void showPopupMenu(const WebCore::IntRect& rect, WebCore::TextDirection, double scaleFactor, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex) = 0;
     virtual void hidePopupMenu() = 0;
 
     void invalidate() { m_client = 0; }
index 788fd20..fda5219 100644 (file)
@@ -38,22 +38,22 @@ class WebPageProxy;
 
 class WebPopupMenuProxyMac : public WebPopupMenuProxy {
 public:
-    static PassRefPtr<WebPopupMenuProxyMac> create(WKViewwebView, WebPopupMenuProxy::Client* client)
+    static PassRefPtr<WebPopupMenuProxyMac> create(WKView *webView, WebPopupMenuProxy::Client* client)
     {
         return adoptRef(new WebPopupMenuProxyMac(webView, client));
     }
     ~WebPopupMenuProxyMac();
 
-    virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
+    virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, double scaleFactor, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
     virtual void hidePopupMenu();
 
 private:
-    WebPopupMenuProxyMac(WKView*, WebPopupMenuProxy::Client* client);
+    WebPopupMenuProxyMac(WKView *, WebPopupMenuProxy::Client*);
 
-    void populate(const Vector<WebPopupItem>&, WebCore::TextDirection);
+    void populate(const Vector<WebPopupItem>&, NSFont *, WebCore::TextDirection);
 
     RetainPtr<NSPopUpButtonCell> m_popup;
-    WKViewm_webView;
+    WKView *m_webView;
 };
 
 } // namespace WebKit
index 61713fc..7ce8764 100644 (file)
@@ -36,7 +36,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
-WebPopupMenuProxyMac::WebPopupMenuProxyMac(WKViewwebView, WebPopupMenuProxy::Client* client)
+WebPopupMenuProxyMac::WebPopupMenuProxyMac(WKView *webView, WebPopupMenuProxy::Client* client)
     : WebPopupMenuProxy(client)
     , m_webView(webView)
 {
@@ -48,7 +48,7 @@ WebPopupMenuProxyMac::~WebPopupMenuProxyMac()
         [m_popup.get() setControlView:nil];
 }
 
-void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, TextDirection menuTextDirection)
+void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, NSFont *font, TextDirection menuTextDirection)
 {
     if (m_popup)
         [m_popup.get() removeAllItems];
@@ -73,7 +73,7 @@ void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, TextDirec
             [paragraphStyle.get() setAlignment:menuTextDirection == LTR ? NSLeftTextAlignment : NSRightTextAlignment];
             RetainPtr<NSMutableDictionary> attributes(AdoptNS, [[NSMutableDictionary alloc] initWithObjectsAndKeys:
                 paragraphStyle.get(), NSParagraphStyleAttributeName,
-                [m_popup.get() font], NSFontAttributeName,
+                font, NSFontAttributeName,
             nil]);
             if (items[i].m_hasTextDirectionOverride) {
                 RetainPtr<NSNumber> writingDirectionValue(AdoptNS, [[NSNumber alloc] initWithInteger:writingDirection + NSTextWritingDirectionOverride]);
@@ -89,15 +89,22 @@ void WebPopupMenuProxyMac::populate(const Vector<WebPopupItem>& items, TextDirec
     }
 }
 
-void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection textDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
+void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection textDirection, double scaleFactor, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
 {
-    populate(items, textDirection);
+    NSFont *font;
+    if (data.fontInfo.fontAttributeDictionary) {
+        NSFontDescriptor *fontDescriptor = [NSFontDescriptor fontDescriptorWithFontAttributes:(NSDictionary *)data.fontInfo.fontAttributeDictionary.get()];
+        font = [NSFont fontWithDescriptor:fontDescriptor size:((scaleFactor != 1) ? [fontDescriptor pointSize] * scaleFactor : 0)];
+    } else
+        font = [NSFont menuFontOfSize:0];
+
+    populate(items, font, textDirection);
 
     [m_popup.get() attachPopUpWithFrame:rect inView:m_webView];
     [m_popup.get() selectItemAtIndex:selectedIndex];
     [m_popup.get() setUserInterfaceLayoutDirection:textDirection == LTR ? NSUserInterfaceLayoutDirectionLeftToRight : NSUserInterfaceLayoutDirectionRightToLeft];
 
-    NSMenumenu = [m_popup.get() menu];
+    NSMenu *menu = [m_popup.get() menu];
 
     // These values were borrowed from AppKit to match their placement of the menu.
     const int popOverHorizontalAdjust = -10;
@@ -111,7 +118,7 @@ void WebPopupMenuProxyMac::showPopupMenu(const IntRect& rect, TextDirection text
     [m_webView addSubview:dummyView.get()];
     location = [dummyView.get() convertPoint:location fromView:m_webView];
 
-    WKPopupMenu(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, [NSFont menuFontOfSize:0]);
+    WKPopupMenu(menu, location, roundf(NSWidth(rect)), dummyView.get(), selectedIndex, font);
 
     [m_popup.get() dismissPopUp];
     [dummyView.get() removeFromSuperview];
index a79cc3c..1e97d74 100644 (file)
@@ -42,7 +42,7 @@ WebPopupMenuProxyQt::~WebPopupMenuProxyQt()
 {
 }
 
-void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
+void WebPopupMenuProxyQt::showPopupMenu(const IntRect& rect, WebCore::TextDirection, double, const Vector<WebPopupItem>& items, const PlatformPopupMenuData&, int32_t selectedIndex)
 {
 }
 
index f41432c..e7197d5 100644 (file)
@@ -38,7 +38,7 @@ public:
     }
     ~WebPopupMenuProxyQt();
 
-    virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
+    virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, double scaleFactor, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
     virtual void hidePopupMenu();
 
 private:
index 4039c49..eebde75 100644 (file)
@@ -188,7 +188,7 @@ WebPopupMenuProxyWin::~WebPopupMenuProxyWin()
         m_scrollbar->setParent(0);
 }
 
-void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, TextDirection, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
+void WebPopupMenuProxyWin::showPopupMenu(const IntRect& rect, TextDirection, double, const Vector<WebPopupItem>& items, const PlatformPopupMenuData& data, int32_t selectedIndex)
 {
     m_items = items;
     m_data = data;
index 2d09bb9..5a20edf 100644 (file)
@@ -48,7 +48,7 @@ public:
     }
     ~WebPopupMenuProxyWin();
 
-    virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
+    virtual void showPopupMenu(const WebCore::IntRect&, WebCore::TextDirection, double scaleFactor, const Vector<WebPopupItem>&, const PlatformPopupMenuData&, int32_t selectedIndex);
     virtual void hidePopupMenu();
 
     void hide() { hidePopupMenu(); }
index b797a19..1df1fe7 100644 (file)
@@ -105,6 +105,8 @@ HEADERS += \
     Shared/ChildProcess.h \
     Shared/CoreIPCSupport/DrawingAreaMessageKinds.h \
     Shared/CoreIPCSupport/DrawingAreaProxyMessageKinds.h \
+    Shared/DictionaryPopupInfo.h \
+    Shared/FontInfo.h \
     Shared/ImageOptions.h \
     Shared/ImmutableArray.h \
     Shared/ImmutableDictionary.h \
@@ -118,7 +120,6 @@ HEADERS += \
     Shared/SecurityOriginData.h \
     Shared/SessionState.h \
     Shared/StringPairVector.h \
-    Shared/TextInfo.h \
     Shared/UserMessageCoders.h \
     Shared/VisitedLinkTable.h \
     Shared/WebCoreArgumentCoders.h \
@@ -284,6 +285,8 @@ SOURCES += \
     Shared/Plugins/Netscape/x11/NetscapePluginModuleX11.cpp \
     Shared/ShareableBitmap.cpp \
     Shared/ChildProcess.cpp \
+    Shared/DictionaryPopupInfo.cpp \
+    Shared/FontInfo.cpp \
     Shared/ImmutableArray.cpp \
     Shared/ImmutableDictionary.cpp \
     Shared/MutableArray.cpp \
@@ -293,7 +296,6 @@ SOURCES += \
     Shared/PrintInfo.cpp \
     Shared/SecurityOriginData.cpp \
     Shared/SessionState.cpp \
-    Shared/TextInfo.cpp \
     Shared/VisitedLinkTable.cpp \
     Shared/WebBackForwardListItem.cpp \
     Shared/WebContextMenuItem.cpp \
index b59db82..cf471ed 100644 (file)
                BC40762B124FF0400068F20A /* WKURLResponseNS.h in Headers */ = {isa = PBXBuildFile; fileRef = BC407625124FF0400068F20A /* WKURLResponseNS.h */; settings = {ATTRIBUTES = (Public, ); }; };
                BC40762C124FF0400068F20A /* WKURLResponseNS.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC407626124FF0400068F20A /* WKURLResponseNS.mm */; };
                BC40783D1250FADD0068F20A /* WKEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = BC40783C1250FADD0068F20A /* WKEvent.h */; settings = {ATTRIBUTES = (Public, ); }; };
-               BC454234130C5F3F0073E1C1 /* TextInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BC454232130C5F3F0073E1C1 /* TextInfo.h */; };
-               BC454235130C5F3F0073E1C1 /* TextInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC454233130C5F3F0073E1C1 /* TextInfo.cpp */; };
                BC498618124D10E200D834E1 /* InjectedBundleHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = BC498616124D10E200D834E1 /* InjectedBundleHitTestResult.h */; };
                BC498619124D10E200D834E1 /* InjectedBundleHitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC498617124D10E200D834E1 /* InjectedBundleHitTestResult.cpp */; };
                BC49862F124D18C100D834E1 /* WKBundleHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = BC49862D124D18C100D834E1 /* WKBundleHitTestResult.h */; settings = {ATTRIBUTES = (Public, ); }; };
                BCE4695A1214EDF4000B98EB /* WKFormSubmissionListener.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */; settings = {ATTRIBUTES = (Public, ); }; };
                BCE469771214F27B000B98EB /* WebFrameListenerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */; };
                BCE469791214F2B4000B98EB /* WebFrameListenerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */; };
+               BCE81D8C1319F7EF00241910 /* FontInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE81D8A1319F7EF00241910 /* FontInfo.cpp */; };
+               BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE81D8B1319F7EF00241910 /* FontInfo.h */; };
+               BCE81D98131AE02100241910 /* DictionaryPopupInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCE81D96131AE02000241910 /* DictionaryPopupInfo.cpp */; };
+               BCE81D99131AE02100241910 /* DictionaryPopupInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = BCE81D97131AE02100241910 /* DictionaryPopupInfo.h */; };
                BCEE7AD012817988009827DA /* WebProcessProxyMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE7ACC12817988009827DA /* WebProcessProxyMessageReceiver.cpp */; };
                BCEE7AD112817988009827DA /* WebProcessProxyMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEE7ACD12817988009827DA /* WebProcessProxyMessages.h */; };
                BCEE7D0D12846F69009827DA /* WebContextMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEE7D0B12846F69009827DA /* WebContextMessageReceiver.cpp */; };
                BC407625124FF0400068F20A /* WKURLResponseNS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKURLResponseNS.h; sourceTree = "<group>"; };
                BC407626124FF0400068F20A /* WKURLResponseNS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKURLResponseNS.mm; sourceTree = "<group>"; };
                BC40783C1250FADD0068F20A /* WKEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKEvent.h; sourceTree = "<group>"; };
-               BC454232130C5F3F0073E1C1 /* TextInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextInfo.h; sourceTree = "<group>"; };
-               BC454233130C5F3F0073E1C1 /* TextInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextInfo.cpp; sourceTree = "<group>"; };
                BC498616124D10E200D834E1 /* InjectedBundleHitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InjectedBundleHitTestResult.h; sourceTree = "<group>"; };
                BC498617124D10E200D834E1 /* InjectedBundleHitTestResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleHitTestResult.cpp; sourceTree = "<group>"; };
                BC49862D124D18C100D834E1 /* WKBundleHitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleHitTestResult.h; sourceTree = "<group>"; };
                BCE469581214EDF4000B98EB /* WKFormSubmissionListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKFormSubmissionListener.h; sourceTree = "<group>"; };
                BCE469761214F27B000B98EB /* WebFrameListenerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFrameListenerProxy.h; sourceTree = "<group>"; };
                BCE469781214F2B4000B98EB /* WebFrameListenerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFrameListenerProxy.cpp; sourceTree = "<group>"; };
+               BCE81D8A1319F7EF00241910 /* FontInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontInfo.cpp; sourceTree = "<group>"; };
+               BCE81D8B1319F7EF00241910 /* FontInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontInfo.h; sourceTree = "<group>"; };
+               BCE81D96131AE02000241910 /* DictionaryPopupInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DictionaryPopupInfo.cpp; sourceTree = "<group>"; };
+               BCE81D97131AE02100241910 /* DictionaryPopupInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DictionaryPopupInfo.h; sourceTree = "<group>"; };
                BCEE7AB312817095009827DA /* WebProcessProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebProcessProxy.messages.in; sourceTree = "<group>"; };
                BCEE7ACC12817988009827DA /* WebProcessProxyMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebProcessProxyMessageReceiver.cpp; sourceTree = "<group>"; };
                BCEE7ACD12817988009827DA /* WebProcessProxyMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebProcessProxyMessages.h; sourceTree = "<group>"; };
                                1A2D956D12848564001EB962 /* ChildProcess.h */,
                                1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
                                1A2C306F12D555450063DAA2 /* ContextMenuState.h */,
+                               BCE81D96131AE02000241910 /* DictionaryPopupInfo.cpp */,
+                               BCE81D97131AE02100241910 /* DictionaryPopupInfo.h */,
                                C517388012DF8F4F00EE3F47 /* DragControllerAction.h */,
                                0FB659221208B4DB0044816C /* DrawingAreaInfo.h */,
                                762B7481120BBA0100819339 /* FontSmoothingLevel.h */,
                                BCC43AB9127B95DC00317F16 /* PlatformPopupMenuData.h */,
                                E18C92F312DB9E7100CF2AEB /* PrintInfo.cpp */,
                                E1CC1B8E12D7EADF00625838 /* PrintInfo.h */,
+                               BCE81D8A1319F7EF00241910 /* FontInfo.cpp */,
+                               BCE81D8B1319F7EF00241910 /* FontInfo.h */,
                                BC2D021612AC41CB00E732A3 /* SameDocumentNavigationType.h */,
                                1AAB4A8C1296F0A20023952F /* SandboxExtension.h */,
                                33152973130D0CB200ED2483 /* SecurityOriginData.cpp */,
                                1A6420E312DCE2FF00CAAE2C /* ShareableBitmap.h */,
                                BCBD3C3A125BFA7A00D2C29F /* StringPairVector.h */,
                                1A5E4DA312D3BD3D0099A2BB /* TextCheckerState.h */,
-                               BC454233130C5F3F0073E1C1 /* TextInfo.cpp */,
-                               BC454232130C5F3F0073E1C1 /* TextInfo.h */,
                                1A64245D12DE29A100CAAE2C /* UpdateInfo.cpp */,
                                1A64245C12DE29A100CAAE2C /* UpdateInfo.h */,
                                BCB0B0DF12305AB100B1341E /* UserMessageCoders.h */,
                                512E352F130B55AF00ABD19A /* WebApplicationCacheManager.h in Headers */,
                                512E356B130B57F000ABD19A /* WebApplicationCacheManagerMessages.h in Headers */,
                                512E35F9130B642E00ABD19A /* WebApplicationCacheManagerProxyMessages.h in Headers */,
-                               BC454234130C5F3F0073E1C1 /* TextInfo.h in Headers */,
                                1AC86FF4130B46D3002C1257 /* WKPluginSiteDataManager.h in Headers */,
                                1AC8702D130B49A2002C1257 /* WebPluginSiteDataManager.h in Headers */,
                                33367630130C9998006C9DE2 /* WebResourceCacheManager.h in Headers */,
                                330934501315B94D0097A7BC /* WebCookieManager.h in Headers */,
                                330934561315B9750097A7BC /* WebCookieManagerProxy.h in Headers */,
                                3309345B1315B9980097A7BC /* WKCookieManager.h in Headers */,
+                               BCE81D8D1319F7EF00241910 /* FontInfo.h in Headers */,
+                               BCE81D99131AE02100241910 /* DictionaryPopupInfo.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                                512E352E130B55AF00ABD19A /* WebApplicationCacheManager.cpp in Sources */,
                                512E356A130B57F000ABD19A /* WebApplicationCacheManagerMessageReceiver.cpp in Sources */,
                                512E35F8130B642E00ABD19A /* WebApplicationCacheManagerProxyMessageReceiver.cpp in Sources */,
-                               BC454235130C5F3F0073E1C1 /* TextInfo.cpp in Sources */,
                                1AC86FF3130B46D3002C1257 /* WKPluginSiteDataManager.cpp in Sources */,
                                1AC8702E130B49A2002C1257 /* WebPluginSiteDataManager.cpp in Sources */,
                                3336762F130C9998006C9DE2 /* WebResourceCacheManager.cpp in Sources */,
                                3309344F1315B94D0097A7BC /* WebCookieManager.cpp in Sources */,
                                330934551315B9750097A7BC /* WebCookieManagerProxy.cpp in Sources */,
                                3309345A1315B9980097A7BC /* WKCookieManager.cpp in Sources */,
+                               BCE81D8C1319F7EF00241910 /* FontInfo.cpp in Sources */,
+                               BCE81D98131AE02100241910 /* DictionaryPopupInfo.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 7e446b7..e36f438 100644 (file)
 #import "WebPopupMenu.h"
 
 #import "PlatformPopupMenuData.h"
+#import <WebCore/Frame.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/PopupMenuClient.h>
 
 using namespace WebCore;
 
 namespace WebKit {
 
-void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData&)
+void WebPopupMenu::setUpPlatformData(const IntRect&, PlatformPopupMenuData& data)
 {
+    NSFont *font = m_popupClient->menuStyle().font().primaryFont()->getNSFont();
+    if (!font)
+        return;
+    
+    CFDictionaryRef fontDescriptorAttributes = (CFDictionaryRef)[[font fontDescriptor] fontAttributes];
+    if (!fontDescriptorAttributes)
+        return;
+    
+    data.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
 }
 
 } // namespace WebKit
index 77868ff..af0e22b 100644 (file)
@@ -28,8 +28,8 @@
 
 #import "AccessibilityWebPageObject.h"
 #import "DataReference.h"
+#import "DictionaryPopupInfo.h"
 #import "PluginView.h"
-#import "TextInfo.h"
 #import "WebCoreArgumentCoders.h"
 #import "WebEvent.h"
 #import "WebFrame.h"
@@ -302,14 +302,12 @@ void WebPage::performDictionaryLookupAtLocation(const FloatPoint& floatPoint)
         return;
 
     IntRect finalRangeRect = frame->view()->contentsToWindow(quads[0].enclosingBoundingBox());
-    FloatPoint baselineOrigin(finalRangeRect.x(), (finalRangeRect.y() + ([font ascender] * frame->pageScaleFactor())));
-    
-    TextInfo textInfo;
-    textInfo.baselineOrigin = baselineOrigin;
-    textInfo.fontAttributeDictionary = fontDescriptorAttributes;
-    textInfo.fontOverrideSize = frame->pageScaleFactor() == 1 ? 0 : ([[font fontDescriptor] pointSize] * frame->pageScaleFactor());
 
-    send(Messages::WebPageProxy::DidPerformDictionaryLookup(finalRange->text(), textInfo));
+    DictionaryPopupInfo dictionaryPopupInfo;
+    dictionaryPopupInfo.origin = FloatPoint(finalRangeRect.x(), finalRangeRect.y());
+    dictionaryPopupInfo.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
+
+    send(Messages::WebPageProxy::DidPerformDictionaryLookup(finalRange->text(), dictionaryPopupInfo));
 }
 
 static inline void scroll(Page* page, ScrollDirection direction, ScrollGranularity granularity)
index cebb123..8b0f97a 100755 (executable)
                                >
                        </File>
                        <File
+                               RelativePath="..\Shared\DictionaryPopupInfo.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\Shared\DictionaryPopupInfo.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\Shared\DrawingAreaInfo.h"
                                >
                        </File>
                        <File
+                               RelativePath="..\Shared\FontInfo.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\Shared\FontInfo.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\Shared\FontSmoothingLevel.h"
                                >
                        </File>
                                >
                        </File>
                        <File
-                               RelativePath="..\Shared\TextInfo.cpp"
-                               >
-                       </File>
-                       <File
-                               RelativePath="..\Shared\TextInfo.h"
-                               >
-                       </File>
-                       <File
                                RelativePath="..\Shared\UpdateInfo.cpp"
                                >
                        </File>