Title: [223211] trunk
Revision
223211
Author
[email protected]
Date
2017-10-11 15:21:58 -0700 (Wed, 11 Oct 2017)

Log Message

[Geolocation] Expose Coordinates.floorLevel
https://bugs.webkit.org/show_bug.cgi?id=178173
<rdar://problem/34918936>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Expose Coordinates.floorLevel via the Geolocation API. This is currently
a WebKit-specific extension and it is only populated on iOS / WKTR / DRT.
It is null on other platforms.

Test: fast/dom/Geolocation/floorLevel.html

* Modules/geolocation/Coordinates.h:
(WebCore::Coordinates::floorLevel const):
* Modules/geolocation/Coordinates.idl:
* Modules/geolocation/GeolocationPosition.h:
(WebCore::GeolocationPosition::encode const):
(WebCore::GeolocationPosition::decode):
* Modules/geolocation/ios/GeolocationPositionIOS.mm:
(WebCore::GeolocationPosition::GeolocationPosition):
* page/Settings.in:

Source/WebKit:

* UIProcess/API/C/WKGeolocationPosition.cpp:
(WKGeolocationPositionCreate):
(WKGeolocationPositionCreate_b):
(WKGeolocationPositionCreate_c):
* UIProcess/API/C/WKGeolocationPosition.h:

Tools:

Add test infrastructure for testing Coordinates.floorLevel.

* DumpRenderTree/TestRunner.cpp:
(setMockGeolocationPositionCallback):
* DumpRenderTree/TestRunner.h:
* DumpRenderTree/mac/TestRunnerMac.mm:
(TestRunner::setMockGeolocationPosition):
* DumpRenderTree/win/TestRunnerWin.cpp:
(TestRunner::setMockGeolocationPosition):
* WebKitTestRunner/GeolocationProviderMock.cpp:
(WTR::GeolocationProviderMock::setPosition):
* WebKitTestRunner/GeolocationProviderMock.h:
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
(WTR::InjectedBundle::setMockGeolocationPosition):
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::setMockGeolocationPosition):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::setMockGeolocationPosition):
* WebKitTestRunner/TestController.h:
* WebKitTestRunner/TestInvocation.cpp:
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):

LayoutTests:

Add layout test coverage.

* fast/dom/Geolocation/floorLevel-expected.txt: Added.
* fast/dom/Geolocation/floorLevel.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (223210 => 223211)


--- trunk/LayoutTests/ChangeLog	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/LayoutTests/ChangeLog	2017-10-11 22:21:58 UTC (rev 223211)
@@ -1,3 +1,16 @@
+2017-10-11  Chris Dumez  <[email protected]>
+
+        [Geolocation] Expose Coordinates.floorLevel
+        https://bugs.webkit.org/show_bug.cgi?id=178173
+        <rdar://problem/34918936>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add layout test coverage.
+
+        * fast/dom/Geolocation/floorLevel-expected.txt: Added.
+        * fast/dom/Geolocation/floorLevel.html: Added.
+
 2017-10-11  Simon Fraser  <[email protected]>
 
         Avoid triggering layout from style change

Added: trunk/LayoutTests/fast/dom/Geolocation/floorLevel-expected.txt (0 => 223211)


--- trunk/LayoutTests/fast/dom/Geolocation/floorLevel-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Geolocation/floorLevel-expected.txt	2017-10-11 22:21:58 UTC (rev 223211)
@@ -0,0 +1,17 @@
+Tests support for Geolocation's floorLevel
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS coords.latitude is mockLatitude
+PASS coords.longitude is mockLongitude
+PASS coords.accuracy is mockAccuracy
+PASS coords.altitude is mockAltitude
+PASS coords.altitudeAccuracy is mockAltitudeAccuracy
+PASS coords.heading is mockHeading
+PASS coords.speed is mockSpeed
+PASS coords.floorLevel is mockFloorLevel
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/Geolocation/floorLevel.html (0 => 223211)


