diff --git a/content/svg/content/test/test_pointer-events.xhtml b/content/svg/content/test/test_pointer-events.xhtml
index c209848af6a..255503bfea5 100644
--- a/content/svg/content/test/test_pointer-events.xhtml
+++ b/content/svg/content/test/test_pointer-events.xhtml
@@ -16,8 +16,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500174
@@ -30,10 +40,17 @@ SimpleTest.waitForExplicitFinish();
function run()
{
var svgDoc = document.getElementById('svg');
- var bad = document.getElementById('bad');
+ var div = document.getElementById("div");
+ var x = div.offsetLeft;
+ var y = div.offsetTop;
var good = document.getElementById('good');
- var elementFromPoint = document.elementFromPoint(50, 50);
- is(elementFromPoint, good, 'pointer-events="all"');
+ var fo = document.getElementById('fo');
+ var elementFromPoint = document.elementFromPoint(55 + x, 55 + y);
+ is(good, elementFromPoint, 'pointer-events="all"');
+ elementFromPoint = document.elementFromPoint(205 + x, 55 + y);
+ is(good, elementFromPoint, 'foreignObject with clip-path');
+ elementFromPoint = document.elementFromPoint(205 + x + 20, 55 + y + 20);
+ is(fo, elementFromPoint, 'foreignObject with clip-path');
SimpleTest.finish();
}
diff --git a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
index cfd4b7826b1..62348b042f1 100644
--- a/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
+++ b/layout/svg/base/src/nsSVGForeignObjectFrame.cpp
@@ -311,7 +311,11 @@ nsSVGForeignObjectFrame::GetFrameForPoint(const nsPoint &aPoint)
pt = pt * nsPresContext::AppUnitsPerCSSPixel();
nsPoint point = nsPoint(NSToIntRound(pt.x), NSToIntRound(pt.y));
- return nsLayoutUtils::GetFrameForPoint(kid, point);
+ nsIFrame *frame = nsLayoutUtils::GetFrameForPoint(kid, point);
+ if (frame && nsSVGUtils::HitTestClip(this, aPoint))
+ return frame;
+
+ return nsnull;
}
NS_IMETHODIMP_(nsRect)