Title: [163329] trunk
Revision
163329
Author
bfulg...@apple.com
Date
2014-02-03 15:10:31 -0800 (Mon, 03 Feb 2014)

Log Message

REGRESSION (r163018): Can’t scroll in <select> lists
https://bugs.webkit.org/show_bug.cgi?id=128090

Source/WebCore: 

The regression was caused by the fact that a new method scrollWithWheelEventLocation() was added
to RenderBox to replace the generic scroll() method for the particular case of scrolling using 
the mouse wheel. This turned out to be a mistake because in the case of some elements, like select lists, 
the scroll method was overriden and now the incorrect method was being called.
The solution was to remove the new method and just add two default parameters to the generic
scroll method.

Patch by Radu Stavila <stav...@adobe.com> on 2014-02-03
Reviewed by Simon Fraser.

Test: fast/scrolling/scroll-select-list.html

* page/EventHandler.cpp:
(WebCore::scrollNode):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::scroll):
* rendering/RenderBox.h:
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::scroll):
* rendering/RenderEmbeddedObject.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::scroll):
* rendering/RenderListBox.h:
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::scroll):
* rendering/RenderTextControlSingleLine.h:

LayoutTests: 

New test validates scrolling using the mouse wheel inside a select list.
This test is for the moment added as a ImageOnlyFailure expectation
because the current implementation of eventSender cannot simulate mouse wheel events.

Patch by Radu Stavila <stav...@adobe.com> on 2014-02-03
Reviewed by Simon Fraser.

* TestExpectations:
* fast/scrolling/scroll-select-list-expected.html: Added.
* fast/scrolling/scroll-select-list.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (163328 => 163329)


--- trunk/LayoutTests/ChangeLog	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/LayoutTests/ChangeLog	2014-02-03 23:10:31 UTC (rev 163329)
@@ -1,3 +1,18 @@
+2014-02-03  Radu Stavila  <stav...@adobe.com>
+
+        REGRESSION (r163018): Can’t scroll in <select> lists
+        https://bugs.webkit.org/show_bug.cgi?id=128090
+
+        New test validates scrolling using the mouse wheel inside a select list.
+        This test is for the moment added as a ImageOnlyFailure expectation
+        because the current implementation of eventSender cannot simulate mouse wheel events.
+
+        Reviewed by Simon Fraser.
+
+        * TestExpectations:
+        * fast/scrolling/scroll-select-list-expected.html: Added.
+        * fast/scrolling/scroll-select-list.html: Added.
+
 2014-02-03  Oliver Hunt  <oli...@apple.com>
 
         Deconstructed parameters aren't being placed in the correct scope

Modified: trunk/LayoutTests/TestExpectations (163328 => 163329)


--- trunk/LayoutTests/TestExpectations	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/LayoutTests/TestExpectations	2014-02-03 23:10:31 UTC (rev 163329)
@@ -2,6 +2,9 @@
 #
 # See http://trac.webkit.org/wiki/TestExpectations for more information on this file.
 
+# Incomplete implementation of eventSender causes this test to fail
+webkit.org/b/42194 fast/scrolling/scroll-select-list.html [ ImageOnlyFailure ]
+
 # pending functional patch and per-port verification
 webkit.org/b/109954 css3/line-break [ Skip ]
 

Added: trunk/LayoutTests/fast/scrolling/scroll-select-list-expected.html (0 => 163329)


--- trunk/LayoutTests/fast/scrolling/scroll-select-list-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/scroll-select-list-expected.html	2014-02-03 23:10:31 UTC (rev 163329)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<style>
+  
+</style>
+
+<script type="text/_javascript_">
+  _onload_ = function() {
+      var selectList = document.getElementById("list");
+      selectList.scrollTop = 84;
+  }
+</script>
+
+<body style="font: 16px/16px monospace;">
+  <p>Scrolling inside the list using the mouse wheel should work as expected<br/>
+  <select id="list" size="2">
+      <option>content1</option>
+      <option>content2</option>
+      <option>content3</option>
+      <option>content4</option>
+      <option>content5</option>
+      <option>content6</option>
+      <option>content7</option>
+      <option>content8</option>
+      <option>content9</option>
+      <option>content10</option>
+  </select>
+</body>

Added: trunk/LayoutTests/fast/scrolling/scroll-select-list.html (0 => 163329)


--- trunk/LayoutTests/fast/scrolling/scroll-select-list.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/scroll-select-list.html	2014-02-03 23:10:31 UTC (rev 163329)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+
+<script>
+  _onload_ = function() {
+    if (window.eventSender) {
+      var selectList = document.getElementById("list");
+      var left = selectList.offsetLeft;
+      var top = selectList.offsetTop;
+
+      // scroll the list all the way down
+      eventSender.mouseMoveTo(left + 10, top + 10);
+      eventSender.continuousMouseScrollBy(0, -10000);
+      eventSender.mouseMoveTo(0, 0);
+    }
+  }
+</script>
+
+<body style="font: 16px/16px monospace;">
+    <p>Scrolling inside the list using the mouse wheel should work as expected<br/>
+    <select id="list" size="2">
+      <option>content1</option>
+      <option>content2</option>
+      <option>content3</option>
+      <option>content4</option>
+      <option>content5</option>
+      <option>content6</option>
+      <option>content7</option>
+      <option>content8</option>
+      <option>content9</option>
+      <option>content10</option>
+    </select>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (163328 => 163329)


--- trunk/Source/WebCore/ChangeLog	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/Source/WebCore/ChangeLog	2014-02-03 23:10:31 UTC (rev 163329)
@@ -1,3 +1,34 @@
+2014-02-03  Radu Stavila  <stav...@adobe.com>
+
+        REGRESSION (r163018): Can’t scroll in <select> lists
+        https://bugs.webkit.org/show_bug.cgi?id=128090
+
+        The regression was caused by the fact that a new method scrollWithWheelEventLocation() was added
+        to RenderBox to replace the generic scroll() method for the particular case of scrolling using 
+        the mouse wheel. This turned out to be a mistake because in the case of some elements, like select lists, 
+        the scroll method was overriden and now the incorrect method was being called.
+        The solution was to remove the new method and just add two default parameters to the generic
+        scroll method.
+
+        Reviewed by Simon Fraser.
+
+        Test: fast/scrolling/scroll-select-list.html
+
+        * page/EventHandler.cpp:
+        (WebCore::scrollNode):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::scroll):
+        * rendering/RenderBox.h:
+        * rendering/RenderEmbeddedObject.cpp:
+        (WebCore::RenderEmbeddedObject::scroll):
+        * rendering/RenderEmbeddedObject.h:
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::scroll):
+        * rendering/RenderListBox.h:
+        * rendering/RenderTextControlSingleLine.cpp:
+        (WebCore::RenderTextControlSingleLine::scroll):
+        * rendering/RenderTextControlSingleLine.h:
+
 2014-02-03  Chris Fleizach  <cfleiz...@apple.com>
 
         AX: WebKit should support @headers/@id for complex accessible web tables

Modified: trunk/Source/WebCore/page/EventHandler.cpp (163328 => 163329)


--- trunk/Source/WebCore/page/EventHandler.cpp	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2014-02-03 23:10:31 UTC (rev 163329)
@@ -281,7 +281,7 @@
     }
 }
 
-static inline bool scrollNode(float delta, ScrollGranularity granularity, ScrollDirection positiveDirection, ScrollDirection negativeDirection, Node* node, Element** stopElement, const IntPoint& absolutePoint)
+static inline bool scrollNode(float delta, ScrollGranularity granularity, ScrollDirection positiveDirection, ScrollDirection negativeDirection, Node* node, Element** stopElement, const IntPoint& wheelEventAbsolutePoint)
 {
     if (!delta)
         return false;
@@ -290,7 +290,7 @@
     RenderBox* enclosingBox = node->renderer()->enclosingBox();
     float absDelta = delta > 0 ? delta : -delta;
 
-    return enclosingBox->scrollWithWheelEventLocation(delta < 0 ? negativeDirection : positiveDirection, granularity, absDelta, enclosingBox, stopElement, absolutePoint);
+    return enclosingBox->scroll(delta < 0 ? negativeDirection : positiveDirection, granularity, absDelta, stopElement, enclosingBox, wheelEventAbsolutePoint);
 }
 
 #if (ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS))

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (163328 => 163329)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2014-02-03 23:10:31 UTC (rev 163329)
@@ -768,7 +768,7 @@
     return false;
 }
 
-bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)
+bool RenderBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement, RenderBox* startBox, const IntPoint& wheelEventAbsolutePoint)
 {
     if (scrollLayer(direction, granularity, multiplier, stopElement))
         return true;
@@ -776,29 +776,14 @@
     if (stopElement && *stopElement && *stopElement == element())
         return true;
 
-    RenderBlock* b = containingBlock();
-    if (b && !b->isRenderView())
-        return b->scroll(direction, granularity, multiplier, stopElement);
-
-    return false;
-}
-
-bool RenderBox::scrollWithWheelEventLocation(ScrollDirection direction, ScrollGranularity granularity, float multiplier, RenderBox* startBox, Element** stopElement, IntPoint absolutePoint)
-{
-    if (scrollLayer(direction, granularity, multiplier, stopElement))
-        return true;
-
-    if (stopElement && *stopElement && *stopElement == element())
-        return true;
-
     RenderBlock* nextScrollBlock = containingBlock();
     if (nextScrollBlock && nextScrollBlock->isRenderNamedFlowThread()) {
         ASSERT(startBox);
-        nextScrollBlock = toRenderFlowThread(nextScrollBlock)->regionFromAbsolutePointAndBox(absolutePoint, *startBox);
+        nextScrollBlock = toRenderFlowThread(nextScrollBlock)->regionFromAbsolutePointAndBox(wheelEventAbsolutePoint, *startBox);
     }
 
     if (nextScrollBlock && !nextScrollBlock->isRenderView())
-        return nextScrollBlock->scrollWithWheelEventLocation(direction, granularity, multiplier, startBox, stopElement, absolutePoint);
+        return nextScrollBlock->scroll(direction, granularity, multiplier, stopElement, startBox, wheelEventAbsolutePoint);
 
     return false;
 }

Modified: trunk/Source/WebCore/rendering/RenderBox.h (163328 => 163329)


--- trunk/Source/WebCore/rendering/RenderBox.h	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2014-02-03 23:10:31 UTC (rev 163329)
@@ -452,8 +452,7 @@
     int horizontalScrollbarHeight() const;
     int instrinsicScrollbarLogicalWidth() const;
     int scrollbarLogicalHeight() const { return style().isHorizontalWritingMode() ? horizontalScrollbarHeight() : verticalScrollbarWidth(); }
-    virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0);
-    virtual bool scrollWithWheelEventLocation(ScrollDirection, ScrollGranularity, float multiplier, RenderBox* startBox, Element** stopElement, IntPoint absolutePoint);
+    virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint());
     virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0);
     bool canBeScrolledAndHasScrollableArea() const;
     virtual bool canBeProgramaticallyScrolled() const;

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp (163328 => 163329)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.cpp	2014-02-03 23:10:31 UTC (rev 163329)
@@ -567,7 +567,7 @@
     return true;
 }
 
-bool RenderEmbeddedObject::scroll(ScrollDirection direction, ScrollGranularity granularity, float, Element**)
+bool RenderEmbeddedObject::scroll(ScrollDirection direction, ScrollGranularity granularity, float, Element**, RenderBox*, const IntPoint&)
 {
     if (!widget() || !widget()->isPluginViewBase())
         return false;

Modified: trunk/Source/WebCore/rendering/RenderEmbeddedObject.h (163328 => 163329)


--- trunk/Source/WebCore/rendering/RenderEmbeddedObject.h	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/Source/WebCore/rendering/RenderEmbeddedObject.h	2014-02-03 23:10:31 UTC (rev 163329)
@@ -80,7 +80,7 @@
 
     virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) override final;
 
-    virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier, Element** stopElement) override final;
+    virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) override final;
     virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier, Element** stopElement) override final;
 
     void setUnavailablePluginIndicatorIsPressed(bool);

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (163328 => 163329)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2014-02-03 23:10:31 UTC (rev 163329)
@@ -592,7 +592,7 @@
     return index >= m_indexOffset && index < m_indexOffset + numVisibleItems();
 }
 
-bool RenderListBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element**)
+bool RenderListBox::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element**, RenderBox*, const IntPoint&)
 {
     return ScrollableArea::scroll(direction, granularity, multiplier);
 }

Modified: trunk/Source/WebCore/rendering/RenderListBox.h (163328 => 163329)


--- trunk/Source/WebCore/rendering/RenderListBox.h	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/Source/WebCore/rendering/RenderListBox.h	2014-02-03 23:10:31 UTC (rev 163329)
@@ -74,7 +74,7 @@
 
     virtual bool isPointInOverflowControl(HitTestResult&, const LayoutPoint& locationInContainer, const LayoutPoint& accumulatedOffset) override;
 
-    virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) override;
+    virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) override;
     virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) override;
 
     virtual void computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const override;

Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp (163328 => 163329)


--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.cpp	2014-02-03 23:10:31 UTC (rev 163329)
@@ -460,7 +460,7 @@
         innerTextElement()->setScrollTop(newTop);
 }
 
-bool RenderTextControlSingleLine::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)
+bool RenderTextControlSingleLine::scroll(ScrollDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement, RenderBox* startBox, const IntPoint& wheelEventAbsolutePoint)
 {
     RenderTextControlInnerBlock* renderer = innerTextElement()->renderer();
     if (!renderer)
@@ -468,7 +468,7 @@
     RenderLayer* layer = renderer->layer();
     if (layer && layer->scroll(direction, granularity, multiplier))
         return true;
-    return RenderBlockFlow::scroll(direction, granularity, multiplier, stopElement);
+    return RenderBlockFlow::scroll(direction, granularity, multiplier, stopElement, startBox, wheelEventAbsolutePoint);
 }
 
 bool RenderTextControlSingleLine::logicalScroll(ScrollLogicalDirection direction, ScrollGranularity granularity, float multiplier, Element** stopElement)

Modified: trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h (163328 => 163329)


--- trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h	2014-02-03 22:43:28 UTC (rev 163328)
+++ trunk/Source/WebCore/rendering/RenderTextControlSingleLine.h	2014-02-03 23:10:31 UTC (rev 163329)
@@ -69,7 +69,7 @@
     virtual int scrollHeight() const override;
     virtual void setScrollLeft(int) override;
     virtual void setScrollTop(int) override;
-    virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) override final;
+    virtual bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = nullptr, RenderBox* startBox = nullptr, const IntPoint& wheelEventAbsolutePoint = IntPoint()) override final;
     virtual bool logicalScroll(ScrollLogicalDirection, ScrollGranularity, float multiplier = 1, Element** stopElement = 0) override final;
 
     int textBlockWidth() const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to