--- trunk/LayoutTests/fast/dom/Geolocation/floorLevel.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/Geolocation/floorLevel.html	2017-10-11 22:21:58 UTC (rev 223211)
@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script>
+description("Tests support for Geolocation's floorLevel");
+jsTestIsAsync = true;
+
+const mockLatitude = 51.478;
+const mockLongitude = -0.166;
+const mockAccuracy = 100.0;
+const mockAltitude = 10.1;
+const mockAltitudeAccuracy = 0.1;
+const mockHeading = 223.3;
+const mockSpeed = 123.4;
+const mockFloorLevel = 3;
+
+if (window.testRunner) {
+    testRunner.setGeolocationPermission(true);
+    testRunner.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy, mockAltitude, mockAltitudeAccuracy, mockHeading, mockSpeed, mockFloorLevel);
+}
+
+function checkPosition(position) {
+    coords = position.coords;
+    shouldBe("coords.latitude", "mockLatitude");
+    shouldBe("coords.longitude", "mockLongitude");
+    shouldBe("coords.accuracy", "mockAccuracy");
+    shouldBe("coords.altitude", "mockAltitude");
+    shouldBe("coords.altitudeAccuracy", "mockAltitudeAccuracy");
+    shouldBe("coords.heading", "mockHeading");
+    shouldBe("coords.speed", "mockSpeed");
+    shouldBe("coords.floorLevel", "mockFloorLevel");
+    finishJSTest();
+}
+
+navigator.geolocation.getCurrentPosition(checkPosition);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (223210 => 223211)


--- trunk/Source/WebCore/ChangeLog	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Source/WebCore/ChangeLog	2017-10-11 22:21:58 UTC (rev 223211)
@@ -1,3 +1,27 @@
+2017-10-11  Chris Dumez  <[email protected]>
+
+        [Geolocation] Expose Coordinates.floorLevel
+        https://bugs.webkit.org/show_bug.cgi?id=178173
+        <rdar://problem/34918936>
+
+        Reviewed by Ryosuke Niwa.
+
+        Expose Coordinates.floorLevel via the Geolocation API. This is currently
+        a WebKit-specific extension and it is only populated on iOS / WKTR / DRT.
+        It is null on other platforms.
+
+        Test: fast/dom/Geolocation/floorLevel.html
+
+        * Modules/geolocation/Coordinates.h:
+        (WebCore::Coordinates::floorLevel const):
+        * Modules/geolocation/Coordinates.idl:
+        * Modules/geolocation/GeolocationPosition.h:
+        (WebCore::GeolocationPosition::encode const):
+        (WebCore::GeolocationPosition::decode):
+        * Modules/geolocation/ios/GeolocationPositionIOS.mm:
+        (WebCore::GeolocationPosition::GeolocationPosition):
+        * page/Settings.in:
+
 2017-10-11  Simon Fraser  <[email protected]>
 
         Avoid triggering layout from style change

Modified: trunk/Source/WebCore/Modules/geolocation/Coordinates.h (223210 => 223211)


--- trunk/Source/WebCore/Modules/geolocation/Coordinates.h	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Source/WebCore/Modules/geolocation/Coordinates.h	2017-10-11 22:21:58 UTC (rev 223211)
@@ -51,6 +51,7 @@
     std::optional<double> altitudeAccuracy() const { return m_position.altitudeAccuracy; }
     std::optional<double> heading() const { return m_position.heading; }
     std::optional<double> speed() const { return m_position.speed; }
+    std::optional<double> floorLevel() const { return m_position.floorLevel; }
     
 private:
     explicit Coordinates(GeolocationPosition&&);

Modified: trunk/Source/WebCore/Modules/geolocation/Coordinates.idl (223210 => 223211)


--- trunk/Source/WebCore/Modules/geolocation/Coordinates.idl	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Source/WebCore/Modules/geolocation/Coordinates.idl	2017-10-11 22:21:58 UTC (rev 223211)
@@ -35,4 +35,5 @@
     readonly attribute unrestricted double? altitudeAccuracy;
     readonly attribute unrestricted double? heading;
     readonly attribute unrestricted double? speed;
+    [EnabledBySetting=GeolocationFloorLevel] readonly attribute unrestricted double? floorLevel;
 };

Modified: trunk/Source/WebCore/Modules/geolocation/GeolocationPosition.h (223210 => 223211)


--- trunk/Source/WebCore/Modules/geolocation/GeolocationPosition.h	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Source/WebCore/Modules/geolocation/GeolocationPosition.h	2017-10-11 22:21:58 UTC (rev 223211)
@@ -62,6 +62,7 @@
     std::optional<double> altitudeAccuracy;
     std::optional<double> heading;
     std::optional<double> speed;
+    std::optional<double> floorLevel;
 
     bool isValid() const;
 
