Add a way to test ScrollAnimator
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Feb 2016 07:16:40 +0000 (07:16 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Feb 2016 07:16:40 +0000 (07:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=153479

Reviewed by Michael Catanzaro.

Source/WebCore:

Tests: fast/scrolling/overlay-scrollbars-scroll-corner.html
       fast/scrolling/scroll-animator-basic-events.html
       fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html
       fast/scrolling/scroll-animator-select-list-events.html

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:
* page/FrameView.cpp:
(WebCore::FrameView::usesMockScrollAnimator):
(WebCore::FrameView::logMockScrollAnimatorMessage):
* page/FrameView.h:
* page/Settings.cpp:
(WebCore::Settings::setUsesMockScrollAnimator):
(WebCore::Settings::usesMockScrollAnimator):
* page/Settings.h:
* platform/ScrollableArea.cpp:
(WebCore::ScrollableArea::scrollAnimator):
* platform/ScrollableArea.h:
(WebCore::ScrollableArea::usesMockScrollAnimator):
(WebCore::ScrollableArea::logMockScrollAnimatorMessage):
* platform/mock/ScrollAnimatorMock.cpp: Added.
(WebCore::ScrollAnimatorMock::create):
(WebCore::ScrollAnimatorMock::ScrollAnimatorMock):
(WebCore::ScrollAnimatorMock::~ScrollAnimatorMock):
(WebCore::ScrollAnimatorMock::didAddVerticalScrollbar):
(WebCore::ScrollAnimatorMock::didAddHorizontalScrollbar):
(WebCore::ScrollAnimatorMock::willRemoveVerticalScrollbar):
(WebCore::ScrollAnimatorMock::willRemoveHorizontalScrollbar):
(WebCore::ScrollAnimatorMock::mouseEnteredContentArea):
(WebCore::ScrollAnimatorMock::mouseMovedInContentArea):
(WebCore::ScrollAnimatorMock::mouseExitedContentArea):
(WebCore::ScrollAnimatorMock::mouseEnteredScrollbar):
(WebCore::ScrollAnimatorMock::mouseExitedScrollbar):
(WebCore::ScrollAnimatorMock::mouseIsDownInScrollbar):
* platform/mock/ScrollAnimatorMock.h: Added.
* platform/mock/ScrollbarThemeMock.cpp:
(WebCore::ScrollbarThemeMock::usesOverlayScrollbars):
* platform/mock/ScrollbarThemeMock.h:
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::usesMockScrollAnimator):
(WebCore::RenderLayer::logMockScrollAnimatorMessage):
* rendering/RenderLayer.h:
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::usesMockScrollAnimator):
(WebCore::RenderListBox::logMockScrollAnimatorMessage):
* rendering/RenderListBox.h:
* testing/Internals.cpp:
(WebCore::Internals::resetToConsistentState):
(WebCore::Internals::setUsesMockScrollAnimator):
* testing/Internals.h:
* testing/Internals.idl:

LayoutTests:

* compositing/overflow/overflow-scrollbar-layer-positions-expected.txt:
* fast/scrolling/overlay-scrollbars-scroll-corner-expected.html: Added.
* fast/scrolling/overlay-scrollbars-scroll-corner.html: Added.
* fast/scrolling/scroll-animator-basic-events-expected.txt: Added.
* fast/scrolling/scroll-animator-basic-events.html: Added.
* fast/scrolling/scroll-animator-overlay-scrollbars-hovered-expected.txt: Added.
* fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html: Added.
* fast/scrolling/scroll-animator-select-list-events-expected.txt: Added.
* fast/scrolling/scroll-animator-select-list-events.html: Added.
* fast/scrolling/scrollbar-tickmarks-hittest.html:
* platform/mac-wk1/TestExpectations:
* platform/mac-wk1/fast/scrolling/scroll-animator-basic-events-expected.txt: Added.
* platform/mac-wk1/fast/scrolling/scroll-animator-select-list-events-expected.txt: Added.

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

34 files changed:
LayoutTests/ChangeLog
LayoutTests/compositing/overflow/overflow-scrollbar-layer-positions-expected.txt
LayoutTests/fast/scrolling/overlay-scrollbars-scroll-corner-expected.html [new file with mode: 0644]
LayoutTests/fast/scrolling/overlay-scrollbars-scroll-corner.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scroll-animator-basic-events-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scroll-animator-basic-events.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scroll-animator-select-list-events-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/scroll-animator-select-list-events.html [new file with mode: 0644]
LayoutTests/fast/scrolling/scrollbar-tickmarks-hittest.html
LayoutTests/platform/mac-wk1/TestExpectations
LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-basic-events-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-select-list-events-expected.txt [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/Settings.cpp
Source/WebCore/page/Settings.h
Source/WebCore/platform/ScrollableArea.cpp
Source/WebCore/platform/ScrollableArea.h
Source/WebCore/platform/mock/ScrollAnimatorMock.cpp [new file with mode: 0644]
Source/WebCore/platform/mock/ScrollAnimatorMock.h [new file with mode: 0644]
Source/WebCore/platform/mock/ScrollbarThemeMock.cpp
Source/WebCore/platform/mock/ScrollbarThemeMock.h
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayer.h
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListBox.h
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl

index 12b5f68..85239d6 100644 (file)
@@ -1,3 +1,24 @@
+2016-02-16  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        Add a way to test ScrollAnimator
+        https://bugs.webkit.org/show_bug.cgi?id=153479
+
+        Reviewed by Michael Catanzaro.
+
+        * compositing/overflow/overflow-scrollbar-layer-positions-expected.txt:
+        * fast/scrolling/overlay-scrollbars-scroll-corner-expected.html: Added.
+        * fast/scrolling/overlay-scrollbars-scroll-corner.html: Added.
+        * fast/scrolling/scroll-animator-basic-events-expected.txt: Added.
+        * fast/scrolling/scroll-animator-basic-events.html: Added.
+        * fast/scrolling/scroll-animator-overlay-scrollbars-hovered-expected.txt: Added.
+        * fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html: Added.
+        * fast/scrolling/scroll-animator-select-list-events-expected.txt: Added.
+        * fast/scrolling/scroll-animator-select-list-events.html: Added.
+        * fast/scrolling/scrollbar-tickmarks-hittest.html:
+        * platform/mac-wk1/TestExpectations:
+        * platform/mac-wk1/fast/scrolling/scroll-animator-basic-events-expected.txt: Added.
+        * platform/mac-wk1/fast/scrolling/scroll-animator-select-list-events-expected.txt: Added.
+
 2016-02-16  Gavin Barraclough  <barraclough@apple.com>
 
         JSDOMWindow::getOwnPropertySlot should not search photo chain
index 92a8ecd..3c84d96 100644 (file)
@@ -11,6 +11,13 @@ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
           (position 2.00 -6.00)
           (bounds 244.00 244.00)
           (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 207.00 22.00)
+              (bounds 15.00 200.00)
+              (drawsContent 1)
+            )
+          )
         )
       )
     )
