This commit is contained in:
Brendan Eich 2008-06-19 12:54:20 -07:00
commit 4e5be946f8
10 changed files with 121 additions and 21 deletions

View File

@ -102,9 +102,14 @@ nsHTMLLinkAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
nsLinkState linkState;
link->GetLinkState(linkState);
if (linkState == eLinkState_NotLink) {
// This is a named anchor, not a link with also a name attribute. bail out.
return NS_OK;
if (linkState == eLinkState_NotLink || linkState == eLinkState_Unknown) {
// This is a either named anchor (a link with also a name attribute) or
// it doesn't have any attributes. Check if 'click' event handler is
// registered, otherwise bail out.
PRBool isOnclick = nsAccUtils::HasListener(content,
NS_LITERAL_STRING("click"));
if (!isOnclick)
return NS_OK;
}
*aState |= nsIAccessibleStates::STATE_LINKED;

View File

@ -11,6 +11,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript">
var gAccRetrieval = null;
function testThis(aID, aAcc, aRole, aAnchors, aName, aValid, aStartIndex,
aEndIndex)
{
@ -36,10 +38,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
"Wrong seleccted state after focus for ID " + aID + "!");
}
function testStates(aID, aAcc, aState, aExtraState, aAbsentState)
function testStates(aID, aAcc, aState, aExtraState, aAbsentState,
aShowStateDebugFlag)
{
var state = {}, extraState = {};
aAcc.getFinalState(state, extraState);
if (aShowStateDebugFlag) {
var list = gAccRetrieval.getStringStates(state.value, 0);
var str = "";
for (var i = 0; i < list.length; i++)
str += list.item(i) + "\n";
alert(str);
}
is(state.value & aState, aState, "Wrong state bits for ID " + aID + "!");
is(extraState.value & aExtraState, aExtraState,
"Wrong extra state bits for ID " + aID + "!");
@ -71,15 +85,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
const ext_state_invalid =
Components.interfaces.nsIAccessibleStates.STATE_INVALID;
var accService = Components.classes["@mozilla.org/accessibleRetrieval;1"].
getService(Components.interfaces.nsIAccessibleRetrieval);
gAccRetrieval = Components.classes["@mozilla.org/accessibleRetrieval;1"].
getService(Components.interfaces.nsIAccessibleRetrieval);
//////////////////////////////////////////////////////////////////////////
// normal hyperlink
var normalHyperlinkElement = document.getElementById("NormalHyperlink");
var normalHyperlinkAcc;
try {
normalHyperlinkAcc = accService.getAccessibleFor(normalHyperlinkElement).
normalHyperlinkAcc = gAccRetrieval.getAccessibleFor(normalHyperlinkElement).
QueryInterface(Components.interfaces.nsIAccessibleHyperLink);
} catch(e) {
ok(normalHyperlinkAcc, "no interface for normal hyperlink!");
@ -102,7 +116,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
var ariaHyperlinkElement = document.getElementById("AriaHyperlink");
var ariaHyperlinkAcc;
try {
ariaHyperlinkAcc = accService.getAccessibleFor(ariaHyperlinkElement).
ariaHyperlinkAcc = gAccRetrieval.getAccessibleFor(ariaHyperlinkElement).
QueryInterface(Components.interfaces.nsIAccessibleHyperLink);
} catch(e) {
ok(ariaHyperlinkAcc, "no interface for ARIA Hyperlink!");
@ -125,7 +139,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
var invalidAriaHyperlinkAcc;
try {
invalidAriaHyperlinkAcc =
accService.getAccessibleFor(invalidAriaHyperlinkElement).
gAccRetrieval.getAccessibleFor(invalidAriaHyperlinkElement).
QueryInterface(Components.interfaces.nsIAccessibleHyperLink);
} catch(e) {
ok(invalidAriaHyperlinkAcc, "no interface for invalid ARIA hyperlink!");
@ -144,7 +158,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
var imageMapHyperlinkAcc;
try {
imageMapHyperlinkAcc =
accService.getAccessibleFor(imageMapHyperlinkElement).
gAccRetrieval.getAccessibleFor(imageMapHyperlinkElement).
QueryInterface(Components.interfaces.nsIAccessibleHyperLink);
} catch(e) {
ok(imageMapHyperlinkAcc, "no Image Map interface!");
@ -202,7 +216,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
var EmptyHLAcc;
try {
EmptyHLAcc =
accService.getAccessibleFor(emptyLinkElement).
gAccRetrieval.getAccessibleFor(emptyLinkElement).
QueryInterface(Components.interfaces.nsIAccessibleHyperLink);
} catch (e) {
ok(EmptyHLAcc, "no interface for empty link!");
@ -220,7 +234,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
var hyperlinkWithSpanAcc;
try {
hyperlinkWithSpanAcc =
accService.getAccessibleFor(hyperlinkElementWithSpan).
gAccRetrieval.getAccessibleFor(hyperlinkElementWithSpan).
QueryInterface(Components.interfaces.nsIAccessibleHyperLink);
} catch(e) {
ok(hyperlinkWithSpanAcc, "no interface for hyperlink with span!");
@ -243,7 +257,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
var namedAnchorElement = document.getElementById("namedAnchor");
var namedAnchorAcc;
try {
namedAnchorAcc = accService.getAccessibleFor(namedAnchorElement).
namedAnchorAcc = gAccRetrieval.getAccessibleFor(namedAnchorElement).
QueryInterface(Components.interfaces.nsIAccessibleHyperLink);
} catch(e) {
ok(namedAnchorAcc, "no interface for named anchor!");
@ -255,12 +269,46 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
(state_selectable),
(ext_state_horizontal), (state_focusable | state_linked));
//////////////////////////////////////////////////////////////////////////
// No link (hasn't any attribute), should never have state_linked
var noLinkElement = document.getElementById("noLink");
var noLinkAcc;
try {
noLinkAcc = gAccRetrieval.getAccessibleFor(noLinkElement).
QueryInterface(Components.interfaces.nsIAccessibleHyperLink);
} catch(e) {
ok(noLinkAcc, "no interface for named anchor!");
}
testThis("noLink", noLinkAcc,
Components.interfaces.nsIAccessibleRole.ROLE_LINK, 1,
"This should never be of state_linked", true, 262, 263);
testStates("noLink", noLinkAcc,
0,
(ext_state_horizontal), (state_focusable | state_linked));
//////////////////////////////////////////////////////////////////////////
// Link with registered 'click' event, should have state_linked
var linkWithClickElement = document.getElementById("linkWithClick");
var linkWithClickAcc;
try {
linkWithClickAcc = gAccRetrieval.getAccessibleFor(linkWithClickElement).
QueryInterface(Components.interfaces.nsIAccessibleHyperLink);
} catch(e) {
ok(linkWithClickAcc, "no interface for named anchor!");
}
testThis("linkWithClick", linkWithClickAcc,
Components.interfaces.nsIAccessibleRole.ROLE_LINK, 1,
"This should have state_linked", true, 301, 302);
testStates("linkWithClick", linkWithClickAcc,
(state_linked),
(ext_state_horizontal), 0);
//////////////////////////////////////////////////////////////////////////
// Maps to group links (bug 431615).
var linksMapElement = document.getElementById("linksmap");
var linksMapAcc;
try {
linksMapAcc = accService.getAccessibleFor(linksMapElement);
linksMapAcc = gAccRetrieval.getAccessibleFor(linksMapElement);
} catch(e) { }
ok(linksMapAcc, "no accessible for map grouping links!");
@ -278,6 +326,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<br>Simple link:<br>
<a id="NormalHyperlink" href="http://www.mozilla.org">Mozilla Foundation</a>
<br>ARIA link:<br>
@ -308,6 +357,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=418368
<a id="LinkWithSpan" href="http://www.heise.de/"><span lang="de">Heise Online</span></a>
<br>Named anchor, must not have "linked" state for it to be exposed correctly:<br>
<a id="namedAnchor" name="named_anchor">This should never be of state_linked</a>
<br>Link having no attributes, must not have "linked" state:</br>
<a id="noLink">This should never be of state_linked</a>
<br>Link with registered 'click' event: </br>
<a id="linkWithClick" onclick="var clicked = true;">This should have state_linked</a>
<br>Map that is used to group links (www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass),
also see the bug 431615:<br>

View File

@ -1270,6 +1270,8 @@ SetupClusterBoundaries(gfxTextRun* aTextRun, const gchar *aUTF8, PRUint32 aUTF8L
NS_ASSERTION(ch != 0, "Shouldn't have NUL in pango_break");
NS_ASSERTION(!IS_SURROGATE(ch), "Shouldn't have surrogates in UTF8");
if (ch >= 0x10000) {
// set glyph info for the UTF-16 low surrogate
aTextRun->SetGlyphs(aUTF16Offset, g.SetComplex(PR_FALSE, PR_FALSE, 0), nsnull);
++aUTF16Offset;
}
// We produced this utf8 so we don't need to worry about malformed stuff

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Letter spacing with surrogate characters</title>
<style type="text/css">
span { padding-right: 10px; }
</style>
</head>
<body>
<!-- ASCII for sanity check -->
<p><span>A</span><span>A</span><span>A</span><span>A</span><span>A</span><span>A</span></p>
<!-- SMP Characters, MATHEMATICAL BOLD CAPITAL A. It will probably appear as hexboxes, but that doesn't matter -->
<p><span>&#x1d400;</span><span>&#x1d400;</span><span>&#x1d400;</span><span>&#x1d400;</span><span>&#x1d400;</span><span>&#x1d400;</span></p>
</body>
</html>

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Letter spacing with surrogate characters</title>
<style type="text/css">
p { letter-spacing: 10px; }
</style>
</head>
<body>
<!-- ASCII for sanity check -->
<p>AAAAAA</p>
<!-- SMP Characters, MATHEMATICAL BOLD CAPITAL A. It will probably appear as hexboxes, but that doesn't matter -->
<p>&#x1d400;&#x1d400;&#x1d400;&#x1d400;&#x1d400;&#x1d400;</p>
</body>
</html>

View File

@ -850,3 +850,4 @@ random == 429849-1.html 429849-1-ref.html # bug 432288
== 430813-3.html 430813-3-ref.html
== 433640-1.html 433640-1-ref.html
== 439004-1.html 439004-1-ref.html
== 439910.html 439910-ref.html

View File

@ -218,7 +218,7 @@ static void LoadProxyinfo()
g_free(httpproxy);
if(gconf_client_get_bool(conf, HTTP_PROXY_DIR "/use_authentication", NULL)) {
gchar *user, *password, *auth;
gchar *user, *password, *auth = NULL;
user = gconf_client_get_string(conf,
HTTP_PROXY_DIR "/authentication_user",
@ -591,6 +591,11 @@ bool UIInit()
if (gtk_init_check(&gArgc, &gArgv)) {
gInitialized = true;
if (gStrings.find("isRTL") != gStrings.end() &&
gStrings["isRTL"] == "yes")
gtk_widget_set_default_direction(GTK_TEXT_DIR_RTL);
TryInitGnome();
return true;
}

View File

@ -156,11 +156,11 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
while (keyboards--) {
locale = buf[keyboards];
if (IsRTLLanguage(locale)) {
sprintf(mRTLKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
sprintf(mRTLKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID((DWORD)locale));
isRTLKeyboardSet = PR_TRUE;
}
else {
sprintf(mLTRKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
sprintf(mLTRKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID((DWORD)locale));
isLTRKeyboardSet = PR_TRUE;
}
}
@ -210,7 +210,7 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
PRBool nsBidiKeyboard::IsRTLLanguage(HKL aLocale)
{
LOCALESIGNATURE localesig;
return (::GetLocaleInfoW(PRIMARYLANGID(aLocale),
return (::GetLocaleInfoW(PRIMARYLANGID((DWORD)aLocale),
LOCALE_FONTSIGNATURE,
(LPWSTR)&localesig,
(sizeof(localesig)/sizeof(WCHAR))) &&

View File

@ -1597,8 +1597,10 @@ nsNativeThemeWin::GetWidgetPadding(nsIDeviceContext* aContext,
case NS_THEME_MENUITEMTEXT:
// There seem to be exactly 4 pixels from the edge
// of the gutter to the text: 2px margin (CSS) + 2px padding (here)
SIZE size(GetGutterSize(theme, NULL));
left = size.cx + 2;
{
SIZE size(GetGutterSize(theme, NULL));
left = size.cx + 2;
}
break;
case NS_THEME_MENUSEPARATOR:
{

View File

@ -3123,7 +3123,7 @@ StringCaseInsensitiveEquals(const PRUint16* aChars1, const PRUint32 aNumChars1,
return PR_FALSE;
nsCaseInsensitiveStringComparator comp;
return comp(aChars1, aChars2, aNumChars1) == 0;
return comp((PRUnichar*)aChars1, (PRUnichar*)aChars2, aNumChars1) == 0;
}
/**