@@ -80,6 +81,7 @@
     encoder << altitudeAccuracy;
     encoder << heading;
     encoder << speed;
+    encoder << floorLevel;
 }
 
 template<class Decoder>
@@ -101,6 +103,8 @@
         return false;
     if (!decoder.decode(position.speed))
         return false;
+    if (!decoder.decode(position.floorLevel))
+        return false;
 
     return true;
 }

Modified: trunk/Source/WebCore/Modules/geolocation/ios/GeolocationPositionIOS.mm (223210 => 223211)


--- trunk/Source/WebCore/Modules/geolocation/ios/GeolocationPositionIOS.mm	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Source/WebCore/Modules/geolocation/ios/GeolocationPositionIOS.mm	2017-10-11 22:21:58 UTC (rev 223211)
@@ -46,6 +46,8 @@
         speed = location.speed;
     if (location.course >= 0.0)
         heading = location.course;
+    if (location.floor)
+        floorLevel = location.floor.level;
 }
 
 }

Modified: trunk/Source/WebCore/page/Settings.in (223210 => 223211)


--- trunk/Source/WebCore/page/Settings.in	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Source/WebCore/page/Settings.in	2017-10-11 22:21:58 UTC (rev 223211)
@@ -295,6 +295,8 @@
 
 beaconAPIEnabled initial=false
 
+geolocationFloorLevelEnabled initial=true
+
 constantPropertiesEnabled initial=false
 
 viewportFitEnabled initial=false

Modified: trunk/Source/WebKit/ChangeLog (223210 => 223211)


--- trunk/Source/WebKit/ChangeLog	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Source/WebKit/ChangeLog	2017-10-11 22:21:58 UTC (rev 223211)
@@ -1,3 +1,17 @@
+2017-10-11  Chris Dumez  <[email protected]>
+
+        [Geolocation] Expose Coordinates.floorLevel
+        https://bugs.webkit.org/show_bug.cgi?id=178173
+        <rdar://problem/34918936>
+
+        Reviewed by Ryosuke Niwa.
+
+        * UIProcess/API/C/WKGeolocationPosition.cpp:
+        (WKGeolocationPositionCreate):
+        (WKGeolocationPositionCreate_b):
+        (WKGeolocationPositionCreate_c):
+        * UIProcess/API/C/WKGeolocationPosition.h:
+
 2017-10-11  Youenn Fablet  <[email protected]>
 
         Bump default cache storage quota to 20MB

Modified: trunk/Source/WebKit/UIProcess/API/C/WKGeolocationPosition.cpp (223210 => 223211)


