Bug 587469 - Remove an image map quirk; r=mats

This commit is contained in:
Ms2ger 2011-03-26 11:59:54 -04:00
Родитель a7161e667f
Коммит 5a022749c7
3 изменённых файлов: 41 добавлений и 18 удалений

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

@ -226,6 +226,7 @@ _TEST_FILES = \
test_bug557087-5.html \
test_bug557087-6.html \
test_bug586763.html \
test_bug587469.html \
test_bug598643.html \
test_bug596350.html \
test_bug600155.html \

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

@ -0,0 +1,39 @@
<!-- Quirks -->
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=587469
-->
<head>
<title>Test for Bug 587469</title>
<script src="/MochiKit/packed.js"></script>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=587469">Mozilla Bug 587469</a>
<p id="display">
<map name=a></map>
<map name=a><area shape=rect coords=25,25,75,75 href=#fail></map>
<img usemap=#a src=image.png>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 587469 **/
SimpleTest.waitForExplicitFinish();
function finish() {
is(location.hash, "", "Should not have changed the hash.");
SimpleTest.finish();
}
SimpleTest.waitForFocus(function() {
synthesizeMouse(document.getElementsByTagName("img")[0], 50, 50, {});
setTimeout(finish, 50); // Sorry!
});
</script>
</pre>
</body>
</html>

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

@ -1165,7 +1165,6 @@ nsHTMLDocument::GetImageMap(const nsAString& aMapName)
mImageMaps = new nsContentList(this, kNameSpaceID_XHTML, nsGkAtoms::map, nsGkAtoms::map);
}
nsIDOMHTMLMapElement* firstMatch = nsnull;
nsAutoString name;
PRUint32 i, n = mImageMaps->Length(PR_TRUE);
for (i = 0; i < n; ++i) {
@ -1187,27 +1186,11 @@ nsHTMLDocument::GetImageMap(const nsAString& aMapName)
}
if (match) {
// Quirk: if the first matching map is empty, remember it, but keep
// searching for a non-empty one, only use it if none was found (bug 264624).
if (mCompatMode == eCompatibility_NavQuirks) {
nsCOMPtr<nsIDOMHTMLCollection> mapAreas;
rv = map->GetAreas(getter_AddRefs(mapAreas));
if (NS_SUCCEEDED(rv) && mapAreas) {
PRUint32 length = 0;
mapAreas->GetLength(&length);
if (length == 0) {
if (!firstMatch) {
firstMatch = map;
}
continue;
}
}
}
return map;
}
}
return firstMatch;
return NULL;
}
void