[prev in list] [next in list] [prev in thread] [next in thread] 

List:       webkit-changes
Subject:    [webkit-changes] [239543] trunk
From:       wenson_hsieh () apple ! com
Date:       2018-12-23 6:38:24
Message-ID: 20181223063824.D58A510051CD () svn ! webkit ! org
[Download RAW message or body]

[Attachment #2 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[239543] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: \
verdana,arial,helvetica,sans-serif; font-size: 10pt;  } #msg dl a { font-weight: \
bold} #msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: \
bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: \
6px; } #logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em \
0; } #logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg \
h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; } \
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; \
} #logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: \
-1.5em; padding-left: 1.5em; } #logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em \
1em 0 1em; background: white;} #logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid \
#fa0; border-bottom: 1px solid #fa0; background: #fff; } #logmsg table th { \
text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted \
#fa0; } #logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: \
0.2em 0.5em; } #logmsg table thead th { text-align: center; border-bottom: 1px solid \
#fa0; } #logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: \
6px; } #patch { width: 100%; }
#patch h4 {font-family: \
verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
 #patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, \
#patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins \
{background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del \
{background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, \
                .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a \
href="http://trac.webkit.org/projects/webkit/changeset/239543">239543</a></dd> \
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd> <dt>Date</dt> <dd>2018-12-22 22:38:24 \
-0800 (Sat, 22 Dec 2018)</dd> </dl>

<h3>Log Message</h3>
<pre>[iOS] Suppress native selection behaviors when focusing a very small editable \
element https://bugs.webkit.org/show_bug.cgi?id=193005
&lt;rdar://problem/46583527&gt;

Reviewed by Tim Horton.

Source/WebKit:

In <a href="http://trac.webkit.org/projects/webkit/changeset/238146">r238146</a>, I \
added a mechanism to detect when the selection is hidden within transparent editable \
elements, and used this to suppress native selection on iOS (such as selection \
handles, highlight, callout bar, etc.) to avoid conflicts between the page's editing \
UI and the platform.

However, one additional technique observed on some websites involves hiding the \
selection by moving it into a tiny (1x1) editable element. Here, we currently still \
present a callout bar with editing actions, as well as show a selection caret or \
handles on iOS. To fix this, we extend the mechanism added in <a \
href="http://trac.webkit.org/projects/webkit/changeset/238146">r238146</a> by also \
suppressing the selection assistant in the case where the editable element's area is \
beneath a tiny minimum threshold.

Test: editing/selection/ios/hide-selection-in-tiny-contenteditable.html

* Shared/EditorState.cpp:
(WebKit::EditorState::PostLayoutData::encode const):
(WebKit::EditorState::PostLayoutData::decode):
(WebKit::operator&lt;&lt;):
* Shared/EditorState.h:

Rename selectionClipRect to focusedElementRect. We currently propagate the bounds of \
the focused element to the UI process through EditorState updates, but only for the \
purpose of returning it in the computed selection clip rect; instead, rename this \
member to something more general-purpose, so we can also use it when determining \
whether to suppress the selection assistant.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _candidateRect]):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::handleRequestedCandidates):
* UIProcess/ios/WKContentViewInteraction.h:

Add a new SuppressSelectionAssistantReason that corresponds to focusing tiny editable \
elements.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _zoomToRevealFocusedElement]):
(-[WKContentView _selectionClipRect]):
(-[WKContentView _elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
 (-[WKContentView _updateChangedSelection:]):

Check the size of the focused element, and begin or stop suppressing the selection \
assistant accordingly.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::platformEditorState const):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::platformEditorState const):

LayoutTests:

Add a new layout test to verify that native selection UI is suppressed when focusing \
a tiny (1px by 1px) editable element.

* editing/selection/ios/hide-selection-in-tiny-contenteditable-expected.txt: Added.
* editing/selection/ios/hide-selection-in-tiny-contenteditable.html: Added.
* resources/ui-helper.js:
(window.UIHelper.zoomToScale):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsresourcesuihelperjs">trunk/LayoutTests/resources/ui-helper.js</a></li>
 <li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitSharedEditorStatecpp">trunk/Source/WebKit/Shared/EditorState.cpp</a></li>
 <li><a href="#trunkSourceWebKitSharedEditorStateh">trunk/Source/WebKit/Shared/EditorState.h</a></li>
 <li><a href="#trunkSourceWebKitUIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm</a></li>
 <li><a href="#trunkSourceWebKitUIProcessCocoaWebViewImplmm">trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm</a></li>
 <li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionh">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h</a></li>
 <li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm</a></li>
 <li><a href="#trunkSourceWebKitWebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
 <li><a href="#trunkSourceWebKitWebProcessWebPagemacWebPageMacmm">trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm</a></li>
 </ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestseditingselectionioshideselectionintinycontenteditableexp \
ectedtxt">trunk/LayoutTests/editing/selection/ios/hide-selection-in-tiny-contenteditable-expected.txt</a></li>
 <li><a href="#trunkLayoutTestseditingselectionioshideselectionintinycontenteditableht \
ml">trunk/LayoutTests/editing/selection/ios/hide-selection-in-tiny-contenteditable.html</a></li>
 </ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (239542 => \
239543)</h4> <pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog	2018-12-23 01:09:21 UTC (rev \
                239542)
+++ trunk/LayoutTests/ChangeLog	2018-12-23 06:38:24 UTC (rev 239543)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2018-12-22  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        [iOS] Suppress native selection behaviors when focusing a very small \
editable element +        https://bugs.webkit.org/show_bug.cgi?id=193005
+        &lt;rdar://problem/46583527&gt;
+
+        Reviewed by Tim Horton.
+
+        Add a new layout test to verify that native selection UI is suppressed when \
focusing a tiny (1px by 1px) +        editable element.
+
+        * editing/selection/ios/hide-selection-in-tiny-contenteditable-expected.txt: \
Added. +        * editing/selection/ios/hide-selection-in-tiny-contenteditable.html: \
Added. +        * resources/ui-helper.js:
+        (window.UIHelper.zoomToScale):
+
</ins><span class="cx"> 2018-12-20  Yusuke Suzuki  &lt;yusukesuzuki@slowstart.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC] Implement &quot;well-formed \
JSON.stringify&quot; proposal </span></span></pre></div>
<a id="trunkLayoutTestseditingselectionioshideselectionintinycontenteditableexpectedtxt"></a>
 <div class="addfile"><h4>Added: \
