Title: [248065] branches/safari-608-branch
Revision
248065
Author
[email protected]
Date
2019-07-31 13:56:37 -0700 (Wed, 31 Jul 2019)

Log Message

Cherry-pick r247936. rdar://problem/53764217

    YouTube search field shows RTL text outside its border on iPadOS
    https://bugs.webkit.org/show_bug.cgi?id=200253
    <rdar://problem/53680603>

    Reviewed by Beth Dakin.

    Source/WebKit:

    Limits code added in r238939 to respect the current keyboard's writing mode to only editable web views. This
    behavior was only intended for Mail, and isn't generally compatible with web content.

    While the call to -setInitialDirection is correctly gated on an web view editability check, it appears that
    other changes in iOS 13 now cause -setBaseWritingDirection:forRange: to be invoked directly from keyboards code.
    This means that -setBaseWritingDirection:forRange: should additionally be guarded with the same check.

    * UIProcess/ios/WKContentViewInteraction.mm:
    (-[WKContentView setBaseWritingDirection:forRange:]):

    LayoutTests:

    * editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page-expected.txt: Renamed from LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt.
    * editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page.html: Renamed from LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html.

    Rename an existing test, rtl-keyboard-input-on-focus.html, to rtl-keyboard-input-on-focus-in-editable-page.html
    to emphasize the fact that it requires an editable web view.

    * editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page-expected.txt: Added.
    * editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page.html: Added.

    Add a new layout test to ensure that we don't automatically apply an RTL attribute when focusing fields in a
    non-editable web view.

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

Modified Paths

Added Paths

Removed Paths

Diff

Modified: branches/safari-608-branch/LayoutTests/ChangeLog (248064 => 248065)


--- branches/safari-608-branch/LayoutTests/ChangeLog	2019-07-31 20:56:33 UTC (rev 248064)
+++ branches/safari-608-branch/LayoutTests/ChangeLog	2019-07-31 20:56:37 UTC (rev 248065)
@@ -1,5 +1,64 @@
 2019-07-31  Alan Coon  <[email protected]>
 
+        Cherry-pick r247936. rdar://problem/53764217
+
+    YouTube search field shows RTL text outside its border on iPadOS
+    https://bugs.webkit.org/show_bug.cgi?id=200253
+    <rdar://problem/53680603>
+    
+    Reviewed by Beth Dakin.
+    
+    Source/WebKit:
+    
+    Limits code added in r238939 to respect the current keyboard's writing mode to only editable web views. This
+    behavior was only intended for Mail, and isn't generally compatible with web content.
+    
+    While the call to -setInitialDirection is correctly gated on an web view editability check, it appears that
+    other changes in iOS 13 now cause -setBaseWritingDirection:forRange: to be invoked directly from keyboards code.
+    This means that -setBaseWritingDirection:forRange: should additionally be guarded with the same check.
+    
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView setBaseWritingDirection:forRange:]):
+    
+    LayoutTests:
+    
+    * editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page-expected.txt: Renamed from LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt.
+    * editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page.html: Renamed from LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html.
+    
+    Rename an existing test, rtl-keyboard-input-on-focus.html, to rtl-keyboard-input-on-focus-in-editable-page.html
+    to emphasize the fact that it requires an editable web view.
+    
+    * editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page-expected.txt: Added.
+    * editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page.html: Added.
+    
+    Add a new layout test to ensure that we don't automatically apply an RTL attribute when focusing fields in a
+    non-editable web view.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247936 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-29  Wenson Hsieh  <[email protected]>
+
+            YouTube search field shows RTL text outside its border on iPadOS
+            https://bugs.webkit.org/show_bug.cgi?id=200253
+            <rdar://problem/53680603>
+
+            Reviewed by Beth Dakin.
+
+            * editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page-expected.txt: Renamed from LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt.
+            * editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page.html: Renamed from LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html.
+
+            Rename an existing test, rtl-keyboard-input-on-focus.html, to rtl-keyboard-input-on-focus-in-editable-page.html
+            to emphasize the fact that it requires an editable web view.
+
+            * editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page-expected.txt: Added.
+            * editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page.html: Added.
+
+            Add a new layout test to ensure that we don't automatically apply an RTL attribute when focusing fields in a
+            non-editable web view.
+
+2019-07-31  Alan Coon  <[email protected]>
+
         Cherry-pick r247923. rdar://problem/53764209
 
     REGRESSION: WebSockets no longer work in Service Workers

