mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Bug 606011 - (OSX) focus event not fired on click for elements made specially focusable via tabindex, r=enndeakin, a=blocking
--HG-- extra : rebase_source : f76cbeee1fad42d51e6529fbcf04d305a09a52c3
This commit is contained in:
parent
90bb1d7dd8
commit
8c20df7deb
@ -2726,6 +2726,22 @@ nsGenericHTMLFormElement::CanBeDisabled() const
|
||||
type != NS_FORM_OUTPUT;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericHTMLFormElement::IsHTMLFocusable(PRBool aWithMouse,
|
||||
PRBool* aIsFocusable,
|
||||
PRInt32* aTabIndex)
|
||||
{
|
||||
if (nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
*aIsFocusable =
|
||||
(!aWithMouse || nsFocusManager::sMouseFocusesFormControl) && *aIsFocusable;
|
||||
#endif
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsGenericHTMLFormElement::IsSubmitControl() const
|
||||
{
|
||||
@ -3317,10 +3333,6 @@ nsGenericHTMLElement::IsHTMLFocusable(PRBool aWithMouse,
|
||||
|
||||
// If a tabindex is specified at all, or the default tabindex is 0, we're focusable
|
||||
*aIsFocusable =
|
||||
#ifdef XP_MACOSX
|
||||
// can only focus with the mouse on Mac if editable
|
||||
(!aWithMouse || override) &&
|
||||
#endif
|
||||
(tabIndex >= 0 || (!disabled && HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex)));
|
||||
|
||||
return override;
|
||||
|
@ -924,6 +924,9 @@ public:
|
||||
*/
|
||||
PRBool CanBeDisabled() const;
|
||||
|
||||
virtual PRBool IsHTMLFocusable(PRBool aWithMouse, PRBool* aIsFocusable,
|
||||
PRInt32* aTabIndex);
|
||||
|
||||
protected:
|
||||
virtual nsresult BeforeSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
|
||||
const nsAString* aValue, PRBool aNotify);
|
||||
|
@ -281,7 +281,7 @@ nsHTMLButtonElement::Click()
|
||||
PRBool
|
||||
nsHTMLButtonElement::IsHTMLFocusable(PRBool aWithMouse, PRBool *aIsFocusable, PRInt32 *aTabIndex)
|
||||
{
|
||||
if (nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
if (nsGenericHTMLFormElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -3531,7 +3531,7 @@ nsHTMLInputElement::WillRemoveFromRadioGroup()
|
||||
PRBool
|
||||
nsHTMLInputElement::IsHTMLFocusable(PRBool aWithMouse, PRBool *aIsFocusable, PRInt32 *aTabIndex)
|
||||
{
|
||||
if (nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
if (nsGenericHTMLFormElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1289,7 +1289,7 @@ PRBool
|
||||
nsHTMLSelectElement::IsHTMLFocusable(PRBool aWithMouse,
|
||||
PRBool *aIsFocusable, PRInt32 *aTabIndex)
|
||||
{
|
||||
if (nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
if (nsGenericHTMLFormElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -480,7 +480,7 @@ PRBool
|
||||
nsHTMLTextAreaElement::IsHTMLFocusable(PRBool aWithMouse,
|
||||
PRBool *aIsFocusable, PRInt32 *aTabIndex)
|
||||
{
|
||||
if (nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
if (nsGenericHTMLFormElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex)) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
|
@ -283,12 +283,13 @@ function getTopWindow(win)
|
||||
function mouseOnElement(element, expectedElement, focusChanged, testid)
|
||||
{
|
||||
var expectedWindow = (element.ownerDocument.defaultView == gChildWindow) ? gChildWindow : window;
|
||||
// on Mac, elements are not focused when clicking, except for lists and textboxes.
|
||||
// on Mac, form elements are not focused when clicking, except for lists and textboxes.
|
||||
var noFocusOnMouse = (navigator.platform.indexOf("Mac") == 0);
|
||||
if (noFocusOnMouse) {
|
||||
if (element.namespaceURI == "http://www.w3.org/1999/xhtml") {
|
||||
// links are special. They can be focused but show no focus ring
|
||||
if (element.localName == "a" || element.localName == "select" ||
|
||||
if (element.localName == "a" || element.localName == "div" ||
|
||||
element.localName == "select" ||
|
||||
element.localName == "input" && (element.type == "text" ||
|
||||
element.type == "password")) {
|
||||
noFocusOnMouse = false;
|
||||
|
@ -133,7 +133,7 @@ var htmlElements = [
|
||||
"<textarea id='elem' class='canfocus'></textarea>",
|
||||
"<select id='elem' class='canfocus'><option>One</select>",
|
||||
"<select id='elem' rows='5' class='canfocus'><option>One</select>",
|
||||
"<div id='elem' tabindex='0' style='width: 10px; height: 10px;'></div>",
|
||||
"<div id='elem' tabindex='0' class='canfocus' style='width: 10px; height: 10px;'></div>",
|
||||
"<a href='about:blank' class='canfocus' onclick='return false;'>about:blank</a>",
|
||||
];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user