Closed
Bug 277543
Opened 20 years ago
Closed 20 years ago
Add default handling for xforms-focus
Categories
(Core Graveyard :: XForms, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: smaug, Assigned: smaug)
References
()
Details
Attachments
(1 file, 2 obsolete files)
14.64 KB,
patch
|
bryner
:
superreview+
|
Details | Diff | Splinter Review |
.
Assignee | ||
Comment 1•20 years ago
|
||
*** Bug 279179 has been marked as a duplicate of this bug. ***
Assignee | ||
Updated•20 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•20 years ago
|
||
This doesn't support repeat yet. I think it can be done after Bug 278209.
Attachment #172028 -
Flags: review?(aaronr)
Assignee | ||
Comment 3•20 years ago
|
||
Comment on attachment 172028 [details] [diff] [review] v1 this doesn't handle http://www.w3.org/TR/xforms/index-all.html#model-prop-relevant properly.
Attachment #172028 -
Flags: review?(aaronr)
Comment on attachment 172028 [details] [diff] [review] v1 yep, that is exactly how I was thinking to do it. -'ing to allow smaug chance to include two exceptional circumstances we found in the spec (handling focus w.r.t. group and non-relevant controls).
Attachment #172028 -
Flags: review-
Assignee | ||
Comment 5•20 years ago
|
||
Attachment #172028 -
Attachment is obsolete: true
Attachment #172115 -
Flags: review?(aaronr)
Comment on attachment 172115 [details] [diff] [review] v2 Looks ok to me. Good job! r=aaronr
Attachment #172115 -
Flags: review?(aaronr) → review+
Assignee | ||
Updated•20 years ago
|
Attachment #172115 -
Flags: superreview?(bryner)
Comment 7•20 years ago
|
||
Comment on attachment 172115 [details] [diff] [review] v2 >@@ -211,12 +216,54 @@ nsXFormsGroupElement::Refresh() > result->GetSingleNodeValue(getter_AddRefs(mBoundNode)); > NS_ENSURE_STATE(mBoundNode); > > return NS_OK; > } > >+PRBool >+nsXFormsGroupElement::TryFocusChildControl(nsIDOMNode* aParent) >+{ >+ if (!aParent) >+ return PR_FALSE; >+ >+ nsCOMPtr<nsIDOMNodeList> children; >+ nsresult rv = aParent->GetChildNodes(getter_AddRefs(children)); >+ if (NS_FAILED(rv)) >+ return PR_FALSE; >+ >+ PRUint32 childCount = 0; >+ children->GetLength(&childCount); >+ nsCOMPtr<nsIDOMNode> child; >+ >+ for (PRUint32 i = 0; i < childCount; ++i) { Hm, should this use the navIndex as described in 4.3.1? >--- nsXFormsInputElement.cpp 19 Jan 2005 16:05:31 -0000 1.19 >+++ nsXFormsInputElement.cpp 22 Jan 2005 19:36:57 -0000 >@@ -339,12 +340,35 @@ nsXFormsInputElement::Refresh() > input->SetReadOnly(readonly); > } > > return NS_OK; > } > >+NS_IMETHODIMP >+nsXFormsInputElement::TryFocus(PRBool* aOK) >+{ >+ *aOK = PR_FALSE; >+ if (GetRelevantState()) { >+ nsresult rv = NS_ERROR_FAILURE; >+ if (mType == eType_TextArea) { >+ nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea = do_QueryInterface(mControl); >+ if (textArea) >+ rv = textArea->Focus(); >+ >+ } else { >+ nsCOMPtr<nsIDOMHTMLInputElement> input = do_QueryInterface(mControl); >+ if (input) >+ rv = input->Focus(); >+ } >+ Slightly easier: nsCOMPtr<nsIDOMNSHTMLElement> element = do_QueryInterface(mControl); element->Focus(); This handles both control types. You could add nsXFormsUtils::FocusControl(nsIDOMElemnet *aElement) to make things more compact, too.
Attachment #172115 -
Flags: superreview?(bryner) → superreview-
I read navIndex in 4.3.1 as being something that is used by the host language (XHTML2, SVG). We could use an attribute like navIndex, but since it isn't part of the spec, I don't know if the other XForms processors would honor it. And of course strictly honoring navIndex values, we'd have to worry about tab navigation jumping over HTML elements that might be intermingled in the document and basically preventing them from focusing. These are the kinds of things that are worrying me about how to generate the DOMFocusOut and DOMFocusIn events, too.
Assignee | ||
Comment 9•20 years ago
|
||
This doesn't support navIndex. If we want to support that, it should be done in a separate bug I think. btw, navIndex is not mentioned in XForms schema.
Attachment #172115 -
Attachment is obsolete: true
Attachment #172477 -
Flags: superreview?(bryner)
Comment 10•20 years ago
|
||
(In reply to comment #9) > Created an attachment (id=172477) [edit] How about having a nsIDOMNSHTMLElement* on nsXFormsControlStub, and then having a common TryFocus() function there? Most controls would just need to set the pointer at OnCreated() to whatever control should get focus.
Updated•20 years ago
|
Attachment #172477 -
Flags: superreview?(bryner) → superreview+
Assignee | ||
Comment 11•20 years ago
|
||
This has been checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•8 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•