Title: [239652] trunk
Revision
239652
Author
[email protected]
Date
2019-01-04 21:06:02 -0800 (Fri, 04 Jan 2019)

Log Message

REGRESSION (r238522): Erratic scrolling on Google flights search result page and vrbo.com
https://bugs.webkit.org/show_bug.cgi?id=192996
<rdar://problem/46573552>

Reviewed by Simon Fraser.

Source/WebCore:

Only scroll a text field if its inner text size changes and it is the currently active and
focused element on the page.

Test: fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout.html

* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::layout):

LayoutTests:

Add a test to ensure that we do not scroll the page when we lay out an unfocused text field.

* fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout-expected.txt: Added.
* fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239651 => 239652)


--- trunk/LayoutTests/ChangeLog	2019-01-05 05:03:29 UTC (rev 239651)
+++ trunk/LayoutTests/ChangeLog	2019-01-05 05:06:02 UTC (rev 239652)
@@ -1,3 +1,16 @@
+2019-01-04  Daniel Bates  <[email protected]>
+
+        REGRESSION (r238522): Erratic scrolling on Google flights search result page and vrbo.com
+        https://bugs.webkit.org/show_bug.cgi?id=192996
+        <rdar://problem/46573552>
+
+        Reviewed by Simon Fraser.
+
+        Add a test to ensure that we do not scroll the page when we lay out an unfocused text field.
+
+        * fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout-expected.txt: Added.
+        * fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout.html: Added.
+
 2019-01-04  Devin Rousso  <[email protected]>
 
         Web Inspector: Audit: disable breakpoints when running Audit

Added: trunk/LayoutTests/fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout-expected.txt (0 => 239652)


--- trunk/LayoutTests/fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout-expected.txt	2019-01-05 05:06:02 UTC (rev 239652)
@@ -0,0 +1,10 @@
+Tests that the page is not scrolled to the current selection when an unfocused text field is laid out.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.scrollY is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout.html (0 => 239652)


--- trunk/LayoutTests/fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout.html	2019-01-05 05:06:02 UTC (rev 239652)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<style>
+#text {
+    margin-top: 1000px; /* Position outside the viewport so that we would have to scroll to see this element. */
+    width: 256px;
+    height: 256px;
+    background-color: red;
+    color: white;
+}
+</style>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="test-container">
+    <p id="text">If you see this text then the test FAILed.</p>
+    <input type="text" id="text-field" placeholder="placeholder">
+</div>
+<script>
+function handleSelectionChange() {
+    // Trigger a re-layout of the text field.
+    document.getElementById("text-field").style.width = "20px";
+
+    // Use a zero timer to allow for a scroll to happen, if it were to happen. (We do not expect a scroll to happen).
+    window.setTimeout(() => {
+        shouldBeZero("window.scrollY");
+        if (window.testRunner)
+            document.body.removeChild(document.getElementById("test-container"));
+        finishJSTest();
+    }, 0);
+};
+
+window.jsTestIsAsync = true;
+
+description("Tests that the page is not scrolled to the current selection when an unfocused text field is laid out.");
+
+document.addEventListener("selectionchange", handleSelectionChange, { once: true });
+let text = document.getElementById("text");
+window.getSelection().setBaseAndExtent(text.firstChild, 0, text.firstChild, 0);
+</script>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/ChangeLog (239651 => 239652)


--- trunk/Source/WebCore/ChangeLog	2019-01-05 05:03:29 UTC (rev 239651)
+++ trunk/Source/WebCore/ChangeLog	2019-01-05 05:06:02 UTC (rev 239652)
@@ -1,3 +1,19 @@
+2019-01-04  Daniel Bates  <[email protected]>
+
+        REGRESSION (r238522): Erratic scrolling on Google flights search result page and vrbo.com
+        https://bugs.webkit.org/show_bug.cgi?id=192996
+        <rdar://problem/46573552>
+
+        Reviewed by Simon Fraser.
+
+        Only scroll a text field if its inner text size changes and it is the currently active and
+        focused element on the page.
+
+        Test: fast/scrolling/page-should-not-scroll-on-unfocused-text-field-layout.html
+
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::layout):
+
 2019-01-04  Alex Christensen  <[email protected]>
 
         Progress towards fixing Mac CMake build

Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (239651 => 239652)


--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2019-01-05 05:03:29 UTC (rev 239651)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2019-01-05 05:06:02 UTC (rev 239652)
@@ -212,7 +212,7 @@
     if (inputElement().isSearchField())
         RenderThemeIOS::adjustRoundBorderRadius(mutableStyle(), *this);
 #endif
-    if (innerTextSizeChanged) {
+    if (innerTextSizeChanged && frame().selection().isFocusedAndActive() && document().focusedElement() == &inputElement()) {
         // The caps lock indicator was hidden or shown. If it is now visible then it may be occluding
         // the current selection (say, the caret was after the last character in the text field).
         // Schedule an update and reveal of the current selection.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to