Bug 576986 - Fix pointer-events on foreignObject with clip-path. r=roc

This commit is contained in:
Robert Longson 2010-07-15 09:10:59 +01:00
Родитель 8ce46d030d
Коммит 7f5a1766a5
2 изменённых файлов: 25 добавлений и 4 удалений

Просмотреть файл

@ -16,8 +16,18 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500174
<div width="100%" height="1" id="div">
</div>
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" id="svg">
<defs>
<clipPath id="clip">
<rect x="20" y="20" width="50" height="50"/>
</clipPath>
</defs>
<rect id="bad" width="100%" height="100%" fill="green"/>
<circle id="good" cx="50%" cy="50%" r="1" stroke-width="1000" fill="black" pointer-events="all"/>
<foreignObject id="fo" x="200" y="50" width="50" height="50" clip-path="url(#clip)">
<svg>
<rect width="100%" height="100%" fill="green"/>
</svg>
</foreignObject>
</svg>
</div>
@ -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();
}

Просмотреть файл

@ -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)