зеркало из https://github.com/mozilla/pjs.git
[XForms] Implement accessible objects for xforms input controls. Bug 337250, patch by surkov, r=olli+aaronr
This commit is contained in:
Родитель
2f0751422d
Коммит
86fb3d46bd
|
@ -46,7 +46,7 @@
|
||||||
* http://developer.mozilla.org/en/docs/XForms:Custom_Controls
|
* 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
|
interface nsIXFormsUIWidget : nsIDOMElement
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -63,4 +63,19 @@ interface nsIXFormsUIWidget : nsIDOMElement
|
||||||
* During submission, the \<submit\> should be disabled.
|
* During submission, the \<submit\> should be disabled.
|
||||||
*/
|
*/
|
||||||
void disable(in boolean disable); // for <submit>
|
void disable(in boolean disable); // for <submit>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,12 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="getCurrentValue">
|
||||||
|
<body>
|
||||||
|
return this.control.value;
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<method name="updateInstanceData">
|
<method name="updateInstanceData">
|
||||||
<parameter name="aIncremental"/>
|
<parameter name="aIncremental"/>
|
||||||
<body>
|
<body>
|
||||||
|
@ -136,6 +142,12 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="getCurrentValue">
|
||||||
|
<body>
|
||||||
|
return this.control.value ? "true" : "false";
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
updateInstanceData updates the instance data bound to this control under
|
updateInstanceData updates the instance data bound to this control under
|
||||||
certain conditions.
|
certain conditions.
|
||||||
|
@ -166,12 +178,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.control.value) {
|
this.accessors.setValue(this.getCurrentValue());
|
||||||
this.accessors.setValue("true");
|
|
||||||
} else {
|
|
||||||
this.accessors.setValue("false");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.changed = false;
|
this.changed = false;
|
||||||
]]>
|
]]>
|
||||||
</body>
|
</body>
|
||||||
|
@ -226,15 +233,19 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="getCurrentValue">
|
||||||
|
<body>
|
||||||
|
// The lexical representation for xsd:gMonth is the left and right
|
||||||
|
// truncated lexical representation for xsd:date: --MM.
|
||||||
|
return this.control.value != "" ? "--" + this.control.value : "";
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<method name="updateInstanceData">
|
<method name="updateInstanceData">
|
||||||
<parameter name="aIncremental"/>
|
<parameter name="aIncremental"/>
|
||||||
<body>
|
<body>
|
||||||
if (!aIncremental || this.getAttribute("incremental") == "true") {
|
if (!aIncremental || this.getAttribute("incremental") == "true") {
|
||||||
if (this.control.value != "") {
|
this.accessors.setValue(this.getCurrentValue());
|
||||||
this.accessors.setValue("--" + this.control.value);
|
|
||||||
} else {
|
|
||||||
this.accessors.setValue("");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
@ -294,15 +305,19 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="getCurrentValue">
|
||||||
|
<body>
|
||||||
|
// The lexical representation for xsd:gDay is the left truncated
|
||||||
|
// lexical representation for xsd:date: ---DD.
|
||||||
|
return this.control.value != "" ? "---" + this.control.value : "";
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<method name="updateInstanceData">
|
<method name="updateInstanceData">
|
||||||
<parameter name="aIncremental"/>
|
<parameter name="aIncremental"/>
|
||||||
<body>
|
<body>
|
||||||
if (!aIncremental || this.getAttribute("incremental") == "true") {
|
if (!aIncremental || this.getAttribute("incremental") == "true") {
|
||||||
if (this.control.value != "") {
|
this.accessors.setValue(this.getCurrentValue());
|
||||||
this.accessors.setValue("---" + this.control.value);
|
|
||||||
} else {
|
|
||||||
this.accessors.setValue("");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
|
@ -400,6 +400,12 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="getCurrentValue">
|
||||||
|
<body>
|
||||||
|
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<!-- create new range object -->
|
<!-- create new range object -->
|
||||||
<method name="createRange">
|
<method name="createRange">
|
||||||
<parameter name="aCanvas"/>
|
<parameter name="aCanvas"/>
|
||||||
|
|
|
@ -177,6 +177,12 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="getCurrentValue">
|
||||||
|
<body>
|
||||||
|
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<property name="incremental">
|
<property name="incremental">
|
||||||
<getter>
|
<getter>
|
||||||
<![CDATA[
|
<![CDATA[
|
||||||
|
|
|
@ -715,6 +715,12 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="getCurrentValue">
|
||||||
|
<body>
|
||||||
|
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<method name="selectItemByValue">
|
<method name="selectItemByValue">
|
||||||
<parameter name="aValue"/>
|
<parameter name="aValue"/>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -528,6 +528,9 @@
|
||||||
<method name="getControlElement">
|
<method name="getControlElement">
|
||||||
<body>
|
<body>
|
||||||
return {
|
return {
|
||||||
|
get value() {
|
||||||
|
return this._textControl.value;
|
||||||
|
},
|
||||||
set value(val) {
|
set value(val) {
|
||||||
this._textControl.value = val;
|
this._textControl.value = val;
|
||||||
},
|
},
|
||||||
|
@ -598,6 +601,7 @@
|
||||||
<method name="getControlElement">
|
<method name="getControlElement">
|
||||||
<body>
|
<body>
|
||||||
return {
|
return {
|
||||||
|
get value(){ return ""; }
|
||||||
set value(val){},
|
set value(val){},
|
||||||
set readonly(val){},
|
set readonly(val){},
|
||||||
focus: function(){}
|
focus: function(){}
|
||||||
|
|
|
@ -225,6 +225,20 @@
|
||||||
return false;
|
return false;
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!-- Method is called to get current value of xforms element.
|
||||||
|
|
||||||
|
Here the method is implemented for those xforms elements that can't be
|
||||||
|
used to change the bound instance value. For example, xforms:output.
|
||||||
|
The rest of the xforms elements should override this implementation.
|
||||||
|
For example, xforms:trigger returns empty string since it actually
|
||||||
|
hasn't value even if it has a bound.
|
||||||
|
-->
|
||||||
|
<method name="getCurrentValue">
|
||||||
|
<body>
|
||||||
|
return this.accessors.getValue();
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
</implementation>
|
</implementation>
|
||||||
</binding>
|
</binding>
|
||||||
|
|
||||||
|
@ -381,6 +395,11 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="getCurrentValue">
|
||||||
|
<body>
|
||||||
|
return "";
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
</implementation>
|
</implementation>
|
||||||
</binding>
|
</binding>
|
||||||
|
|
||||||
|
@ -461,6 +480,12 @@
|
||||||
</body>
|
</body>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<method name="getCurrentValue">
|
||||||
|
<body>
|
||||||
|
return this.control.value;
|
||||||
|
</body>
|
||||||
|
</method>
|
||||||
|
|
||||||
<property name="uploadElement" readonly="true">
|
<property name="uploadElement" readonly="true">
|
||||||
<getter>
|
<getter>
|
||||||
if (!this._uploadElement) {
|
if (!this._uploadElement) {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче