Support panels which can be moved by dragging their background




XP Toolkit/Widgets: XUL
8 years ago
6 years ago


(Reporter: Neil Deakin (mostly unavailable until September), Assigned: Neil Deakin (mostly unavailable until September))



Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)



(1 attachment, 2 obsolete attachments)

This involves:
 - modifying WindowDraggingUtils.jsm to support panels as well as windows
 - hooking this up if some attribute is set on the panel

Comment 1

7 years ago
 popup's moveTo method

<method name="moveTo">
        <parameter name="aLeft"/>
        <parameter name="aTop"/>
          this.popupBoxObject.moveTo(aLeft, aTop);
uses popupBoxObject property

<property name="popupBoxObject">
          return this.boxObject.QueryInterface(Components.interfaces.nsIPopupBoxObject);

which calls QueryInterface every time without a reason, making everything slow

so making lazygetter for popupBoxObject is needed for this too
Depends on: 552982
Depends on: 577377
No longer depends on: 552982
Created attachment 456350 [details] [diff] [review]
implement this
Assignee: nobody → enndeakin
Created attachment 520629 [details] [diff] [review]
patch, with gtk support and test
Attachment #456350 - Attachment is obsolete: true
Attachment #520629 - Flags: review?(dao)
Comment on attachment 520629 [details] [diff] [review]
patch, with gtk support and test

>   handleEvent: function(aEvent) {
>-#ifdef XP_WIN
>-    if (this.shouldDrag(aEvent))
>-      aEvent.preventDefault();
>     switch (aEvent.type) {
>       case "mousedown":
>         if (!this.shouldDrag(aEvent))
>           return;
>+        let isPanel = this.isPanel();
>+#ifdef XP_WIN
>+        if (!isPanel) {
>+          aEvent.preventDefault();
>+          return;
>+        }

This new code seems unreachable, since MozMouseHittest is used instead of mousedown in the XP_WIN case.

>--- a/toolkit/content/widgets/popup.xml
>+++ b/toolkit/content/widgets/popup.xml

>+      <field name="_alive">true</field>

That doesn't work this way anymore, we changed this in bug 624157.

smaug, sicking, jst or bz should probably review the change to beginWindowMove.
Attachment #520629 - Flags: review?(dao) → review-
Created attachment 521187 [details] [diff] [review]
Address comments
Attachment #520629 - Attachment is obsolete: true
Attachment #521187 - Flags: review?(dao)
Attachment #521187 - Flags: review?(Olli.Pettay)

Comment 6

7 years ago
Comment on attachment 521187 [details] [diff] [review]
Address comments

r+ for the dom/ part.

Is 'backdrag' such attribute that it can be set only before ctor has
run? Is there some way to disable the feature for sometime and then
enable it again?
Attachment #521187 - Flags: review?(Olli.Pettay) → review+
There isn't a way to modify it currently. I can add that in a followup bug.
Comment on attachment 521187 [details] [diff] [review]
Address comments

WindowDraggingUtils.jsm doesn't seem to handle elements inside of panels in a sensible way. This can be taken care of in a separate bug (I could do it in bug 574971).

>+        if (isPanel) {
>+          var screenRect = this._elem.getOuterScreenRect();
>+          this._deltaX = aEvent.screenX - screenRect.left;
>+          this._deltaY = aEvent.screenY -;
>+        }

>+        if (this._draggingWindow) {
>+          var toDrag = this.isPanel() ? this._elem : this._window;
>+          toDrag.moveTo(aEvent.screenX - this._deltaX, aEvent.screenY - this._deltaY);
>+        }

Attachment #521187 - Flags: review?(dao) → review+
Last Resolved: 6 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Keywords: dev-doc-needed
To clarify before I begin writing: this is about the new "backdrag" attribute on the XUL panel element, correct?
Yes, setting backdrag="true" allows the panel to be moved around on the screen by dragging on a background area of the panel.
Documentation written:

Pages updated:

And listed on Firefox 7 for developers.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.