Deleted: branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt (248064 => 248065)


--- branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt	2019-07-31 20:56:33 UTC (rev 248064)
+++ branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt	2019-07-31 20:56:37 UTC (rev 248065)
@@ -1,38 +0,0 @@
-
-
-Using Hebrew keyboard: 
-    <div><br></div>
-    <div style="direction: rtl;"><br></div>
-
-
-
-Using English keyboard: 
-    <div><br></div>
-    <div style="direction: ltr;"><br></div>
-
-
-
-Observed 'beforeinput' events: [
-    {
-        "inputType": "formatSetBlockTextDirection",
-        "data": "rtl",
-        "order": 1
-    },
-    {
-        "inputType": "formatSetBlockTextDirection",
-        "data": "ltr",
-        "order": 3
-    }
-]
-Observed 'input' events: [
-    {
-        "inputType": "formatSetBlockTextDirection",
-        "data": "rtl",
-        "order": 2
-    },
-    {
-        "inputType": "formatSetBlockTextDirection",
-        "data": "ltr",
-        "order": 4
-    }
-]

Copied: branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page-expected.txt (from rev 248064, branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt) (0 => 248065)


--- branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page-expected.txt	2019-07-31 20:56:37 UTC (rev 248065)
@@ -0,0 +1,38 @@
+
+
+Using Hebrew keyboard: 
+    <div><br></div>
+    <div style="direction: rtl;"><br></div>
+
+
+
+Using English keyboard: 
+    <div><br></div>
+    <div style="direction: ltr;"><br></div>
+
+
+
+Observed 'beforeinput' events: [
+    {
+        "inputType": "formatSetBlockTextDirection",
+        "data": "rtl",
+        "order": 1
+    },
+    {
+        "inputType": "formatSetBlockTextDirection",
+        "data": "ltr",
+        "order": 3
+    }
+]
+Observed 'input' events: [
+    {
+        "inputType": "formatSetBlockTextDirection",
+        "data": "rtl",
+        "order": 2
+    },
+    {
+        "inputType": "formatSetBlockTextDirection",
+        "data": "ltr",
+        "order": 4
+    }
+]

Copied: branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page.html (from rev 248064, branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html) (0 => 248065)


--- branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page.html	2019-07-31 20:56:37 UTC (rev 248065)
@@ -0,0 +1,79 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true editable=true ] -->
+<html>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<head>
+    <script src=""
+    <script src=""
+    <style>
+        body {
+            margin: 0;
+        }
+    </style>
+    <script>
+    function appendOutput(string) {
+        let pre = document.createElement("pre");
+        pre.textContent = string;
+        document.body.appendChild(pre);
+    }
+
+    beforeInputEvents = [];
+    inputEvents = [];
+    eventNumber = 0;
+
+    async function run()
+    {
+        script.remove();
+
+        document.body.addEventListener("beforeinput", event => {
+            beforeInputEvents.push({
+                "inputType": event.inputType,
+                "data": event.data,
+                "order": ++eventNumber
+            });
+        });
+
+        document.body.addEventListener("input", event => {
+            inputEvents.push({
+                "inputType": event.inputType,
+                "data": event.data,
+                "order": ++eventNumber
+            });
+        });
+
+        await UIHelper.setKeyboardInputModeIdentifier("he_IL");
+        await UIHelper.activateAndWaitForInputSessionAt(100, 250);
+        await UIHelper.ensurePresentationUpdate();
+        const markupUsingHebrewKeyboard = document.body.innerHTML;
+
+        document.body.blur();
+        await UIHelper.waitForKeyboardToHide();
+        await UIHelper.setKeyboardInputModeIdentifier("en_US");
+        await UIHelper.activateAndWaitForInputSessionAt(100, 250);
+        await UIHelper.ensurePresentationUpdate();
+        const markupUsingEnglishKeyboard = document.body.innerHTML;
+
+        appendOutput(`Using Hebrew keyboard: ${markupUsingHebrewKeyboard}`);
+        appendOutput(`Using English keyboard: ${markupUsingEnglishKeyboard}`);
+        appendOutput(`Observed 'beforeinput' events: ${JSON.stringify(beforeInputEvents, null, 4)}`);
+        appendOutput(`Observed 'input' events: ${JSON.stringify(inputEvents, null, 4)}`);
+        testRunner.notifyDone();
+    }
+    </script>
+</head>
+<body _onload_="run()">
+    <div><br></div>
+    <div><br></div>
+</body>
+<script id="script">
+if (window.testRunner) {
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+} else {
+    const description = document.createElement("p");
+    description.textContent = "Verifies that focusing an editable area with an RTL keyboard switches text direction to RTL. "
+        + "To test manually, switch to a Hebrew keyboard and focus the editable area. "
+        + "The editable area should be made RTL.";
+    document.body.prepend(description);
+}
+</script>
+</html>

