Source/WebCore/ChangeLog

 12015-04-06 Brent Fulgham <bfulgham@apple.com>
 2
 3 Expand test infrastructure to support scrolling tests
 4 https://bugs.webkit.org/show_bug.cgi?id=143286
 5 <rdar://problem/20375516>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 No new functionality.
 10
 11 This series of changes adds a new singleton class, 'WheelEventTestTrigger', which encapsulates a
 12 function object to be fired when scroll events are finished. The object also keeps track of reasons
 13 why the test should not yet fire (e.g., 'rubberbanding' is active) so that tests do not incorrectly
 14 check rendering state in the middle of an animation.
 15
 16 This code is not yet hooked up to the rendering system, and so does not have any effect on behavior.
 17
 18 * CMakeLists.txt: Add new WheelEventTestTrigger files.
 19 * WebCore.vcxproj/WebCore.vcxproj: Ditto.
 20 * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
 21 * WebCore.xcodeproj/project.pbxproj: Ditto.
 22 * page/MainFrame.cpp:
 23 (WebCore::MainFrame::MainFrame): Add new member to constructor.
 24 (WebCore::MainFrame::testTrigger): Added.
 25 (WebCore::MainFrame::initializeTestTrigger): Added.
 26 (WebCore::MainFrame::clearTrigger): Added.
 27 * page/MainFrame.h:
 28 * page/WheelEventTestTrigger.cpp: Added.
 29 (WebCore::WheelEventTestTrigger::WheelEventTestTrigger):
 30 (WebCore::WheelEventTestTrigger::createWeakPtr):
 31 (WebCore::WheelEventTestTrigger::clearAllTestDeferrals):
 32 (WebCore::WheelEventTestTrigger::setTestNotificationCallback):
 33 (WebCore::WheelEventTestTrigger::deferTestsForReason):
 34 (WebCore::WheelEventTestTrigger::removeTestDeferralForReason):
 35 (WebCore::WheelEventTestTrigger::triggerTestTimerFired):
 36 * page/WheelEventTestTrigger.h: Added.
 37
1382015-04-06 Myles C. Maxfield <mmaxfield@apple.com>
239
340 [Win] [SVG -> OTF Converter] Support the SVG -> OTF Font Converter

950987 3. Remove a number of unneeded null checks in EventHandler.
951988 4. ScrollController must always have a client, so hold a reference instead of using a pointer.
952989
 990 * WebCore.vcxproj/WebCore.vcxproj: Add new WheelEventTestTrigger files.
 991 * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
 992 * WebCore.xcodeproj/project.pbxproj: Ditto.
953993 * page/EventHandler.cpp:
954994 (WebCore::EventHandler::platformNotifyIfEndGesture): Renamed from 'platformNotifySnapIfNecessary'.
955995 (WebCore::EventHandler::handleWheelEvent): Call 'platformNotifySnapIfNecessary' at method exit points.
182423

Source/WebCore/CMakeLists.txt

@@set(WebCore_SOURCES
19741974 page/UserContentURLPattern.cpp
19751975 page/VisitedLinkStore.cpp
19761976 page/WheelEventDeltaTracker.cpp
 1977 page/WheelEventTestTrigger.cpp
19771978 page/WindowFeatures.cpp
19781979 page/WindowFocusAllowedIndicator.cpp
19791980 page/WorkerNavigator.cpp
182423

Source/WebCore/WebCore.vcxproj/WebCore.vcxproj

72367236 <ClCompile Include="..\page\VisitedLinkStore.cpp" />
72377237 <ClCompile Include="..\fileapi\WebKitBlobBuilder.cpp" />
72387238 <ClCompile Include="..\page\WheelEventDeltaTracker.cpp" />
 7239 <ClCompile Include="..\page\WheelEventTestTrigger.cpp" />
72397240 <ClCompile Include="..\page\WindowFeatures.cpp" />
72407241 <ClCompile Include="..\page\WindowFocusAllowedIndicator.cpp" />
72417242 <ClCompile Include="..\page\WorkerNavigator.cpp" />

1964819649 <ClInclude Include="..\fileapi\WebKitBlobBuilder.h" />
1964919650 <ClInclude Include="..\page\WebKitPoint.h" />
1965019651 <ClInclude Include="..\page\WheelEventDeltaTracker.h" />
 19652 <ClInclude Include="..\page\WheelEventTestTrigger.h" />
1965119653 <ClInclude Include="..\page\WindowFeatures.h" />
1965219654 <ClInclude Include="..\page\WindowFocusAllowedIndicator.h" />
1965319655 <ClInclude Include="..\page\WorkerNavigator.h" />
182423

Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters

819819 <ClCompile Include="..\page\WheelEventDeltaTracker.cpp">
820820 <Filter>page</Filter>
821821 </ClCompile>
 822 <ClCompile Include="..\page\WheelEventTestTrigger.cpp">
 823 <Filter>page</Filter>
 824 </ClCompile>
822825 <ClCompile Include="..\page\WindowFeatures.cpp">
823826 <Filter>page</Filter>
824827 </ClCompile>

78307833 <ClInclude Include="..\page\WheelEventDeltaTracker.h">
78317834 <Filter>page</Filter>
78327835 </ClInclude>
 7836 <ClInclude Include="..\page\WheelEventTestTrigger.h">
 7837 <Filter>page</Filter>
 7838 </ClInclude>
78337839 <ClInclude Include="..\page\WindowFeatures.h">
78347840 <Filter>page</Filter>
78357841 </ClInclude>
182423

Source/WebCore/WebCore.xcodeproj/project.pbxproj

24922492 7ACD88D314C08BD60084EDD2 /* InspectorIndexedDBAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7ACD88D114C08BD60084EDD2 /* InspectorIndexedDBAgent.cpp */; };
24932493 7ACD88D414C08BD60084EDD2 /* InspectorIndexedDBAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ACD88D214C08BD60084EDD2 /* InspectorIndexedDBAgent.h */; };
24942494 7ADE722610CBBB9B006B3B3A /* ContextMenuProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
 2495 7AE335F11ACB09E200E401EF /* WheelEventTestTrigger.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AE335EF1ACB09E200E401EF /* WheelEventTestTrigger.cpp */; };
 2496 7AE335F21ACB09E200E401EF /* WheelEventTestTrigger.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AE335F01ACB09E200E401EF /* WheelEventTestTrigger.h */; settings = {ATTRIBUTES = (Private, ); }; };
