Closed Bug 751663 Opened 13 years ago Closed 13 years ago

Implement new device proximity like event that fires only when the screen is close to the user's face.

Categories

(Core :: DOM: Device Interfaces, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla15

People

(Reporter: dougt, Assigned: dougt)

Details

Attachments

(1 file)

as a follow up to 738131 -- Me: > I'd be happy with some specialized event - a separate event that gets fired > only when the value changes. Jonas: > That would be even better! I guess we can do that as a followup yes
Assignee: nobody → doug.turner
The details are being spec'ed out in the dap wg. more to follow.
Attached patch patch v.1Splinter Review
Attachment #624185 - Flags: review?(bugs)
Comment on attachment 624185 [details] [diff] [review] patch v.1 >+// UserProximityEvent >+e = new UserProximityEvent("hello", {near: false}); >+ok(e.type, "hello", "Wrong event type!"); >+ok(!e.isTrusted, "Event should not be trusted"); >+is(e.near, false, "near should be false"); Please test near: true case, since false is the default value. >-[scriptable, uuid(8fc58f56-f769-4368-a098-edd08550cf1a)] >+[scriptable, uuid(f51bfe5f-cda7-4c9b-96b3-ec37817f91b8)] > interface nsIDOMMozURLProperty : nsISupports > { Unrelated change > nsDeviceSensors::nsDeviceSensors() > { >+ mIsUserProximityNear = true; I would have assumed the initial value was false. >+nsDeviceSensors::FireDOMUserProximityEvent(nsIDOMEventTarget *aTarget, bool aNear) >+{ >+ nsCOMPtr<nsIDOMEvent> event; >+ NS_NewDOMUserProximityEvent(getter_AddRefs(event), nsnull, nsnull); >+ nsCOMPtr<nsIDOMUserProximityEvent> pe = do_QueryInterface(event); >+ >+ pe->InitUserProximityEvent(NS_LITERAL_STRING("userproximity"), >+ true, >+ false, >+ aNear); You have tabs in this code. Please use spaces. Check also rest of the patch. > >+ void FireDOMUserProximityEvent(nsIDOMEventTarget *aTarget, >+ bool aNear); At least here as well
Attachment #624185 - Flags: review?(bugs) → review+
(In reply to Doug Turner (:dougt) from comment #3) > example page: http://dl.dropbox.com/u/8727858/mozilla/proximity/user.html > > spec draft: > http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/userproximity.html To clarify: the W3C Device APIs working group has not yet reached an agreement on the spec design. There's an alternative design on the table. See the proximitystate attribute section below: http://dvcs.w3.org/hg/dap/raw-file/tip/proximity/Overview.html#the-proximitystate-attribute The above proposal addresses the following use case that is presumably not addressed by what is being implemented in this patch: http://lists.w3.org/Archives/Public/public-device-apis/2012May/0103.html Given the prototype, you should experiment whether the concern raised above is valid, and provide feedback to the working group so that it can make an educated choice on the design. From an implementor's PoV it may make sense to re-use as much of the Device Proximity patch (https://bugzil.la/738131) as possible, but a good design should consider users and use cases over authors over implementors, IMHO.
Anssi, thanks for your comments. > To clarify: the W3C Device APIs working group has not yet reached an agreement on the spec design. We typically do not wait for the w3c dap to reach agreement. > Given the prototype, you should experiment whether the concern raised above is valid, and provide feedback to the working group so that it can make an educated choice on the design. Yup. That is why we implement early. > From an implementor's PoV it may make sense to re-use as much of the Device Proximity patch (https://bugzil.la/738131) as possible, but a good design should consider users and use cases over authors over implementors, IMHO. That is what we did. This bug is for the firefox specific implementation. Feel free to take these concerns to the w3c dap mailing list. Doug
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla15
Comment on attachment 624185 [details] [diff] [review] patch v.1 Review of attachment 624185 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/system/nsDeviceSensors.cpp @@ +301,5 @@ > + false, > + aNear); > + > + nsCOMPtr<nsIPrivateDOMEvent> privateEvent = do_QueryInterface(event); > + privateEvent = do_QueryInterface(event); Eh.
Ugh, I should have noticed that.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: