<rdar://problem/10294191> REGRESSION (WebKit2): Lookup bubble sized and positioned...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Nov 2011 22:13:00 +0000 (22:13 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Nov 2011 22:13:00 +0000 (22:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=72217

Reviewed by Dave Hyatt.

* UIProcess/API/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::didPerformDictionaryLookup): Rather than adding the NSFont’s ascender
to the top of the text rect to establish the baseline here...
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performDictionaryLookupForRange): ...do it here, using the WebCore::Font’s
ascender, which is what’s actually used when drawing the text.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm

index f7a9bcf468e5ab04f6a003bc9bc758bc9dc9fa96..8b2970ebcc858a1facbf9388f37d631e282f1ee8 100644 (file)
@@ -1,3 +1,17 @@
+2011-11-12  Dan Bernstein  <mitz@apple.com>
+
+        <rdar://problem/10294191> REGRESSION (WebKit2): Lookup bubble sized and positioned incorrectly (vertically off)
+        https://bugs.webkit.org/show_bug.cgi?id=72217
+
+        Reviewed by Dave Hyatt.
+
+        * UIProcess/API/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::didPerformDictionaryLookup): Rather than adding the NSFont’s ascender
+        to the top of the text rect to establish the baseline here...
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::performDictionaryLookupForRange): ...do it here, using the WebCore::Font’s
+        ascender, which is what’s actually used when drawing the text.
+
 2011-11-11  Nayan Kumar K  <nayankk@motorola.com>
 
         [GTK][WEBKIT2] Add font and charset properties to WebKitWebSettings
index 16b500701f66445ced654d3460aee5de10448786..1dc26714afb575372b558e9f637aa091b9454319 100644 (file)
@@ -406,8 +406,7 @@ void PageClientImpl::didPerformDictionaryLookup(const String& text, double scale
     [attributedString.get() addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, [attributedString.get() length])];
 
     NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
-    textBaselineOrigin.y += [font ascender];
-    
+
 #if !defined(BUILDING_ON_SNOW_LEOPARD)
     // Convert to screen coordinates.
     textBaselineOrigin = [m_wkView convertPoint:textBaselineOrigin toView:nil];
index 17963a075136bc9bec43782933665ae8fa4b30eb..a6d28b19ea7e5e89ca5813aa76e0469b04aa06bc 100644 (file)
@@ -539,7 +539,7 @@ void WebPage::performDictionaryLookupForRange(DictionaryPopupInfo::Type type, Fr
     
     DictionaryPopupInfo dictionaryPopupInfo;
     dictionaryPopupInfo.type = type;
-    dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y());
+    dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y() + style->fontMetrics().ascent());
     dictionaryPopupInfo.fontInfo.fontAttributeDictionary = fontDescriptorAttributes;
 #if !defined(BUILDING_ON_SNOW_LEOPARD)
     dictionaryPopupInfo.options = (CFDictionaryRef)options;