Title: [251724] branches/safari-608-branch
Revision
251724
Author
[email protected]
Date
2019-10-29 12:51:17 -0700 (Tue, 29 Oct 2019)

Log Message

Cherry-pick r250640. rdar://problem/56237433

    REGRESSION (r245672): <select> dropdown with text-rendering: optimizeLegibility freezes Safari
    https://bugs.webkit.org/show_bug.cgi?id=202198

    Reviewed by Tim Horton.

    Source/WebKit:

    NSFont has a bug where passing "auto" to kCTFontOpticalSizeAttribute
    causes an exception to be thrown. We don't catch the exception, so we
    pop up back to the runloop, which confuses the UI process.

    The solution is twofold: 1) Workaround the bug by passing the font size
    to kCTFontOpticalSizeAttribute instead, and 2) catch any exceptions that
    this part of the code might throw.

    * UIProcess/mac/WebPopupMenuProxyMac.mm:
    (WebKit::WebPopupMenuProxyMac::showPopupMenu):

    Source/WTF:

    * wtf/Platform.h:

    LayoutTests:

    * fast/forms/select-font-optical-size-expected.txt: Added.
    * fast/forms/select-font-optical-size.html: Added.

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-608-branch/LayoutTests/ChangeLog (251723 => 251724)


--- branches/safari-608-branch/LayoutTests/ChangeLog	2019-10-29 19:51:13 UTC (rev 251723)
+++ branches/safari-608-branch/LayoutTests/ChangeLog	2019-10-29 19:51:17 UTC (rev 251724)
@@ -1,3 +1,46 @@
+2019-10-24  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r250640. rdar://problem/56237433
+
+    REGRESSION (r245672): <select> dropdown with text-rendering: optimizeLegibility freezes Safari
+    https://bugs.webkit.org/show_bug.cgi?id=202198
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebKit:
+    
+    NSFont has a bug where passing "auto" to kCTFontOpticalSizeAttribute
+    causes an exception to be thrown. We don't catch the exception, so we
+    pop up back to the runloop, which confuses the UI process.
+    
+    The solution is twofold: 1) Workaround the bug by passing the font size
+    to kCTFontOpticalSizeAttribute instead, and 2) catch any exceptions that
+    this part of the code might throw.
+    
+    * UIProcess/mac/WebPopupMenuProxyMac.mm:
+    (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+    
+    Source/WTF:
+    
+    * wtf/Platform.h:
+    
+    LayoutTests:
+    
+    * fast/forms/select-font-optical-size-expected.txt: Added.
+    * fast/forms/select-font-optical-size.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-02  Myles C. Maxfield  <[email protected]>
+
+            REGRESSION (r245672): <select> dropdown with text-rendering: optimizeLegibility freezes Safari
+            https://bugs.webkit.org/show_bug.cgi?id=202198
+
+            Reviewed by Tim Horton.
+
+            * fast/forms/select-font-optical-size-expected.txt: Added.
+            * fast/forms/select-font-optical-size.html: Added.
+
 2019-10-20  Babak Shafiei  <[email protected]>
 
         Apply patch. rdar://problem/56427498

Added: branches/safari-608-branch/LayoutTests/fast/forms/select-font-optical-size-expected.txt (0 => 251724)


--- branches/safari-608-branch/LayoutTests/fast/forms/select-font-optical-size-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/fast/forms/select-font-optical-size-expected.txt	2019-10-29 19:51:17 UTC (rev 251724)
@@ -0,0 +1,9 @@
+This test makes sure that text-rendering: optimizeLegibility on a drop-down select element doesn't cause a hang.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-608-branch/LayoutTests/fast/forms/select-font-optical-size.html (0 => 251724)


--- branches/safari-608-branch/LayoutTests/fast/forms/select-font-optical-size.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/fast/forms/select-font-optical-size.html	2019-10-29 19:51:17 UTC (rev 251724)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+body {
+    text-rendering: optimizeLegibility;
+}
+select {
+    -webkit-appearance: none;
+}
+</style>
+</head>
+<body>
+<select id="target">
+    <option>Click</option>
+    <option>Click</option>
+</select>
+<script>
+description("This test makes sure that text-rendering: optimizeLegibility on a drop-down select element doesn't cause a hang.");
+window.jsTestIsAsync = true;
+const target = document.getElementById("target");
+if (window.internals) {
+    internals.withUserGesture(function() {
+        target.click();
+        window.setTimeout(finishJSTest, 50);
+    });
+} else
+    finishJSTest();
+</script>
+<script src=""
+</body>
+</html>

Modified: branches/safari-608-branch/Source/WTF/ChangeLog (251723 => 251724)


--- branches/safari-608-branch/Source/WTF/ChangeLog	2019-10-29 19:51:13 UTC (rev 251723)
+++ branches/safari-608-branch/Source/WTF/ChangeLog	2019-10-29 19:51:17 UTC (rev 251724)
@@ -1,3 +1,45 @@
+2019-10-24  Kocsen Chung  <[email protected]>
+
+        Cherry-pick r250640. rdar://problem/56237433
+
+    REGRESSION (r245672): <select> dropdown with text-rendering: optimizeLegibility freezes Safari
+    https://bugs.webkit.org/show_bug.cgi?id=202198
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebKit:
+    
+    NSFont has a bug where passing "auto" to kCTFontOpticalSizeAttribute
+    causes an exception to be thrown. We don't catch the exception, so we
+    pop up back to the runloop, which confuses the UI process.
+    
+    The solution is twofold: 1) Workaround the bug by passing the font size
+    to kCTFontOpticalSizeAttribute instead, and 2) catch any exceptions that
+    this part of the code might throw.
+    
+    * UIProcess/mac/WebPopupMenuProxyMac.mm:
+    (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+    
+    Source/WTF:
+    
+    * wtf/Platform.h:
+    
+    LayoutTests:
+    
+    * fast/forms/select-font-optical-size-expected.txt: Added.
+    * fast/forms/select-font-optical-size.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-02  Myles C. Maxfield  <[email protected]>
+
+            REGRESSION (r245672): <select> dropdown with text-rendering: optimizeLegibility freezes Safari
+            https://bugs.webkit.org/show_bug.cgi?id=202198
+
+            Reviewed by Tim Horton.
+
+            * wtf/Platform.h:
+
 2019-10-03  Alan Coon  <[email protected]>
 
         Cherry-pick r248319. rdar://problem/55964805

Modified: branches/safari-608-branch/Source/WTF/wtf/Platform.h (251723 => 251724)


--- branches/safari-608-branch/Source/WTF/wtf/Platform.h	2019-10-29 19:51:13 UTC (rev 251723)
+++ branches/safari-608-branch/Source/WTF/wtf/Platform.h	2019-10-29 19:51:17 UTC (rev 251724)
@@ -1601,6 +1601,10 @@
 #define HAVE_CORETEXT_AUTO_OPTICAL_SIZING 1
 #endif
 
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000)
+#define HAVE_NSFONT_WITH_OPTICAL_SIZING_BUG 1
+#endif
+
 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 130000 || PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101500)
 #define HAVE_APP_SSO 1
 #endif

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (251723 => 251724)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-10-29 19:51:13 UTC (rev 251723)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-10-29 19:51:17 UTC (rev 251724)
@@ -1,5 +1,56 @@
 2019-10-24  Kocsen Chung  <[email protected]>
 
