зеркало из https://github.com/mozilla/gecko-dev.git
Fix some IsFocusable methods to do the right thing. Bug 261707, r=aaronl, sr=jst
This commit is contained in:
Родитель
fe17731ee5
Коммит
a4d8e15629
|
@ -219,8 +219,9 @@ nsHTMLAnchorElement::SetFocus(nsPresContext* aPresContext)
|
|||
NS_EVENT_STATE_FOCUS);
|
||||
|
||||
// Make sure the presentation is up-to-date
|
||||
if (IsInDoc()) {
|
||||
GetOwnerDoc()->FlushPendingNotifications(Flush_Layout);
|
||||
nsIDocument* doc = GetCurrentDoc();
|
||||
if (doc) {
|
||||
doc->FlushPendingNotifications(Flush_Layout);
|
||||
}
|
||||
|
||||
nsIPresShell *presShell = aPresContext->GetPresShell();
|
||||
|
@ -244,15 +245,17 @@ nsHTMLAnchorElement::IsFocusable(PRInt32 *aTabIndex)
|
|||
}
|
||||
|
||||
PRBool isFocusable = PR_FALSE;
|
||||
nsAutoString href;
|
||||
GetAttribute(NS_LITERAL_STRING("href"), href);
|
||||
if (href.IsEmpty() && !HasAttr(kNameSpaceID_None, nsHTMLAtoms::tabindex)) {
|
||||
// Not tabbable or focusable without href (bug 17605), unless
|
||||
// forced to be via presence of nonnegative tabindex attribute
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = -1;
|
||||
if (!HasAttr(kNameSpaceID_None, nsHTMLAtoms::tabindex)) {
|
||||
// check whether we're actually a link
|
||||
nsCOMPtr<nsIURI> linkURI = nsContentUtils::GetLinkURI(this);
|
||||
if (!linkURI) {
|
||||
// Not tabbable or focusable without href (bug 17605), unless
|
||||
// forced to be via presence of nonnegative tabindex attribute
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = -1;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
if (aTabIndex && (sTabFocusModel & eTabFocus_linksMask) == 0) {
|
||||
|
|
|
@ -258,7 +258,7 @@ nsXMLElement::MaybeTriggerAutoLink(nsIDocShell *aShell)
|
|||
nsCOMPtr<nsIURI> uri;
|
||||
rv = nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri),
|
||||
value,
|
||||
GetCurrentDoc(),
|
||||
GetOwnerDoc(),
|
||||
base);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsPresContext> pc;
|
||||
|
@ -416,6 +416,25 @@ nsXMLElement::HandleDOMEvent(nsPresContext* aPresContext,
|
|||
return ret;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsXMLElement::IsFocusable(PRInt32 *aTabIndex)
|
||||
{
|
||||
nsCOMPtr<nsIURI> linkURI = nsContentUtils::GetLinkURI(this);
|
||||
if (linkURI) {
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = ((sTabFocusModel & eTabFocus_linksMask) == 0 ? -1 : 0);
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
if (aTabIndex) {
|
||||
*aTabIndex = -1;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLElement::CloneNode(PRBool aDeep, nsIDOMNode** aReturn)
|
||||
{
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
nsEvent* aEvent, nsIDOMEvent** aDOMEvent,
|
||||
PRUint32 aFlags,
|
||||
nsEventStatus* aEventStatus);
|
||||
virtual PRBool IsFocusable(PRInt32 *aTabIndex = nsnull);
|
||||
|
||||
protected:
|
||||
PRBool mIsLink;
|
||||
|
|
Загрузка…
Ссылка в новой задаче