Bug 676387 - XUL elements with -moz-appearance should ignore clicks in their overflow. r=roc
authorMarkus Stange <mstange@themasta.com>
Mon, 08 Aug 2011 20:31:52 +0200
changeset 74005 e45e7a591956184c18ef55fa18e5a3044012a63a
parent 74004 845547a3c2813c425313aa29d81d5ec574ca8d85
child 74006 10c2c74197fc6dbdd4a761104eec6ca841d42f0b
push id1052
push usermstange@themasta.com
push dateMon, 08 Aug 2011 18:34:37 +0000
treeherdermozilla-inbound@10c2c74197fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs676387
milestone8.0a1
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 676387 - XUL elements with -moz-appearance should ignore clicks in their overflow. r=roc
layout/base/nsDisplayList.cpp
layout/reftests/native-theme/676387-1-ref.xul
layout/reftests/native-theme/676387-1.xul
layout/reftests/native-theme/reftest.list
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -1018,22 +1018,25 @@ static PRBool RoundedRectContainsRect(co
 }
 
 void
 nsDisplayBackground::HitTest(nsDisplayListBuilder* aBuilder,
                              const nsRect& aRect,
                              HitTestState* aState,
                              nsTArray<nsIFrame*> *aOutFrames)
 {
-  // For theme backgrounds, assume that any point in our bounds is a hit.
-  // We don't know the true hit region of the theme background.
-  if (!mIsThemed &&
-      !RoundedBorderIntersectsRect(mFrame, ToReferenceFrame(), aRect)) {
-    // aRect doesn't intersect our border-radius curve.
-    return;
+  if (mIsThemed) {
+    // For theme backgrounds, assume that any point in our border rect is a hit.
+    if (!nsRect(ToReferenceFrame(), mFrame->GetSize()).Intersects(aRect))
+      return;
+  } else {
+    if (!RoundedBorderIntersectsRect(mFrame, ToReferenceFrame(), aRect)) {
+      // aRect doesn't intersect our border-radius curve.
+      return;
+    }
   }
 
   aOutFrames->AppendElement(mFrame);
 }
 
 PRBool
 nsDisplayBackground::ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                        nsRegion* aVisibleRegion,
new file mode 100644
--- /dev/null
+++ b/layout/reftests/native-theme/676387-1-ref.xul
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<window id="window676387-1-ref"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+  <hbox><button id="button" label="SUCCESS"/></hbox>
+</window>
new file mode 100644
--- /dev/null
+++ b/layout/reftests/native-theme/676387-1.xul
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<window id="window676387-1"
+        class="reftest-wait"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+        onload="var button = document.getElementById('button');
+                var r = button.getBoundingClientRect();
+                if (document.elementFromPoint(r.right, r.top) == button.parentNode)
+                  button.label = 'SUCCESS';
+                document.documentElement.className = '';">
+  <hbox><button id="button" label="FAIL"/></hbox>
+</window>
--- a/layout/reftests/native-theme/reftest.list
+++ b/layout/reftests/native-theme/reftest.list
@@ -73,8 +73,10 @@ skip-if(!winWidget) == scroll-thumb-mini
 
 == checkbox-dynamic-1.html checkbox-dynamic-1-ref.html
 
 # These tests have been written to test the overflow of the window widget
 # (bug 568825) but we can't test it on Windows and Cocoa because they have
 # animated progress bars.
 skip-if(cocoaWidget) skip-if(winWidget) == progress-overflow.html progress-overflow-ref.html
 skip-if(cocoaWidget) skip-if(winWidget) != progress-overflow-small.html progress-nobar.html
+
+== 676387-1.xul 676387-1-ref.xul