+        Cherry-pick r250640. rdar://problem/56237433
+
+    REGRESSION (r245672): <select> dropdown with text-rendering: optimizeLegibility freezes Safari
+    https://bugs.webkit.org/show_bug.cgi?id=202198
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebKit:
+    
+    NSFont has a bug where passing "auto" to kCTFontOpticalSizeAttribute
+    causes an exception to be thrown. We don't catch the exception, so we
+    pop up back to the runloop, which confuses the UI process.
+    
+    The solution is twofold: 1) Workaround the bug by passing the font size
+    to kCTFontOpticalSizeAttribute instead, and 2) catch any exceptions that
+    this part of the code might throw.
+    
+    * UIProcess/mac/WebPopupMenuProxyMac.mm:
+    (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+    
+    Source/WTF:
+    
+    * wtf/Platform.h:
+    
+    LayoutTests:
+    
+    * fast/forms/select-font-optical-size-expected.txt: Added.
+    * fast/forms/select-font-optical-size.html: Added.
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-10-02  Myles C. Maxfield  <[email protected]>
+
+            REGRESSION (r245672): <select> dropdown with text-rendering: optimizeLegibility freezes Safari
+            https://bugs.webkit.org/show_bug.cgi?id=202198
+
+            Reviewed by Tim Horton.
+
+            NSFont has a bug where passing "auto" to kCTFontOpticalSizeAttribute
+            causes an exception to be thrown. We don't catch the exception, so we
+            pop up back to the runloop, which confuses the UI process.
+
+            The solution is twofold: 1) Workaround the bug by passing the font size
+            to kCTFontOpticalSizeAttribute instead, and 2) catch any exceptions that
+            this part of the code might throw.
+
+            * UIProcess/mac/WebPopupMenuProxyMac.mm:
+            (WebKit::WebPopupMenuProxyMac::showPopupMenu):
+
+2019-10-24  Kocsen Chung  <[email protected]>
+
         Cherry-pick r251370. rdar://problem/56579672
 
     Add more release logging for "Unexpectedly resumed" assertion

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm (251723 => 251724)


--- branches/safari-608-branch/Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm	2019-10-29 19:51:13 UTC (rev 251723)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm	2019-10-29 19:51:17 UTC (rev 251724)
@@ -34,7 +34,9 @@
 #import "PlatformPopupMenuData.h"
 #import "StringUtilities.h"
 #import "WebPopupItem.h"
+#import <pal/spi/cocoa/CoreTextSPI.h>
 #import <pal/system/mac/PopupMenu.h>
+#import <wtf/BlockObjCExceptions.h>
 #import <wtf/ProcessPrivilege.h>
 
 namespace WebKit {
@@ -101,11 +103,16 @@
 {
     ASSERT(hasProcessPrivilege(ProcessPrivilege::CanCommunicateWithWindowServer));
     NSFont *font;
+
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+
     if (data.fontInfo.fontAttributeDictionary) {
         PlatformFontDescriptor *fontDescriptor = fontDescriptorWithFontAttributes(static_cast<NSDictionary *>(data.fontInfo.fontAttributeDictionary.get()));
         font = [NSFont fontWithDescriptor:fontDescriptor size:((pageScaleFactor != 1) ? [fontDescriptor pointSize] * pageScaleFactor : 0)];
     } else
         font = [NSFont menuFontOfSize:0];
+    
+    END_BLOCK_OBJC_EXCEPTIONS
 
     populate(items, font, textDirection);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to