<!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>[169244] 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/169244">169244</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2014-05-22 21:06:05 -0700 (Thu, 22 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Can't type in status in facebook.com on iOS Safari because keyboard disappears
https://bugs.webkit.org/show_bug.cgi?id=133196

Reviewed by Geoffrey Garen.

Source/WebCore:
Fixed the bug by rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/156252">r156252</a>.

When the user taps on the status on facebook.com, the page focuses a textarea,
which is then made momentarily invisible by setting display:none.
The page then removes display:none later and expects the textarea to be still focused.

With <a href="http://trac.webkit.org/projects/webkit/changeset/156252">r156252</a>, the focus is removed after the page sets display:none and the keyboard disappears.
Since the focus is never reset on the textarea, the user can never type in anything.

The specification may need to change here given that this (rather odd) behavior/expectation exists
on one of the most popular websites on the Web.

* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::recalcStyle):
(WebCore::Document::updateLayout):
(WebCore::Document::resetHiddenFocusElementSoon): Deleted.
(WebCore::Document::resetHiddenFocusElementTimer): Deleted.
* dom/Document.h:

LayoutTests:
Removed the test added by <a href="http://trac.webkit.org/projects/webkit/changeset/156252">r156252</a>.

* fast/dom/HTMLDocument/active-element-gets-unfocusable-expected.txt: Removed.
* fast/dom/HTMLDocument/active-element-gets-unfocusable.html: Removed.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDocumenth">trunk/Source/WebCore/dom/Document.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastdomHTMLDocumentactiveelementgetsunfocusableexpectedtxt">trunk/LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastdomHTMLDocumentactiveelementgetsunfocusablehtml">trunk/LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (169243 => 169244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-05-23 03:59:11 UTC (rev 169243)
+++ trunk/LayoutTests/ChangeLog        2014-05-23 04:06:05 UTC (rev 169244)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-05-22  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Can't type in status in facebook.com on iOS Safari because keyboard disappears
+        https://bugs.webkit.org/show_bug.cgi?id=133196
+
+        Reviewed by Geoffrey Garen.
+
+        Removed the test added by r156252.
+
+        * fast/dom/HTMLDocument/active-element-gets-unfocusable-expected.txt: Removed.
+        * fast/dom/HTMLDocument/active-element-gets-unfocusable.html: Removed.
+
</ins><span class="cx"> 2014-05-22  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         http/tests/security/xss-DENIED-xsl-document-redirect.xml fails with NetworkProcess
</span></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLDocumentactiveelementgetsunfocusableexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable-expected.txt (169243 => 169244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable-expected.txt        2014-05-23 03:59:11 UTC (rev 169243)
+++ trunk/LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable-expected.txt        2014-05-23 04:06:05 UTC (rev 169244)
</span><span class="lines">@@ -1,19 +0,0 @@
</span><del>-Making a focused element invisible should make it blur.
-
-On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
-
-
-===&gt; Setting display:none
-Event: blur
-PASS document.activeElement is document.body
-PASS The focusTarget element lost focus.
-
-===&gt; Setting visibility:hidden
-Event: blur
-PASS document.activeElement is document.body
-PASS The focusTarget element lost focus.
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestsfastdomHTMLDocumentactiveelementgetsunfocusablehtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable.html (169243 => 169244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable.html        2014-05-23 03:59:11 UTC (rev 169243)
+++ trunk/LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable.html        2014-05-23 04:06:05 UTC (rev 169244)
</span><span class="lines">@@ -1,49 +0,0 @@
</span><del>-&lt;!DOCTYPE html&gt;
-&lt;body&gt;
-&lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
-
-&lt;div id=&quot;f1&quot;&gt;
-  &lt;div tabindex=&quot;1&quot; id=&quot;div1&quot;&gt;&lt;/div&gt;
-&lt;/div&gt;
-
-&lt;script type=&quot;text/javascript&quot;&gt;
-description('Making a focused element invisible should make it blur.');
-jsTestIsAsync = true;
-var focusTarget = document.getElementById('div1');
-var testStage = 0;
-var testTimeout = 0;
-
-document.body.onload = function() {
-    focusTarget.focus();
-
-    shouldBe('document.activeElement', 'focusTarget', true);
-    debug('===&gt; Setting display:none');
-    setTimeout(&quot;f1.style.display = 'none'&quot;,0);
-
-    testTimeout = setTimeout(function() {
-        testFailed('Timeout: Didn\'t loose focus.');
-        finishJSTest();
-    }, 1000);
-};
-
-focusTarget.addEventListener('blur', function() {
-    debug('Event: blur');
-    shouldBe('document.activeElement', 'document.body');
-    testPassed('The focusTarget element lost focus.');
-
-    debug('');
-    if (testStage++ == 0) {
-        f1.style.display = 'block';
-        focusTarget.focus();
-        shouldBe('document.activeElement', 'focusTarget', true);
-        debug('===&gt; Setting visibility:hidden');
-        setTimeout(&quot;f1.style.visibility = 'hidden'&quot;,0);
-    } else {
-        clearTimeout(testTimeout);
-        finishJSTest();
-    }
-}, false);
-
-&lt;/script&gt;
-&lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
-&lt;/body&gt;
</del></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169243 => 169244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-23 03:59:11 UTC (rev 169243)
+++ trunk/Source/WebCore/ChangeLog        2014-05-23 04:06:05 UTC (rev 169244)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-05-22  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        Can't type in status in facebook.com on iOS Safari because keyboard disappears
+        https://bugs.webkit.org/show_bug.cgi?id=133196
+
+        Reviewed by Geoffrey Garen.
+
+        Fixed the bug by rolling out r156252.
+
+        When the user taps on the status on facebook.com, the page focuses a textarea,
+        which is then made momentarily invisible by setting display:none.
+        The page then removes display:none later and expects the textarea to be still focused.
+
+        With r156252, the focus is removed after the page sets display:none and the keyboard disappears.
+        Since the focus is never reset on the textarea, the user can never type in anything.
+
+        The specification may need to change here given that this (rather odd) behavior/expectation exists
+        on one of the most popular websites on the Web.
+
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::recalcStyle):
+        (WebCore::Document::updateLayout):
+        (WebCore::Document::resetHiddenFocusElementSoon): Deleted.
+        (WebCore::Document::resetHiddenFocusElementTimer): Deleted.
+        * dom/Document.h:
+
</ins><span class="cx"> 2014-05-22  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         http/tests/security/xss-DENIED-xsl-document-redirect.xml fails with NetworkProcess
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (169243 => 169244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2014-05-23 03:59:11 UTC (rev 169243)
+++ trunk/Source/WebCore/dom/Document.cpp        2014-05-23 04:06:05 UTC (rev 169244)
</span><span class="lines">@@ -442,7 +442,6 @@
</span><span class="cx">     , m_titleSetExplicitly(false)
</span><span class="cx">     , m_markers(std::make_unique&lt;DocumentMarkerController&gt;())
</span><span class="cx">     , m_updateFocusAppearanceTimer(this, &amp;Document::updateFocusAppearanceTimerFired)
</span><del>-    , m_resetHiddenFocusElementTimer(this, &amp;Document::resetHiddenFocusElementTimer)
</del><span class="cx">     , m_cssTarget(nullptr)
</span><span class="cx">     , m_processingLoadEvent(false)
</span><span class="cx">     , m_loadEventFinished(false)
</span><span class="lines">@@ -1774,9 +1773,6 @@
</span><span class="cx">     // to check if any other elements ended up under the mouse pointer due to re-layout.
</span><span class="cx">     if (m_hoveredElement &amp;&amp; !m_hoveredElement-&gt;renderer())
</span><span class="cx">         frameView.frame().mainFrame().eventHandler().dispatchFakeMouseMoveEventSoon();
</span><del>-
-    // Style change may reset the focus, e.g. display: none, visibility: hidden.
-    resetHiddenFocusElementSoon();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void Document::updateStyleIfNeeded()
</span><span class="lines">@@ -1820,9 +1816,6 @@
</span><span class="cx">     // Only do a layout if changes have occurred that make it necessary.      
</span><span class="cx">     if (frameView &amp;&amp; renderView() &amp;&amp; (frameView-&gt;layoutPending() || renderView()-&gt;needsLayout()))
</span><span class="cx">         frameView-&gt;layout();
</span><del>-
-    // Active focus element's isFocusable() state may change after Layout. e.g. width: 0px or height: 0px.
-    resetHiddenFocusElementSoon();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // FIXME: This is a bad idea and needs to be removed eventually.
</span><span class="lines">@@ -4729,12 +4722,6 @@
</span><span class="cx">     m_updateFocusAppearanceTimer.stop();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Document::resetHiddenFocusElementSoon()
-{
-    if (!m_resetHiddenFocusElementTimer.isActive() &amp;&amp; m_focusedElement)
-        m_resetHiddenFocusElementTimer.startOneShot(0);
-}
-
</del><span class="cx"> void Document::updateFocusAppearanceTimerFired(Timer&lt;Document&gt;&amp;)
</span><span class="cx"> {
</span><span class="cx">     Element* element = focusedElement();
</span><span class="lines">@@ -4746,15 +4733,6 @@
</span><span class="cx">         element-&gt;updateFocusAppearance(m_updateFocusAppearanceRestoresSelection);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Document::resetHiddenFocusElementTimer(Timer&lt;Document&gt;&amp;)
-{
-    if (view() &amp;&amp; view()-&gt;needsLayout())
-        return;
-
-    if (m_focusedElement &amp;&amp; !m_focusedElement-&gt;isFocusable())
-        setFocusedElement(nullptr);
-}
-
</del><span class="cx"> void Document::attachRange(Range* range)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_ranges.contains(range));
</span></span></pre></div>
<a id="trunkSourceWebCoredomDocumenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.h (169243 => 169244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.h        2014-05-23 03:59:11 UTC (rev 169243)
+++ trunk/Source/WebCore/dom/Document.h        2014-05-23 04:06:05 UTC (rev 169244)
</span><span class="lines">@@ -993,8 +993,6 @@
</span><span class="cx">     void updateFocusAppearanceSoon(bool restorePreviousSelection);
</span><span class="cx">     void cancelFocusAppearanceUpdate();
</span><span class="cx"> 
</span><del>-    void resetHiddenFocusElementSoon();
-
</del><span class="cx">     // Extension for manipulating canvas drawing contexts for use in CSS
</span><span class="cx">     CanvasRenderingContext* getCSSCanvasContext(const String&amp; type, const String&amp; name, int width, int height);
</span><span class="cx">     HTMLCanvasElement* getCSSCanvasElement(const String&amp; name);
</span><span class="lines">@@ -1321,8 +1319,6 @@
</span><span class="cx">     void updateFocusAppearanceTimerFired(Timer&lt;Document&gt;&amp;);
</span><span class="cx">     void updateBaseURL();
</span><span class="cx"> 
</span><del>-    void resetHiddenFocusElementTimer(Timer&lt;Document&gt;&amp;);
-
</del><span class="cx">     void buildAccessKeyMap(TreeScope* root);
</span><span class="cx"> 
</span><span class="cx">     void createStyleResolver();
</span><span class="lines">@@ -1468,7 +1464,6 @@
</span><span class="cx">     const std::unique_ptr&lt;DocumentMarkerController&gt; m_markers;
</span><span class="cx">     
</span><span class="cx">     Timer&lt;Document&gt; m_updateFocusAppearanceTimer;
</span><del>-    Timer&lt;Document&gt; m_resetHiddenFocusElementTimer;
</del><span class="cx"> 
</span><span class="cx">     Element* m_cssTarget;
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>