Bug 1143972. Return 0,0 for offsetX/Y when the document has no presentation. r=mats

--HG--
extra : rebase_source : a80f1aa79a94ec48342b127fae35022eb3978835
This commit is contained in:
Robert O'Callahan 2015-03-18 02:04:32 +13:00
Родитель 71dce41197
Коммит fc9c32b6a2
3 изменённых файлов: 14 добавлений и 1 удалений

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

@ -980,7 +980,7 @@ Event::GetOffsetCoords(nsPresContext* aPresContext,
return GetPageCoords(aPresContext, aEvent, aPoint, aDefaultPoint);
}
nsCOMPtr<nsIContent> content = do_QueryInterface(aEvent->target);
if (!content) {
if (!content || !aPresContext) {
return CSSIntPoint(0, 0);
}
nsCOMPtr<nsIPresShell> shell = aPresContext->GetPresShell();

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

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<script>
var x;
function doTest() {
f.contentDocument.body.onclick = function (event) {
x = event.offsetX;
}
f.contentDocument.body.dispatchEvent(f.contentWindow.ev);
}
</script>
<iframe id="f" style="display:none" onload="doTest()"
src="data:text/html,<script>var ev = new MouseEvent('click', {clientX:0, clientY:0})</script>"></iframe>

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

@ -8,6 +8,7 @@ load 682637-1.html
load 1033343.html
load 1035654-1.html
load 1035654-2.html
load 1143972-1.html
needs-focus load 1072137-1.html
load eventctor-nulldictionary.html
load eventctor-nullstorage.html