--- trunk/Source/WebKit/UIProcess/API/C/WKGeolocationPosition.cpp	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Source/WebKit/UIProcess/API/C/WKGeolocationPosition.cpp	2017-10-11 22:21:58 UTC (rev 223211)
@@ -38,11 +38,16 @@
 
 WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy)
 {
-    return WKGeolocationPositionCreate_b(timestamp, latitude, longitude, accuracy, false, 0., false, 0., false, 0., false, 0.);
+    return WKGeolocationPositionCreate_c(timestamp, latitude, longitude, accuracy, false, 0., false, 0., false, 0., false, 0., false, 0.);
 }
 
 WKGeolocationPositionRef WKGeolocationPositionCreate_b(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
 {
+    return WKGeolocationPositionCreate_c(timestamp, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed, false, 0.);
+}
+
+WKGeolocationPositionRef WKGeolocationPositionCreate_c(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel)
+{
     WebCore::GeolocationPosition corePosition { timestamp, latitude, longitude, accuracy };
     if (providesAltitude)
         corePosition.altitude = altitude;
@@ -52,6 +57,8 @@
         corePosition.heading = heading;
     if (providesSpeed)
         corePosition.speed = speed;
+    if (providesFloorLevel)
+        corePosition.floorLevel = floorLevel;
 
     auto position = WebGeolocationPosition::create(WTFMove(corePosition));
     return toAPI(&position.leakRef());

Modified: trunk/Source/WebKit/UIProcess/API/C/WKGeolocationPosition.h (223210 => 223211)


--- trunk/Source/WebKit/UIProcess/API/C/WKGeolocationPosition.h	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Source/WebKit/UIProcess/API/C/WKGeolocationPosition.h	2017-10-11 22:21:58 UTC (rev 223211)
@@ -36,6 +36,7 @@
 
 WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy);
 WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate_b(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
+WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate_c(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel);
 
 #ifdef __cplusplus
 }

Modified: trunk/Tools/ChangeLog (223210 => 223211)


--- trunk/Tools/ChangeLog	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/ChangeLog	2017-10-11 22:21:58 UTC (rev 223211)
@@ -1,3 +1,36 @@
+2017-10-11  Chris Dumez  <[email protected]>
+
+        [Geolocation] Expose Coordinates.floorLevel
+        https://bugs.webkit.org/show_bug.cgi?id=178173
+        <rdar://problem/34918936>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add test infrastructure for testing Coordinates.floorLevel.
+
+        * DumpRenderTree/TestRunner.cpp:
+        (setMockGeolocationPositionCallback):
+        * DumpRenderTree/TestRunner.h:
+        * DumpRenderTree/mac/TestRunnerMac.mm:
+        (TestRunner::setMockGeolocationPosition):
+        * DumpRenderTree/win/TestRunnerWin.cpp:
+        (TestRunner::setMockGeolocationPosition):
+        * WebKitTestRunner/GeolocationProviderMock.cpp:
+        (WTR::GeolocationProviderMock::setPosition):
+        * WebKitTestRunner/GeolocationProviderMock.h:
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
+        (WTR::InjectedBundle::setMockGeolocationPosition):
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::setMockGeolocationPosition):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::setMockGeolocationPosition):
+        * WebKitTestRunner/TestController.h:
+        * WebKitTestRunner/TestInvocation.cpp:
+        (WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
+
 2017-10-11  Youenn Fablet  <[email protected]>
 
         Bump default cache storage quota to 20MB

Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (223210 => 223211)


--- trunk/Tools/DumpRenderTree/TestRunner.cpp	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp	2017-10-11 22:21:58 UTC (rev 223211)
@@ -1019,8 +1019,15 @@
         speed = JSValueToNumber(context, arguments[6], 0);
     }
 
+    bool canProvideFloorLevel = false;
+    double floorLevel = 0.;
+    if (argumentCount > 7 && !JSValueIsUndefined(context, arguments[7])) {
+        canProvideFloorLevel = true;
+        floorLevel = JSValueToNumber(context, arguments[7], 0);
+    }
+
     TestRunner* controller = reinterpret_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
-    controller->setMockGeolocationPosition(latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading, canProvideSpeed, speed);
+    controller->setMockGeolocationPosition(latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading, canProvideSpeed, speed, canProvideFloorLevel, floorLevel);
 
     return JSValueMakeUndefined(context);
 }

Modified: trunk/Tools/DumpRenderTree/TestRunner.h (223210 => 223211)


--- trunk/Tools/DumpRenderTree/TestRunner.h	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/DumpRenderTree/TestRunner.h	2017-10-11 22:21:58 UTC (rev 223211)
@@ -110,7 +110,7 @@
     void setAutomaticLinkDetectionEnabled(bool flag);
     void setMainFrameIsFirstResponder(bool flag);
     void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
-    void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
+    void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel);
     void setMockGeolocationPositionUnavailableError(JSStringRef message);
     void setPersistentUserStyleSheetLocation(JSStringRef path);
     void setPluginsEnabled(bool);

Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (223210 => 223211)


--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm	2017-10-11 22:21:58 UTC (rev 223211)
@@ -442,7 +442,7 @@
     [orientation release];
 }
 
-void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
+void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel)
 {
     WebGeolocationPosition *position = nil;
     if (!providesAltitude && !providesAltitudeAccuracy && !providesHeading && !providesSpeed) {
@@ -458,6 +458,8 @@
             geolocationPosition.heading = heading;
         if (providesSpeed)
             geolocationPosition.speed = speed;
+        if (providesFloorLevel)
+            geolocationPosition.floorLevel = floorLevel;
         position = [[WebGeolocationPosition alloc] initWithGeolocationPosition:(WTFMove(geolocationPosition))];
     }
     [[MockGeolocationProvider shared] setPosition:position];

Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (223210 => 223211)


--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp	2017-10-11 22:21:58 UTC (rev 223211)
@@ -473,7 +473,7 @@
     fprintf(testResult, "ERROR: TestRunner::setMockDeviceOrientation() not implemented\n");
 }
 
