Bug 597931 - New CSS' Item bounds incorrectly include highlighting [r=ian, a=beltzner]
authorMichael Yoshitaka Erlewine <mitcho@mitcho.com>
Fri, 28 Jan 2011 21:53:15 +1300
changeset 61523 06d9df6ca0fa29bf6192e46f540bc3658e494cd4
parent 61522 58d8ac6ba70eac57ab8527456e9476c1f2a222c6
child 61524 51188908033fe5622d00beb98fe182249344ef76
push id18370
push userjwatt@jwatt.org
push dateFri, 28 Jan 2011 08:56:34 +0000
treeherdermozilla-central@06d9df6ca0fa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersian, beltzner
bugs597931
milestone2.0b11pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 597931 - New CSS' Item bounds incorrectly include highlighting [r=ian, a=beltzner]
browser/base/content/test/tabview/browser_tabview_bug587503.js
browser/themes/gnomestripe/browser/tabview/tabview.css
browser/themes/pinstripe/browser/tabview/tabview.css
browser/themes/winstripe/browser/tabview/tabview.css
--- a/browser/base/content/test/tabview/browser_tabview_bug587503.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug587503.js
@@ -33,72 +33,45 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 function test() {
   waitForExplicitFinish();
 
-  window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
-  if (TabView.isVisible())
-    onTabViewWindowLoaded();
-  else
-    TabView.show();
+  newWindowWithTabView(onTabViewWindowLoaded);
 }
 
-function onTabViewWindowLoaded() {
-  window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
+function onTabViewWindowLoaded(win) {
+  ok(win.TabView.isVisible(), "Tab View is visible");
 
-  ok(TabView.isVisible(), "Tab View is visible");
-
-  let contentWindow = document.getElementById("tab-view").contentWindow;
-  let [originalTab] = gBrowser.visibleTabs;
+  let contentWindow = win.document.getElementById("tab-view").contentWindow;
+  let [originalTab] = win.gBrowser.visibleTabs;
 
   let currentGroup = contentWindow.GroupItems.getActiveGroupItem();
 
   // Create a group and make it active
   let box = new contentWindow.Rect(100, 100, 400, 430);
   let group = new contentWindow.GroupItem([], { bounds: box });
   ok(group.isEmpty(), "This group is empty");
   contentWindow.GroupItems.setActiveGroupItem(group);
   
   // Create a bunch of tabs in the group
   let tabs = [];
-  tabs.push(gBrowser.loadOneTab("about:blank#0", {inBackground: true}));
-  tabs.push(gBrowser.loadOneTab("about:blank#1", {inBackground: true}));
-  tabs.push(gBrowser.loadOneTab("about:blank#2", {inBackground: true}));
-  tabs.push(gBrowser.loadOneTab("about:blank#3", {inBackground: true}));
-  tabs.push(gBrowser.loadOneTab("about:blank#4", {inBackground: true}));
-  tabs.push(gBrowser.loadOneTab("about:blank#5", {inBackground: true}));
-  tabs.push(gBrowser.loadOneTab("about:blank#6", {inBackground: true}));
+  tabs.push(win.gBrowser.loadOneTab("about:blank#0", {inBackground: true}));
+  tabs.push(win.gBrowser.loadOneTab("about:blank#1", {inBackground: true}));
+  tabs.push(win.gBrowser.loadOneTab("about:blank#2", {inBackground: true}));
+  tabs.push(win.gBrowser.loadOneTab("about:blank#3", {inBackground: true}));
+  tabs.push(win.gBrowser.loadOneTab("about:blank#4", {inBackground: true}));
+  tabs.push(win.gBrowser.loadOneTab("about:blank#5", {inBackground: true}));
+  tabs.push(win.gBrowser.loadOneTab("about:blank#6", {inBackground: true}));
 
   ok(!group.shouldStack(group._children.length), "Group should not stack.");
   is(group._columns, 3, "There should be three columns.");
-
-  // PREPARE FINISH:
-  group.addSubscriber(group, "close", function() {
-    group.removeSubscriber(group, "close");
-
-    ok(group.isEmpty(), "The group is empty again");
-
-    contentWindow.GroupItems.setActiveGroupItem(currentGroup);
-    isnot(contentWindow.GroupItems.getActiveGroupItem(), null, "There is an active group");
-    is(gBrowser.tabs.length, 1, "There is only one tab left");
-    is(gBrowser.visibleTabs.length, 1, "There is also only one visible tab");
-
-    let onTabViewHidden = function() {
-      window.removeEventListener("tabviewhidden", onTabViewHidden, false);
-      finish();
-    };
-    window.addEventListener("tabviewhidden", onTabViewHidden, false);
-    gBrowser.selectedTab = originalTab;
-
-    TabView.hide();
-  });
   
   // STAGE 1: move the last tab to the third position
   let currentTarget = tabs[6]._tabViewTabItem;
   let currentPos = currentTarget.getBounds().center();
   let targetPos = tabs[2]._tabViewTabItem.getBounds().center();
   let vector = new contentWindow.Point(targetPos.x - currentPos.x,
                                        targetPos.y - currentPos.y);
   checkDropIndexAndDropSpace(currentTarget, group, vector.x, vector.y, contentWindow,
@@ -158,37 +131,34 @@ function onTabViewWindowLoaded() {
             is(group._columns, 3, "There should be three columns.");
 
             // Now: 0, 6, 2, 3, 4, 5, 1
             is(index, 4, "Tab 5 is back and again the fifth tab.");
             contentWindow.Utils.log('dropSpaceActiveValues',dropSpaceActiveValues);
             is(dropSpaceActiveValues[0], false, "The group began by not showing a dropSpace");
             is(dropSpaceActiveValues[dropSpaceActiveValues.length - 1], true, "In the end, the group was showing a dropSpace");
             
-            // Get rid of the group and its children
-            // The group close will trigger a finish().
-            group.closeAll();
-            group.closeHidden();
+            // Close the window and we're done!
+            win.close();
+            finish();
           }, 6000, false);
         },1000);
         
       });
     
     });
 
   });
 }
 
 function simulateSlowDragDrop(srcElement, offsetX, offsetY, contentWindow, time) {
   // enter drag mode
   let dataTransfer;
 
-  // contentWindow.Utils.log('offset', offsetX, offsetY);
   let bounds = srcElement.getBoundingClientRect();
-  // contentWindow.Utils.log('original center', bounds.left + bounds.width / 2, bounds.top + bounds.height / 2);
 
   EventUtils.synthesizeMouse(
     srcElement, 2, 2, { type: "mousedown" }, contentWindow);
   let event = contentWindow.document.createEvent("DragEvents");
   event.initDragEvent(
     "dragenter", true, true, contentWindow, 0, 0, 0, 0, 0,
     false, false, false, false, 1, null, dataTransfer);
   srcElement.dispatchEvent(event);
--- a/browser/themes/gnomestripe/browser/tabview/tabview.css
+++ b/browser/themes/gnomestripe/browser/tabview/tabview.css
@@ -21,17 +21,16 @@ body {
   background-color: #D7D7D7;
   border-radius: 0.4em;
   box-shadow: 0 1px 0 #FFFFFF inset,
               0 -1px 1px rgba(255, 255, 255, 0.4) inset,
               1px 0 1px rgba(255, 255, 255, 0.4) inset,
               -1px 0 1px rgba(255, 255, 255, 0.4) inset,
               0 1px 1.5px rgba(0, 0, 0, 0.4);
   cursor: pointer;
-  margin: 4px;
 }
 
 html[dir=rtl] .tab {
   box-shadow: 0 1px 0 #FFFFFF inset,
               0 -1px 1px rgba(255, 255, 255, 0.4) inset,
               -1px 0 1px rgba(255, 255, 255, 0.4) inset,
               1px 0 1px rgba(255, 255, 255, 0.4) inset,
               0 1px 1.5px rgba(0, 0, 0, 0.4);
@@ -193,16 +192,17 @@ html[dir=rtl] .stack-trayed .tab-title {
 }
 
 /* Tab GroupItem
 ----------------------------------*/
 
 .tabInGroupItem {
   border: none;
   box-shadow: none !important;
+  margin: 4px;
 }
 
 .groupItem {
   cursor: move;
   border: 1px solid rgba(230,230,230,1);
   background-color: window;
   background-image: -moz-linear-gradient(rgba(255,255,255,.3),rgba(255,255,255,.1));
   border-radius: 0.4em;
--- a/browser/themes/pinstripe/browser/tabview/tabview.css
+++ b/browser/themes/pinstripe/browser/tabview/tabview.css
@@ -22,17 +22,16 @@ body {
   -moz-padding-end: 6px;
   padding-bottom: 6px;
   -moz-padding-start: 4px;
   background-color: #D7D7D7;
   border-radius: 0.4em;
   box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.4);
   border: 1px solid rgba(255, 255, 255, 0.5);
   cursor: pointer;
-  margin: 8px;
 }
 
 .tab canvas,
 .cached-thumb {
   border: 1px solid rgba(0, 0, 0, 0.3);
 }
 
 .thumb {
@@ -192,16 +191,17 @@ html[dir=rtl] .stack-trayed .tab-title {
 
 /* Tab GroupItem
 ----------------------------------*/
 
 .tabInGroupItem {
   box-shadow: none;
   border-color: transparent;
   background-color: transparent;
+  margin: 8px;
 }
 
 .tabInGroupItem .favicon {
   background-color: #EBEBEB;
 }
 
 .groupItem {
   cursor: move;
--- a/browser/themes/winstripe/browser/tabview/tabview.css
+++ b/browser/themes/winstripe/browser/tabview/tabview.css
@@ -22,17 +22,16 @@ body {
   border-radius: 0.4em;
   box-shadow:
     0 1px 0 #FFFFFF inset,
     0 -1px 1px rgba(255, 255, 255, 0.8) inset,
     1px 0 1px rgba(255, 255, 255, 0.8) inset,
     -1px 0 1px rgba(255, 255, 255, 0.8) inset,
     0 1px 1.5px rgba(4, 38, 60, 0.4);
   cursor: pointer;
-  margin: 4px;
 }
 
 html[dir=rtl] .tab {
   box-shadow:
     0 1px 0 #FFFFFF inset,
     0 -1px 1px rgba(255, 255, 255, 0.8) inset,
     -1px 0 1px rgba(255, 255, 255, 0.8) inset,
     1px 0 1px rgba(255, 255, 255, 0.8) inset,
@@ -206,16 +205,17 @@ html[dir=rtl] .tab.focus {
 }
 
 /* Tab GroupItem
 ----------------------------------*/
 
 .tabInGroupItem {
   box-shadow: none;
   background-color: #E0EAF5;
+  margin: 4px;
 }
 
 .tabInGroupItem .favicon {
   background-color: #E0EAF5;
 }
 
 .groupItem {
   cursor: move;