Unreviewed, rolling out r202147.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Jun 2016 06:23:26 +0000 (06:23 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Jun 2016 06:23:26 +0000 (06:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158867

Broke scrolling tests on iOS Simulator (Requested by ap on
#webkit).

Reverted changeset:

"Focus event dispatched in iframe causes parent document to
scroll incorrectly"
https://bugs.webkit.org/show_bug.cgi?id=158629
http://trac.webkit.org/changeset/202147

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

LayoutTests/ChangeLog
LayoutTests/fast/forms/ios/focus-input-in-iframe-expected.txt [deleted file]
LayoutTests/fast/forms/ios/focus-input-in-iframe.html [deleted file]
LayoutTests/fast/forms/ios/programmatic-focus-input-in-iframe-expected.txt [deleted file]
LayoutTests/fast/forms/ios/programmatic-focus-input-in-iframe.html [deleted file]
Source/WebCore/ChangeLog
Source/WebCore/dom/Element.cpp
Source/WebCore/history/CachedPage.cpp

index 5b10f97..c742692 100644 (file)
@@ -1,3 +1,18 @@
+2016-06-16  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r202147.
+        https://bugs.webkit.org/show_bug.cgi?id=158867
+
+        Broke scrolling tests on iOS Simulator (Requested by ap on
+        #webkit).
+
+        Reverted changeset:
+
+        "Focus event dispatched in iframe causes parent document to
+        scroll incorrectly"
+        https://bugs.webkit.org/show_bug.cgi?id=158629
+        http://trac.webkit.org/changeset/202147
+
 2016-06-16  Benjamin Poulain  <bpoulain@apple.com>
 
         :in-range & :out-of-range CSS pseudo-classes shouldn't match disabled or readonly inputs
diff --git a/LayoutTests/fast/forms/ios/focus-input-in-iframe-expected.txt b/LayoutTests/fast/forms/ios/focus-input-in-iframe-expected.txt
deleted file mode 100644 (file)
index f5a2ebd..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-Tests zooming into a text input on tap.
-
-Click to focus input
-
-tap location   { x: 20.000, y: 62.000 }
-scale  1.455
-visibleRect    { left: 0.000, top: 1201.976, width: 219.979, height: 329.968 }
diff --git a/LayoutTests/fast/forms/ios/focus-input-in-iframe.html b/LayoutTests/fast/forms/ios/focus-input-in-iframe.html
deleted file mode 100644 (file)
index c3712de..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
-
-<html>
-<head>
-    <meta name="viewport" content="initial-scale=0.5">
-    <style>
-        button {
-            display: block;
-        }
-        iframe {
-            margin-top: 800px;
-        }
-    </style>
-    
-    <script src="resources/zooming-test-utils.js"></script>
-    <script>
-    if (window.testRunner) {
-        testRunner.dumpAsText();
-        testRunner.waitUntilDone();
-    }
-
-    if (window.internals)
-        internals.settings.setFrameFlatteningEnabled(true);
-    
-    function buttonClicked()
-    {
-        document.getElementById('frame').contentDocument.getElementById('input').focus();
-    }
-
-    function doTest()
-    {
-        testZoomAfterTap(document.getElementById('target'), 10, 10);
-    }
-
-    window.addEventListener('load', doTest, false);
-    </script>
-</head>
-<body>
-
-<p>Tests zooming into a text input on tap.</p>
-<button id="target" onclick="buttonClicked()">Click to focus input</button>
-
-<iframe id="frame" srcdoc="<style>input { margin: 400px 20px; }</style>
-<input id='input' type='text'>
-"></iframe>
-
-</body>
-</html>
diff --git a/LayoutTests/fast/forms/ios/programmatic-focus-input-in-iframe-expected.txt b/LayoutTests/fast/forms/ios/programmatic-focus-input-in-iframe-expected.txt
deleted file mode 100644 (file)
index 4eef465..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-Tests that a programmatic focus should not scroll into view
-
-PASS: page did not scroll.
-
diff --git a/LayoutTests/fast/forms/ios/programmatic-focus-input-in-iframe.html b/LayoutTests/fast/forms/ios/programmatic-focus-input-in-iframe.html
deleted file mode 100644 (file)
index 6edb5fa..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
-
-<html>
-<head>
-    <meta name="viewport" content="initial-scale=0.5">
-    <style>
-        button {
-            display: block;
-        }
-        iframe {
-            margin-top: 800px;
-        }
-    </style>
-    
-    <script>
-    if (window.testRunner) {
-        testRunner.dumpAsText();
-        testRunner.waitUntilDone();
-    }
-    
-    if (window.internals)
-        internals.settings.setFrameFlatteningEnabled(true);
-    
-    function pageDidScroll()
-    {
-        document.getElementById('result').textContent = 'FAIL: page scrolled to ' + document.scrollingElement.scrollTop;
-    }
-
-    function doTest()
-    {
-        window.setTimeout(function() {
-            document.getElementById('frame').contentDocument.getElementById('input').focus();
-        }, 0);
-
-        // Wait for any scroll to happen.
-        window.setTimeout(function() {
-            if (window.testRunner)
-                testRunner.notifyDone();
-        }, 100);
-    }
-
-    window.addEventListener('load', doTest, false);
-    </script>
-</head>
-<body onscroll="pageDidScroll()">
-
-<p>Tests that a programmatic focus should not scroll into view</p>
-<div id="result">
-    PASS: page did not scroll.
-</div>
-
-<iframe id="frame" srcdoc="<style>input { margin: 400px 20px; }</style>
-<input id='input' type='text'>
-"></iframe>
-
-</body>
-</html>
index 8be134b..03cff38 100644 (file)
@@ -1,3 +1,18 @@
+2016-06-16  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r202147.
+        https://bugs.webkit.org/show_bug.cgi?id=158867
+
+        Broke scrolling tests on iOS Simulator (Requested by ap on
+        #webkit).
+
+        Reverted changeset:
+
+        "Focus event dispatched in iframe causes parent document to
+        scroll incorrectly"
+        https://bugs.webkit.org/show_bug.cgi?id=158629
+        http://trac.webkit.org/changeset/202147
+
 2016-06-16  Benjamin Poulain  <bpoulain@apple.com>
 
         :in-range & :out-of-range CSS pseudo-classes shouldn't match disabled or readonly inputs
index cdb65a4..eebb715 100644 (file)
@@ -2245,8 +2245,6 @@ void Element::focus(bool restorePreviousSelection, FocusDirection direction)
     }
         
     cancelFocusAppearanceUpdate();
-
-    SelectionRevealMode revealMode = SelectionRevealMode::Reveal;
 #if PLATFORM(IOS)
     // Focusing a form element triggers animation in UIKit to scroll to the right position.
     // Calling updateFocusAppearance() would generate an unnecessary call to ScrollView::setScrollPosition(),
@@ -2254,9 +2252,13 @@ void Element::focus(bool restorePreviousSelection, FocusDirection direction)
     FrameView* view = document().view();
     bool isFormControl = view && is<HTMLFormControlElement>(*this);
     if (isFormControl)
-        revealMode = SelectionRevealMode::DoNotReveal;
+        view->setProhibitsScrolling(true);
+#endif
+    updateFocusAppearance(restorePreviousSelection ? SelectionRestorationMode::Restore : SelectionRestorationMode::SetDefault);
+#if PLATFORM(IOS)
+    if (isFormControl)
+        view->setProhibitsScrolling(false);
 #endif
-    updateFocusAppearance(restorePreviousSelection ? SelectionRestorationMode::Restore : SelectionRestorationMode::SetDefault, revealMode);
 }
 
 void Element::updateFocusAppearanceAfterAttachIfNeeded()
index e701ad7..add64e0 100644 (file)
@@ -77,18 +77,25 @@ void CachedPage::restore(Page& page)
     m_cachedMainFrame->open();
     
     // Restore the focus appearance for the focused element.
-    // FIXME: Right now we don't support pages with frames in the b/f cache. This may need to be tweaked when we add support for that.
+    // FIXME: Right now we don't support pages w/ frames in the b/f cache.  This may need to be tweaked when we add support for that.
     Document* focusedDocument = page.focusController().focusedOrMainFrame().document();
     if (Element* element = focusedDocument->focusedElement()) {
-        SelectionRevealMode revealMode = SelectionRevealMode::Reveal;
 #if PLATFORM(IOS)
         // We don't want focused nodes changing scroll position when restoring from the cache
         // as it can cause ugly jumps before we manage to restore the cached position.
         page.mainFrame().selection().suppressScrolling();
-        revealMode = SelectionRevealMode::DoNotReveal;
+
+        bool hadProhibitsScrolling = false;
+        FrameView* frameView = page.mainFrame().view();
+        if (frameView) {
+            hadProhibitsScrolling = frameView->prohibitsScrolling();
+            frameView->setProhibitsScrolling(true);
+        }
 #endif
-        element->updateFocusAppearance(SelectionRestorationMode::Restore, revealMode);
+        element->updateFocusAppearance(SelectionRestorationMode::Restore);
 #if PLATFORM(IOS)
+        if (frameView)
+            frameView->setProhibitsScrolling(hadProhibitsScrolling);
         page.mainFrame().selection().restoreScrolling();
 #endif
     }