From 86fb3d46bd3f0ecd2d6db1b7599cca0093567b87 Mon Sep 17 00:00:00 2001 From: "aaronr%us.ibm.com" Date: Mon, 21 Aug 2006 21:24:08 +0000 Subject: [PATCH] [XForms] Implement accessible objects for xforms input controls. Bug 337250, patch by surkov, r=olli+aaronr --- extensions/xforms/nsIXFormsUIWidget.idl | 17 ++++++- extensions/xforms/resources/content/input.xml | 47 ++++++++++++------- extensions/xforms/resources/content/range.xml | 6 +++ .../xforms/resources/content/select.xml | 6 +++ .../xforms/resources/content/select1.xml | 6 +++ .../xforms/resources/content/xforms-xhtml.xml | 4 ++ .../xforms/resources/content/xforms.xml | 25 ++++++++++ 7 files changed, 94 insertions(+), 17 deletions(-) diff --git a/extensions/xforms/nsIXFormsUIWidget.idl b/extensions/xforms/nsIXFormsUIWidget.idl index d53b4b7cde6..cd4c442edcd 100644 --- a/extensions/xforms/nsIXFormsUIWidget.idl +++ b/extensions/xforms/nsIXFormsUIWidget.idl @@ -46,7 +46,7 @@ * http://developer.mozilla.org/en/docs/XForms:Custom_Controls * */ -[scriptable, uuid(b88a1c27-47a2-4c25-be7c-170501a93643)] +[scriptable, uuid(f636007c-cc01-4295-b3cb-d525054c4a14)] interface nsIXFormsUIWidget : nsIDOMElement { /** @@ -63,4 +63,19 @@ interface nsIXFormsUIWidget : nsIDOMElement * During submission, the \ should be disabled. */ void disable(in boolean disable); // for + + /** + * Return "string" value of xforms element that element actually shows. + * + * From time to time current element value can be different from current value + * of instance node that element is bound to. For example: + * 1) When a XForms control has non-incremental update and its value is + * changed due to user interaction, then getCurrentValue will return the + * control's new value even though the bound node has not be updated yet. + * 2) If instace value is out of range then xforms element can't show it. + * Therefore it shows default value and getCurrentValue will return showed + * value. + */ + AString getCurrentValue(); }; + diff --git a/extensions/xforms/resources/content/input.xml b/extensions/xforms/resources/content/input.xml index a133f3d32bf..659e4856281 100644 --- a/extensions/xforms/resources/content/input.xml +++ b/extensions/xforms/resources/content/input.xml @@ -88,6 +88,12 @@ + + + return this.control.value; + + + @@ -136,6 +142,12 @@ + + + return this.control.value ? "true" : "false"; + + + diff --git a/extensions/xforms/resources/content/select.xml b/extensions/xforms/resources/content/select.xml index d1732c87300..9f2a0915db7 100644 --- a/extensions/xforms/resources/content/select.xml +++ b/extensions/xforms/resources/content/select.xml @@ -177,6 +177,12 @@ + + + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + + + + + throw Components.results.NS_ERROR_NOT_IMPLEMENTED; + + + diff --git a/extensions/xforms/resources/content/xforms-xhtml.xml b/extensions/xforms/resources/content/xforms-xhtml.xml index 4cbeaa7b36c..fd8ddedd5a8 100644 --- a/extensions/xforms/resources/content/xforms-xhtml.xml +++ b/extensions/xforms/resources/content/xforms-xhtml.xml @@ -528,6 +528,9 @@ return { + get value() { + return this._textControl.value; + }, set value(val) { this._textControl.value = val; }, @@ -598,6 +601,7 @@ return { + get value(){ return ""; } set value(val){}, set readonly(val){}, focus: function(){} diff --git a/extensions/xforms/resources/content/xforms.xml b/extensions/xforms/resources/content/xforms.xml index 6559600c679..2401ccc60f3 100644 --- a/extensions/xforms/resources/content/xforms.xml +++ b/extensions/xforms/resources/content/xforms.xml @@ -225,6 +225,20 @@ return false; + + + + + return this.accessors.getValue(); + + @@ -381,6 +395,11 @@ + + + return ""; + + @@ -461,6 +480,12 @@ + + + return this.control.value; + + + if (!this._uploadElement) {