Title: [169244] trunk
Revision
169244
Author
[email protected]
Date
2014-05-22 21:06:05 -0700 (Thu, 22 May 2014)

Log Message

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 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:

LayoutTests:
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.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (169243 => 169244)


--- trunk/LayoutTests/ChangeLog	2014-05-23 03:59:11 UTC (rev 169243)
+++ trunk/LayoutTests/ChangeLog	2014-05-23 04:06:05 UTC (rev 169244)
@@ -1,3 +1,15 @@
+2014-05-22  Ryosuke Niwa  <[email protected]>
+
+        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.
+
 2014-05-22  Myles C. Maxfield  <[email protected]>
 
         http/tests/security/xss-DENIED-xsl-document-redirect.xml fails with NetworkProcess

Deleted: trunk/LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable-expected.txt (169243 => 169244)


--- 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)
@@ -1,19 +0,0 @@
-Making a focused element invisible should make it blur.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-===> Setting display:none
-Event: blur
-PASS document.activeElement is document.body
-PASS The focusTarget element lost focus.
-
-===> Setting visibility:hidden
-Event: blur
-PASS document.activeElement is document.body
-PASS The focusTarget element lost focus.
-
-PASS successfullyParsed is true
-
-TEST COMPLETE
-

Deleted: trunk/LayoutTests/fast/dom/HTMLDocument/active-element-gets-unfocusable.html (169243 => 169244)


--- 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)
@@ -1,49 +0,0 @@
-<!DOCTYPE html>
-<body>
-<script src=""
-
-<div id="f1">
-  <div tabindex="1" id="div1"></div>
-</div>
-
-<script type="text/_javascript_">
-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('===> Setting display:none');
-    setTimeout("f1.style.display = 'none'",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('===> Setting visibility:hidden');
-        setTimeout("f1.style.visibility = 'hidden'",0);
-    } else {
-        clearTimeout(testTimeout);
-        finishJSTest();
-    }
-}, false);
-
-</script>
-<script src=""
-</body>

Modified: trunk/Source/WebCore/ChangeLog (169243 => 169244)


--- 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)
@@ -1,3 +1,30 @@
+2014-05-22  Ryosuke Niwa  <[email protected]>
+
+        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:
+
 2014-05-22  Myles C. Maxfield  <[email protected]>
 
         http/tests/security/xss-DENIED-xsl-document-redirect.xml fails with NetworkProcess

Modified: trunk/Source/WebCore/dom/Document.cpp (169243 => 169244)


--- 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)
@@ -442,7 +442,6 @@
     , m_titleSetExplicitly(false)
     , m_markers(std::make_unique<DocumentMarkerController>())
     , m_updateFocusAppearanceTimer(this, &Document::updateFocusAppearanceTimerFired)
-    , m_resetHiddenFocusElementTimer(this, &Document::resetHiddenFocusElementTimer)
     , m_cssTarget(nullptr)
     , m_processingLoadEvent(false)
     , m_loadEventFinished(false)
@@ -1774,9 +1773,6 @@
     // to check if any other elements ended up under the mouse pointer due to re-layout.
     if (m_hoveredElement && !m_hoveredElement->renderer())
         frameView.frame().mainFrame().eventHandler().dispatchFakeMouseMoveEventSoon();
-
-    // Style change may reset the focus, e.g. display: none, visibility: hidden.
-    resetHiddenFocusElementSoon();
 }
 
 void Document::updateStyleIfNeeded()
@@ -1820,9 +1816,6 @@
     // Only do a layout if changes have occurred that make it necessary.      
     if (frameView && renderView() && (frameView->layoutPending() || renderView()->needsLayout()))
         frameView->layout();
-
-    // Active focus element's isFocusable() state may change after Layout. e.g. width: 0px or height: 0px.
-    resetHiddenFocusElementSoon();
 }
 
 // FIXME: This is a bad idea and needs to be removed eventually.
@@ -4729,12 +4722,6 @@
     m_updateFocusAppearanceTimer.stop();
 }
 
-void Document::resetHiddenFocusElementSoon()
-{
-    if (!m_resetHiddenFocusElementTimer.isActive() && m_focusedElement)
-        m_resetHiddenFocusElementTimer.startOneShot(0);
-}
-
 void Document::updateFocusAppearanceTimerFired(Timer<Document>&)
 {
     Element* element = focusedElement();
@@ -4746,15 +4733,6 @@
         element->updateFocusAppearance(m_updateFocusAppearanceRestoresSelection);
 }
 
-void Document::resetHiddenFocusElementTimer(Timer<Document>&)
-{
-    if (view() && view()->needsLayout())
-        return;
-
-    if (m_focusedElement && !m_focusedElement->isFocusable())
-        setFocusedElement(nullptr);
-}
-
 void Document::attachRange(Range* range)
 {
     ASSERT(!m_ranges.contains(range));

Modified: trunk/Source/WebCore/dom/Document.h (169243 => 169244)


--- 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)
@@ -993,8 +993,6 @@
     void updateFocusAppearanceSoon(bool restorePreviousSelection);
     void cancelFocusAppearanceUpdate();
 
-    void resetHiddenFocusElementSoon();
-
     // Extension for manipulating canvas drawing contexts for use in CSS
     CanvasRenderingContext* getCSSCanvasContext(const String& type, const String& name, int width, int height);
     HTMLCanvasElement* getCSSCanvasElement(const String& name);
@@ -1321,8 +1319,6 @@
     void updateFocusAppearanceTimerFired(Timer<Document>&);
     void updateBaseURL();
 
-    void resetHiddenFocusElementTimer(Timer<Document>&);
-
     void buildAccessKeyMap(TreeScope* root);
 
     void createStyleResolver();
@@ -1468,7 +1464,6 @@
     const std::unique_ptr<DocumentMarkerController> m_markers;
     
     Timer<Document> m_updateFocusAppearanceTimer;
-    Timer<Document> m_resetHiddenFocusElementTimer;
 
     Element* m_cssTarget;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to