Skip to content

Commit e096cef

Browse files
[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. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@223211 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent fd30e0e commit e096cef

27 files changed

+208
-18
lines changed

LayoutTests/ChangeLog

+13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
2017-10-11 Chris Dumez <[email protected]>
2+
3+
[Geolocation] Expose Coordinates.floorLevel
4+
https://bugs.webkit.org/show_bug.cgi?id=178173
5+
<rdar://problem/34918936>
6+
7+
Reviewed by Ryosuke Niwa.
8+
9+
Add layout test coverage.
10+
11+
* fast/dom/Geolocation/floorLevel-expected.txt: Added.
12+
* fast/dom/Geolocation/floorLevel.html: Added.
13+
114
2017-10-11 Simon Fraser <[email protected]>
215

316
Avoid triggering layout from style change
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Tests support for Geolocation's floorLevel
2+
3+
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4+
5+
6+
PASS coords.latitude is mockLatitude
7+
PASS coords.longitude is mockLongitude
8+
PASS coords.accuracy is mockAccuracy
9+
PASS coords.altitude is mockAltitude
10+
PASS coords.altitudeAccuracy is mockAltitudeAccuracy
11+
PASS coords.heading is mockHeading
12+
PASS coords.speed is mockSpeed
13+
PASS coords.floorLevel is mockFloorLevel
14+
PASS successfullyParsed is true
15+
16+
TEST COMPLETE
17+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<body>
4+
<script src="../../../resources/js-test.js"></script>
5+
<script>
6+
description("Tests support for Geolocation's floorLevel");
7+
jsTestIsAsync = true;
8+
9+
const mockLatitude = 51.478;
10+
const mockLongitude = -0.166;
11+
const mockAccuracy = 100.0;
12+
const mockAltitude = 10.1;
13+
const mockAltitudeAccuracy = 0.1;
14+
const mockHeading = 223.3;
15+
const mockSpeed = 123.4;
16+
const mockFloorLevel = 3;
17+
18+
if (window.testRunner) {
19+
testRunner.setGeolocationPermission(true);
20+
testRunner.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy, mockAltitude, mockAltitudeAccuracy, mockHeading, mockSpeed, mockFloorLevel);
21+
}
22+
23+
function checkPosition(position) {
24+
coords = position.coords;
25+
shouldBe("coords.latitude", "mockLatitude");
26+
shouldBe("coords.longitude", "mockLongitude");
27+
shouldBe("coords.accuracy", "mockAccuracy");
28+
shouldBe("coords.altitude", "mockAltitude");
29+
shouldBe("coords.altitudeAccuracy", "mockAltitudeAccuracy");
30+
shouldBe("coords.heading", "mockHeading");
31+
shouldBe("coords.speed", "mockSpeed");
32+
shouldBe("coords.floorLevel", "mockFloorLevel");
33+
finishJSTest();
34+
}
35+
36+
navigator.geolocation.getCurrentPosition(checkPosition);
37+
</script>
38+
</body>
39+
</html>

Source/WebCore/ChangeLog

+24
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
2017-10-11 Chris Dumez <[email protected]>
2+
3+
[Geolocation] Expose Coordinates.floorLevel
4+
https://bugs.webkit.org/show_bug.cgi?id=178173
5+
<rdar://problem/34918936>
6+
7+
Reviewed by Ryosuke Niwa.
8+
9+
Expose Coordinates.floorLevel via the Geolocation API. This is currently
10+
a WebKit-specific extension and it is only populated on iOS / WKTR / DRT.
11+
It is null on other platforms.
12+
13+
Test: fast/dom/Geolocation/floorLevel.html
14+
15+
* Modules/geolocation/Coordinates.h:
16+
(WebCore::Coordinates::floorLevel const):
17+
* Modules/geolocation/Coordinates.idl:
18+
* Modules/geolocation/GeolocationPosition.h:
19+
(WebCore::GeolocationPosition::encode const):
20+
(WebCore::GeolocationPosition::decode):
21+
* Modules/geolocation/ios/GeolocationPositionIOS.mm:
22+
(WebCore::GeolocationPosition::GeolocationPosition):
23+
* page/Settings.in:
24+
125
2017-10-11 Simon Fraser <[email protected]>
226

327
Avoid triggering layout from style change

