Commit d35658cd authored by bolsinga@apple.com's avatar bolsinga@apple.com

2009-03-12 Greg Bolsinga <bolsinga@apple.com>

        Reviewed by Antti Koivisto.

        https://bugs.webkit.org/show_bug.cgi?id=24506
        Geolocation in Safari differs from the spec, no Coordinates attribute on Position
        
        Get up to date.

        * DerivedSources.make:
        * GNUmakefile.am:
        * WebCore.pro:
        * WebCore.scons:
        * WebCore.vcproj/WebCore.vcproj:
        * WebCore.xcodeproj/project.pbxproj:
        * WebCoreSources.bkl:
        * bindings/js/JSGeolocationCustom.cpp:
        (WebCore::createPositionOptions):
        * page/Coordinates.cpp: Added.
        (WebCore::Coordinates::toString):
        * page/Coordinates.h: Added.
        (WebCore::Coordinates::create):
        (WebCore::Coordinates::latitude):
        (WebCore::Coordinates::longitude):
        (WebCore::Coordinates::altitude):
        (WebCore::Coordinates::accuracy):
        (WebCore::Coordinates::altitudeAccuracy):
        (WebCore::Coordinates::heading):
        (WebCore::Coordinates::speed):
        (WebCore::Coordinates::Coordinates):
        * page/Coordinates.idl: Added.
        * page/Geoposition.cpp:
        (WebCore::Geoposition::toString):
        * page/Geoposition.h:
        (WebCore::Geoposition::create):
        (WebCore::Geoposition::coords):
        (WebCore::Geoposition::Geoposition):
        * page/Geoposition.idl:
        * page/PositionOptions.h:
        (WebCore::PositionOptions::create):
        (WebCore::PositionOptions::maximumAge):
        (WebCore::PositionOptions::setMaximumAge):
        (WebCore::PositionOptions::PositionOptions):
        * platform/mac/GeolocationServiceMac.mm:
        (-[WebCoreCoreLocationObserver locationManager:didUpdateToLocation:fromLocation:]):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@41650 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 186762fa
