Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Intent to ship: MouseEvent.offsetX/Y

107 views
Skip to first unread message

Robert O'Callahan

unread,
Feb 27, 2015, 2:16:29 PM2/27/15
to dev-pl...@lists.mozilla.org
Summary: CSSOM Views specify offsetX/Y properties on MouseEvent. Other
browsers implement them. Many sites use it with a fallback for Firefox, but
I've found at least one site that doesn't have a fallback. It's trivial to
implement.

Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=69787

Spec: http://www.w3.org/TR/cssom-view/#dom-mouseevent-offsetx
The spec has a few issues; I've posted to www-style about those, but I
don't think they'll have much effect in the wild.

Platform coverage: All
Target release: Gecko 39

Preference behind which this will be implemented: I don't think this needs
one. Other browsers already have this. There is a bit of risk due to sites
taking a new path in Firefox, but I think it's low since this path is
already taken in IE and Blink so they won't be checking offsetX/Y and
switching on some Webkit-specific stuff, probably.

Rob
--
oIo otoeololo oyooouo otohoaoto oaonoyooonoeo owohooo oioso oaonogoroyo
owoiotoho oao oboroootohoeoro oooro osoiosotoeoro owoiololo oboeo
osouobojoeocoto otooo ojouodogomoeonoto.o oAogoaoiono,o oaonoyooonoeo
owohooo
osoaoyoso otooo oao oboroootohoeoro oooro osoiosotoeoro,o o‘oRoaocoao,o’o
oioso
oaonosowoeoroaoboloeo otooo otohoeo ocooouoroto.o oAonodo oaonoyooonoeo
owohooo
osoaoyoso,o o‘oYooouo ofooooolo!o’o owoiololo oboeo oiono odoaonogoeoro
ooofo
otohoeo ofoioroeo ooofo ohoeololo.

Robert O'Callahan

unread,
Feb 27, 2015, 2:21:53 PM2/27/15
to dev-pl...@lists.mozilla.org
On Sat, Feb 28, 2015 at 8:15 AM, Robert O'Callahan <rob...@ocallahan.org>
wrote:

> Summary: CSSOM Views specify offsetX/Y properties on MouseEvent. Other
> browsers implement them. Many sites use it with a fallback for Firefox, but
> I've found at least one site that doesn't have a fallback. It's trivial to
> implement.
>
> Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=69787
>
> Spec: http://www.w3.org/TR/cssom-view/#dom-mouseevent-offsetx
> The spec has a few issues; I've posted to www-style about those, but I
> don't think they'll have much effect in the wild.
>
> Platform coverage: All
> Target release: Gecko 39
>
> Preference behind which this will be implemented: I don't think this needs
> one. Other browsers already have this. There is a bit of risk due to sites
> taking a new path in Firefox, but I think it's low since this path is
> already taken in IE and Blink so they won't be checking offsetX/Y and
> switching on some Webkit-specific stuff, probably.
>

Oh, another issue is that I've followed the spec and made offsetX/Y
doubles, whereas Blink is integers, which introduces a small amount compat
risk.

Jeff Muizelaar

unread,
Feb 27, 2015, 2:30:43 PM2/27/15
to Robert O'Callahan, dev-pl...@lists.mozilla.org
On Fri, Feb 27, 2015 at 2:21 PM, Robert O'Callahan <rob...@ocallahan.org> wrote:
> Oh, another issue is that I've followed the spec and made offsetX/Y
> doubles, whereas Blink is integers, which introduces a small amount compat
> risk.
>

IE also uses integers. Wouldn't it be better to change the spec to
follow the existing browser's behaviour?

-Jeff

Robert O'Callahan

unread,
Feb 27, 2015, 10:26:11 PM2/27/15
to Jeff Muizelaar, dev-pl...@lists.mozilla.org
On Sat, Feb 28, 2015 at 8:30 AM, Jeff Muizelaar <jmuiz...@mozilla.com>
wrote:
In some ways, yes, although the extra accuracy given by doubles could be
useful in practice.

smaug

