Backed out 3 changesets (bug 102663, bug 915962) for crashing constantly. a=me

Backed out changeset 984018eae04a (bug 102663)
Backed out changeset ec40bfefa08d (bug 915962)
Backed out changeset 79aeff6684f6 (bug 915962)
This commit is contained in:
Kyle Huey 2015-04-21 09:19:01 -07:00
Родитель c560e33395
Коммит 044aeb9cda
4 изменённых файлов: 26 добавлений и 111 удалений

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

@ -24,7 +24,6 @@
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsFocusManager.h"
#include "nsIFormControl.h"
#include "nsIDOMEventListener.h"
#include "nsPIDOMWindow.h"
#include "nsPIWindowRoot.h"
@ -477,17 +476,34 @@ nsXBLPrototypeHandler::DispatchXBLCommand(EventTarget* aTarget, nsIDOMEvent* aEv
nsFocusManager::GetFocusedDescendant(windowToCheck, true, getter_AddRefs(focusedWindow));
}
// If the focus is in an editable region, don't scroll.
if (focusedContent->IsEditable()) {
return NS_OK;
}
bool isLink = false;
nsIContent *content = focusedContent;
// If the focus is in a form control, don't scroll.
for (nsIContent* c = focusedContent; c; c = c->GetParent()) {
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(c);
if (formControl) {
return NS_OK;
// if the focused element is a link then we do want space to
// scroll down. The focused element may be an element in a link,
// we need to check the parent node too. Only do this check if an
// element is focused and has a parent.
if (focusedContent && focusedContent->GetParent()) {
while (content) {
if (content->IsHTMLElement(nsGkAtoms::a)) {
isLink = true;
break;
}
if (content->HasAttr(kNameSpaceID_XLink, nsGkAtoms::type)) {
isLink = content->AttrValueIs(kNameSpaceID_XLink, nsGkAtoms::type,
nsGkAtoms::simple, eCaseMatters);
if (isLink) {
break;
}
}
content = content->GetParent();
}
if (!isLink)
return NS_OK;
}
}

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

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<button>Button</button>
<img src="green.png" usemap="#map">
<map name="map">
<!-- This URL ensures that the link doesn't get clicked, since
mochitests cannot access the outside network. -->
<area shape="rect" coords="0,0,10,10" href="https://youtube.com/">
</map>
<div style="height: 20000px;" tabindex="-1"><hr></div>
</body>
</html>

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

@ -9,7 +9,6 @@ support-files =
file_bug549262.html
file_bug586662.html
file_bug674770-1.html
file_bug915962.html
file_select_all_without_body.html
green.png
spellcheck.js
@ -138,8 +137,6 @@ skip-if = toolkit == 'android' || e10s
[test_bug832025.html]
[test_bug857487.html]
[test_bug858918.html]
[test_bug915962.html]
skip-if = toolkit == 'android' || e10s
[test_bug966155.html]
skip-if = os != "win"
[test_bug966552.html]

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

@ -1,85 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=915962
-->
<head>
<title>Test for Bug 915962</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=915962">Mozilla Bug 915962</a>
<p id="display"></p>
<div id="content">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 915962 **/
var smoothScrollPref = "general.smoothScroll";
SimpleTest.waitForExplicitFinish();
var win = window.open("file_bug915962.html", "_blank",
"width=600,height=600,scrollbars=yes");
// grab the timer right at the start
var cwu = SpecialPowers.getDOMWindowUtils(win);
function step() {
cwu.advanceTimeAndRefresh(100);
}
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, startTest);
}, win);
function startTest() {
// Make sure that pressing Space when a tabindex=-1 element is focused
// will scroll the page.
var button = win.document.querySelector("button");
var sc = win.document.querySelector("div");
sc.focus();
is(win.scrollY, 0, "Sanity check");
synthesizeKey(" ", {}, win);
step();
isnot(win.scrollY, 0, "Page is scrolled down");
var oldY = win.scrollY;
synthesizeKey(" ", {shiftKey: true}, win);
step();
ok(win.scrollY < oldY, "Page is scrolled up");
// Make sure that pressing Space when a tabindex=-1 element is focused
// will not scroll the page, and will activate the element.
button.focus();
var clicked = false;
button.onclick = () => clicked = true;
oldY = win.scrollY;
synthesizeKey(" ", {}, win);
step();
ok(win.scrollY <= oldY, "Page is not scrolled down");
ok(clicked, "The button should be clicked");
synthesizeKey("VK_TAB", {}, win);
step();
oldY = win.scrollY;
synthesizeKey(" ", {}, win);
step()
ok(win.scrollY >= oldY, "Page is scrolled down");
win.close();
cwu.restoreNormalRefresh();
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>