Source/WebCore/Modules/geolocation/Coordinates.h

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class Coordinates : public RefCounted<Coordinates> {
5151
std::optional<double> altitudeAccuracy() const { return m_position.altitudeAccuracy; }
5252
std::optional<double> heading() const { return m_position.heading; }
5353
std::optional<double> speed() const { return m_position.speed; }
54+
std::optional<double> floorLevel() const { return m_position.floorLevel; }
5455

5556
private:
5657
explicit Coordinates(GeolocationPosition&&);

Source/WebCore/Modules/geolocation/Coordinates.idl

+1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@
3535
readonly attribute unrestricted double? altitudeAccuracy;
3636
readonly attribute unrestricted double? heading;
3737
readonly attribute unrestricted double? speed;
38+
[EnabledBySetting=GeolocationFloorLevel] readonly attribute unrestricted double? floorLevel;
3839
};

Source/WebCore/Modules/geolocation/GeolocationPosition.h

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class GeolocationPosition {
6262
std::optional<double> altitudeAccuracy;
6363
std::optional<double> heading;
6464
std::optional<double> speed;
65+
std::optional<double> floorLevel;
6566

6667
bool isValid() const;
6768

@@ -80,6 +81,7 @@ void GeolocationPosition::encode(Encoder& encoder) const
8081
encoder << altitudeAccuracy;
8182
encoder << heading;
8283
encoder << speed;
84+
encoder << floorLevel;
8385
}
8486

8587
template<class Decoder>
@@ -101,6 +103,8 @@ bool GeolocationPosition::decode(Decoder& decoder, GeolocationPosition& position
101103
return false;
102104
if (!decoder.decode(position.speed))
103105
return false;
106+
if (!decoder.decode(position.floorLevel))
107+
return false;
104108

105109
return true;
106110
}

Source/WebCore/Modules/geolocation/ios/GeolocationPositionIOS.mm

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
speed = location.speed;
4747
if (location.course >= 0.0)
4848
heading = location.course;
49+
if (location.floor)
50+
floorLevel = location.floor.level;
4951
}
5052

5153
}

Source/WebCore/page/Settings.in

+2
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ linkPreconnectEnabled initial=false
295295

296296
beaconAPIEnabled initial=false
297297

298+
geolocationFloorLevelEnabled initial=true
299+
298300
constantPropertiesEnabled initial=false
299301

300302
viewportFitEnabled initial=false

Source/WebKit/ChangeLog

+14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
2017-10-11 Chris Dumez <[email protected]>
2+
3+
[Geolocation] Expose Coordinates.floorLevel
4+
https://bugs.webkit.org/show_bug.cgi?id=178173
5+
<rdar://problem/34918936>
6+
7+
Reviewed by Ryosuke Niwa.
8+
9+
* UIProcess/API/C/WKGeolocationPosition.cpp:
10+
(WKGeolocationPositionCreate):
11+
(WKGeolocationPositionCreate_b):
12+
(WKGeolocationPositionCreate_c):
13+
* UIProcess/API/C/WKGeolocationPosition.h:
14+
115
2017-10-11 Youenn Fablet <[email protected]>
216

317
Bump default cache storage quota to 20MB

Source/WebKit/UIProcess/API/C/WKGeolocationPosition.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,15 @@ WKTypeID WKGeolocationPositionGetTypeID()
3838

3939
WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy)
4040
{
41-
return WKGeolocationPositionCreate_b(timestamp, latitude, longitude, accuracy, false, 0., false, 0., false, 0., false, 0.);
41+
return WKGeolocationPositionCreate_c(timestamp, latitude, longitude, accuracy, false, 0., false, 0., false, 0., false, 0., false, 0.);
4242
}
4343

4444
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)
45+
{
46+
return WKGeolocationPositionCreate_c(timestamp, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed, false, 0.);
47+
}
48+
49+
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)
4550
{
4651
WebCore::GeolocationPosition corePosition { timestamp, latitude, longitude, accuracy };
4752
if (providesAltitude)
@@ -52,6 +57,8 @@ WKGeolocationPositionRef WKGeolocationPositionCreate_b(double timestamp, double
5257
corePosition.heading = heading;
5358
if (providesSpeed)
5459
corePosition.speed = speed;
60+
if (providesFloorLevel)
61+
corePosition.floorLevel = floorLevel;
5562

5663
auto position = WebGeolocationPosition::create(WTFMove(corePosition));
5764
return toAPI(&position.leakRef());

Source/WebKit/UIProcess/API/C/WKGeolocationPosition.h

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ WK_EXPORT WKTypeID WKGeolocationPositionGetTypeID();
3636

3737
WK_EXPORT WKGeolocationPositionRef WKGeolocationPositionCreate(double timestamp, double latitude, double longitude, double accuracy);
3838
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);
39+
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);
3940

4041
#ifdef __cplusplus
4142
}

Tools/ChangeLog

+33
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,36 @@
1+
2017-10-11 Chris Dumez <[email protected]>
2+
3+
[Geolocation] Expose Coordinates.floorLevel
4+
https://bugs.webkit.org/show_bug.cgi?id=178173
5+
<rdar://problem/34918936>
6+
7+
Reviewed by Ryosuke Niwa.
8+
9+
Add test infrastructure for testing Coordinates.floorLevel.
10+
11+
* DumpRenderTree/TestRunner.cpp:
12+
(setMockGeolocationPositionCallback):
13+
* DumpRenderTree/TestRunner.h:
14+
* DumpRenderTree/mac/TestRunnerMac.mm:
15+
(TestRunner::setMockGeolocationPosition):
16+
* DumpRenderTree/win/TestRunnerWin.cpp:
17+
(TestRunner::setMockGeolocationPosition):
18+
* WebKitTestRunner/GeolocationProviderMock.cpp:
19+
(WTR::GeolocationProviderMock::setPosition):
20+
* WebKitTestRunner/GeolocationProviderMock.h:
21+
* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl:
22+
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
23+
(WTR::InjectedBundle::setMockGeolocationPosition):
24+
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
25+
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
26+
(WTR::TestRunner::setMockGeolocationPosition):
27+
* WebKitTestRunner/InjectedBundle/TestRunner.h:
28+
* WebKitTestRunner/TestController.cpp:
29+
(WTR::TestController::setMockGeolocationPosition):
30+
* WebKitTestRunner/TestController.h:
31+
* WebKitTestRunner/TestInvocation.cpp:
32+
(WTR::TestInvocation::didReceiveMessageFromInjectedBundle):
33+
134
2017-10-11 Youenn Fablet <[email protected]>
235

336
Bump default cache storage quota to 20MB

Tools/DumpRenderTree/TestRunner.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,15 @@ static JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObj
10191019
speed = JSValueToNumber(context, arguments[6], 0);
10201020
}
10211021

1022+
bool canProvideFloorLevel = false;
1023+
double floorLevel = 0.;
1024+
if (argumentCount > 7 && !JSValueIsUndefined(context, arguments[7])) {
1025+
canProvideFloorLevel = true;
1026+
floorLevel = JSValueToNumber(context, arguments[7], 0);
1027+
}
1028+
10221029
TestRunner* controller = reinterpret_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
1023-
controller->setMockGeolocationPosition(latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading, canProvideSpeed, speed);
1030+
controller->setMockGeolocationPosition(latitude, longitude, accuracy, canProvideAltitude, altitude, canProvideAltitudeAccuracy, altitudeAccuracy, canProvideHeading, heading, canProvideSpeed, speed, canProvideFloorLevel, floorLevel);
10241031

10251032
return JSValueMakeUndefined(context);
10261033
}

Tools/DumpRenderTree/TestRunner.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class TestRunner : public WTR::UIScriptContextDelegate, public RefCounted<TestRu
110110
void setAutomaticLinkDetectionEnabled(bool flag);
111111
void setMainFrameIsFirstResponder(bool flag);
112112
void setMockDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma);
113-
void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
113+
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);
114114
void setMockGeolocationPositionUnavailableError(JSStringRef message);
115115
void setPersistentUserStyleSheetLocation(JSStringRef path);
116116
void setPluginsEnabled(bool);

Tools/DumpRenderTree/mac/TestRunnerMac.mm

+3-1
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ static inline size_t indexOfSeparatorAfterDirectoryName(const std::string& direc
442442
[orientation release];
443443
}
444444

445-
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)
445+
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)
446446
{
447447
WebGeolocationPosition *position = nil;
448448
if (!providesAltitude && !providesAltitudeAccuracy && !providesHeading && !providesSpeed) {
@@ -458,6 +458,8 @@ static inline size_t indexOfSeparatorAfterDirectoryName(const std::string& direc
458458
geolocationPosition.heading = heading;
459459
if (providesSpeed)
460460
geolocationPosition.speed = speed;
461+
if (providesFloorLevel)
462+
geolocationPosition.floorLevel = floorLevel;
461463
position = [[WebGeolocationPosition alloc] initWithGeolocationPosition:(WTFMove(geolocationPosition))];
462464
}
463465
[[MockGeolocationProvider shared] setPosition:position];

Tools/DumpRenderTree/win/TestRunnerWin.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ void TestRunner::setMockDeviceOrientation(bool canProvideAlpha, double alpha, bo
473473
fprintf(testResult, "ERROR: TestRunner::setMockDeviceOrientation() not implemented\n");
474474
}
475475

476-
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)
476+
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)
477477
{
478478
// FIXME: Implement for Geolocation layout tests.
479479
// See https://bugs.webkit.org/show_bug.cgi?id=28264.

Tools/WebKitTestRunner/GeolocationProviderMock.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ GeolocationProviderMock::~GeolocationProviderMock()
6363
WKGeolocationManagerSetProvider(m_geolocationManager, 0);
6464
}
6565

66-
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)
66+
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)
6767
{
68-
m_position.adopt(WKGeolocationPositionCreate_b(currentTime(), latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed));
68+
m_position.adopt(WKGeolocationPositionCreate_c(currentTime(), latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed, providesFloorLevel, floorLevel));
6969

7070
m_hasError = false;
7171
m_errorMessage.clear();

Tools/WebKitTestRunner/GeolocationProviderMock.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class GeolocationProviderMock {
3535
GeolocationProviderMock(WKContextRef);
3636
~GeolocationProviderMock();
3737

38-
void setPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
38+
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);
3939
void setPositionUnavailableError(WKStringRef errorMessage);
4040

4141
void startUpdating(WKGeolocationManagerRef);

Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl

+1-1
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ interface TestRunner {
189189

190190
// Geolocation
191191
void setGeolocationPermission(boolean value);
192-
void setMockGeolocationPosition(double latitude, double longitude, double accuracy, optional object altitude, optional object altitudeAccuracy, optional object heading, optional object speed);
192+
void setMockGeolocationPosition(double latitude, double longitude, double accuracy, optional object altitude, optional object altitudeAccuracy, optional object heading, optional object speed, optional object floorLevel);
193193
void setMockGeolocationPositionUnavailableError(DOMString errorMessage);
194194
boolean isGeolocationProviderActive();
195195

Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ void InjectedBundle::setGeolocationPermission(bool enabled)
538538
WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
539539
}
540540

541-
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)
541+
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)
542542
{
543543
WKRetainPtr<WKStringRef> messageName(AdoptWK, WKStringCreateWithUTF8CString("SetMockGeolocationPosition"));
544544

@@ -588,6 +588,14 @@ void InjectedBundle::setMockGeolocationPosition(double latitude, double longitud
588588
WKRetainPtr<WKDoubleRef> speedWK(AdoptWK, WKDoubleCreate(speed));
589589
WKDictionarySetItem(messageBody.get(), speedKeyWK.get(), speedWK.get());
590590

591+
WKRetainPtr<WKStringRef> providesFloorLevelKeyWK(AdoptWK, WKStringCreateWithUTF8CString("providesFloorLevel"));
592+
WKRetainPtr<WKBooleanRef> providesFloorLevelWK(AdoptWK, WKBooleanCreate(providesFloorLevel));
593+
WKDictionarySetItem(messageBody.get(), providesFloorLevelKeyWK.get(), providesFloorLevelWK.get());
594+
595+
WKRetainPtr<WKStringRef> floorLevelKeyWK(AdoptWK, WKStringCreateWithUTF8CString("floorLevel"));
596+
WKRetainPtr<WKDoubleRef> floorLevelWK(AdoptWK, WKDoubleCreate(floorLevel));
597+
WKDictionarySetItem(messageBody.get(), floorLevelKeyWK.get(), floorLevelWK.get());
598+
591599
WKBundlePagePostMessage(page()->page(), messageName.get(), messageBody.get());
592600
}
593601

Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class InjectedBundle {
9797

9898
// Geolocation.
9999
void setGeolocationPermission(bool);
100-
void setMockGeolocationPosition(double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed);
100+
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);
101101
void setMockGeolocationPositionUnavailableError(WKStringRef errorMessage);
102102
bool isGeolocationProviderActive() const;
103103

0 commit comments

Comments
 (0)