unread,
Mar 1, 2015, 6:58:30 PM3/1/15
to rob...@ocallahan.org, Jeff Muizelaar, Boris Zbarsky
On 02/28/2015 05:25 AM, Robert O'Callahan wrote:
> On Sat, Feb 28, 2015 at 8:30 AM, Jeff Muizelaar <jmuiz...@mozilla.com>
> wrote:
>
>> On Fri, Feb 27, 2015 at 2:21 PM, Robert O'Callahan <rob...@ocallahan.org>
>> wrote:
>>> Oh, another issue is that I've followed the spec and made offsetX/Y
>>> doubles, whereas Blink is integers, which introduces a small amount
>> compat
>>> risk.
>>>
>>
>> IE also uses integers. Wouldn't it be better to change the spec to
>> follow the existing browser's behaviour?
>>
>
> In some ways, yes, although the extra accuracy given by doubles could be
> useful in practice.

Haven't changes from integer to doubles caused issues in some cases.
Boris might recall some examples.




>
> Rob
>

Chris Peterson

unread,
Mar 2, 2015, 1:00:31 AM3/2/15
to
On 2/27/15 7:25 PM, Robert O'Callahan wrote:
> On Sat, Feb 28, 2015 at 8:30 AM, Jeff Muizelaar<jmuiz...@mozilla.com>
> wrote:
>
>> >On Fri, Feb 27, 2015 at 2:21 PM, Robert O'Callahan<rob...@ocallahan.org>
>> >wrote:
>>> > >Oh, another issue is that I've followed the spec and made offsetX/Y
>>> > >doubles, whereas Blink is integers, which introduces a small amount
>> >compat
>>> > >risk.
>>> > >
>> >
>> >IE also uses integers. Wouldn't it be better to change the spec to
>> >follow the existing browser's behaviour?
>> >
> In some ways, yes, although the extra accuracy given by doubles could be
> useful in practice.

Gecko's offsetX/Y could return doubles, for compatibility with the spec,
that are always snapped to whole numbers, for compatibility with other
browsers.

Or Gecko could add random noise to the low bits of offsetX/Y so they are
*never* whole numbers. Web developers would need to handle fuzzy results
today, thus preparing for more precise results in the future. :)

Boris Zbarsky

unread,
Mar 2, 2015, 1:30:20 AM3/2/15
to
On 3/2/15 1:00 AM, Chris Peterson wrote:
> Gecko's offsetX/Y could return doubles, for compatibility with the spec,
> that are always snapped to whole numbers, for compatibility with other
> browsers.

How, precisely, is this different from returning integers? Remember,
this is JS we're talking about: there is only one Number type.

-Boris

Robert O'Callahan

unread,
Mar 2, 2015, 3:00:29 AM3/2/15
to Chris Peterson, dev-pl...@lists.mozilla.org
On Mon, Mar 2, 2015 at 7:00 PM, Chris Peterson <cpet...@mozilla.com>
wrote:

> Gecko's offsetX/Y could return doubles, for compatibility with the spec,
> that are always snapped to whole numbers, for compatibility with other
> browsers.
>
> Or Gecko could add random noise to the low bits of offsetX/Y so they are
> *never* whole numbers. Web developers would need to handle fuzzy results
> today, thus preparing for more precise results in the future. :)
>

Let's not overthink this :-)

Mike Taylor

unread,
Mar 2, 2015, 2:50:44 PM3/2/15
to smaug, dev-pl...@lists.mozilla.org, Boris Zbarsky
On 3/1/15 17:58, smaug wrote:
> Haven't changes from integer to doubles caused issues in some cases.
> Boris might recall some examples.

IE just reverted from using doubles on MouseEvent for compat reasons:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=28029#c6

--
Mike Taylor
Web Compat, Mozilla

Robert O'Callahan

unread,
Mar 2, 2015, 3:54:44 PM3/2/15
to Mike Taylor, dev-pl...@lists.mozilla.org, Boris Zbarsky, smaug
On Tue, Mar 3, 2015 at 8:49 AM, Mike Taylor <mi...@mozilla.com> wrote:

> On 3/1/15 17:58, smaug wrote:
>
>> Haven't changes from integer to doubles caused issues in some cases.
>> Boris might recall some examples.
>>
>
> IE just reverted from using doubles on MouseEvent for compat reasons:
> https://www.w3.org/Bugs/Public/show_bug.cgi?id=28029#c6
>

Ah, that's good to know! I'll change offsetX/Y to long then.
0 new messages