Closed Bug 293579 Opened 20 years ago Closed 20 years ago

xforms-value-changed, other events targeting every xf control

Categories

(Core Graveyard :: XForms, defect)

x86
All
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aaronr, Assigned: aaronr)

Details

Attachments

(2 files, 1 obsolete file)

In sect. 4.1 in the spec, it says:  Throughout this chapter, each reference to
"form control" as a target element is a shorthand for any of the following
elements: input, secret, textarea, output, upload, trigger, range, submit,
select, select1, or group.

We aren't currently this particular.  We are sending xforms-value-changed to
switch and label, for example.
Attached file testcase
This testcase shows xforms-value-changed going to xf:switch and xf:label and
this shouldn't be the case.
Attached patch first attempt (obsolete) — Splinter Review
this fix introduces a new function to nsIXFormsControl interface called
isEventTarget.	When the xforms events that target form controls pass through
nsXFormsUtils::DispatchEvent, it calls isEventTarget on the control.  The
default is true, but when the target is a switch, label, repeat or
repeatItemElement, I return false.  When false is returned, the event is NOT
sent to the target.
Attachment #183701 - Flags: review?(smaug)
Comment on attachment 183701 [details] [diff] [review]
first attempt

>+  nsCOMPtr<nsIXFormsControl> control = do_QueryInterface(aTarget);
>+  if (control) {
>+    switch (aEvent) {
>+      case eEvent_Previous:
>+      case eEvent_Next:
>+      case eEvent_Focus:
>+      case eEvent_Help:
>+      case eEvent_Hint:
>+      case eEvent_DOMActivate:
>+      case eEvent_ValueChanged: 
>+      case eEvent_Valid:
>+      case eEvent_Invalid:
>+      case eEvent_DOMFocusIn:
>+      case eEvent_DOMFocusOut:
>+      case eEvent_Readonly:
>+      case eEvent_Readwrite:
>+      case eEvent_Required:
>+      case eEvent_Optional:
>+      case eEvent_Enabled:
>+      case eEvent_Disabled:
>+      case eEvent_InRange:
>+      case eEvent_OutOfRange:
>+        {
>+          PRBool acceptableEventTarget;

s/;/ = PR_FALSE;/

>+          control->IsEventTarget(&acceptableEventTarget);
>+          if (!acceptableEventTarget) {
>+            return NS_OK;
>+          }
>+          break;
>+        }

      default:
	break;

With those r=me
Attachment #183701 - Flags: review?(smaug) → review+
Attached patch fixed commentsSplinter Review
fixed smaug's review comments.	Can you do second review Allan?
Attachment #183701 - Attachment is obsolete: true
Attachment #183775 - Flags: review?(allan)
Comment on attachment 183775 [details] [diff] [review]
fixed comments

>+  NS_IMETHOD IsEventTarget(PRBool* aOK);

At some places you use "PRBool* aOK" and at other places "PRBool *aOK". Please
be consistent. Our code is generally using the latter. I'll fix that and a typo
in the comment in the IDL, and check it in for you.
Attachment #183775 - Flags: review?(allan) → review+
Checked in.
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: