Title: [100083] trunk/Source/WebKit2
Revision
100083
Author
m...@apple.com
Date
2011-11-12 14:13:00 -0800 (Sat, 12 Nov 2011)

Log Message

<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.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (100082 => 100083)


--- trunk/Source/WebKit2/ChangeLog	2011-11-12 18:43:42 UTC (rev 100082)
+++ trunk/Source/WebKit2/ChangeLog	2011-11-12 22:13:00 UTC (rev 100083)
@@ -1,3 +1,17 @@
+2011-11-12  Dan Bernstein  <m...@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  <naya...@motorola.com>
 
         [GTK][WEBKIT2] Add font and charset properties to WebKitWebSettings

Modified: trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm (100082 => 100083)


--- trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2011-11-12 18:43:42 UTC (rev 100082)
+++ trunk/Source/WebKit2/UIProcess/API/mac/PageClientImpl.mm	2011-11-12 22:13:00 UTC (rev 100083)
@@ -406,8 +406,7 @@
     [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];

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (100082 => 100083)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2011-11-12 18:43:42 UTC (rev 100082)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2011-11-12 22:13:00 UTC (rev 100083)
@@ -539,7 +539,7 @@
     
     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;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to