Guys,

I am facing the following problem on my embedded application:

I have an VirtualKeyboard component (based on minimo's one - http://lxr.mozilla.org/mozilla1.8/source/minimo/components/softkb/nsSoftKeyBoard.cpp), that listens to DOMEvent and pops up the environment's virtual keyboard in cases when an editable form gets focus.

It work for most of cases, however when I tried it on gmail's chat it's failed to get nsIDOMHTMLFormElement from formControl. I am doing like these :

<quoted>

NS_IMETHODIMP
nsSoftKeyBoard::HandleEvent(nsIDOMEvent* aEvent) {
*
if* (!aEvent) *return* NS_OK;

nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aEvent));
nsCOMPtr<nsIDOMEventTarget> target;
nsevent->GetOriginalTarget(getter_AddRefs(target));
nsCOMPtr<nsIContent> targetContent = do_QueryInterface(target);

if (!targetContent ||
!targetContent->IsNodeOfType(nsIContent::eHTML_FORM_CONTROL))
  return NS_OK;

nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(targetContent));
if (!formControl)
  return NS_OK;

PRInt32 controlType = formControl->GetType();

if (controlType != NS_FORM_TEXTAREA     &&  controlType !=
NS_FORM_INPUT_TEXT &&
controlType != NS_FORM_INPUT_PASSWORD && controlType != NS_FORM_INPUT_FILE)
  return NS_OK;

// FIXME: debugging printfs
if (controlType == NS_FORM_TEXTAREA)  printf ("[vkb] textarea\n");
if (controlType == NS_FORM_INPUT_TEXT) printf ("[vkb] input_text \n");
if (controlType == NS_FORM_INPUT_PASSWORD) printf ("[vkb] input_passwd\n");
if (controlType == NS_FORM_INPUT_FILE) printf ("[vkb] input_file\n");

// I AM FAILING HERE ALTHOUGH IT PRINTS ''[vkb] textarea" (see
above), SO WHY WOULD IT FAIL IF I AM A TEXTAREA ??
// MINIMO VKB DiFFS FROM MINE AT THIS POINT ...
nsCOMPtr <nsIDOMHTMLFormElement> focusedHTMLFormElement;
formControl->GetForm(getter_AddRefs(focusedHTMLFormElement));

if (!focusedHTMLFormElement) {
  NS_ASSERTION (PR_TRUE, "[vkb] nsSoftKeyBoard::HandleEvent
focusedHTMLFormElement == NULL");
  return NS_ERROR_UNEXPECTED;
}

(...)


So although FormControl says it a NS_FORM_TEXTAREA (see bunch of printfs above), it fails to nsIDOMHTMLFormElement.

This problem occurs only on gmails chat, which is defined as following (from the html source):


...
<tr>
<td align=center id="[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>" class=wackinputopen
style="border: none;">
<div style="margin-left: 2px; margin-right: 1px;"">
<textarea (... lots here) onkeypress=... onfocus=... >
</textarea>
</div>
</td>
</tr>
...

This div that is handling onkeypress() events might the problem ? Any suggestion of how could I get it working ? Workarounds ?

Thanks

regards

--Antonio Gomes
Nokia Technology Institute
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to