Closed Bug 725388 Opened 13 years ago Closed 13 years ago

Expose the Orion mouse events in the Source Editor

Categories

(DevTools :: General, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 13

People

(Reporter: msucan, Assigned: livathinos.spyros)

References

Details

(Whiteboard: [sourceeditor][good first bug][mentor=msucan][lang=js])

Attachments

(1 file, 4 obsolete files)

We need to allow listeners for mouseover, mousemove and mouseout in the Source Editor.
Blocks: 725392
Assignee: nobody → livathinos.spyros
Status: NEW → ASSIGNED
Attached patch Proposed fix with testcase. (obsolete) — Splinter Review
I added the three events from Orion (MouseOver, MouseOut, MouseMove) and mapped them to the Source Editor's known events collection.
Attachment #596621 - Flags: feedback?(mihai.sucan)
Attached patch Proposed fix with testcase. (obsolete) — Splinter Review
Wrong test on the previous attachment.
Attachment #596621 - Attachment is obsolete: true
Attachment #596621 - Flags: feedback?(mihai.sucan)
Attachment #596652 - Flags: feedback?(mihai.sucan)
Comment on attachment 596652 [details] [diff] [review] Proposed fix with testcase. Review of attachment 596652 [details] [diff] [review]: ----------------------------------------------------------------- This is awesome! Thanks a lot for your patch Spyros! This is looking good, but please address the comments below. Looking forward for the updated patch! ::: browser/devtools/sourceeditor/source-editor.jsm @@ +167,5 @@ > + * annotation. The event object properties: > + * > + * - lineIndex - the line index of the annotation under the pointer. > + * - e - the mouse move event. > + */ This comments are not the right ones. In orion.js you saw the onMouseOver/Move/Out methods of the Ruler object. Search for the onMouseMove of the TextView object, see line 3747. The actual event objects are in the _createMouseEvent() method of the TextView object: event, x and y. The event property is the actual DOM mouse event, and the x and y coordinates are the "document coordinates" - these are absolute pixel coordinates of the mouse event where it happened, irrespective of the view scroll. So, in bug 725392 we will add a method to convert these coordinates to character offsets in the document. ::: browser/devtools/sourceeditor/test/browser_bug725388_mouse_events.js @@ +39,5 @@ > +{ > + let mMoveHandler = function(aEvent) { > + editor.removeEventListener(SourceEditor.EVENTS.MOUSE_MOVE, mMoveHandler); > + > + ok(aEvent, "MouseMove event fired."); Please check in each event handler that aEvent.event.type is what we expect: mousemove, mouseout and mouseover. @@ +60,5 @@ > + > + let text = "BrowserBug - 725388"; > + editor.setText(text); > + > + let target = view._clientDiv; Please use the editor.editorElement object as target. Tests should not rely on editor._view, nor view._clientDiv - these are private properties. We use these in very few tests under strict rules: that is, if things can't be tested otherwise (for example the drag and drop tests do this). Please let me know if you can't get this to work without relying on private properties. Thanks! @@ +65,5 @@ > + let targetWin = target.ownerDocument.defaultView; > + > + editor.addEventListener(SourceEditor.EVENTS.MOUSE_MOVE, mMoveHandler); > + editor.addEventListener(SourceEditor.EVENTS.MOUSE_OVER, mOverHandler); > + editor.addEventListener(SourceEditor.EVENTS.MOUSE_OUT, mOutHandler); Please do these tests in sequence, or add a counter-like function that tracks that all these events fired, so you can end the test only when all of these events fired. Currently the test ends prematurely if mouseout happens first. Thanks!
Attachment #596652 - Flags: feedback?(mihai.sucan)
I also noticed the patch has trailing whitespaces. Please make sure patches do not have trailing whitespaces. hg qdiff/diff with colors enabled shows if you have such whitespace in red.
Attached patch Proposed fix with testcase. (obsolete) — Splinter Review
Made changes according to Mihai's comments (removed trailing whitespace, broke the test into separate steps etc.)
Attachment #596652 - Attachment is obsolete: true
Attachment #597352 - Flags: feedback?(mihai.sucan)
Comment on attachment 597352 [details] [diff] [review] Proposed fix with testcase. Review of attachment 597352 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for your updated patch Spyros! This is almost ready to land. Please update it based on the comments below. ::: browser/devtools/sourceeditor/source-editor.jsm @@ +164,5 @@ > + > + /** > + * The MouseMove event is sent when the user moves the mouse over a line > + * annotation. The event object properties: > + * - e - the mouse move event. The list of object properties needs to be: - event - the DOM mousemove event object. - x and y - the mouse coordinates relative to the document being edited. (same for all of the three mouse events) ::: browser/devtools/sourceeditor/test/browser_bug725388_mouse_events.js @@ +78,5 @@ > + > + editor.focus(); > + waitForFocus(function() { > + EventUtils.synthesizeMouse(target, 1, 1, {type: "mousemove"}, > + targetWin); nit: indentation problems.
Attachment #597352 - Flags: feedback?(mihai.sucan) → feedback+
Attached patch Proposed fix with testcase. (obsolete) — Splinter Review
Updated patch, fixed mouse event description and indentation issues.
Attachment #597352 - Attachment is obsolete: true
Attachment #597503 - Flags: feedback?(mihai.sucan)
Comment on attachment 597503 [details] [diff] [review] Proposed fix with testcase. Review of attachment 597503 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for the quick update! ::: browser/devtools/sourceeditor/source-editor.jsm @@ +172,5 @@ > + > + /** > + * The MouseOver event is sent when the mouse pointer enters a line > + * annotation. The event object properties: > + * - event - the DOM mousemove event object. This should be "mouseover". @@ +180,5 @@ > + > + /** > + * This MouseOut event is sent when the mouse pointer exits a line > + * annotation. The event object properties: > + * - event - the DOM mousemove event object. This should be "mouseout".
Attachment #597503 - Flags: feedback?(mihai.sucan) → feedback+
Fixed...
Attachment #597503 - Attachment is obsolete: true
Attachment #597522 - Flags: feedback?(mihai.sucan)
Comment on attachment 597522 [details] [diff] [review] [in-fx-team] Proposed fix with testcase. Review of attachment 597522 [details] [diff] [review]: ----------------------------------------------------------------- Thanks for your contribution! Awesome work!
Attachment #597522 - Flags: feedback?(mihai.sucan) → review+
This is ready to land!
Whiteboard: [sourceeditor][good first bug][mentor=msucan][lang=js] → [sourceeditor][good first bug][mentor=msucan][lang=js][land-in-fx-team]
Attachment #597522 - Attachment description: Proposed fix with testcase. → [in-fx-team] Proposed fix with testcase.
Spyros: thanks a lot for your awesome contributions!
Whiteboard: [sourceeditor][good first bug][mentor=msucan][lang=js][land-in-fx-team] → [sourceeditor][good first bug][mentor=msucan][lang=js][fixed-in-fx-team]
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [sourceeditor][good first bug][mentor=msucan][lang=js][fixed-in-fx-team] → [sourceeditor][good first bug][mentor=msucan][lang=js]
Target Milestone: --- → Firefox 13
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: