Title: [149880] trunk/Source/WebCore
Revision
149880
Author
[email protected]
Date
2013-05-10 09:18:31 -0700 (Fri, 10 May 2013)

Log Message

Don't trust character widths for internal OS X fonts in form controls
https://bugs.webkit.org/show_bug.cgi?id=115883
<rdar://problem/13817757>

Reviewed by Darin Adler.

We ignore the character width for a bunch of fonts when predicting
the width of a form control. Some of the internal fonts in OS X are
not in the ignored list. Rather than add them, simply test for
fonts whose family begins with a period character ".".

* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::hasValidAvgCharWidth): Return false for
    any family that starts with "."

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149879 => 149880)


--- trunk/Source/WebCore/ChangeLog	2013-05-10 16:11:20 UTC (rev 149879)
+++ trunk/Source/WebCore/ChangeLog	2013-05-10 16:18:31 UTC (rev 149880)
@@ -1,3 +1,20 @@
+2013-05-09  Dean Jackson  <[email protected]>
+
+        Don't trust character widths for internal OS X fonts in form controls
+        https://bugs.webkit.org/show_bug.cgi?id=115883
+        <rdar://problem/13817757>
+
+        Reviewed by Darin Adler.
+
+        We ignore the character width for a bunch of fonts when predicting
+        the width of a form control. Some of the internal fonts in OS X are
+        not in the ignored list. Rather than add them, simply test for
+        fonts whose family begins with a period character ".".
+
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::hasValidAvgCharWidth): Return false for
+            any family that starts with "."
+
 2013-05-10  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Remove unnecessary GLIB_CHECK_VERSION #ifdefs

Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (149879 => 149880)


--- trunk/Source/WebCore/rendering/RenderTextControl.cpp	2013-05-10 16:11:20 UTC (rev 149879)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp	2013-05-10 16:18:31 UTC (rev 149880)
@@ -218,11 +218,17 @@
 // all platforms.
 bool RenderTextControl::hasValidAvgCharWidth(AtomicString family)
 {
-    static HashSet<AtomicString>* fontFamiliesWithInvalidCharWidthMap = 0;
-
     if (family.isEmpty())
         return false;
 
+    // Internal fonts on OS X also have an invalid entry in the table for avgCharWidth.
+    // They are hidden by having a name that begins with a period, so simply search
+    // for that here rather than try to keep the list up to date.
+    if (family.startsWith('.'))
+        return false;
+
+    static HashSet<AtomicString>* fontFamiliesWithInvalidCharWidthMap = 0;
+    
     if (!fontFamiliesWithInvalidCharWidthMap) {
         fontFamiliesWithInvalidCharWidthMap = new HashSet<AtomicString>;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to