[webkit-dev] DeviceOrientation/Motion on Document rather than Page
Maciej Stachowiak
mjs at apple.com
Tue Aug 17 11:57:09 PDT 2010
On Aug 17, 2010, at 6:50 AM, Dean Jackson wrote:
>
> On 17/08/2010, at 12:22 AM, Maciej Stachowiak wrote:
>
>>
>> On Aug 16, 2010, at 10:52 PM, Eric Seidel wrote:
>>
>>> Where-ever it goes, please don't put it on Document directly. :)
>>> (Feel free to tie it to Document's lifetime, just don't add to
>>> Document's 300+ methods.)
>>>
>>> The madness must stop... Document is long overdue for some weightloss...
>>
>> I assume Dean is suggesting that Document would gain a new data member (DeviceMotionController?) which strikes me as a reasonable approach.
>
> Right - either one or two (+DeviceOrientationController). I do think the controllers of both events could be a single object - but that is another discussion.
>
> If it wasn't on Document, what do you suggest otherwise? DOMWindow? Putting it on Frame but tying it to Document seems less than perfect.
My specific advice was in the rest of my reply - trimming quotes so you can see it:
>> For this sort of thing, it seems reasonable to me that there is a layer of the implementation that is a per-document controller, and then below that a singleton object in case we don't need things to happen multiple times per document. It doesn't seem especially helpful to have something happen at the Page level, in normal operation.
>>
>> The reason it seems a singleton would be useful is that you only want to register with the OS service once, and then multicast the relevant notifications to all clients that are listening.
>>
>> For purposes of substituting a mock controller:
>>
>> (1) If there is a singleton beneath the per-document controllers, perhaps the mock object can insert itself at that level.
>> (2) Even if the mock controller is at the per-document level, it is likely still sufficient for most tests; it might mean a little extra work if we need to specifically test geolocation or device motion/orientation from a subframe.
Regards,
Maciej
More information about the webkit-dev
mailing list