diff --git a/LayoutTests/fast/scrolling/overlay-scrollbars-scroll-corner-expected.html b/LayoutTests/fast/scrolling/overlay-scrollbars-scroll-corner-expected.html
new file mode 100644 (file)
index 0000000..4846665
--- /dev/null
@@ -0,0 +1,33 @@
+<html>
+<style>
+    #scrollme {
+        width: 100px;
+        height: 100px;
+        overflow: auto;
+    }
+    #scrollme p {
+        height: 1000px;
+        width: 1000px;
+    }
+    ::-webkit-scrollbar {
+        width: 15px;
+        height: 15px;
+        background-color: #C0C0C0;
+    }
+    ::-webkit-scrollbar-thumb {
+        background-color: #808080;
+    }
+    ::-webkit-scrollbar-corner {
+        background-color: #C0C0C0;
+    }
+</style>
+<script>
+  if (window.internals) {
+      window.internals.setUsesOverlayScrollbars(false);
+  }
+</script>
+<body>
+  <p>This is a test for <a href="https://bugs.webkit.org/show_bug.cgi?id=153352">https://bugs.webkit.org/show_bug.cgi?id=153352</a></p>
+  <div id="scrollme"><p>This is a scrollable div.</p></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/overlay-scrollbars-scroll-corner.html b/LayoutTests/fast/scrolling/overlay-scrollbars-scroll-corner.html
new file mode 100644 (file)
index 0000000..c235fdd
--- /dev/null
@@ -0,0 +1,22 @@
+<html>
+<style>
+    #scrollme {
+        width: 100px;
+        height: 100px;
+        overflow: auto;
+    }
+    #scrollme p {
+        width: 1000px;
+        height: 1000px;
+    }
+</style>
+<script>
+  if (window.internals) {
+      window.internals.setUsesOverlayScrollbars(true);
+  }
+</script>
+<body>
+  <p>This is a test for <a href="https://bugs.webkit.org/show_bug.cgi?id=153352">https://bugs.webkit.org/show_bug.cgi?id=153352</a></p>
+  <div id="scrollme"><p>This is a scrollable div.</p></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scroll-animator-basic-events-expected.txt b/LayoutTests/fast/scrolling/scroll-animator-basic-events-expected.txt
new file mode 100644 (file)
index 0000000..81dee00
--- /dev/null
@@ -0,0 +1,21 @@
+CONSOLE MESSAGE: line 24: MainFrameView: didAddVerticalScrollbar
+CONSOLE MESSAGE: line 24: RenderLayer: didAddVerticalScrollbar
+CONSOLE MESSAGE: line 24: MainFrameView: mouseEnteredContentArea
+CONSOLE MESSAGE: line 24: MainFrameView: mouseMovedInContentArea
+CONSOLE MESSAGE: line 25: RenderLayer: mouseEnteredContentArea
+CONSOLE MESSAGE: line 25: RenderLayer: mouseMovedInContentArea
+CONSOLE MESSAGE: line 25: MainFrameView: mouseMovedInContentArea
+CONSOLE MESSAGE: line 26: RenderLayer: mouseEnteredVerticalScrollbar
+CONSOLE MESSAGE: line 26: RenderLayer: mouseMovedInContentArea
+CONSOLE MESSAGE: line 26: MainFrameView: mouseMovedInContentArea
+CONSOLE MESSAGE: line 27: RenderLayer: mouseIsDownInVerticalScrollbar
+CONSOLE MESSAGE: line 28: RenderLayer: mouseIsUpInVerticalScrollbar
+CONSOLE MESSAGE: line 29: RenderLayer: mouseExitedVerticalScrollbar
+CONSOLE MESSAGE: line 29: RenderLayer: mouseExitedContentArea
+CONSOLE MESSAGE: line 29: MainFrameView: mouseMovedInContentArea
+PASS successfullyParsed is true
+
+TEST COMPLETE
+This is a scrollable div.
+
+
diff --git a/LayoutTests/fast/scrolling/scroll-animator-basic-events.html b/LayoutTests/fast/scrolling/scroll-animator-basic-events.html
new file mode 100644 (file)
index 0000000..b69e08b
--- /dev/null
@@ -0,0 +1,40 @@
+<html>
+<style>
+    #scrollme {
+        width: 100px;
+        height: 100px;
+        overflow: auto;
+    }
+    #scrollme p {
+        height: 1000px;
+    }
+</style>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+  if (window.internals) {
+      window.internals.setUsesMockScrollAnimator(true);
+  }
+  if (window.testRunner) {
+      testRunner.waitUntilDone();
+      testRunner.dumpAsText();
+  }
+  window.onload = function () {
+      var div = document.querySelector('#scrollme');
+      if (window.eventSender) {
+          eventSender.mouseMoveTo(0, 0);
+          eventSender.mouseMoveTo(div.offsetLeft + 1, div.offsetTop + 1);
+          eventSender.mouseMoveTo(div.offsetLeft + div.offsetWidth - 4, div.offsetTop + 1);
+          eventSender.mouseDown();
+          eventSender.mouseUp();
+          eventSender.mouseMoveTo(0, 0);
+      }
+      if (window.testRunner)
+          testRunner.notifyDone();
+  };
+</script>
+<script src="../../resources/js-test-post.js"></script>
+<body>
+  <div id="scrollme"><p>This is a scrollable div.</p></div>
+  <pre id="console"></pre>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered-expected.txt b/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered-expected.txt
new file mode 100644 (file)
index 0000000..43645b3
--- /dev/null
@@ -0,0 +1,19 @@
+CONSOLE MESSAGE: line 15: MainFrameView: didAddVerticalScrollbar
+CONSOLE MESSAGE: line 15: FrameView: didAddVerticalScrollbar
+CONSOLE MESSAGE: line 15: FrameView: didAddHorizontalScrollbar
+CONSOLE MESSAGE: line 15: FrameView: willRemoveVerticalScrollbar
+CONSOLE MESSAGE: line 15: MainFrameView: mouseEnteredContentArea
+CONSOLE MESSAGE: line 15: MainFrameView: mouseMovedInContentArea
+CONSOLE MESSAGE: line 16: FrameView: mouseEnteredHorizontalScrollbar
+CONSOLE MESSAGE: line 16: FrameView: mouseEnteredContentArea
+CONSOLE MESSAGE: line 16: MainFrameView: mouseMovedInContentArea
+CONSOLE MESSAGE: line 17: FrameView: mouseExitedHorizontalScrollbar
+CONSOLE MESSAGE: line 17: FrameView: mouseExitedContentArea
+CONSOLE MESSAGE: line 17: MainFrameView: mouseMovedInContentArea
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test for https://bugs.webkit.org/show_bug.cgi?id=153304.
+
+
+
diff --git a/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html b/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html
new file mode 100644 (file)
index 0000000..cb5e0ac
--- /dev/null
@@ -0,0 +1,32 @@
+<html>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+  if (window.internals) {
+      window.internals.setUsesMockScrollAnimator(true);
+      window.internals.setUsesOverlayScrollbars(true);
+  }
+  if (window.testRunner) {
+      testRunner.waitUntilDone();
+      testRunner.dumpAsText();
+  }
+  window.onload = function () {
+      var frame = document.getElementById("frame");
+      if (window.eventSender) {
+          eventSender.mouseMoveTo(0, 0);
+          eventSender.mouseMoveTo(frame.offsetLeft + 4, frame.offsetTop + frame.offsetHeight - 4);
+          eventSender.mouseMoveTo(0, 0);
+      }
+      if (window.testRunner)
+          testRunner.notifyDone();
+  };
+</script>
+<script src="../../resources/js-test-post.js"></script>
+<body>
+  <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=153304">https://bugs.webkit.org/show_bug.cgi?id=153304</a>.</p>
+  <iframe width=120 scrolling=yes id="frame" src="data:text/html,
+      <p style='white-space: nowrap'>Scroll animator should be notified when overlay scrollbars in main frame are hovered</p>
+      ">
+  </iframe>
+  <pre id="console"></pre>
+</body>
+</html>
diff --git a/LayoutTests/fast/scrolling/scroll-animator-select-list-events-expected.txt b/LayoutTests/fast/scrolling/scroll-animator-select-list-events-expected.txt
new file mode 100644 (file)
index 0000000..e935e92
--- /dev/null
@@ -0,0 +1,22 @@
+CONSOLE MESSAGE: RenderListBox: didAddVerticalScrollbar
+CONSOLE MESSAGE: line 14: MainFrameView: didAddVerticalScrollbar
+CONSOLE MESSAGE: line 14: MainFrameView: mouseEnteredContentArea
+CONSOLE MESSAGE: line 14: MainFrameView: mouseMovedInContentArea
+CONSOLE MESSAGE: line 15: RenderListBox: mouseEnteredContentArea
+CONSOLE MESSAGE: line 15: RenderListBox: mouseMovedInContentArea
+CONSOLE MESSAGE: line 15: MainFrameView: mouseMovedInContentArea
+CONSOLE MESSAGE: line 16: RenderListBox: mouseEnteredVerticalScrollbar
+CONSOLE MESSAGE: line 16: RenderListBox: mouseMovedInContentArea
+CONSOLE MESSAGE: line 16: MainFrameView: mouseMovedInContentArea
+CONSOLE MESSAGE: line 17: RenderListBox: mouseIsDownInVerticalScrollbar
+CONSOLE MESSAGE: line 18: RenderListBox: mouseIsUpInVerticalScrollbar
+CONSOLE MESSAGE: line 19: RenderListBox: mouseExitedVerticalScrollbar
+CONSOLE MESSAGE: line 19: RenderListBox: mouseExitedContentArea
+CONSOLE MESSAGE: line 19: MainFrameView: mouseMovedInContentArea
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test for https://bugs.webkit.org/show_bug.cgi?id=153398.
+
+
+
diff --git a/LayoutTests/fast/scrolling/scroll-animator-select-list-events.html b/LayoutTests/fast/scrolling/scroll-animator-select-list-events.html
new file mode 100644 (file)
index 0000000..292cf9c
--- /dev/null
@@ -0,0 +1,42 @@
+<html>
+<script src="../../resources/js-test-pre.js"></script>
+<script>
+  if (window.internals) {
+      window.internals.setUsesMockScrollAnimator(true);
+  }
+  if (window.testRunner) {
+      testRunner.waitUntilDone();
+      testRunner.dumpAsText();
+  }
+  window.onload = function () {
+      var list = document.getElementById("list");
+      if (window.eventSender) {
+          eventSender.mouseMoveTo(0, 0);
+          eventSender.mouseMoveTo(list.offsetLeft + 1, list.offsetTop + 1);
+          eventSender.mouseMoveTo(list.offsetLeft + list.offsetWidth - 4, list.offsetTop + 1);
+          eventSender.mouseDown();
+          eventSender.mouseUp();
+          eventSender.mouseMoveTo(0, 0);
+      }
+      if (window.testRunner)
+          testRunner.notifyDone();
+  };
+</script>
+<script src="../../resources/js-test-post.js"></script>
+<body>
+  <p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=153398">https://bugs.webkit.org/show_bug.cgi?id=153398</a>.</p>
+  <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>
+  <pre id="console"></pre>
+</body>
+</html>
index 273fb7d..3e8f8d3 100644 (file)
@@ -13,7 +13,6 @@ onload = function()
     var elt = document.getElementById('elt');
     range.selectNodeContents(elt);
     if (window.internals) {
-        window.internals.setUsesOverlayScrollbars(true);
         window.internals.addTextMatchMarker(range, true);
     }
     if (window.testRunner)