2009-03-12 Greg Bolsinga <bolsinga@apple.com>
Reviewed by Antti Koivisto.
https://bugs.webkit.org/show_bug.cgi?id=24506
Geolocation in Safari differs from the spec, no Coordinates attribute on Position
Get up to date.
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.pro:
* WebCore.scons:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* WebCoreSources.bkl:
* bindings/js/JSGeolocationCustom.cpp:
(WebCore::createPositionOptions):
* page/Coordinates.cpp: Added.
(WebCore::Coordinates::toString):
* page/Coordinates.h: Added.
(WebCore::Coordinates::create):
(WebCore::Coordinates::latitude):
(WebCore::Coordinates::longitude):
(WebCore::Coordinates::altitude):
(WebCore::Coordinates::accuracy):
(WebCore::Coordinates::altitudeAccuracy):
(WebCore::Coordinates::heading):
(WebCore::Coordinates::speed):
(WebCore::Coordinates::Coordinates):
* page/Coordinates.idl: Added.
* page/Geoposition.cpp:
(WebCore::Geoposition::toString):
* page/Geoposition.h:
(WebCore::Geoposition::create):
(WebCore::Geoposition::coords):
(WebCore::Geoposition::Geoposition):
* page/Geoposition.idl:
* page/PositionOptions.h:
(WebCore::PositionOptions::create):
(WebCore::PositionOptions::maximumAge):
(WebCore::PositionOptions::setMaximumAge):
(WebCore::PositionOptions::PositionOptions):
* platform/mac/GeolocationServiceMac.mm:
(-[WebCoreCoreLocationObserver locationManager:didUpdateToLocation:fromLocation:]):
2009-03-12 Dimitri Glazkov <dglazkov@chromium.org>
Reviewed by Darin Fisher.
......@@ -73,6 +73,7 @@ DOM_CLASSES = \
Clipboard \
Comment \
Console \
Coordinates \
Counter \
DOMApplicationCache \
DOMCoreException \
......
......@@ -215,6 +215,7 @@ IDL_BINDINGS += \
WebCore/inspector/InspectorController.idl \
WebCore/page/BarInfo.idl \
WebCore/page/Console.idl \
WebCore/page/Coordinates.idl \
WebCore/page/DOMSelection.idl \
WebCore/page/DOMWindow.idl \
WebCore/page/Geolocation.idl \
......@@ -1160,6 +1161,8 @@ webcore_sources += \
WebCore/page/ContextMenuClient.h \
WebCore/page/ContextMenuController.cpp \
WebCore/page/ContextMenuController.h \
WebCore/page/Coordinates.h \
WebCore/page/Coordinates.cpp \
WebCore/page/DOMSelection.cpp \
WebCore/page/DOMSelection.h \
WebCore/page/DOMTimer.cpp \
......
......@@ -383,6 +383,7 @@ IDL_BINDINGS += \
inspector/InspectorController.idl \
page/BarInfo.idl \
page/Console.idl \
page/Coordinates.idl \
page/DOMSelection.idl \
page/DOMWindow.idl \
page/Geolocation.idl \
......@@ -849,6 +850,7 @@ SOURCES += \
page/Chrome.cpp \
page/Console.cpp \
page/ContextMenuController.cpp \
page/Coordinates.cpp \
page/DOMSelection.cpp \
page/DOMTimer.cpp \
page/DOMWindow.cpp \
......
......@@ -377,6 +377,7 @@ sources['page'] = [
'page/Chrome.cpp',
'page/Console.cpp',
'page/ContextMenuController.cpp',
'page/Coordinates.cpp',
'page/DOMSelection.cpp',
'page/DOMTimer.cpp',
'page/DOMWindow.cpp',
......
......@@ -579,6 +579,10 @@
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSConsole.h"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSCoordinates.h"
>
</File>
<File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSCounter.h"
>
......@@ -2159,6 +2163,22 @@
RelativePath="..\page\ContextMenuController.h"
>
</File>
<File
RelativePath="..\page\Coordinates.cpp"
>
<FileConfiguration
Name="Release_PGO|Win32"
>
<Tool
Name="VCCLCompilerTool"
WholeProgramOptimization="true"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\page\Coordinates.h"
>
</File>
<File
RelativePath="..\page\DOMSelection.cpp"
>
......
......@@ -4454,6 +4454,11 @@
F916C48D0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F916C48B0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.cpp */; };
F916C48E0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F916C48C0DB510F80076CD83 /* JSXMLHttpRequestProgressEvent.h */; };
F9F0ED7A0DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */; };
FE6FD4870F676E5700092873 /* Coordinates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6FD4840F676E5700092873 /* Coordinates.cpp */; };
FE6FD4880F676E5700092873 /* Coordinates.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6FD4850F676E5700092873 /* Coordinates.h */; };
FE6FD4890F676E5700092873 /* Coordinates.idl in Resources */ = {isa = PBXBuildFile; fileRef = FE6FD4860F676E5700092873 /* Coordinates.idl */; };
FE6FD48D0F676E9300092873 /* JSCoordinates.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */; };
FE6FD48E0F676E9300092873 /* JSCoordinates.h in Headers */ = {isa = PBXBuildFile; fileRef = FE6FD48C0F676E9300092873 /* JSCoordinates.h */; };
FE80D7A70E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80D7A20E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp */; };
FE80D7A80E9C1ED2000D6F75 /* JSCustomPositionCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = FE80D7A30E9C1ED2000D6F75 /* JSCustomPositionCallback.h */; };
FE80D7A90E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FE80D7A40E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.cpp */; };
......@@ -9334,6 +9339,11 @@
F9F0ED770DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XMLHttpRequestProgressEvent.h; sourceTree = "<group>"; };
F9F0ED780DB50CA200D16DB9 /* XMLHttpRequestProgressEvent.idl */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = XMLHttpRequestProgressEvent.idl; sourceTree = "<group>"; };
FE49EF970DC51462004266E1 /* DashboardSupportCSSPropertyNames.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DashboardSupportCSSPropertyNames.in; sourceTree = "<group>"; };
FE6FD4840F676E5700092873 /* Coordinates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Coordinates.cpp; sourceTree = "<group>"; };
FE6FD4850F676E5700092873 /* Coordinates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Coordinates.h; sourceTree = "<group>"; };
FE6FD4860F676E5700092873 /* Coordinates.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Coordinates.idl; sourceTree = "<group>"; };
FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCoordinates.cpp; sourceTree = "<group>"; };
FE6FD48C0F676E9300092873 /* JSCoordinates.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCoordinates.h; sourceTree = "<group>"; };
FE80D7A20E9C1ED2000D6F75 /* JSCustomPositionCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomPositionCallback.cpp; sourceTree = "<group>"; };
FE80D7A30E9C1ED2000D6F75 /* JSCustomPositionCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCustomPositionCallback.h; sourceTree = "<group>"; };
FE80D7A40E9C1ED2000D6F75 /* JSCustomPositionErrorCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomPositionErrorCallback.cpp; sourceTree = "<group>"; };
......@@ -9352,7 +9362,6 @@
FE80D7C10E9C1F25000D6F75 /* PositionErrorCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PositionErrorCallback.h; sourceTree = "<group>"; };
FE80D7C20E9C1F25000D6F75 /* PositionErrorCallback.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PositionErrorCallback.idl; sourceTree = "<group>"; };
FE80D7C30E9C1F25000D6F75 /* PositionOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PositionOptions.h; sourceTree = "<group>"; };
FE80D7C40E9C1F25000D6F75 /* PositionOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = PositionOptions.idl; sourceTree = "<group>"; };
FE80DA5F0E9C4703000D6F75 /* JSGeolocation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGeolocation.cpp; sourceTree = "<group>"; };
FE80DA600E9C4703000D6F75 /* JSGeolocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSGeolocation.h; sourceTree = "<group>"; };
FE80DA610E9C4703000D6F75 /* JSGeoposition.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSGeoposition.cpp; sourceTree = "<group>"; };
......@@ -10261,6 +10270,9 @@
065AD4F20B0C2EDA005A2B1D /* ContextMenuClient.h */,
065AD4F30B0C2EDA005A2B1D /* ContextMenuController.cpp */,
065AD4F40B0C2EDA005A2B1D /* ContextMenuController.h */,
FE6FD4840F676E5700092873 /* Coordinates.cpp */,
FE6FD4850F676E5700092873 /* Coordinates.h */,
FE6FD4860F676E5700092873 /* Coordinates.idl */,
BC5A86810C33676000EEA649 /* DOMSelection.cpp */,
BC5A86820C33676000EEA649 /* DOMSelection.h */,
BC5A86830C33676000EEA649 /* DOMSelection.idl */,
......@@ -10316,7 +10328,6 @@
FE80D7C10E9C1F25000D6F75 /* PositionErrorCallback.h */,
FE80D7C20E9C1F25000D6F75 /* PositionErrorCallback.idl */,
FE80D7C30E9C1F25000D6F75 /* PositionOptions.h */,
FE80D7C40E9C1F25000D6F75 /* PositionOptions.idl */,
BCEC01BA0C274DAC009F4EC9 /* Screen.cpp */,
BCEC01BB0C274DAC009F4EC9 /* Screen.h */,
BCEC01BC0C274DAC009F4EC9 /* Screen.idl */,
......@@ -12374,6 +12385,8 @@
BCA83E4E0D7CE1E9003421A8 /* JSClipboard.h */,
93F9B6DE0BA0FB7200854064 /* JSComment.cpp */,
93F9B6DF0BA0FB7200854064 /* JSComment.h */,
FE6FD48B0F676E9300092873 /* JSCoordinates.cpp */,
FE6FD48C0F676E9300092873 /* JSCoordinates.h */,
BC60D7BE0D29A46300B9918F /* JSDOMCoreException.cpp */,
BC60D7BF0D29A46300B9918F /* JSDOMCoreException.h */,
65DF31E309D1CC60000BE325 /* JSDOMImplementation.cpp */,
......@@ -16866,6 +16879,8 @@
E1C415DA0F655D6F0092D2FB /* CrossOriginPreflightResultCache.h in Headers */,
E1C416120F6562FD0092D2FB /* CrossOriginAccessControl.h in Headers */,
A7D6B3490F61104500B79FD1 /* WorkerImportScriptsClient.h in Headers */,
FE6FD4880F676E5700092873 /* Coordinates.h in Headers */,
FE6FD48E0F676E9300092873 /* JSCoordinates.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -16980,6 +16995,7 @@
85136CA80AED665900F90A3D /* westResizeCursor.png in Resources */,
1AB1AE7A0C051FDE00139F4F /* zoomInCursor.png in Resources */,
1AB1AE7B0C051FDE00139F4F /* zoomOutCursor.png in Resources */,
FE6FD4890F676E5700092873 /* Coordinates.idl in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -18863,6 +18879,8 @@
E1C415DE0F655D7C0092D2FB /* CrossOriginPreflightResultCache.cpp in Sources */,
E1C416170F6563180092D2FB /* CrossOriginAccessControl.cpp in Sources */,
A7D6B34A0F61104500B79FD1 /* WorkerImportScriptsClient.cpp in Sources */,
FE6FD4870F676E5700092873 /* Coordinates.cpp in Sources */,
FE6FD48D0F676E9300092873 /* JSCoordinates.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -237,6 +237,7 @@ This file contains the list of files needed to build WebCore.
DerivedSources/WebCore/JSClipboard.cpp
DerivedSources/WebCore/JSComment.cpp
DerivedSources/WebCore/JSConsole.cpp
DerivedSources/WebCore/JSCoordinates.cpp
DerivedSources/WebCore/JSCounter.cpp
DerivedSources/WebCore/JSDatabase.cpp
DerivedSources/WebCore/JSDocument.cpp
......@@ -701,6 +702,7 @@ This file contains the list of files needed to build WebCore.
page/Chrome.cpp
page/Console.cpp
page/ContextMenuController.cpp
page/Coordinates.cpp
page/DOMSelection.cpp
page/DOMTimer.cpp
page/DOMWindow.cpp
......
......@@ -60,7 +60,14 @@ static PassRefPtr<PositionOptions> createPositionOptions(ExecState* exec, JSValu
if (exec->hadException())
return 0;
return PositionOptions::create(enableHighAccuracy, timeout);
JSValuePtr maximumAgeValue = object->get(exec, Identifier(exec, "maximumAge"));
if (exec->hadException())
return 0;
unsigned maximumAge = maximumAgeValue.toUInt32(exec);
if (exec->hadException())
return 0;
return PositionOptions::create(enableHighAccuracy, timeout, maximumAge);
}
JSValuePtr JSGeolocation::getCurrentPosition(ExecState* exec, const ArgList& args)
......
/*
* Copyright (C) 2009 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "Coordinates.h"
namespace WebCore {
String Coordinates::toString() const
{
return String::format("coordinate(%.6lg, %.6lg, %.6lg, %.6lg, %.6lg, %.6lg, %.6lg)",
m_latitude, m_longitude, m_altitude, m_accuracy,
m_altitudeAccuracy, m_heading, m_speed);
}
} // namespace WebCore
/*
* Copyright (C) 2009 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef Coordinates_h
#define Coordinates_h
#include "Event.h"
#include "PlatformString.h"
#include <wtf/RefCounted.h>
namespace WebCore {
typedef int ExceptionCode;
class Coordinates : public RefCounted<Coordinates> {
public:
static PassRefPtr<Coordinates> create(double latitude, double longitude, double altitude, double accuracy, double altitudeAccuracy, double heading, double speed) { return adoptRef(new Coordinates(latitude, longitude, altitude, accuracy, altitudeAccuracy, heading, speed)); }
double latitude() const { return m_latitude; }
double longitude() const { return m_longitude; }
double altitude() const { return m_altitude; }
double accuracy() const { return m_accuracy; }
double altitudeAccuracy() const { return m_altitudeAccuracy; }
double heading() const { return m_heading; }
double speed() const { return m_speed; }
String toString() const;
private:
Coordinates(double latitude, double longitude, double altitude, double accuracy, double altitudeAccuracy, double heading, double speed)
: m_latitude(latitude)
, m_longitude(longitude)
, m_altitude(altitude)
, m_accuracy(accuracy)
, m_altitudeAccuracy(altitudeAccuracy)
, m_heading(heading)
, m_speed(speed)
{
}
double m_latitude;
double m_longitude;
double m_altitude;
double m_accuracy;
double m_altitudeAccuracy;
double m_heading;
double m_speed;
};
} // namespace WebCore
#endif // Coordinates_h
/*
* Copyright (C) 2009 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
module core {
interface Coordinates {
readonly attribute double latitude;
readonly attribute double longitude;
readonly attribute double altitude;
readonly attribute double accuracy;
readonly attribute double altitudeAccuracy;
readonly attribute double heading;
readonly attribute double speed;
#if defined(LANGUAGE_JAVASCRIPT)
[DontEnum] DOMString toString();
#endif
};
}
......@@ -30,9 +30,7 @@ namespace WebCore {
String Geoposition::toString() const
{
return String::format("position(%.6lg, %.6lg, %.6lg, %.6lg, %.6lg, %.6lg, %.6lg, %.lld)",
m_latitude, m_longitude, m_altitude, m_accuracy,
m_altitudeAccuracy, m_heading, m_speed, m_timestamp);
return String::format("position(%.lld)", m_timestamp);
}
} // namespace WebCore
......@@ -26,6 +26,7 @@
#ifndef Geoposition_h
#define Geoposition_h
#include "Coordinates.h"
#include "Event.h"
#include "PlatformString.h"
#include <wtf/RefCounted.h>
......@@ -36,39 +37,21 @@ typedef int ExceptionCode;
class Geoposition : public RefCounted<Geoposition> {
public:
static PassRefPtr<Geoposition> create(double latitude, double longitude, double altitude, double accuracy, double altitudeAccuracy, double heading, double speed, DOMTimeStamp timestamp) { return adoptRef(new Geoposition(latitude, longitude, altitude, accuracy, altitudeAccuracy, heading, speed, timestamp)); }
static PassRefPtr<Geoposition> create(PassRefPtr<Coordinates> coordinates, DOMTimeStamp timestamp) { return adoptRef(new Geoposition(coordinates, timestamp)); }
double latitude() const { return m_latitude; }
double longitude() const { return m_longitude; }
double altitude() const { return m_altitude; }
double accuracy() const { return m_accuracy; }
double altitudeAccuracy() const { return m_altitudeAccuracy; }
double heading() const { return m_heading; }
double speed() const { return m_speed; }
DOMTimeStamp timestamp() const { return m_timestamp; }
Coordinates* coords() const { return m_coordinates.get(); }
String toString() const;
private:
Geoposition(double latitude, double longitude, double altitude, double accuracy, double altitudeAccuracy, double heading, double speed, DOMTimeStamp timestamp)
: m_latitude(latitude)
, m_longitude(longitude)
, m_altitude(altitude)
, m_accuracy(accuracy)
, m_altitudeAccuracy(altitudeAccuracy)
, m_heading(heading)
, m_speed(speed)
Geoposition(PassRefPtr<Coordinates> coordinates, DOMTimeStamp timestamp)
: m_coordinates(coordinates)
, m_timestamp(timestamp)
{
}
double m_latitude;
double m_longitude;
double m_altitude;
double m_accuracy;
double m_altitudeAccuracy;
double m_heading;
double m_speed;
RefPtr<Coordinates> m_coordinates;
DOMTimeStamp m_timestamp;
};
......
......@@ -26,13 +26,7 @@
module core {
interface Geoposition {
readonly attribute double latitude;
readonly attribute double longitude;
readonly attribute double altitude;
readonly attribute double accuracy;
readonly attribute double altitudeAccuracy;
readonly attribute double heading;
readonly attribute double speed;
readonly attribute Coordinates coords;
readonly attribute DOMTimeStamp timestamp;
#if defined(LANGUAGE_JAVASCRIPT)
......
......@@ -33,22 +33,26 @@ namespace WebCore {
class PositionOptions : public RefCounted<PositionOptions> {
public:
static PassRefPtr<PositionOptions> create(bool highAccuracy, unsigned timeout) { return adoptRef(new PositionOptions(highAccuracy, timeout)); }
static PassRefPtr<PositionOptions> create(bool highAccuracy, unsigned timeout, unsigned maximumAge) { return adoptRef(new PositionOptions(highAccuracy, timeout, maximumAge)); }
bool enableHighAccuracy() const { return m_highAccuracy; }
void setEnableHighAccuracy(bool enable) { m_highAccuracy = enable; }
unsigned timeout() const { return m_timeout; }
void setTimeout(unsigned t) { m_timeout = t; }
unsigned maximumAge() const { return m_maximumAge; }
void setMaximumAge(unsigned a) { m_maximumAge = a; }
private:
PositionOptions(bool highAccuracy, unsigned timeout)
PositionOptions(bool highAccuracy, unsigned timeout, unsigned maximumAge)
: m_highAccuracy(highAccuracy)
, m_timeout(timeout)
, m_maximumAge(maximumAge)
{
}
bool m_highAccuracy;
unsigned m_timeout;
unsigned m_maximumAge;
};
} // namespace WebCore
......
......@@ -160,14 +160,16 @@ void GeolocationServiceMac::errorOccurred(PassRefPtr<PositionError> error)
altitude = 0.0;
}
WTF::RefPtr<WebCore::Coordinates> newCoordinates = WebCore::Coordinates::create(
newLocation.coordinate.latitude,
newLocation.coordinate.longitude,
altitude,
newLocation.horizontalAccuracy,
altitudeAccuracy,
newLocation.course,
newLocation.speed);
WTF::RefPtr<WebCore::Geoposition> newPosition = WebCore::Geoposition::create(
newLocation.coordinate.latitude,
newLocation.coordinate.longitude,
altitude,
newLocation.horizontalAccuracy,
altitudeAccuracy,
newLocation.course,
newLocation.speed,
newCoordinates.release(),
[newLocation.timestamp timeIntervalSinceReferenceDate] * 1000.0); // seconds -> milliseconds
m_callback->positionChanged(newPosition.release());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment