Bug 1451256 - Dump inner and outer element size. draft
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Tue, 08 May 2018 19:21:00 +0100
changeset 792603 8993df98cdb2d5cdcc7bc65a7cfb7aeceb4cfc5e
parent 792602 b928280e1209efd6097ecb73b4a8696bc1990b58
push id109160
push userpaolo.mozmail@amadzone.org
push dateTue, 08 May 2018 18:26:56 +0000
bugs1451256
milestone62.0a1
Bug 1451256 - Dump inner and outer element size. MozReview-Commit-ID: 8PqjgnY28Hn
browser/components/customizableui/CustomizeMode.jsm
browser/components/customizableui/test/browser_876926_customize_mode_wrapping.js
toolkit/content/widgets/toolbar.xml
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -1669,16 +1669,20 @@ CustomizeMode.prototype = {
     dt.effectAllowed = "move";
 
     let itemRect = this._dwu.getBoundsWithoutFlushing(draggedItem);
     let itemCenter = {x: itemRect.left + itemRect.width / 2,
                       y: itemRect.top + itemRect.height / 2};
     this._dragOffset = {x: aEvent.clientX - itemCenter.x,
                         y: aEvent.clientY - itemCenter.y};
 
+    let outerRect = this._dwu.getBoundsWithoutFlushing(item);
+    dump("Outer: " + outerRect.width + "x" + outerRect.height + "\n");
+    dump("Inner: " + itemRect.width + "x" + itemRect.height + "\n");
+
     let toolbarParent = draggedItem.closest("toolbar");
     if (toolbarParent) {
       let toolbarRect = this._dwu.getBoundsWithoutFlushing(toolbarParent);
       toolbarParent.style.minHeight = toolbarRect.height + "px";
     }
 
     gDraggingInToolbars = new Set();
 
--- a/browser/components/customizableui/test/browser_876926_customize_mode_wrapping.js
+++ b/browser/components/customizableui/test/browser_876926_customize_mode_wrapping.js
@@ -108,23 +108,26 @@ function isLastVisibleInToolbar(containe
 function isFirst(containerId, defaultPlacements, id) {
   assertAreaPlacements(containerId, [id].concat(defaultPlacements));
   is(document.getElementById(containerId).customizationTarget.firstChild.firstChild.id, id,
      "Widget " + id + " should be in " + containerId + " in customizing window.");
   is(otherWin.document.getElementById(containerId).customizationTarget.firstChild.id, id,
      "Widget " + id + " should be in " + containerId + " in other window.");
 }
 
+let count = 0;
+
 async function checkToolbar(id, method) {
   // Place at start of the toolbar:
   let toolbarPlacements = getAreaWidgetIds(kToolbar);
   await move[method](id, kToolbar);
   if (method == "dragToItem") {
     isFirst(kToolbar, toolbarPlacements, id);
   } else if (method == "drag") {
+    if (++count == 2) { await new Promise(() => {}); }
     isLastVisibleInToolbar(kToolbar, toolbarPlacements, id);
   } else {
     isLast(kToolbar, toolbarPlacements, id);
   }
   checkWrapper(id);
 }
 
 async function checkPanel(id, method) {
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -120,17 +120,17 @@
                      this.getAttribute("customizing") != "true";
             };
           } catch (e) {}
         }
       ]]></constructor>
     </implementation>
   </binding>
 
-  <binding id="toolbarpaletteitem">
+  <binding id="toolbarpaletteitem" extends="xul:button">
     <content>
       <xul:hbox class="toolbarpaletteitem-box" flex="1" xbl:inherits="type,place">
         <children/>
       </xul:hbox>
     </content>
   </binding>
 
   <binding id="toolbarpaletteitem-palette" extends="chrome://global/content/bindings/toolbar.xml#toolbarpaletteitem">