index afbd870..834cdf9 100644 (file)
@@ -253,6 +253,9 @@ webgl/1.0.3/151055_asan.html [ Failure ]
 # Lacking WK1 TestRunner API that evaluates JavaScript through JSC APIs and not WebCore APIs
 inspector/script-profiler/event-type-API.html
 
+# This test checks ScrollAnimator events only for main frame scrollbars that use native widgets in WK1.
+fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html [ Skip ]
+
 ########################################
 ### START OF (3) IndexedDB failures with SQLite
 
diff --git a/LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-basic-events-expected.txt b/LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-basic-events-expected.txt
new file mode 100644 (file)
index 0000000..f10ef6e
--- /dev/null
@@ -0,0 +1,15 @@
+CONSOLE MESSAGE: line 25: RenderLayer: didAddVerticalScrollbar
+CONSOLE MESSAGE: line 25: RenderLayer: mouseMovedInContentArea
+CONSOLE MESSAGE: line 26: RenderLayer: mouseEnteredVerticalScrollbar
+CONSOLE MESSAGE: line 26: RenderLayer: mouseMovedInContentArea
+CONSOLE MESSAGE: line 27: RenderLayer: mouseIsDownInVerticalScrollbar
+CONSOLE MESSAGE: line 28: RenderLayer: mouseIsUpInVerticalScrollbar
+CONSOLE MESSAGE: line 28: RenderLayer: mouseMovedInContentArea
+CONSOLE MESSAGE: line 29: RenderLayer: mouseExitedVerticalScrollbar
+CONSOLE MESSAGE: line 29: RenderLayer: mouseExitedContentArea
+PASS successfullyParsed is true
+
+TEST COMPLETE
+This is a scrollable div.
+
+
diff --git a/LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-select-list-events-expected.txt b/LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-select-list-events-expected.txt
new file mode 100644 (file)
index 0000000..5923397
--- /dev/null
@@ -0,0 +1,16 @@
+CONSOLE MESSAGE: RenderListBox: didAddVerticalScrollbar
+CONSOLE MESSAGE: line 15: RenderListBox: mouseMovedInContentArea
+CONSOLE MESSAGE: line 16: RenderListBox: mouseEnteredVerticalScrollbar
+CONSOLE MESSAGE: line 16: RenderListBox: mouseMovedInContentArea
+CONSOLE MESSAGE: line 17: RenderListBox: mouseIsDownInVerticalScrollbar
+CONSOLE MESSAGE: line 18: RenderListBox: mouseIsUpInVerticalScrollbar
+CONSOLE MESSAGE: line 18: RenderListBox: mouseMovedInContentArea
+CONSOLE MESSAGE: line 19: RenderListBox: mouseExitedVerticalScrollbar
+CONSOLE MESSAGE: line 19: RenderListBox: mouseExitedContentArea
+PASS successfullyParsed is true
+
+TEST COMPLETE
+Test for https://bugs.webkit.org/show_bug.cgi?id=153398.
+
+
+
index 89fbc82..f76fc98 100644 (file)
@@ -2314,6 +2314,7 @@ set(WebCore_SOURCES
     platform/mock/RTCDataChannelHandlerMock.cpp
     platform/mock/RTCNotifiersMock.cpp
     platform/mock/RTCPeerConnectionHandlerMock.cpp
+    platform/mock/ScrollAnimatorMock.cpp
     platform/mock/ScrollbarThemeMock.cpp
 
     platform/network/AuthenticationChallengeBase.cpp
index 3b47ec7..744b3bc 100644 (file)
@@ -1,5 +1,64 @@
 2016-02-16  Carlos Garcia Campos  <cgarcia@igalia.com>
 
+        Add a way to test ScrollAnimator
+        https://bugs.webkit.org/show_bug.cgi?id=153479
+
+        Reviewed by Michael Catanzaro.
+
+        Tests: fast/scrolling/overlay-scrollbars-scroll-corner.html
+               fast/scrolling/scroll-animator-basic-events.html
+               fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html
+               fast/scrolling/scroll-animator-select-list-events.html
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::usesMockScrollAnimator):
+        (WebCore::FrameView::logMockScrollAnimatorMessage):
+        * page/FrameView.h:
+        * page/Settings.cpp:
+        (WebCore::Settings::setUsesMockScrollAnimator):
+        (WebCore::Settings::usesMockScrollAnimator):
+        * page/Settings.h:
+        * platform/ScrollableArea.cpp:
+        (WebCore::ScrollableArea::scrollAnimator):
+        * platform/ScrollableArea.h:
+        (WebCore::ScrollableArea::usesMockScrollAnimator):
+        (WebCore::ScrollableArea::logMockScrollAnimatorMessage):
+        * platform/mock/ScrollAnimatorMock.cpp: Added.
+        (WebCore::ScrollAnimatorMock::create):
+        (WebCore::ScrollAnimatorMock::ScrollAnimatorMock):
+        (WebCore::ScrollAnimatorMock::~ScrollAnimatorMock):
+        (WebCore::ScrollAnimatorMock::didAddVerticalScrollbar):
+        (WebCore::ScrollAnimatorMock::didAddHorizontalScrollbar):
+        (WebCore::ScrollAnimatorMock::willRemoveVerticalScrollbar):
+        (WebCore::ScrollAnimatorMock::willRemoveHorizontalScrollbar):
+        (WebCore::ScrollAnimatorMock::mouseEnteredContentArea):
+        (WebCore::ScrollAnimatorMock::mouseMovedInContentArea):
+        (WebCore::ScrollAnimatorMock::mouseExitedContentArea):
+        (WebCore::ScrollAnimatorMock::mouseEnteredScrollbar):
+        (WebCore::ScrollAnimatorMock::mouseExitedScrollbar):
+        (WebCore::ScrollAnimatorMock::mouseIsDownInScrollbar):
+        * platform/mock/ScrollAnimatorMock.h: Added.
+        * platform/mock/ScrollbarThemeMock.cpp:
+        (WebCore::ScrollbarThemeMock::usesOverlayScrollbars):
+        * platform/mock/ScrollbarThemeMock.h:
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::usesMockScrollAnimator):
+        (WebCore::RenderLayer::logMockScrollAnimatorMessage):
+        * rendering/RenderLayer.h:
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::usesMockScrollAnimator):
+        (WebCore::RenderListBox::logMockScrollAnimatorMessage):
+        * rendering/RenderListBox.h:
+        * testing/Internals.cpp:
+        (WebCore::Internals::resetToConsistentState):
+        (WebCore::Internals::setUsesMockScrollAnimator):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
+2016-02-16  Carlos Garcia Campos  <cgarcia@igalia.com>
+
         Unreviewed. Enable overlay scrollbars in GTK+ after r196641.
 
         This was blocked by bug #153404, but the commit that introduced
