diff --git a/browser/base/content/tabview/modules/utils.jsm b/browser/base/content/tabview/modules/utils.jsm index 4555192c80f..0650369d35b 100644 --- a/browser/base/content/tabview/modules/utils.jsm +++ b/browser/base/content/tabview/modules/utils.jsm @@ -156,16 +156,16 @@ Rect.prototype = { // ---------- // Function: contains - // Returns a boolean denoting if the is contained inside - // of the bounding rect. + // Returns a boolean denoting if the given is contained within + // the this rectangle. // // Paramaters // - A contains: function Rect_contains(rect) { - return (rect.left > this.left && - rect.right < this.right && - rect.top > this.top && - rect.bottom < this.bottom); + return (rect.left >= this.left && + rect.right <= this.right && + rect.top >= this.top && + rect.bottom <= this.bottom); }, // ---------- diff --git a/browser/base/content/test/tabview/Makefile.in b/browser/base/content/test/tabview/Makefile.in index cb76aae2bad..c1fe877fa88 100644 --- a/browser/base/content/test/tabview/Makefile.in +++ b/browser/base/content/test/tabview/Makefile.in @@ -105,6 +105,7 @@ _BROWSER_FILES = \ browser_tabview_bug627736.js \ browser_tabview_bug628165.js \ browser_tabview_bug628270.js \ + browser_tabview_bug629189.js \ browser_tabview_bug629195.js \ browser_tabview_bug630102.js \ browser_tabview_bug630157.js \ diff --git a/browser/base/content/test/tabview/browser_tabview_bug629189.js b/browser/base/content/test/tabview/browser_tabview_bug629189.js new file mode 100644 index 00000000000..0b7504fd501 --- /dev/null +++ b/browser/base/content/test/tabview/browser_tabview_bug629189.js @@ -0,0 +1,14 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +function test() { + let {Rect} = Components.utils.import("resource:///modules/tabview/utils.jsm", {}); + + let referenceRect = new Rect(50,50,150,150); + let rect = new Rect(100,100,100,100); + + ok(referenceRect.contains(referenceRect), "A rect contains itself"); + ok(referenceRect.contains(rect), "[50,50,150,150] contains [100,100,99,99]"); + rect.inset(-1,-1); + ok(!referenceRect.contains(rect), "Now it grew and [50,50,150,150] doesn't contain [99,99,102,102]"); +}