-void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
+void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel)
 {
     // FIXME: Implement for Geolocation layout tests.
     // See https://bugs.webkit.org/show_bug.cgi?id=28264.

Modified: trunk/Tools/WebKitTestRunner/GeolocationProviderMock.cpp (223210 => 223211)


--- trunk/Tools/WebKitTestRunner/GeolocationProviderMock.cpp	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/WebKitTestRunner/GeolocationProviderMock.cpp	2017-10-11 22:21:58 UTC (rev 223211)
@@ -63,9 +63,9 @@
     WKGeolocationManagerSetProvider(m_geolocationManager, 0);
 }
 
-void GeolocationProviderMock::setPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
+void GeolocationProviderMock::setPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel)
 {
-    m_position.adopt(WKGeolocationPositionCreate_b(currentTime(), latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed));
+    m_position.adopt(WKGeolocationPositionCreate_c(currentTime(), latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed, providesFloorLevel, floorLevel));
 
     m_hasError = false;
     m_errorMessage.clear();

Modified: trunk/Tools/WebKitTestRunner/GeolocationProviderMock.h (223210 => 223211)


--- trunk/Tools/WebKitTestRunner/GeolocationProviderMock.h	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/WebKitTestRunner/GeolocationProviderMock.h	2017-10-11 22:21:58 UTC (rev 223211)
@@ -35,7 +35,7 @@
     GeolocationProviderMock(WKContextRef);
     ~GeolocationProviderMock();
 
-    void setPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
+    void setPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel);
     void setPositionUnavailableError(WKStringRef errorMessage);
 
     void startUpdating(WKGeolocationManagerRef);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (223210 => 223211)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2017-10-11 22:21:58 UTC (rev 223211)
@@ -189,7 +189,7 @@
 
     // Geolocation
     void setGeolocationPermission(boolean value);
-    void setMockGeolocationPosition(double latitude, double longitude, double accuracy, optional object altitude, optional object altitudeAccuracy, optional object heading, optional object speed);
+    void setMockGeolocationPosition(double latitude, double longitude, double accuracy, optional object altitude, optional object altitudeAccuracy, optional object heading, optional object speed, optional object floorLevel);
     void setMockGeolocationPositionUnavailableError(DOMString errorMessage);
     boolean isGeolocationProviderActive();
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (223210 => 223211)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2017-10-11 22:21:58 UTC (rev 223211)
@@ -538,7 +538,7 @@
     WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
 }
 
-void InjectedBundle::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
+void InjectedBundle::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel)
 {
     WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGeolocationPosition"));
 
@@ -588,6 +588,14 @@
     WKRetainPtr<WKDoubleRef> speedWK(AdoptWK, WKDoubleCreate(speed));
     WKDictionarySetItem(messageBody.get(), speedKeyWK.get(), speedWK.get());
 
+    WKRetainPtr<WKStringRef> providesFloorLevelKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesFloorLevel"));
+    WKRetainPtr<WKBooleanRef> providesFloorLevelWK(AdoptWK, WKBooleanCreate(providesFloorLevel));
+    WKDictionarySetItem(messageBody.get(), providesFloorLevelKeyWK.get(), providesFloorLevelWK.get());
+
+    WKRetainPtr<WKStringRef> floorLevelKeyWK(AdoptWK, WKStringCreateWithUTF8CString("floorLevel"));
+    WKRetainPtr<WKDoubleRef> floorLevelWK(AdoptWK, WKDoubleCreate(floorLevel));
+    WKDictionarySetItem(messageBody.get(), floorLevelKeyWK.get(), floorLevelWK.get());
+
     WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
 }
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (223210 => 223211)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h	2017-10-11 22:21:58 UTC (rev 223211)
@@ -97,7 +97,7 @@
 
     // Geolocation.
     void setGeolocationPermission(bool);
-    void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
+    void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel);
     void setMockGeolocationPositionUnavailableError(WKStringRef errorMessage);
     bool isGeolocationProviderActive() const;
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (223210 => 223211)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2017-10-11 22:21:58 UTC (rev 223211)
@@ -886,7 +886,7 @@
     return InjectedBundle::singleton().isGeolocationProviderActive();
 }
 
