Last Comment Bug 554919 - Support panels which can be moved by dragging their background
: Support panels which can be moved by dragging their background
: dev-doc-complete
Product: Core
Classification: Components
Component: XP Toolkit/Widgets: XUL (show other bugs)
: Trunk
: All All
-- normal (vote)
: ---
Assigned To: Neil Deakin
: Neil Deakin
Depends on: 577377
  Show dependency treegraph
Reported: 2010-03-25 06:47 PDT by Neil Deakin
Modified: 2011-08-09 06:10 PDT (History)
8 users (show)
enndeakin: in‑testsuite+
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

implement this (3.72 KB, patch)
2010-07-07 15:23 PDT, Neil Deakin
no flags Details | Diff | Splinter Review
patch, with gtk support and test (8.58 KB, patch)
2011-03-21 06:48 PDT, Neil Deakin
dao+bmo: review-
Details | Diff | Splinter Review
Address comments (9.50 KB, patch)
2011-03-23 08:33 PDT, Neil Deakin
dao+bmo: review+
bugs: review+
Details | Diff | Splinter Review

Description User image Neil Deakin 2010-03-25 06:47:08 PDT
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 User image 2010-04-18 02:53:18 PDT
 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
Comment 2 User image Neil Deakin 2010-07-07 15:23:14 PDT
Created attachment 456350 [details] [diff] [review]
implement this
Comment 3 User image Neil Deakin 2011-03-21 06:48:19 PDT
Created attachment 520629 [details] [diff] [review]
patch, with gtk support and test
Comment 4 User image Dão Gottwald [:dao] 2011-03-21 07:04:58 PDT
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.
Comment 5 User image Neil Deakin 2011-03-23 08:33:00 PDT
Created attachment 521187 [details] [diff] [review]
Address comments
Comment 6 User image Olli Pettay [:smaug] (pto-ish for couple of days) 2011-03-23 09:12:17 PDT
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?
Comment 7 User image Neil Deakin 2011-03-23 09:25:02 PDT
There isn't a way to modify it currently. I can add that in a followup bug.
Comment 8 User image Dão Gottwald [:dao] 2011-03-24 08:54:06 PDT
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);
>+        }

Comment 10 User image Eric Shepherd [:sheppy] 2011-08-08 11:31:23 PDT
To clarify before I begin writing: this is about the new "backdrag" attribute on the XUL panel element, correct?
Comment 11 User image Neil Deakin 2011-08-08 15:17:18 PDT
Yes, setting backdrag="true" allows the panel to be moved around on the screen by dragging on a background area of the panel.

Note You need to log in before you can comment on or make changes to this bug.