index e84f462..096c705 100644 (file)
                5C9A7A751AA0F6EA00958ACF /* DFABytecodeCompiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C39305E1AA0F6A90029C816 /* DFABytecodeCompiler.cpp */; };
                5C9A7A761AA0F6ED00958ACF /* DFABytecodeInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C3930601AA0F6A90029C816 /* DFABytecodeInterpreter.cpp */; };
                5C9B860C1C21E3C900110F36 /* ResourceLoadTiming.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C9B860B1C21E3C600110F36 /* ResourceLoadTiming.mm */; };
+               5CB37FFE1C62D28C00F20188 /* ScrollAnimatorMock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CB37FFC1C62D27800F20188 /* ScrollAnimatorMock.cpp */; };
+               5CB37FFF1C62D2A100F20188 /* ScrollAnimatorMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CB37FFD1C62D27800F20188 /* ScrollAnimatorMock.h */; };
                5CBC8DAC1AAA302200E1C803 /* MediaAccessibilitySoftLink.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5CBC8DAA1AAA302200E1C803 /* MediaAccessibilitySoftLink.cpp */; };
                5CBC8DAD1AAA302200E1C803 /* MediaAccessibilitySoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 5CBC8DAB1AAA302200E1C803 /* MediaAccessibilitySoftLink.h */; };
                5CD9F5661AA0F73C00DA45FF /* DFABytecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C39305D1AA0F6A90029C816 /* DFABytecode.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5C4304B3191AEF46000E2BC0 /* JSEXTShaderTextureLOD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSEXTShaderTextureLOD.cpp; sourceTree = "<group>"; };
                5C4304B4191AEF46000E2BC0 /* JSEXTShaderTextureLOD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSEXTShaderTextureLOD.h; sourceTree = "<group>"; };
                5C9B860B1C21E3C600110F36 /* ResourceLoadTiming.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourceLoadTiming.mm; sourceTree = "<group>"; };
+               5CB37FFC1C62D27800F20188 /* ScrollAnimatorMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimatorMock.cpp; sourceTree = "<group>"; };
+               5CB37FFD1C62D27800F20188 /* ScrollAnimatorMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimatorMock.h; sourceTree = "<group>"; };
                5CBC8DAA1AAA302200E1C803 /* MediaAccessibilitySoftLink.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaAccessibilitySoftLink.cpp; sourceTree = "<group>"; };
                5CBC8DAB1AAA302200E1C803 /* MediaAccessibilitySoftLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaAccessibilitySoftLink.h; sourceTree = "<group>"; };
                5CDFA6C71AA4F2DA00EA8746 /* ContentExtensionActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContentExtensionActions.h; sourceTree = "<group>"; };
                59C77F101054591C00506104 /* mock */ = {
                        isa = PBXGroup;
                        children = (
+                               5CB37FFC1C62D27800F20188 /* ScrollAnimatorMock.cpp */,
+                               5CB37FFD1C62D27800F20188 /* ScrollAnimatorMock.h */,
                                CDF2B005182053DF00F2B424 /* mediasource */,
                                59309A1011F4AE5800250603 /* DeviceOrientationClientMock.cpp */,
                                59309A1211F4AE6A00250603 /* DeviceOrientationClientMock.h */,
                                FD31608312B026F700C1A359 /* AudioFileReader.h in Headers */,
                                CD5596921475B678001D0BD0 /* AudioFileReaderIOS.h in Headers */,
                                FD3160BF12B0272A00C1A359 /* AudioFileReaderMac.h in Headers */,
+                               5CB37FFF1C62D2A100F20188 /* ScrollAnimatorMock.h in Headers */,
                                CD2F4A2418D89F700063746D /* AudioHardwareListener.h in Headers */,
                                CD2F4A2818D8A3490063746D /* AudioHardwareListenerMac.h in Headers */,
                                FDE2D55B159E66EB00DCCCF8 /* AudioIOCallback.h in Headers */,
                                14C9A5EA0B3D105F005A0232 /* Settings.cpp in Sources */,
                                A182D5B71BE722670087A7CC /* SettingsCocoa.mm in Sources */,
                                0F3DD44F12F5EA1B000D9190 /* ShadowBlur.cpp in Sources */,
+                               5CB37FFE1C62D28C00F20188 /* ScrollAnimatorMock.cpp in Sources */,
                                BC5EB8C30E82031B00B25965 /* ShadowData.cpp in Sources */,
                                A6D169621346B49B000EB770 /* ShadowRoot.cpp in Sources */,
                                FD45A953175D3FB800C21EC8 /* Shape.cpp in Sources */,
index 20da993..9aabb70 100644 (file)
@@ -1631,6 +1631,24 @@ bool FrameView::usesAsyncScrolling() const
     return false;
 }
 
+bool FrameView::usesMockScrollAnimator() const
+{
+    return Settings::usesMockScrollAnimator();
+}
+
+void FrameView::logMockScrollAnimatorMessage(const String& message) const
+{
+    Document* document = frame().document();
+    if (!document)
+        return;
+    StringBuilder builder;
+    if (frame().isMainFrame())
+        builder.appendLiteral("Main");
+    builder.appendLiteral("FrameView: ");
+    builder.append(message);
+    document->addConsoleMessage(MessageSource::Other, MessageLevel::Debug, builder.toString());
+}
+
 void FrameView::setCannotBlitToWindow()
 {
     m_cannotBlitToWindow = true;
index d0fcf5d..67cf122 100644 (file)
@@ -636,6 +636,8 @@ private:
 
     virtual bool usesCompositedScrolling() const override;
     virtual bool usesAsyncScrolling() const override;
+    bool usesMockScrollAnimator() const override;
+    void logMockScrollAnimatorMessage(const String&) const override;
 
     // Override scrollbar notifications to update the AXObject cache.
     virtual void didAddScrollbar(Scrollbar*, ScrollbarOrientation) override;
index 2b66f0f..a0bc576 100644 (file)
@@ -84,6 +84,7 @@ bool Settings::gQTKitEnabled = false;
 
 bool Settings::gMockScrollbarsEnabled = false;
 bool Settings::gUsesOverlayScrollbars = false;
+bool Settings::gMockScrollAnimatorEnabled = false;
 
 #if ENABLE(MEDIA_STREAM)
 bool Settings::gMockCaptureDevicesEnabled = false;
@@ -655,6 +656,16 @@ bool Settings::usesOverlayScrollbars()
     return gUsesOverlayScrollbars;
 }
 
+void Settings::setUsesMockScrollAnimator(bool flag)
+{
+    gMockScrollAnimatorEnabled = flag;
+}
+
+bool Settings::usesMockScrollAnimator()
+{
+    return gMockScrollAnimatorEnabled;
+}
+
 void Settings::setShouldRespectPriorityInCSSAttributeSetters(bool flag)
 {
     gShouldRespectPriorityInCSSAttributeSetters = flag;
index 822bfe7..f59864d 100644 (file)
@@ -216,6 +216,9 @@ public:
     WEBCORE_EXPORT static void setUsesOverlayScrollbars(bool flag);
     static bool usesOverlayScrollbars();
 
+    WEBCORE_EXPORT static void setUsesMockScrollAnimator(bool);
+    static bool usesMockScrollAnimator();
+
 #if ENABLE(TOUCH_EVENTS)
     void setTouchEventEmulationEnabled(bool enabled) { m_touchEventEmulationEnabled = enabled; }
     bool isTouchEventEmulationEnabled() const { return m_touchEventEmulationEnabled; }
@@ -357,6 +360,7 @@ private:
 
     static bool gMockScrollbarsEnabled;
     static bool gUsesOverlayScrollbars;
+    static bool gMockScrollAnimatorEnabled;
 
 #if PLATFORM(WIN)
     static bool gShouldUseHighResolutionTimers;
index d400270..8dfc940 100644 (file)
@@ -39,6 +39,7 @@
 #include "Logging.h"
 #include "PlatformWheelEvent.h"
 #include "ScrollAnimator.h"
+#include "ScrollAnimatorMock.h"
 #include "ScrollbarTheme.h"
 #include "TextStream.h"
 
@@ -75,8 +76,14 @@ ScrollableArea::~ScrollableArea()
 
 ScrollAnimator& ScrollableArea::scrollAnimator() const
 {
-    if (!m_scrollAnimator)
-        m_scrollAnimator = ScrollAnimator::create(const_cast<ScrollableArea&>(*this));
+    if (!m_scrollAnimator) {
+        if (usesMockScrollAnimator()) {
+            m_scrollAnimator = std::make_unique<ScrollAnimatorMock>(const_cast<ScrollableArea&>(*this), [this](const String& message) {
+                logMockScrollAnimatorMessage(message);
+            });
+        } else
+            m_scrollAnimator = ScrollAnimator::create(const_cast<ScrollableArea&>(*this));
+    }
 
     ASSERT(m_scrollAnimator);
     return *m_scrollAnimator.get();
index 47bb274..2bf13a1 100644 (file)
@@ -307,6 +307,9 @@ public:
     void verticalScrollbarLayerDidChange();
     void horizontalScrollbarLayerDidChange();
 
+    virtual bool usesMockScrollAnimator() const { return false; }
+    virtual void logMockScrollAnimatorMessage(const String&) const { };
+
 protected:
     WEBCORE_EXPORT ScrollableArea();
     WEBCORE_EXPORT virtual ~ScrollableArea();
diff --git a/Source/WebCore/platform/mock/ScrollAnimatorMock.cpp b/Source/WebCore/platform/mock/ScrollAnimatorMock.cpp
new file mode 100644 (file)
index 0000000..c080381
--- /dev/null
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2016 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ScrollAnimatorMock.h"
+
+#include "ScrollableArea.h"
+#include <wtf/text/StringBuilder.h>
+
+namespace WebCore {
+
+ScrollAnimatorMock::ScrollAnimatorMock(ScrollableArea& scrollableArea, std::function<void(const String&)>&& logger)
+    : ScrollAnimator(scrollableArea)
+    , m_logger(WTFMove(logger))
+{
+}
+
+ScrollAnimatorMock::~ScrollAnimatorMock()
+{
+}
+
+void ScrollAnimatorMock::didAddVerticalScrollbar(Scrollbar* scrollbar)
+{
+    m_verticalScrollbar = scrollbar;
+    m_logger("didAddVerticalScrollbar");
+    ScrollAnimator::didAddVerticalScrollbar(scrollbar);
+}
+
+void ScrollAnimatorMock::didAddHorizontalScrollbar(Scrollbar* scrollbar)
+{
+    m_horizontalScrollbar = scrollbar;
+    m_logger("didAddHorizontalScrollbar");
+    ScrollAnimator::didAddHorizontalScrollbar(scrollbar);
+}
+
+void ScrollAnimatorMock::willRemoveVerticalScrollbar(Scrollbar* scrollbar)
+{
+    m_logger("willRemoveVerticalScrollbar");
+    ScrollAnimator::willRemoveVerticalScrollbar(scrollbar);
+    m_verticalScrollbar = nullptr;
+}
+
+void ScrollAnimatorMock::willRemoveHorizontalScrollbar(Scrollbar* scrollbar)
+{
+    m_logger("willRemoveHorizontalScrollbar");
+    ScrollAnimator::willRemoveHorizontalScrollbar(scrollbar);
+    m_horizontalScrollbar = nullptr;
+}
+
+void ScrollAnimatorMock::mouseEnteredContentArea()
+{
+    m_logger("mouseEnteredContentArea");
+    ScrollAnimator::mouseEnteredContentArea();
+}
+
+void ScrollAnimatorMock::mouseMovedInContentArea()
+{
+    m_logger("mouseMovedInContentArea");
+    ScrollAnimator::mouseMovedInContentArea();
+}
+
+void ScrollAnimatorMock::mouseExitedContentArea()
+{
+    m_logger("mouseExitedContentArea");
+    ScrollAnimator::mouseExitedContentArea();
+}
+
+void ScrollAnimatorMock::mouseEnteredScrollbar(Scrollbar* scrollbar) const
+{
+    StringBuilder message;
+    message.appendLiteral("mouseEntered");
+    if (scrollbar == m_verticalScrollbar)
+        message.appendLiteral("Vertical");
+    else if (scrollbar == m_horizontalScrollbar)
+        message.appendLiteral("Horizontal");
+    else
+        message.appendLiteral("Unknown");
+    message.appendLiteral("Scrollbar");
+    m_logger(message.toString());
+    ScrollAnimator::mouseEnteredScrollbar(scrollbar);
+}
+
+void ScrollAnimatorMock::mouseExitedScrollbar(Scrollbar* scrollbar) const
+{
+    StringBuilder message;
+    message.appendLiteral("mouseExited");
+    if (scrollbar == m_verticalScrollbar)
+        message.appendLiteral("Vertical");
+    else if (scrollbar == m_horizontalScrollbar)
+        message.appendLiteral("Horizontal");
+    else
+        message.appendLiteral("Unknown");
+    message.appendLiteral("Scrollbar");
+    m_logger(message.toString());
+    ScrollAnimator::mouseExitedScrollbar(scrollbar);
+}
+
+void ScrollAnimatorMock::mouseIsDownInScrollbar(Scrollbar* scrollbar, bool isPressed) const
+{
+    StringBuilder message;
+    message.appendLiteral("mouseIs");
+    if (isPressed)
+        message.appendLiteral("Down");
+    else
+        message.appendLiteral("Up");
+    message.appendLiteral("In");
+    if (scrollbar == m_verticalScrollbar)
+        message.appendLiteral("Vertical");
+    else if (scrollbar == m_horizontalScrollbar)
+        message.appendLiteral("Horizontal");
+    else
+        message.appendLiteral("Unknown");
+    message.appendLiteral("Scrollbar");
+    m_logger(message.toString());
+    ScrollAnimator::mouseIsDownInScrollbar(scrollbar, isPressed);
+}
+
+} // namespace WebCore
diff --git a/Source/WebCore/platform/mock/ScrollAnimatorMock.h b/Source/WebCore/platform/mock/ScrollAnimatorMock.h
new file mode 100644 (file)
index 0000000..85dc4f6
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef ScrollAnimatorMock_h
+#define ScrollAnimatorMock_h
+
+#include "ScrollAnimator.h"
+
+namespace WebCore {
+
+// A Mock implementation of ScrollAnimator used to test the scroll events
+// received by the scroll animator. Tests can enable this scroll animator using
+// the internal setting enableMockScrollAnimator.
+class ScrollAnimatorMock final : public ScrollAnimator {
+public:
+    ScrollAnimatorMock(ScrollableArea&, std::function<void(const String&)>&&);
+    virtual ~ScrollAnimatorMock();
+
+#if ENABLE(RUBBER_BANDING)
+    bool allowsHorizontalStretching(const PlatformWheelEvent&) override { return false; }
+    bool allowsVerticalStretching(const PlatformWheelEvent&) override { return false; }
+    IntSize stretchAmount() override { return IntSize(); }
+    bool pinnedInDirection(const FloatSize&) override { return false; }
+    bool canScrollHorizontally() override { return false; }
+    bool canScrollVertically() override { return false; }
+    bool shouldRubberBandInDirection(ScrollDirection) override { return false; }
+    void immediateScrollBy(const FloatSize&) override { }
+    void immediateScrollByWithoutContentEdgeConstraints(const FloatSize&) override { }
+    void adjustScrollPositionToBoundsIfNecessary() override { }
+#endif
+
+private:
+    void didAddVerticalScrollbar(Scrollbar*) override;
+    void didAddHorizontalScrollbar(Scrollbar*) override;
+    void willRemoveVerticalScrollbar(Scrollbar*) override;
+    void willRemoveHorizontalScrollbar(Scrollbar*) override;
+    void mouseEnteredContentArea() override;
+    void mouseMovedInContentArea() override;
+    void mouseExitedContentArea() override;
+    void mouseEnteredScrollbar(Scrollbar*) const override;
+    void mouseExitedScrollbar(Scrollbar*) const override;
+    void mouseIsDownInScrollbar(Scrollbar*, bool) const override;
+
+    std::function<void(const String&)> m_logger;
+    Scrollbar* m_verticalScrollbar { nullptr };
+    Scrollbar* m_horizontalScrollbar { nullptr };
+};
+
+} // namespace WebCore
+
+#endif // ScrollAnimatorMock_h
index 9ad757f..171dfd5 100644 (file)
@@ -27,6 +27,8 @@
 #include "ScrollbarThemeMock.h"
 
 #include "Scrollbar.h"
+// FIXME: This is a layering violation.
+#include "Settings.h"
 
 namespace WebCore {
 
@@ -53,5 +55,12 @@ void ScrollbarThemeMock::paintThumb(GraphicsContext& context, Scrollbar& scrollb
         context.fillRect(thumbRect, Color::darkGray);
 }
 
+bool ScrollbarThemeMock::usesOverlayScrollbars() const
+{
+    // FIXME: This is a layering violation, but ScrollbarThemeMock is also created depending on settings in platform layer,
+    // we should fix it in both places.
+    return Settings::usesOverlayScrollbars();
+}
+
 }
 
index c00fca3..eba119e 100644 (file)
@@ -46,7 +46,8 @@ protected:
     virtual void paintTrackBackground(GraphicsContext&, Scrollbar&, const IntRect&) override;
     virtual void paintThumb(GraphicsContext&, Scrollbar&, const IntRect&) override;
     virtual int maxOverlapBetweenPages() override { return 40; }
-    
+
+    virtual bool usesOverlayScrollbars() const override;
 private:
     virtual bool isMockTheme() const override { return true; }
 };
index 07ea2d5..2da5622 100644 (file)
@@ -3226,6 +3226,16 @@ bool RenderLayer::isScrollSnapInProgress() const
 }
 #endif
 
+bool RenderLayer::usesMockScrollAnimator() const
+{
+    return Settings::usesMockScrollAnimator();
+}
+
+void RenderLayer::logMockScrollAnimatorMessage(const String& message) const
+{
+    renderer().document().addConsoleMessage(MessageSource::Other, MessageLevel::Debug, "RenderLayer: " + message);
+}
+
 int RenderLayer::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const
 {
     if (!m_vBar
index 55db55b..da4d567 100644 (file)
@@ -884,6 +884,8 @@ private:
 #if ENABLE(CSS_SCROLL_SNAP)
     bool isScrollSnapInProgress() const override;
 #endif
+    bool usesMockScrollAnimator() const override;
+    void logMockScrollAnimatorMessage(const String&) const override;
 
 #if PLATFORM(IOS)
     void registerAsTouchEventListenerForScrolling();
index 21353b6..6d10f30 100644 (file)
@@ -819,6 +819,16 @@ IntRect RenderListBox::scrollableAreaBoundingBox(bool*) const
     return absoluteBoundingBoxRect();
 }
 
+bool RenderListBox::usesMockScrollAnimator() const
+{
+    return Settings::usesMockScrollAnimator();
+}
+
+void RenderListBox::logMockScrollAnimatorMessage(const String& message) const
+{
+    document().addConsoleMessage(MessageSource::Other, MessageLevel::Debug, "RenderListBox: " + message);
+}
+
 PassRefPtr<Scrollbar> RenderListBox::createScrollbar()
 {
     RefPtr<Scrollbar> widget;
index cf23f67..3a72132 100644 (file)
@@ -136,6 +136,8 @@ private:
     virtual bool isScrollableOrRubberbandable() override;
     virtual bool hasScrollableOrRubberbandableAncestor() override;
     virtual IntRect scrollableAreaBoundingBox(bool* = nullptr) const override;
+    bool usesMockScrollAnimator() const override;
+    void logMockScrollAnimatorMessage(const String&) const override;
 
     // NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
     void scrollTo(int newOffset);
index ec4026a..a2ba3ab 100644 (file)
@@ -374,6 +374,7 @@ void Internals::resetToConsistentState(Page* page)
 
     WebCore::overrideUserPreferredLanguages(Vector<String>());
     WebCore::Settings::setUsesOverlayScrollbars(false);
+    WebCore::Settings::setUsesMockScrollAnimator(false);
     page->inspectorController().setLegacyProfilerEnabled(false);
 #if ENABLE(VIDEO_TRACK)
     page->group().captionPreferences().setCaptionsStyleSheetOverride(emptyString());
@@ -2675,6 +2676,11 @@ void Internals::setUsesOverlayScrollbars(bool enabled)
     WebCore::Settings::setUsesOverlayScrollbars(enabled);
 }
 
+void Internals::setUsesMockScrollAnimator(bool enabled)
+{
+    WebCore::Settings::setUsesMockScrollAnimator(enabled);
+}
+
 void Internals::forceReload(bool endToEnd)
 {
     frame()->loader().reload(endToEnd);
index 5159d38..3083c25 100644 (file)
@@ -346,6 +346,7 @@ public:
     bool isFromCurrentWorld(Deprecated::ScriptValue) const;
 
     void setUsesOverlayScrollbars(bool enabled);
+    void setUsesMockScrollAnimator(bool enabled);
 
     String getCurrentCursorInfo(ExceptionCode&);
 
index dc15302..7d33221 100644 (file)
@@ -347,6 +347,7 @@ enum AutoFillButtonType {
     boolean isFromCurrentWorld(any obj);
 
     void setUsesOverlayScrollbars(boolean enabled);
+    void setUsesMockScrollAnimator(boolean enabled);
 
     void forceReload(boolean endToEnd);