Backed out changeset 2b2de9cc2f59 (bug 849438) for B2G mochitest failures.

This commit is contained in:
Ryan VanderMeulen 2013-03-19 16:44:14 -04:00
parent b7dd030514
commit aec7121812
5 changed files with 20 additions and 87 deletions

View File

@ -334,12 +334,6 @@ public:
*/
static bool IsHTMLWhitespace(PRUnichar aChar);
/*
* Returns whether the character is an HTML whitespace (see IsHTMLWhitespace)
* or a nbsp character (U+00A0).
*/
static bool IsHTMLWhitespaceOrNBSP(PRUnichar aChar);
/**
* Is the HTML local name a block element?
*/

View File

@ -1199,13 +1199,6 @@ nsContentUtils::IsHTMLWhitespace(PRUnichar aChar)
aChar == PRUnichar(0x0020);
}
/* static */
bool
nsContentUtils::IsHTMLWhitespaceOrNBSP(PRUnichar aChar)
{
return IsHTMLWhitespace(aChar) || aChar == PRUnichar(0xA0);
}
/* static */
bool
nsContentUtils::IsHTMLBlock(nsIAtom* aLocalName)
@ -2165,9 +2158,6 @@ nsContentUtils::TrimWhitespace<nsCRT::IsAsciiSpace>(const nsAString&, bool);
template
const nsDependentSubstring
nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespace>(const nsAString&, bool);
template
const nsDependentSubstring
nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespaceOrNBSP>(const nsAString&, bool);
static inline void KeyAppendSep(nsACString& aKey)
{

View File

@ -2472,32 +2472,28 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
startIndex++;
}
for (uint32_t i = 0; i < numOptions; ++i) {
uint32_t i;
for (i = 0; i < numOptions; i++) {
uint32_t index = (i + startIndex) % numOptions;
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement = GetOption(options, index);
if (!optionElement) {
continue;
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement =
GetOption(options, index);
if (optionElement) {
nsAutoString text;
if (NS_OK == optionElement->GetText(text)) {
if (StringBeginsWith(text, incrementalString,
nsCaseInsensitiveStringComparator())) {
bool wasChanged = PerformSelection(index, isShift, isControl);
if (wasChanged) {
// dispatch event, update combobox, etc.
if (!UpdateSelection()) {
return NS_OK;
}
}
break;
}
}
}
nsAutoString text;
if (NS_FAILED(optionElement->GetText(text)) ||
!StringBeginsWith(nsContentUtils::TrimWhitespace<nsContentUtils::IsHTMLWhitespaceOrNBSP>(text, false),
incrementalString,
nsCaseInsensitiveStringComparator())) {
continue;
}
if (!PerformSelection(index, isShift, isControl)) {
break;
}
// If UpdateSelection() returns false, that means the frame is no longer
// alive. We should stop doing anything.
if (!UpdateSelection()) {
return NS_OK;
}
break;
}
} // for
} break;//case
} // switch

View File

@ -44,7 +44,6 @@ MOCHITEST_FILES = test_bug231389.html \
test_bug644542.html \
test_bug672810.html \
test_bug704049.html \
test_listcontrol_search.html \
$(NULL)
MOCHITEST_CHROME_FILES = \

View File

@ -1,46 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=849438
-->
<head>
<meta charset="utf-8">
<title>Test for &lt;select&gt; list control search</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** This test will focus a select element and press a key that matches the
first non-space character of an entry. **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
var select = document.getElementsByTagName('select')[0];
select.focus();
synthesizeKey('a', {});
is(select.options[0].selected, false, "the first option isn't selected");
is(select.options[1].selected, true, "the second option is selected");
select.blur();
SimpleTest.finish();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=849438">Mozilla Bug 849438</a>
<p id="display"></p>
<div id="content">
<select>
<option>Please select an entry</option>
<option>&nbsp;a</option>
<option>&nbsp;b</option>
</select>
</div>
<pre id="test">
</pre>
</body>
</html>