24952497 7AF9B20218CFB2DF00C64BEF /* VTTRegion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AF9B1FC18CFB2DF00C64BEF /* VTTRegion.cpp */; };
24962498 7AF9B20318CFB2DF00C64BEF /* VTTRegion.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AF9B1FD18CFB2DF00C64BEF /* VTTRegion.h */; };
24972499 7AF9B20518CFB2DF00C64BEF /* VTTRegionList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AF9B1FF18CFB2DF00C64BEF /* VTTRegionList.cpp */; };

97509752 7ACD88D114C08BD60084EDD2 /* InspectorIndexedDBAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorIndexedDBAgent.cpp; sourceTree = "<group>"; };
97519753 7ACD88D214C08BD60084EDD2 /* InspectorIndexedDBAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorIndexedDBAgent.h; sourceTree = "<group>"; };
97529754 7ADE722510CBBB9B006B3B3A /* ContextMenuProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextMenuProvider.h; sourceTree = "<group>"; };
 9755 7AE335EF1ACB09E200E401EF /* WheelEventTestTrigger.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WheelEventTestTrigger.cpp; sourceTree = "<group>"; };
 9756 7AE335F01ACB09E200E401EF /* WheelEventTestTrigger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WheelEventTestTrigger.h; sourceTree = "<group>"; };
97539757 7AF9B1FC18CFB2DF00C64BEF /* VTTRegion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VTTRegion.cpp; sourceTree = "<group>"; };
97549758 7AF9B1FD18CFB2DF00C64BEF /* VTTRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VTTRegion.h; sourceTree = "<group>"; };
97559759 7AF9B1FE18CFB2DF00C64BEF /* VTTRegion.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VTTRegion.idl; sourceTree = "<group>"; };

1700417008 494BD7940F55C8EE00747828 /* WebKitPoint.idl */,
1700517009 93EC449F188F4BB800661DF1 /* WheelEventDeltaTracker.cpp */,
1700617010 93EC44A0188F4BB800661DF1 /* WheelEventDeltaTracker.h */,
 17011 7AE335EF1ACB09E200E401EF /* WheelEventTestTrigger.cpp */,
 17012 7AE335F01ACB09E200E401EF /* WheelEventTestTrigger.h */,
1700717013 BC8243E60D0CFD7500460C8F /* WindowFeatures.cpp */,
1700817014 BC8243E70D0CFD7500460C8F /* WindowFeatures.h */,
1700917015 7E99AF520B13846468FB01A5 /* WindowFocusAllowedIndicator.cpp */,

2364023646 buildActionMask = 2147483647;
2364123647 files = (
2364223648 FE115FAB167988CD00249134 /* AbstractDatabaseServer.h in Headers */,
 23649 7AE335F21ACB09E200E401EF /* WheelEventTestTrigger.h in Headers */,
2364323650 41E1B1D10FF5986900576B3B /* AbstractWorker.h in Headers */,
2364423651 29A8122E0FBB9C1D00510293 /* AccessibilityARIAGridCell.h in Headers */,
2364523652 29A812330FBB9C1D00510293 /* AccessibilityARIAGridRow.h in Headers */,

2811328120 7728694E14F8882500F484DC /* EXTTextureFilterAnisotropic.cpp in Sources */,
2811428121 A75E8B880E1DE2D6007F2481 /* FEBlend.cpp in Sources */,
2811528122 A75E8B8A0E1DE2D6007F2481 /* FEColorMatrix.cpp in Sources */,
 28123 7AE335F11ACB09E200E401EF /* WheelEventTestTrigger.cpp in Sources */,
2811628124 A75E8B8C0E1DE2D6007F2481 /* FEComponentTransfer.cpp in Sources */,
2811728125 A75E8B8E0E1DE2D6007F2481 /* FEComposite.cpp in Sources */,
2811828126 84730D781248F0B300D3A9C9 /* FEConvolveMatrix.cpp in Sources */,
182423

Source/WebCore/page/MainFrame.cpp

3333#include "ScrollLatchingState.h"
3434#include "Settings.h"
3535#include "WheelEventDeltaTracker.h"
 36#include "WheelEventTestTrigger.h"
3637#include <wtf/NeverDestroyed.h>
3738
3839#if PLATFORM(MAC)

@@inline MainFrame::MainFrame(Page& page,
4950 , m_servicesOverlayController(std::make_unique<ServicesOverlayController>(*this))
5051#endif
5152#endif
 53 , m_testTrigger(nullptr)
5254 , m_recentWheelEventDeltaTracker(std::make_unique<WheelEventDeltaTracker>())
5355 , m_pageOverlayController(std::make_unique<PageOverlayController>(*this))
5456 , m_diagnosticLoggingClient(configuration.diagnosticLoggingClient)

@@void MainFrame::popLatchingState()
122124{
123125 m_latchingState.removeLast();
124126}
125 
126127#endif
127128
 129WheelEventTestTrigger* MainFrame::testTrigger()
 130{
 131 return m_testTrigger.get();
 132}
 133
 134WheelEventTestTrigger* MainFrame::initializeTestTrigger()
 135{
 136 m_testTrigger = std::make_unique<WheelEventTestTrigger>();
 137
 138 return m_testTrigger.get();
 139}
 140
 141void MainFrame::clearTrigger()
 142{
 143 m_testTrigger = nullptr;
 144}
 145
128146}
182423

Source/WebCore/page/MainFrame.h

@@class PageOverlayController;
3737class ScrollLatchingState;
3838class ServicesOverlayController;
3939class WheelEventDeltaTracker;
 40class WheelEventTestTrigger;
4041
4142class MainFrame final : public Frame {
4243public:

@@public:
6364
6465 WEBCORE_EXPORT DiagnosticLoggingClient& diagnosticLoggingClient() const;
6566
 67 WEBCORE_EXPORT WheelEventTestTrigger* testTrigger();
 68 WEBCORE_EXPORT WheelEventTestTrigger* initializeTestTrigger();
 69 WEBCORE_EXPORT void clearTrigger();
 70
6671private:
6772 MainFrame(Page&, PageConfiguration&);
6873

@@private:
7681 std::unique_ptr<ServicesOverlayController> m_servicesOverlayController;
7782#endif
7883#endif
 84 std::unique_ptr<WheelEventTestTrigger> m_testTrigger;
 85
7986 std::unique_ptr<WheelEventDeltaTracker> m_recentWheelEventDeltaTracker;
8087 std::unique_ptr<PageOverlayController> m_pageOverlayController;
8188 DiagnosticLoggingClient* m_diagnosticLoggingClient;
182423

Source/WebCore/page/WheelEventTestTrigger.cpp

 1/*
 2 * Copyright (C) 2015 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#include "config.h"
 30#include "WheelEventTestTrigger.h"
 31
 32#include <JavaScriptCore/JSObjectRef.h>
 33#include <JavaScriptCore/JSRetainPtr.h>
 34
 35namespace WebCore {
 36
 37WheelEventTestTrigger::WheelEventTestTrigger()
 38 : m_testTriggerTimer(RunLoop::current(), this, &WheelEventTestTrigger::triggerTestTimerFired)
 39 , m_weakPtrFactory(this)
 40{
 41}
 42
 43WeakPtr<WheelEventTestTrigger> WheelEventTestTrigger::createWeakPtr()
 44{
 45 return m_weakPtrFactory.createWeakPtr();
 46}
 47
 48void WheelEventTestTrigger::clearAllTestDeferrals()
 49{
 50 std::lock_guard<std::mutex> lock(m_testTriggerMutex);
 51 m_deferTestTriggerReasons.clear();
 52 m_testNotificationCallback = std::function<void()>();
 53 m_testTriggerTimer.stop();
 54}
 55
 56void WheelEventTestTrigger::setTestNotificationCallback(std::function<void()> functionCallback)
 57{
 58 std::lock_guard<std::mutex> lock(m_testTriggerMutex);
 59 m_testNotificationCallback = WTF::move(functionCallback);
 60
 61 if (!m_testTriggerTimer.isActive())
 62 m_testTriggerTimer.startRepeating(1.0 / 60.0);
 63}
 64
 65void WheelEventTestTrigger::deferTestsForReason(void* key, DeferTestTriggerReason reason)
 66{
 67 std::lock_guard<std::mutex> lock(m_testTriggerMutex);
 68 auto it = m_deferTestTriggerReasons.find(key);
 69 if (it == m_deferTestTriggerReasons.end()) {
 70 m_deferTestTriggerReasons.add(key, std::set<DeferTestTriggerReason>());
 71 it = m_deferTestTriggerReasons.find(key);
 72 }
 73
 74 it->value.insert(reason);
 75}
 76
 77void WheelEventTestTrigger::removeTestDeferralForReason(void* key, DeferTestTriggerReason reason)
 78{
 79 std::lock_guard<std::mutex> lock(m_testTriggerMutex);
 80 auto it = m_deferTestTriggerReasons.find(key);
 81 if (it == m_deferTestTriggerReasons.end())
 82 return;
 83
 84 it->value.erase(reason);
 85
 86 if (it->value.empty())
 87 m_deferTestTriggerReasons.remove(key);
 88}
 89
 90void WheelEventTestTrigger::triggerTestTimerFired()
 91{
 92 std::lock_guard<std::mutex> lock(m_testTriggerMutex);
 93 if (!m_deferTestTriggerReasons.isEmpty())
 94 return;
 95
 96 if (m_testNotificationCallback)
 97 m_testNotificationCallback();
 98
 99 m_testNotificationCallback = std::function<void()>();
 100
 101 m_testTriggerTimer.stop();
 102}
 103
 104}
0

Source/WebCore/page/WheelEventTestTrigger.h

 1/*
 2 * Copyright (C) 2015 Apple Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions
 6 * are met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above copyright
 11 * notice, this list of conditions and the following disclaimer in the
 12 * documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
 14 * its contributors may be used to endorse or promote products derived
 15 * from this software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 27 */
 28
 29#ifndef WheelEventTestTrigger_h
 30#define WheelEventTestTrigger_h
 31
 32#include <mutex>
 33#include <set>
 34#include <wtf/HashMap.h>
 35#include <wtf/RunLoop.h>
 36#include <wtf/WeakPtr.h>
 37
 38namespace WebCore {
 39
 40class WheelEventTestTrigger {
 41 WTF_MAKE_NONCOPYABLE(WheelEventTestTrigger); WTF_MAKE_FAST_ALLOCATED;
 42public:
 43 WheelEventTestTrigger();
 44
 45 WEBCORE_EXPORT void setTestNotificationCallback(std::function<void()>);
 46 WEBCORE_EXPORT void clearAllTestDeferrals();
 47
 48 enum DeferTestTriggerReason {
 49 RubberbandInProgress,
 50 ScrollSnapInProgress,
 51 ScrollingThreadSyncNeeded,
 52 ContentScrollInProgress
 53 };
 54 void deferTestsForReason(void* key, DeferTestTriggerReason);
 55 void removeTestDeferralForReason(void* key, DeferTestTriggerReason);
 56 void triggerTestTimerFired();
 57
 58 WeakPtr<WheelEventTestTrigger> createWeakPtr();
 59
 60private:
 61 std::function<void()> m_testNotificationCallback;
 62 RunLoop::Timer<WheelEventTestTrigger> m_testTriggerTimer;
 63 mutable std::mutex m_testTriggerMutex;
 64 WTF::HashMap<void*, std::set<DeferTestTriggerReason>> m_deferTestTriggerReasons;
 65
 66 WeakPtrFactory<WheelEventTestTrigger> m_weakPtrFactory;
 67};
 68
 69}
 70
 71#endif
0

Source/WebKit2/ChangeLog

 12015-04-06 Brent Fulgham <bfulgham@apple.com>
 2
 3 Expand test infrastructure to support scrolling tests
 4 https://bugs.webkit.org/show_bug.cgi?id=143286
 5 <rdar://problem/20375516>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 Extend the WK2 testing API to include a method for setting a JSC callback function to be triggered
 10 by the new WebCore::WheelEventTestTrigger singleton.
 11
 12 * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
 13 (WKBundlePageMonitoringWheelEvents): WK2 method that causes the testing system to begin tracking wheel events.
 14 (WKBundlePageRegisterTestNotificationCallback): WK2 method to set the callback function for testing.
 15 * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
 16
1172015-04-06 Žan Doberšek <zdobersek@igalia.com>
218
319 [WK2] API::Array::copy() should move the resulting Vector<> of copies into the Array::create() call
182423

Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp

11/*
2  * Copyright (C) 2010, 2011, 2013 Apple Inc. All rights reserved.
 2 * Copyright (C) 2010, 2011, 2013, 2015 Apple Inc. All rights reserved.
33 *
44 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions

5959#include <WebCore/PageOverlay.h>
6060#include <WebCore/PageOverlayController.h>
6161#include <WebCore/URL.h>
 62#include <WebCore/WheelEventTestTrigger.h>
6263#include <wtf/StdLibExtras.h>
6364
6465using namespace WebKit;

@@void WKBundlePageSetUseTestingViewportCo
573574}
574575#endif
575576
 577void WKBundlePageMonitoringWheelEvents(WKBundlePageRef pageRef)
 578{
 579 WebKit::WebPage* webPage = toImpl(pageRef);
 580 WebCore::Page* page = webPage ? webPage->corePage() : nullptr;
 581
 582 if (!page)
 583 return;
 584
 585 page->mainFrame().initializeTestTrigger();
 586}
 587
 588void WKBundlePageRegisterTestNotificationCallback(WKBundlePageRef pageRef, WKBundlePageTestNotificationCallback callback, void* context)
 589{
 590 if (!callback)
 591 return;
 592
 593 WebKit::WebPage* webPage = toImpl(pageRef);
 594 WebCore::Page* page = webPage ? webPage->corePage() : nullptr;
 595
 596 if (!page)
 597 return;
 598
 599 WebCore::WheelEventTestTrigger* trigger = page->mainFrame().testTrigger();
 600 if (!trigger)
 601 trigger = page->mainFrame().initializeTestTrigger();
 602
 603 trigger->setTestNotificationCallback([=]() {
 604 callback(context);
 605 });
 606}
 607
576608void WKBundlePagePostMessage(WKBundlePageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef)
577609{
578610 toImpl(pageRef)->postMessage(toWTFString(messageNameRef), toImpl(messageBodyRef));
182423

Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePage.h

11/*
2  * Copyright (C) 2010 Apple Inc. All rights reserved.
 2 * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
33 *
44 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions

@@WK_EXPORT WKBundleInspectorRef WKBundleP
109109
110110WK_EXPORT bool WKBundlePageIsUsingEphemeralSession(WKBundlePageRef page);
111111
 112WK_EXPORT void WKBundlePageMonitoringWheelEvents(WKBundlePageRef);
 113
 114typedef void (*WKBundlePageTestNotificationCallback)(void* context);
 115WK_EXPORT void WKBundlePageRegisterTestNotificationCallback(WKBundlePageRef, WKBundlePageTestNotificationCallback, void* context);
 116
112117WK_EXPORT void WKBundlePagePostMessage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody);
113118WK_EXPORT void WKBundlePagePostSynchronousMessage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnData);
114119
182423

Tools/ChangeLog

 12015-04-06 Brent Fulgham <bfulgham@apple.com>
 2
 3 Expand test infrastructure to support scrolling tests
 4 https://bugs.webkit.org/show_bug.cgi?id=143286
 5 <rdar://problem/20375516>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 Extend the WK1 and WK2 test programs to support two new EventSender commands:
 10 (1) monitorWheelEvents: Tells DRT and WKTR to track the wheel event and animation state, so that we can
 11 block executing tests until WebKit has completed any rubberband, scroll, or scroll-snap animations.
 12 (2) callAfterScrollingCompletes: Provide a callback method to be executed when WebKit determines that
 13 relevant rubberband, scroll, and scroll-snap animations are finished.
 14
 15 * DumpRenderTree/mac/EventSendingController.mm:
 16 (+[EventSendingController isSelectorExcludedFromWebScript:]): Update to recognize 'callAfterScrollingCompletes:'
 17 and 'monitorWheelEvents'.
 18 (+[EventSendingController webScriptNameForSelector:]): Ditto.
 19 (-[EventSendingController mouseScrollByX:andY:continuously:]): Add some stderr logging to help when
 20 debugging test failures.
 21 (-[EventSendingController mouseScrollByX:andY:withWheel:andMomentumPhases:]): Ditto.
 22 (-[EventSendingController callAfterScrollingCompletes:]): Added. Protects the JSObject representing the callback
 23 function, then passes it to WebCore to be called once the test deferrals have been cleared.
 24 (-[EventSendingController monitorWheelEvents:]): Added. Activates the wheel event tracking used by the
 25 'callAfterScrollingCompletes' method.
 26 * WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl: Added signatures for 'callAfterScrollingCompletes'
 27 and 'monitorWheelEvents'.
 28 * WebKitTestRunner/InjectedBundle/EventSendingController.cpp:
 29 (WTR::EventSendingController::callAfterScrollingCompletes): Added. Protects the JSObject representing the
 30 callback function, then passes it to WebCore to be called once the test deferrals have been cleared
 31 (WTR::EventSendingController::monitorWheelEvents): Added. Activates the wheel event tracking used by the
 32 'callAfterScrollingComplates' method.
 33 * WebKitTestRunner/InjectedBundle/EventSendingController.h:
 34
1352015-04-06 Youenn Fablet <youenn.fablet@crf.canon.fr>
236
337 W3C test importer should generate the modules installed dynamically to run wpt tests
182423

Tools/DumpRenderTree/mac/EventSendingController.mm

11/*
2  * Copyright (C) 2005, 2006, 2007, 2008, 2014 Apple Inc. All rights reserved.
 2 * Copyright (C) 2005, 2006, 2007, 2008, 2014-2015 Apple Inc. All rights reserved.
33 * Copyright (C) 2006 Jonas Witt <jonas.witt@gmail.com>
44 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
55 * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>

3535#import "DumpRenderTree.h"
3636#import "DumpRenderTreeDraggingInfo.h"
3737#import "DumpRenderTreeFileDraggingSource.h"
38 
3938#import <WebKit/DOMPrivate.h>
4039#import <WebKit/WebKit.h>
4140#import <WebKit/WebViewPrivate.h>
 41#import <functional>
4242
4343#if !PLATFORM(IOS)
4444#import <Carbon/Carbon.h> // for GetCurrentEventTime()
 45#import <JavaScriptCore/JSRetainPtr.h>
 46#import <WebCore/MainFrame.h>
 47#import <WebCore/Page.h>
 48#import <WebCore/WheelEventTestTrigger.h>
4549#endif
4650
4751#if PLATFORM(IOS)

@@- (id)initWithLocation:(CGPoint)location
128132@end // SyntheticTouch
129133#endif
130134
 135#if !PLATFORM(IOS)
 136@interface WebView (WebViewInternalForTesting)
 137- (WebCore::Frame*)_mainCoreFrame;
 138@end
 139#endif
 140
131141@implementation EventSendingController
132142
133143+ (void)initialize

@@+ (BOOL)isSelectorExcludedFromWebScript:
204214 || aSelector == @selector(mouseScrollByX:andY:)
205215 || aSelector == @selector(mouseScrollByX:andY:withWheel:andMomentumPhases:)
206216 || aSelector == @selector(continuousMouseScrollByX:andY:)
 217 || aSelector == @selector(monitorWheelEvents)
 218 || aSelector == @selector(callAfterScrollingCompletes:)
207219#if PLATFORM(IOS)
208220 || aSelector == @selector(addTouchAtX:y:)
209221 || aSelector == @selector(updateTouchAtIndex:x:y:)

@@+ (NSString *)webScriptNameForSelector:(
261273 return @"continuousMouseScrollBy";
262274 if (aSelector == @selector(scalePageBy:atX:andY:))
263275 return @"scalePageBy";
 276 if (aSelector == @selector(monitorWheelEvents))
 277 return @"monitorWheelEvents";
 278 if (aSelector == @selector(callAfterScrollingCompletes:))
 279 return @"callAfterScrollingCompletes";
264280#if PLATFORM(IOS)
265281 if (aSelector == @selector(addTouchAtX:y:))
266282 return @"addTouchPoint";

@@- (void)mouseScrollByX:(int)x andY:(int)
687703 [NSApp _setCurrentEvent:scrollEvent];
688704 [subView scrollWheel:scrollEvent];
689705 [NSApp _setCurrentEvent:nil];
690  }
 706 } else
 707 printf("mouseScrollByXandYContinuously: Unable to locate target view for current mouse location.");
691708#endif
692709}
693710

@@- (void)mouseScrollByX:(int)x andY:(int)
746763 [NSApp _setCurrentEvent:scrollEvent];
747764 [targetView scrollWheel:scrollEvent];
748765 [NSApp _setCurrentEvent:nil];
749  }
 766 } else
 767 printf("mouseScrollByX...andMomentumPhases: Unable to locate target view for current mouse location.");
750768#endif
751769}
752770

@@- (void)fireKeyboardEventsToElement:(Web
12431261
12441262}
12451263
 1264- (void)monitorWheelEvents
 1265{
 1266#if PLATFORM(MAC)
 1267 WebCore::Frame* frame = [[mainFrame webView] _mainCoreFrame];
 1268 if (!frame)
 1269 return;
 1270
 1271 frame->mainFrame().initializeTestTrigger();
 1272#endif
 1273}
 1274
 1275- (void)callAfterScrollingCompletes:(WebScriptObject*)callback
 1276{
 1277#if PLATFORM(MAC)
 1278 JSObjectRef jsCallbackFunction = [callback JSObject];
 1279 if (!jsCallbackFunction)
 1280 return;
 1281
 1282 WebCore::Frame* frame = [[mainFrame webView] _mainCoreFrame];
 1283 if (!frame)
 1284 return;
 1285
 1286 WebCore::WheelEventTestTrigger* trigger = frame->mainFrame().testTrigger();
 1287 if (!trigger)
 1288 trigger = frame->mainFrame().initializeTestTrigger();
 1289
 1290 JSGlobalContextRef globalContext = [mainFrame globalContext];
 1291 JSValueProtect(globalContext, jsCallbackFunction);
 1292
 1293 trigger->setTestNotificationCallback([=](void) {
 1294 JSObjectCallAsFunction(globalContext, jsCallbackFunction, nullptr, 0, nullptr, nullptr);
 1295 JSValueUnprotect(globalContext, jsCallbackFunction);
 1296 });
 1297#else
 1298 UNUSED_PARAMETER(callback);
 1299#endif
 1300}
 1301
12461302#if PLATFORM(IOS)
12471303- (void)addTouchAtX:(int)x y:(int)y
12481304{
182423

Tools/WebKitTestRunner/InjectedBundle/EventSendingController.cpp

11/*
2  * Copyright (C) 2010, 2011, 2014 Apple Inc. All rights reserved.
 2 * Copyright (C) 2010, 2011, 2014-2015 Apple Inc. All rights reserved.
33 *
44 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions

@@void EventSendingController::scalePageBy
501501 WKBundlePageSetScaleAtOrigin(InjectedBundle::singleton().page()->page(), scale, origin);
502502}
503503
 504void EventSendingController::monitorWheelEvents()
 505{
 506 WKBundlePageRef page = InjectedBundle::singleton().page()->page();
 507
 508 WKBundlePageMonitoringWheelEvents(page);
 509}
 510
 511struct ScrollCompletionCallbackData {
 512 JSContextRef m_context;
 513 JSObjectRef m_function;
 514
 515 ScrollCompletionCallbackData(JSContextRef context, JSObjectRef function)
 516 : m_context(context), m_function(function)
 517 {
 518 }
 519};
 520
 521static void executeCallback(void* context)
 522{
 523 if (!context)
 524 return;
 525
 526 std::unique_ptr<ScrollCompletionCallbackData> callBackData(reinterpret_cast<ScrollCompletionCallbackData*>(context));
 527
 528 JSObjectCallAsFunction(callBackData->m_context, callBackData->m_function, nullptr, 0, nullptr, nullptr);
 529 JSValueUnprotect(callBackData->m_context, callBackData->m_function);
 530}
 531
 532void EventSendingController::callAfterScrollingCompletes(JSValueRef functionCallback)
 533{
 534 if (!functionCallback)
 535 return;
 536
 537 WKBundlePageRef page = InjectedBundle::singleton().page()->page();
 538 WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(page);
 539 JSContextRef context = WKBundleFrameGetJavaScriptContext(mainFrame);
 540
 541 JSObjectRef functionCallbackObject = JSValueToObject(context, functionCallback, nullptr);
 542 if (!functionCallbackObject)
 543 return;
 544
 545 JSValueProtect(context, functionCallbackObject);
 546
 547 auto scrollCompletionCallbackData = std::make_unique<ScrollCompletionCallbackData>(context, functionCallbackObject);
 548
 549 WKBundlePageRegisterTestNotificationCallback(page, executeCallback, scrollCompletionCallbackData.release());
 550}
 551
504552#if ENABLE(TOUCH_EVENTS)
505553void EventSendingController::addTouchPoint(int x, int y)
506554{
182423

Tools/WebKitTestRunner/InjectedBundle/EventSendingController.h

11/*
2  * Copyright (C) 2010, 2011, 2014 Apple Inc. All rights reserved.
 2 * Copyright (C) 2010, 2011, 2014-2015 Apple Inc. All rights reserved.
33 *
44 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions

@@public:
5252 JSValueRef contextClick();
5353 void leapForward(int milliseconds);
5454 void scheduleAsynchronousClick();
 55 void monitorWheelEvents();
 56 void callAfterScrollingCompletes(JSValueRef functionCallback);
5557
5658 void keyDown(JSStringRef key, JSValueRef modifierArray, int location);
5759 void scheduleAsynchronousKeyDown(JSStringRef key);
182423

Tools/WebKitTestRunner/InjectedBundle/Bindings/EventSendingController.idl

11/*
2  * Copyright (C) 2010, 2011, 2014 Apple Inc. All rights reserved.
 2 * Copyright (C) 2010, 2011, 2014-2015 Apple Inc. All rights reserved.
33 *
44 * Redistribution and use in source and binary forms, with or without
55 * modification, are permitted provided that the following conditions

@@interface EventSendingController {
4545 void zoomPageOut();
4646 void scalePageBy(double scale, double x, double y);
4747
 48 void monitorWheelEvents();
 49 void callAfterScrollingCompletes(object functionCallback);
 50
4851#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
4952 // Touch events.
5053 void addTouchPoint(long x, long y);
182423

LayoutTests/ChangeLog

 12015-04-06 Brent Fulgham <bfulgham@apple.com>
 2
 3 Expand test infrastructure to support scrolling tests
 4 https://bugs.webkit.org/show_bug.cgi?id=143286
 5 <rdar://problem/20375516>
 6
 7 Reviewed by NOBODY (OOPS!).
 8
 9 Correct a scrolling test that had not been issuing wheel events to a valid
 10 view. This was found by some new logging in this patch.
 11
 12 * platform/mac/fast/scrolling/scroll-div-latched-div-expected.txt:
 13 * platform/mac/fast/scrolling/scroll-div-latched-div.html:
 14 * platform/mac-wk1/scrollbars/scrollevent-iframe-no-scrolling-wheel-expected.txt: Added.*
 15
1162015-04-05 Andy Estes <aestes@apple.com>
217
318 [Content Filtering] Add some additional unblock tests
182423

LayoutTests/platform/mac-wk1/scrollbars/scrollevent-iframe-no-scrolling-wheel-expected.txt

 1mouseScrollByXandYContinuously: Unable to locate target view for current mouse location.Content-Type: text/plain
 2Not scrolled by WheelEvent: SUCCESS
 3
0

LayoutTests/platform/mac/fast/scrolling/scroll-div-latched-div-expected.txt

@@On success, you will see a series of "PA
5252PASS successfullyParsed is true
5353
5454TEST COMPLETE
55 div display height = 485
56 Mouse moved to (28, 610)
5755PASS Page did not receive wheel events.
5856
182423

LayoutTests/platform/mac/fast/scrolling/scroll-div-latched-div.html

@@var pageScrollPositionBefore;
4040var divScrollPositionBefore;
4141var continueCount = 5;
4242
43 function checkForScroll() {
44 
 43function checkForScroll()
 44{
4545 // The div should not have scrolled at all.
4646 var pageScrollPositionAfter = document.body.scrollTop;
4747 var divScrollPositionAfter = divTarget.scrollTop;
4848
49  //debug("Page before: " + pageScrollPositionBefore + ", div before: " + divScrollPositionBefore);
50  //debug("Page after: " + pageScrollPositionAfter + ", div after: " + divScrollPositionAfter);
51 
5249 if (pageScrollPositionBefore != pageScrollPositionAfter)
5350 testFailed("Page received wheel events.");
5451 else

@@function checkForScroll() {
5754 testRunner.notifyDone();
5855}
5956
60 function scrollTest() {
61  // See where our IFrame lives:
 57function scrollTest()
 58{
6259 pageScrollPositionBefore = document.body.scrollTop;
6360
6461 divTarget = document.getElementById('target');

@@function scrollTest() {
6764 divScrollPositionBefore = divTarget.scrollTop;
6865
6966 // Scroll the #source until we reach the #target.
70  var startPosX = divTarget.offsetLeft + 20;
71  debug("div display height = " + divTarget.clientHeight);
72  var startPosY = Math.round(divTarget.offsetTop) + Math.round(divTarget.clientHeight) - 42; // One wheel turn before end.
73  eventSender.mouseMoveTo(startPosX, startPosY); // Make sure we are just outside the iFrame
74  debug("Mouse moved to (" + startPosX + ", " + startPosY + ")");
 67 var startPosX = Math.round(divTarget.offsetLeft) + 20;
 68 var startPosY = Math.round(divTarget.offsetTop) + 100; // One wheel turn before end.
 69 eventSender.mouseMoveTo(startPosX, startPosY);
7570 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none', true);
7671 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);
7772 eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none', true);

@@function scrollTest() {
8580 setTimeout(checkForScroll, 100);
8681}
8782
88 function setupTopLevel() {
89 
 83function setupTopLevel()
 84{
9085 if (window.eventSender) {
 86 testRunner.dumpAsText();
9187 testRunner.waitUntilDone();
9288
9389 setTimeout(scrollTest, 1000);

@@function setupTopLevel() {
109105 </div>
110106 <div class="scrollable_region">
111107 <h3>Scrollable Region</h3>
112  <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 485px;'>
 108 <div id="target" style='overflow-y: auto; overflow-x: hidden; max-height: 350px;'>
113109 <table class="table" style='width: 99%'>
114110 <tr><th>Count</th><th>DATA</th><th>Rev Count</th></tr>
115111 <tr><td>TOP TOP TOP TOP TOP</td><td>TOP TOP TOP TOP TOP</td><td>TOP TOP TOP TOP TOP</td></tr>
182423