From a350224ed95a23b2a3fb5238013675c8226b93f2 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Fri, 28 Sep 2012 23:19:38 +1200 Subject: [PATCH] Bug 770106. nsDisplayButtonBorderBackground should use the button's border-box for hit-testing, not its visual overflow area. r=mattwoodrow --- layout/base/tests/Makefile.in | 1 + layout/base/tests/test_bug770106.html | 24 ++++++++++++++++++++++++ layout/forms/nsButtonFrameRenderer.cpp | 3 ++- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 layout/base/tests/test_bug770106.html diff --git a/layout/base/tests/Makefile.in b/layout/base/tests/Makefile.in index 66f06d21ac5..6d178c6ac24 100644 --- a/layout/base/tests/Makefile.in +++ b/layout/base/tests/Makefile.in @@ -147,6 +147,7 @@ MOCHITEST_FILES = \ test_bug725426.html \ test_bug731777.html \ test_bug761572.html \ + test_bug770106.html \ test_maxLineBoxWidth.html \ $(NULL) diff --git a/layout/base/tests/test_bug770106.html b/layout/base/tests/test_bug770106.html new file mode 100644 index 00000000000..ff440f73852 --- /dev/null +++ b/layout/base/tests/test_bug770106.html @@ -0,0 +1,24 @@ + + + + Test for Bug 770106 + + + + +Hello + + +
+
+
+ + diff --git a/layout/forms/nsButtonFrameRenderer.cpp b/layout/forms/nsButtonFrameRenderer.cpp index 7bea461c811..eeca1bef751 100644 --- a/layout/forms/nsButtonFrameRenderer.cpp +++ b/layout/forms/nsButtonFrameRenderer.cpp @@ -126,7 +126,8 @@ private: nsRect nsDisplayButtonBorderBackground::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) { *aSnap = false; - return mFrame->GetVisualOverflowRectRelativeToSelf() + ToReferenceFrame(); + return aBuilder->IsForEventDelivery() ? nsRect(ToReferenceFrame(), mFrame->GetSize()) + : mFrame->GetVisualOverflowRectRelativeToSelf() + ToReferenceFrame(); } class nsDisplayButtonForeground : public nsDisplayItem {