-void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, JSValueRef jsAltitude, JSValueRef jsAltitudeAccuracy, JSValueRef jsHeading, JSValueRef jsSpeed)
+void TestRunner::setMockGeolocationPosition(double latitude, double longitude, double accuracy, JSValueRef jsAltitude, JSValueRef jsAltitudeAccuracy, JSValueRef jsHeading, JSValueRef jsSpeed, JSValueRef jsFloorLevel)
 {
     auto& injectedBundle = InjectedBundle::singleton();
     WKBundleFrameRef mainFrame = WKBundlePageGetMainFrame(injectedBundle.page()->page());
@@ -920,7 +920,14 @@
         speed = JSValueToNumber(context, jsSpeed, 0);
     }
 
-    injectedBundle.setMockGeolocationPosition(latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
+    bool providesFloorLevel = false;
+    double floorLevel = 0.;
+    if (!JSValueIsUndefined(context, jsFloorLevel)) {
+        providesFloorLevel = true;
+        floorLevel = JSValueToNumber(context, jsFloorLevel, 0);
+    }
+
+    injectedBundle.setMockGeolocationPosition(latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed, providesFloorLevel, floorLevel);
 }
 
 void TestRunner::setMockGeolocationPositionUnavailableError(JSStringRef message)

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (223210 => 223211)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2017-10-11 22:21:58 UTC (rev 223211)
@@ -289,7 +289,7 @@
 
     // Geolocation.
     void setGeolocationPermission(bool);
-    void setMockGeolocationPosition(double latitude, double longitude, double accuracy, JSValueRef altitude, JSValueRef altitudeAccuracy, JSValueRef heading, JSValueRef speed);
+    void setMockGeolocationPosition(double latitude, double longitude, double accuracy, JSValueRef altitude, JSValueRef altitudeAccuracy, JSValueRef heading, JSValueRef speed, JSValueRef floorLevel);
     void setMockGeolocationPositionUnavailableError(JSStringRef message);
     bool isGeolocationProviderActive();
 

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (223210 => 223211)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2017-10-11 22:21:58 UTC (rev 223211)
@@ -1870,9 +1870,9 @@
     decidePolicyForGeolocationPermissionRequestIfPossible();
 }
 
-void TestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
+void TestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel)
 {
-    m_geolocationProvider->setPosition(latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
+    m_geolocationProvider->setPosition(latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed, providesFloorLevel, floorLevel);
 }
 
 void TestController::setMockGeolocationPositionUnavailableError(WKStringRef errorMessage)

Modified: trunk/Tools/WebKitTestRunner/TestController.h (223210 => 223211)


--- trunk/Tools/WebKitTestRunner/TestController.h	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/WebKitTestRunner/TestController.h	2017-10-11 22:21:58 UTC (rev 223211)
@@ -94,7 +94,7 @@
 
     // Geolocation.
     void setGeolocationPermission(bool);
-    void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
+    void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed, bool providesFloorLevel, double floorLevel);
     void setMockGeolocationPositionUnavailableError(WKStringRef errorMessage);
     void handleGeolocationPermissionRequest(WKGeolocationPermissionRequestRef);
     bool isGeolocationProviderActive() const;

Modified: trunk/Tools/WebKitTestRunner/TestInvocation.cpp (223210 => 223211)


--- trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2017-10-11 21:33:58 UTC (rev 223210)
+++ trunk/Tools/WebKitTestRunner/TestInvocation.cpp	2017-10-11 22:21:58 UTC (rev 223211)
@@ -488,7 +488,15 @@
         WKDoubleRef speedWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, speedKeyWK.get()));
         double speed = WKDoubleGetValue(speedWK);
 
-        TestController::singleton().setMockGeolocationPosition(latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed);
+        WKRetainPtr<WKStringRef> providesFloorLevelKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesFloorLevel"));
+        WKBooleanRef providesFloorLevelWK = static_cast<WKBooleanRef>(WKDictionaryGetItemForKey(messageBodyDictionary, providesFloorLevelKeyWK.get()));
+        bool providesFloorLevel = WKBooleanGetValue(providesFloorLevelWK);
+
+        WKRetainPtr<WKStringRef> floorLevelKeyWK(AdoptWK, WKStringCreateWithUTF8CString("floorLevel"));
+        WKDoubleRef floorLevelWK = static_cast<WKDoubleRef>(WKDictionaryGetItemForKey(messageBodyDictionary, floorLevelKeyWK.get()));
+        double floorLevel = WKDoubleGetValue(floorLevelWK);
+
+        TestController::singleton().setMockGeolocationPosition(latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed, providesFloorLevel, floorLevel);
         return;
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to