Added: branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page-expected.txt (0 => 248065)


--- branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page-expected.txt	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page-expected.txt	2019-07-31 20:56:37 UTC (rev 248065)
@@ -0,0 +1 @@
+The text field direction is: ''

Added: branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page.html (0 => 248065)


--- branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page.html	                        (rev 0)
+++ branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page.html	2019-07-31 20:56:37 UTC (rev 248065)
@@ -0,0 +1,41 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<head>
+    <script src=""
+    <style>
+    body, html {
+        margin: 0;
+        width: 100%;
+        height: 100%;
+    }
+
+    input {
+        font-size: 16px;
+    }
+    </style>
+    <script>
+    if (window.testRunner) {
+        testRunner.waitUntilDone();
+        testRunner.dumpAsText();
+    }
+
+    addEventListener("load", async () => {
+        const field = document.getElementById("field");
+
+        await UIHelper.setKeyboardInputModeIdentifier("he_IL");
+        await UIHelper.activateElementAndWaitForInputSession(field);
+        document.write(`The text field direction is: '${field.dir}'`);
+        field.blur();
+        await UIHelper.waitForKeyboardToHide();
+        testRunner.notifyDone();
+    });
+    </script>
+</head>
+<body>
+    <p>Verifies that focusing an editable area with an RTL keyboard does not switch text direction to RTL in a non-editable web view.
+    To test manually, switch to a Hebrew keyboard and focus the editable area in Safari.
+    The editable area should not be made RTL.</p>
+    <input type="text" id="field"></input>
+</body>
+</html>

Deleted: branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html (248064 => 248065)


--- branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html	2019-07-31 20:56:33 UTC (rev 248064)
+++ branches/safari-608-branch/LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html	2019-07-31 20:56:37 UTC (rev 248065)
@@ -1,79 +0,0 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true, editable=true ] -->
-<html>
-<meta name="viewport" content="width=device-width, initial-scale=1">
-<head>
-    <script src=""
-    <script src=""
-    <style>
-        body {
-            margin: 0;
-        }
-    </style>
-    <script>
-    function appendOutput(string) {
-        let pre = document.createElement("pre");
-        pre.textContent = string;
-        document.body.appendChild(pre);
-    }
-
-    beforeInputEvents = [];
-    inputEvents = [];
-    eventNumber = 0;
-
-    async function run()
-    {
-        script.remove();
-
-        document.body.addEventListener("beforeinput", event => {
-            beforeInputEvents.push({
-                "inputType": event.inputType,
-                "data": event.data,
-                "order": ++eventNumber
-            });
-        });
-
-        document.body.addEventListener("input", event => {
-            inputEvents.push({
-                "inputType": event.inputType,
-                "data": event.data,
-                "order": ++eventNumber
-            });
-        });
-
-        await UIHelper.setKeyboardInputModeIdentifier("he_IL");
-        await UIHelper.activateAndWaitForInputSessionAt(100, 250);
-        await UIHelper.ensurePresentationUpdate();
-        const markupUsingHebrewKeyboard = document.body.innerHTML;
-
-        document.body.blur();
-        await UIHelper.waitForKeyboardToHide();
-        await UIHelper.setKeyboardInputModeIdentifier("en_US");
-        await UIHelper.activateAndWaitForInputSessionAt(100, 250);
-        await UIHelper.ensurePresentationUpdate();
-        const markupUsingEnglishKeyboard = document.body.innerHTML;
-
-        appendOutput(`Using Hebrew keyboard: ${markupUsingHebrewKeyboard}`);
-        appendOutput(`Using English keyboard: ${markupUsingEnglishKeyboard}`);
-        appendOutput(`Observed 'beforeinput' events: ${JSON.stringify(beforeInputEvents, null, 4)}`);
-        appendOutput(`Observed 'input' events: ${JSON.stringify(inputEvents, null, 4)}`);
-        testRunner.notifyDone();
-    }
-    </script>
-</head>
-<body _onload_="run()">
-    <div><br></div>
-    <div><br></div>
-</body>
-<script id="script">
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-} else {
-    const description = document.createElement("p");
-    description.textContent = "Verifies that focusing an editable area with an RTL keyboard switches text direction to RTL. "
-        + "To test manually, switch to a Hebrew keyboard and focus the editable area. "
-        + "The editable area should be made RTL.";
-    document.body.prepend(description);
-}
-</script>
-</html>

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (248064 => 248065)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-07-31 20:56:33 UTC (rev 248064)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-07-31 20:56:37 UTC (rev 248065)
@@ -1,5 +1,62 @@
 2019-07-31  Alan Coon  <[email protected]>
 
+        Cherry-pick r247936. rdar://problem/53764217
+
+    YouTube search field shows RTL text outside its border on iPadOS
+    https://bugs.webkit.org/show_bug.cgi?id=200253
+    <rdar://problem/53680603>
+    
+    Reviewed by Beth Dakin.
+    
+    Source/WebKit:
+    
+    Limits code added in r238939 to respect the current keyboard's writing mode to only editable web views. This
+    behavior was only intended for Mail, and isn't generally compatible with web content.
+    
+    While the call to -setInitialDirection is correctly gated on an web view editability check, it appears that
+    other changes in iOS 13 now cause -setBaseWritingDirection:forRange: to be invoked directly from keyboards code.
+    This means that -setBaseWritingDirection:forRange: should additionally be guarded with the same check.
+    
+    * UIProcess/ios/WKContentViewInteraction.mm:
+    (-[WKContentView setBaseWritingDirection:forRange:]):
+    
+    LayoutTests:
+    
+    * editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page-expected.txt: Renamed from LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus-expected.txt.
+    * editing/input/ios/rtl-keyboard-input-on-focus-in-editable-page.html: Renamed from LayoutTests/editing/input/ios/rtl-keyboard-input-on-focus.html.
+    
+    Rename an existing test, rtl-keyboard-input-on-focus.html, to rtl-keyboard-input-on-focus-in-editable-page.html
+    to emphasize the fact that it requires an editable web view.
+    
+    * editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page-expected.txt: Added.
+    * editing/input/ios/rtl-keyboard-input-on-focus-in-non-editable-page.html: Added.
+    
+    Add a new layout test to ensure that we don't automatically apply an RTL attribute when focusing fields in a
+    non-editable web view.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247936 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-07-29  Wenson Hsieh  <[email protected]>
+
+            YouTube search field shows RTL text outside its border on iPadOS
+            https://bugs.webkit.org/show_bug.cgi?id=200253
+            <rdar://problem/53680603>
+
+            Reviewed by Beth Dakin.
+
+            Limits code added in r238939 to respect the current keyboard's writing mode to only editable web views. This
+            behavior was only intended for Mail, and isn't generally compatible with web content.
+
+            While the call to -setInitialDirection is correctly gated on an web view editability check, it appears that
+            other changes in iOS 13 now cause -setBaseWritingDirection:forRange: to be invoked directly from keyboards code.
+            This means that -setBaseWritingDirection:forRange: should additionally be guarded with the same check.
+
+            * UIProcess/ios/WKContentViewInteraction.mm:
+            (-[WKContentView setBaseWritingDirection:forRange:]):
+
+2019-07-31  Alan Coon  <[email protected]>
+
         Cherry-pick r247933. rdar://problem/53764069
 
     Try fixing crash at com.apple.WebKit.Networking: NetworkProcess::setSharedHTTPCookieStorage

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (248064 => 248065)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-07-31 20:56:33 UTC (rev 248064)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-07-31 20:56:37 UTC (rev 248065)
@@ -4316,6 +4316,9 @@
 
 - (void)setBaseWritingDirection:(NSWritingDirection)direction forRange:(UITextRange *)range
 {
+    if (!_page->isEditable())
+        return;
+
     if (range && ![range isEqual:self.selectedTextRange]) {
         // We currently only support changing the base writing direction at the selection.
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to