trunk/LayoutTests/editing/selection/ios/hide-selection-in-tiny-contenteditable-expected.txt \
(0 => 239543)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/editing/selection/ios/hide-selection-in-tiny-contenteditable-expected.txt	 \
                (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/hide-selection-in-tiny-contenteditable-expected.txt	2018-12-23 \
06:38:24 UTC (rev 239543) </span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+Focus the editor
+abcdefg
+Verifies that selection UI is suppressed when the editable root is extremely small. \
To manually test, tap on the button above and verify that (1) the editable element is \
focused, and (2) selection handles are not shown. +
+On success, you will see a series of &quot;PASS&quot; messages, followed by \
&quot;TEST COMPLETE&quot;. +
+After focus, the caret rect is empty
+After zooming in, the caret rect is empty
+After making editor large, the caret rect is empty
+After making editor opaque, the caret rect is (left=21, top=100, width=2, height=19)
+After making editor tiny again, the caret rect is empty
+After making editor transparent again, the caret rect is empty
+After making editor large again, the caret rect is empty
+After making editor opaque again, the caret rect is (left=50, top=100, width=2, \
height=19) +PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestseditingselectionioshideselectionintinycontenteditablehtml"></a>
 <div class="addfile"><h4>Added: \
trunk/LayoutTests/editing/selection/ios/hide-selection-in-tiny-contenteditable.html \
(0 => 239543)</h4> <pre class="diff"><span>
<span class="info">--- \
trunk/LayoutTests/editing/selection/ios/hide-selection-in-tiny-contenteditable.html	  \
                (rev 0)
+++ trunk/LayoutTests/editing/selection/ios/hide-selection-in-tiny-contenteditable.html	2018-12-23 \
06:38:24 UTC (rev 239543) </span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+&lt;!DOCTYPE html&gt; &lt;!-- webkit-test-runner [ \
useFlexibleViewport=true ] --&gt; +&lt;html&gt;
+&lt;head&gt;
+&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, \
initial-scale=1&quot;&gt; +&lt;script \
src=&quot;../../../resources/ui-helper.js&quot;&gt;&lt;/script&gt; +&lt;script \
src=&quot;../../../resources/js-test.js&quot;&gt;&lt;/script&gt; +&lt;style&gt;
+body, html {
+    width: 100%;
+    height: 100%;
+    margin: 0;
+}
+
+#editor {
+    width: 1px;
+    height: 1px;
+    outline: none;
+    overflow: hidden;
+    opacity: 0;
+}
+
+button {
+    width: 320px;
+    height: 100px;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;button onclick=&quot;editor.focus()&quot;&gt;Focus the editor&lt;/button&gt;
+&lt;div id=&quot;editor&quot; contenteditable autocorrect=&quot;off&quot; \
autocapitalize=&quot;off&quot; spellcheck=&quot;false&quot;&gt;&lt;/div&gt; +&lt;div \
id=&quot;description&quot;&gt;&lt;/div&gt; +&lt;div \
id=&quot;console&quot;&gt;&lt;/div&gt; +&lt;script&gt;
+jsTestIsAsync = true;
+
+function caretRectToString(rect) {
+    if (!rect.width &amp;&amp; !rect.height)
+        return &quot;empty&quot;;
+    return `(left=${rect.left}, top=${rect.top}, width=${rect.width}, \
height=${rect.height})`; +}
+
+async function checkCaretRect(description)
+{
+    await UIHelper.ensurePresentationUpdate();
+    const rect = await UIHelper.getUICaretViewRect();
+    debug(`${description}, the caret rect is ${caretRectToString(rect)}`);
+}
+
+(async () =&gt; {
+    description(&quot;Verifies that selection UI is suppressed when the editable \
root is extremely small. To manually test, &quot; +        + &quot;tap on the button \
above and verify that (1) the editable element is focused, and (2) selection handles \
are &quot; +        + &quot;not shown.&quot;);
+
+    await UIHelper.activateAndWaitForInputSessionAt(160, 50);
+    await checkCaretRect(&quot;After focus&quot;);
+
+    await UIHelper.zoomToScale(3);
+    await UIHelper.typeCharacter(&quot;a&quot;);
+    await checkCaretRect(&quot;After zooming in&quot;);
+    await UIHelper.zoomToScale(1);
+
+    editor.style.width = &quot;100px&quot;;
+    editor.style.height = &quot;100px&quot;;
+    await UIHelper.typeCharacter(&quot;b&quot;);
+    await checkCaretRect(&quot;After making editor large&quot;);
+
+    editor.style.opacity = 1;
+    await UIHelper.typeCharacter(&quot;c&quot;);
+    await checkCaretRect(&quot;After making editor opaque&quot;);
+
+    editor.style.width = &quot;1px&quot;;
+    editor.style.height = &quot;1px&quot;;
+    await UIHelper.typeCharacter(&quot;d&quot;);
+    await checkCaretRect(&quot;After making editor tiny again&quot;);
+
+    editor.style.opacity = 0;
+    await UIHelper.typeCharacter(&quot;e&quot;);
+    await checkCaretRect(&quot;After making editor transparent again&quot;);
+
+    editor.style.width = &quot;100px&quot;;
+    editor.style.height = &quot;100px&quot;;
+    await UIHelper.typeCharacter(&quot;f&quot;);
+    await checkCaretRect(&quot;After making editor large again&quot;);
+
+    editor.style.opacity = 1;
+    await UIHelper.typeCharacter(&quot;g&quot;);
+    await checkCaretRect(&quot;After making editor opaque again&quot;);
+
+    finishJSTest();
+})();
+&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsresourcesuihelperjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/resources/ui-helper.js (239542 \
=> 239543)</h4> <pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/resources/ui-helper.js	2018-12-23 01:09:21 \
                UTC (rev 239542)
+++ trunk/LayoutTests/resources/ui-helper.js	2018-12-23 06:38:24 UTC (rev 239543)
</span><span class="lines">@@ -346,6 +346,12 @@
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    static zoomToScale(scale)
+    {
+        const uiScript = `uiController.zoomToScale(${scale}, () =&gt; \
uiController.uiScriptComplete())`; +        return new Promise(resolve =&gt; \
testRunner.runUIScript(uiScript, resolve)); +    }
+
</ins><span class="cx">     static typeCharacter(characterString)
</span><span class="cx">     {
</span><span class="cx">         if (!this.isWebKit2() || !this.isIOS()) {
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (239542 => \
239543)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog	2018-12-23 01:09:21 UTC (rev \
                239542)
+++ trunk/Source/WebKit/ChangeLog	2018-12-23 06:38:24 UTC (rev 239543)
</span><span class="lines">@@ -1,3 +1,55 @@
</span><ins>+2018-12-22  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        [iOS] Suppress native selection behaviors when focusing a very small \
editable element +        https://bugs.webkit.org/show_bug.cgi?id=193005
+        &lt;rdar://problem/46583527&gt;
+
+        Reviewed by Tim Horton.
+
+        In r238146, I added a mechanism to detect when the selection is hidden \
within transparent editable elements, and +        used this to suppress native \
selection on iOS (such as selection handles, highlight, callout bar, etc.) to avoid + \
conflicts between the page's editing UI and the platform. +
+        However, one additional technique observed on some websites involves hiding \
the selection by moving it into a +        tiny (1x1) editable element. Here, we \
currently still present a callout bar with editing actions, as well as +        show \
a selection caret or handles on iOS. To fix this, we extend the mechanism added in \
r238146 by also +        suppressing the selection assistant in the case where the \
editable element's area is beneath a tiny minimum +        threshold.
+
+        Test: editing/selection/ios/hide-selection-in-tiny-contenteditable.html
+
+        * Shared/EditorState.cpp:
+        (WebKit::EditorState::PostLayoutData::encode const):
+        (WebKit::EditorState::PostLayoutData::decode):
+        (WebKit::operator&lt;&lt;):
+        * Shared/EditorState.h:
+
+        Rename selectionClipRect to focusedElementRect. We currently propagate the \
bounds of the focused element to the +        UI process through EditorState updates, \
but only for the purpose of returning it in the computed selection clip +        \
rect; instead, rename this member to something more general-purpose, so we can also \
use it when determining +        whether to suppress the selection assistant.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _candidateRect]):
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::handleRequestedCandidates):
+        * UIProcess/ios/WKContentViewInteraction.h:
+
+        Add a new SuppressSelectionAssistantReason that corresponds to focusing tiny \
editable elements. +
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView _zoomToRevealFocusedElement]):
+        (-[WKContentView _selectionClipRect]):
+        (-[WKContentView \
_elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:]):
 +        (-[WKContentView _updateChangedSelection:]):
+
+        Check the size of the focused element, and begin or stop suppressing the \
selection assistant accordingly. +
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::platformEditorState const):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::platformEditorState const):
+
</ins><span class="cx"> 2018-12-20  Yusuke Suzuki  &lt;yusukesuzuki@slowstart.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Use Ref&lt;&gt; as much as possible
</span></span></pre></div>
<a id="trunkSourceWebKitSharedEditorStatecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/EditorState.cpp (239542 \
=> 239543)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/EditorState.cpp	2018-12-23 01:09:21 \
                UTC (rev 239542)
+++ trunk/Source/WebKit/Shared/EditorState.cpp	2018-12-23 06:38:24 UTC (rev 239543)
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">     encoder &lt;&lt; caretRectAtStart;
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS_FAMILY) || PLATFORM(MAC)
</span><del>-    encoder &lt;&lt; selectionClipRect;
</del><ins>+    encoder &lt;&lt; focusedElementRect;
</ins><span class="cx">     encoder &lt;&lt; selectedTextLength;
</span><span class="cx">     encoder &lt;&lt; textAlignment;
</span><span class="cx">     encoder &lt;&lt; textColor;
</span><span class="lines">@@ -153,7 +153,7 @@
</span><span class="cx">         return false;
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS_FAMILY) || PLATFORM(MAC)
</span><del>-    if (!decoder.decode(result.selectionClipRect))
</del><ins>+    if (!decoder.decode(result.focusedElementRect))
</ins><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(result.selectedTextLength))
</span><span class="cx">         return false;
</span><span class="lines">@@ -262,8 +262,8 @@
</span><span class="cx">         ts.dumpProperty(&quot;caretRectAtStart&quot;, \
editorState.postLayoutData().caretRectAtStart); </span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS_FAMILY) || PLATFORM(MAC)
</span><del>-    if (editorState.postLayoutData().selectionClipRect != IntRect())
-        ts.dumpProperty(&quot;selectionClipRect&quot;, \
editorState.postLayoutData().selectionClipRect); </del><ins>+    if \
(editorState.postLayoutData().focusedElementRect != IntRect()) +        \
ts.dumpProperty(&quot;focusedElementRect&quot;, \
editorState.postLayoutData().focusedElementRect); </ins><span class="cx">     if \
(editorState.postLayoutData().selectedTextLength) </span><span class="cx">         \
ts.dumpProperty(&quot;selectedTextLength&quot;, \
editorState.postLayoutData().selectedTextLength); </span><span class="cx">     if \
(editorState.postLayoutData().textAlignment != NoAlignment) \
</span></span></pre></div> <a id="trunkSourceWebKitSharedEditorStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/EditorState.h (239542 \
=> 239543)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/EditorState.h	2018-12-23 01:09:21 \
                UTC (rev 239542)
+++ trunk/Source/WebKit/Shared/EditorState.h	2018-12-23 06:38:24 UTC (rev 239543)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx">         WebCore::IntRect caretRectAtStart;
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS_FAMILY) || PLATFORM(MAC)
</span><del>-        WebCore::IntRect selectionClipRect;
</del><ins>+        WebCore::IntRect focusedElementRect;
</ins><span class="cx">         uint64_t selectedTextLength { 0 };
</span><span class="cx">         uint32_t textAlignment { NoAlignment };
</span><span class="cx">         WebCore::Color textColor { WebCore::Color::black };
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (239542 => 239543)</h4> <pre \
class="diff"><span> <span class="info">--- \
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-12-23 01:09:21 UTC (rev \
                239542)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2018-12-23 06:38:24 UTC (rev \
239543) </span><span class="lines">@@ -6739,7 +6739,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (NSRect)_candidateRect
</span><span class="cx"> {
</span><del>-    return _page-&gt;editorState().postLayoutData().selectionClipRect;
</del><ins>+    return _page-&gt;editorState().postLayoutData().focusedElementRect;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)_useSystemAppearance
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessCocoaWebViewImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm \
(239542 => 239543)</h4> <pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-12-23 \
                01:09:21 UTC (rev 239542)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2018-12-23 06:38:24 UTC (rev \
239543) </span><span class="lines">@@ -3297,7 +3297,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if HAVE(TOUCH_BAR)
</span><span class="cx">     NSRange selectedRange = \
NSMakeRange(postLayoutData.candidateRequestStartPosition, \
postLayoutData.selectedTextLength); </span><del>-    WebCore::IntRect \
offsetSelectionRect = postLayoutData.selectionClipRect; </del><ins>+    \
WebCore::IntRect offsetSelectionRect = postLayoutData.focusedElementRect; </ins><span \
class="cx">     offsetSelectionRect.move(0, offsetSelectionRect.height()); \
</span><span class="cx">  </span><span class="cx">     [candidateListTouchBarItem() \
setCandidates:candidates forSelectedRange:selectedRange \
inString:postLayoutData.paragraphContextForCandidateRequest rect:offsetSelectionRect \
view:m_view.getAutoreleased() completionHandler:nil]; </span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionh"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h (239542 => 239543)</h4> \
<pre class="diff"><span> <span class="info">--- \
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-12-23 01:09:21 UTC \
                (rev 239542)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.h	2018-12-23 06:38:24 \
UTC (rev 239543) </span><span class="lines">@@ -163,7 +163,8 @@
</span><span class="cx"> 
</span><span class="cx"> enum SuppressSelectionAssistantReason : uint8_t {
</span><span class="cx">     FocusedElementIsTransparent = 1 &lt;&lt; 0,
</span><del>-    DropAnimationIsRunning = 1 &lt;&lt; 1
</del><ins>+    FocusedElementIsTooSmall = 1 &lt;&lt; 1,
+    DropAnimationIsRunning = 1 &lt;&lt; 2
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct WKSelectionDrawingInfo {
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (239542 => 239543)</h4> \
<pre class="diff"><span> <span class="info">--- \
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-12-23 01:09:21 UTC \
                (rev 239542)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2018-12-23 06:38:24 \
UTC (rev 239543) </span><span class="lines">@@ -1398,7 +1398,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_zoomToRevealFocusedElement
</span><span class="cx"> {
</span><del>-    if (_suppressSelectionAssistantReasons.contains(WebKit::FocusedElementIsTransparent))
 </del><ins>+    if (_suppressSelectionAssistantReasons.contains(WebKit::FocusedElementIsTransparent) \
|| _suppressSelectionAssistantReasons.contains(WebKit::FocusedElementIsTooSmall)) \
</ins><span class="cx">         return; </span><span class="cx"> 
</span><span class="cx">     SetForScope&lt;BOOL&gt; \
isZoomingToRevealFocusedElementForScope { _isZoomingToRevealFocusedElement, YES }; \
</span><span class="lines">@@ -1465,7 +1465,7 @@ </span><span class="cx"> {
</span><span class="cx">     if (!hasFocusedElement(_focusedElementInformation))
</span><span class="cx">         return CGRectNull;
</span><del>-    return _page-&gt;editorState().postLayoutData().selectionClipRect;
</del><ins>+    return _page-&gt;editorState().postLayoutData().focusedElementRect;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (BOOL)gestureRecognizer:(UIGestureRecognizer \
*)preventingGestureRecognizer canPreventGestureRecognizer:(UIGestureRecognizer \
*)preventedGestureRecognizer </span><span class="lines">@@ -4446,6 +4446,8 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static const double \
minimumFocusedElementAreaForSuppressingSelectionAssistant = 4; +
</ins><span class="cx"> - (void)_elementDidFocus:(const \
WebKit::FocusedElementInformation&amp;)information \
userIsInteracting:(BOOL)userIsInteracting blurPreviousNode:(BOOL)blurPreviousNode \
changingActivityState:(BOOL)changingActivityState userObject:(NSObject \
&lt;NSSecureCoding&gt; *)userObject </span><span class="cx"> {
</span><span class="cx">     SetForScope&lt;BOOL&gt; isChangingFocusForScope { \
_isChangingFocus, hasFocusedElement(_focusedElementInformation) }; </span><span \
class="lines">@@ -4474,6 +4476,11 @@ </span><span class="cx">     else
</span><span class="cx">         [self \
_stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparent]; \
</span><span class="cx">  </span><ins>+    if (information.elementRect.area() &lt; \
minimumFocusedElementAreaForSuppressingSelectionAssistant) +        [self \
_beginSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTooSmall]; +    \
else +        [self _stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTooSmall];
 +
</ins><span class="cx">     switch (startInputSessionPolicy) {
</span><span class="cx">     case _WKFocusStartsInputSessionPolicyAuto:
</span><span class="cx">         // The default behavior is to allow node assistance \
if the user is interacting. </span><span class="lines">@@ -5000,11 +5007,16 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     auto&amp; postLayoutData = state.postLayoutData();
</span><del>-    if (hasFocusedElement(_focusedElementInformation)) {
</del><ins>+    if (!state.selectionIsNone &amp;&amp; \
hasFocusedElement(_focusedElementInformation)) { </ins><span class="cx">         if \
(postLayoutData.elementIsTransparent) </span><span class="cx">             [self \
_beginSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparent]; \
</span><span class="cx">         else </span><span class="cx">             [self \
_stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTransparent]; \
</span><ins>+ +        if (postLayoutData.focusedElementRect.area() &lt; \
minimumFocusedElementAreaForSuppressingSelectionAssistant) +            [self \
_beginSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTooSmall]; +     \
else +            [self \
_stopSuppressingSelectionAssistantForReason:WebKit::FocusedElementIsTooSmall]; \
</ins><span class="cx">     } </span><span class="cx"> 
</span><span class="cx">     WebKit::WKSelectionDrawingInfo \
selectionDrawingInfo(_page-&gt;editorState()); </span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (239542 => 239543)</h4> <pre \
class="diff"><span> <span class="info">--- \
trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2018-12-23 01:09:21 UTC (rev \
                239542)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2018-12-23 06:38:24 UTC \
(rev 239543) </span><span class="lines">@@ -241,7 +241,7 @@
</span><span class="cx">     postLayoutData.insideFixedPosition = \
startNodeIsInsideFixedPosition || endNodeIsInsideFixedPosition; </span><span \
class="cx">     if (!selection.isNone()) { </span><span class="cx">         if \
(m_focusedElement &amp;&amp; m_focusedElement-&gt;renderer()) { </span><del>-         \
postLayoutData.selectionClipRect = \
view-&gt;contentsToRootView(m_focusedElement-&gt;renderer()-&gt;absoluteBoundingBoxRect());
 </del><ins>+            postLayoutData.focusedElementRect = \
view-&gt;contentsToRootView(m_focusedElement-&gt;renderer()-&gt;absoluteBoundingBoxRect());
 </ins><span class="cx">             postLayoutData.caretColor = \
m_focusedElement-&gt;renderer()-&gt;style().caretColor(); </span><span class="cx">    \
postLayoutData.elementIsTransparent = \
m_focusedElement-&gt;renderer()-&gt;isTransparentRespectingParentFrames(); \
</span><span class="cx">         } </span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPagemacWebPageMacmm"></a>
<div class="modfile"><h4>Modified: \
trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm (239542 => 239543)</h4> <pre \
class="diff"><span> <span class="info">--- \
trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2018-12-23 01:09:21 UTC (rev \
                239542)
+++ trunk/Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm	2018-12-23 06:38:24 UTC \
(rev 239543) </span><span class="lines">@@ -151,11 +151,11 @@
</span><span class="cx">     Vector&lt;FloatQuad&gt; quads;
</span><span class="cx">     selectedRange-&gt;absoluteTextQuads(quads);
</span><span class="cx">     if (!quads.isEmpty())
</span><del>-        postLayoutData.selectionClipRect = \
frame.view()-&gt;contentsToWindow(quads[0].enclosingBoundingBox()); </del><ins>+      \
postLayoutData.focusedElementRect = \
frame.view()-&gt;contentsToWindow(quads[0].enclosingBoundingBox()); </ins><span \
class="cx">     else { </span><span class="cx">         // Range::absoluteTextQuads() \
will be empty at the start of a paragraph. </span><span class="cx">         if \
(selection.isCaret()) </span><del>-            postLayoutData.selectionClipRect = \
frame.view()-&gt;contentsToWindow(frame.selection().absoluteCaretBounds()); \
</del><ins>+            postLayoutData.focusedElementRect = \
frame.view()-&gt;contentsToWindow(frame.selection().absoluteCaretBounds()); \
</ins><span class="cx">     } </span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>



_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic