diff --git a/extensions/xforms/jar.mn b/extensions/xforms/jar.mn index 9ec17b0e1aba..20314dd92d83 100755 --- a/extensions/xforms/jar.mn +++ b/extensions/xforms/jar.mn @@ -8,6 +8,7 @@ xforms.jar: * content/xforms/xforms-prefs-ui.xul (resources/content/xforms-prefs-ui.xul) * content/xforms/xforms-prefs.js (resources/content/xforms-prefs.js) content/xforms/xforms.xml (resources/content/xforms.xml) + content/xforms/xforms-xhtml.xml (resources/content/xforms-xhtml.xml) content/xforms/select1.xml (resources/content/select1.xml) content/xforms/range.xml (resources/content/range.xml) content/xforms/select.xml (resources/content/select.xml) diff --git a/extensions/xforms/resources/content/xforms.css b/extensions/xforms/resources/content/xforms.css index 574be598b391..341fec952d24 100755 --- a/extensions/xforms/resources/content/xforms.css +++ b/extensions/xforms/resources/content/xforms.css @@ -77,7 +77,7 @@ alert { } output { - -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-output'); + -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-output'); } range { @@ -85,11 +85,11 @@ range { } input { - -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-input'); + -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-input'); } input[mozType|type="http://www.w3.org/2001/XMLSchema#boolean"] { - -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-input-boolean'); + -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-input-boolean'); } input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] { @@ -168,29 +168,25 @@ input[mozType|type="http://www.w3.org/2001/XMLSchema#gYear"] { } secret { - -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-secret'); + -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-secret'); } textarea { - -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-textarea'); + -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-textarea'); } trigger, submit { - -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-trigger'); + -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-trigger'); } trigger[appearance="minimal"], submit[appearance="minimal"] { - -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-trigger-minimal'); + -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-trigger-minimal'); } trigger[appearance="minimal"]:hover, submit[appearance="minimal"]:hover { cursor: pointer; } -label { - -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-label'); -} - input > label, secret > label, textarea > label, @@ -202,6 +198,10 @@ upload > label { -moz-binding: url('chrome://xforms/content/xforms.xml#xformswidget-label-accesskey'); } +label { + -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-label'); +} + select1 { -moz-binding: url('chrome://xforms/content/select1.xml#xformswidget-select1'); } diff --git a/extensions/xforms/resources/content/xforms.xml b/extensions/xforms/resources/content/xforms.xml index 1b355ef53294..3947b85abaf1 100644 --- a/extensions/xforms/resources/content/xforms.xml +++ b/extensions/xforms/resources/content/xforms.xml @@ -38,71 +38,40 @@ - - ***** END LICENSE BLOCK ***** --> + + + %xformsDTD; ]> + xmlns="http://www.mozilla.org/xbl" + xmlns:html="http://www.w3.org/1999/xhtml" + xmlns:xbl="http://www.mozilla.org/xbl" + xmlns:xforms="http://www.w3.org/2002/xforms" + xmlns:lazy="http://www.mozilla.org/projects/xforms/2005/lazy"> + + + - + - - this.delegate.widgetAttached(); - - - - this._delegate = null; - this._accessors = null; - - - - - return "http://www.w3.org/2002/xforms"; - - - - null - - - - if (!this._delegate) - this._delegate = this.QueryInterface(Components.interfaces.nsIXFormsDelegate); - return this._delegate; - - - - null - - - - - - - - - - var value = this.accessors.getValue(); - return value != null ? value : ""; - - + return true; @@ -122,6 +91,30 @@ + + + + return "http://www.w3.org/2002/xforms"; + + + + + + + + + + + + var value = this.accessors.getValue(); + return value != null ? value : ""; + + + @@ -147,67 +140,103 @@ return true; - - - - - - - - - - + + + if (!this._control) + this._control = this.getControlElement(); + return this._control; + + - - + + - // XXX changing from setting textContent to setting nodeValue of - // first child (text node created by space character initializer - // above). Workaround for bug 322975. Probably should be changed - // back after repeat is xbl-ized - document.getAnonymousElementByAttribute(this, "anonid", "content").firstChild.nodeValue = - this.stringValue; - - return true; + throw Error("getControlElement() method isn't implemented."); - - - - - - - - - - - - - - var anoncontent = - document.getAnonymousElementByAttribute(this, "anonid", "anoncontent"); + + + this.delegate.widgetAttached(); + - if (this.accessors.hasBoundNode() || this.accessors.getValue() != null) { - anoncontent.setAttribute("style", "display:none;"); - } else { - anoncontent.removeAttribute("style"); + + this._delegate = null; + this._accessors = null; + + + + + if (!this._delegate) { + this._delegate = + this.QueryInterface(Components.interfaces.nsIXFormsDelegate); } + return this._delegate; + + - document.getAnonymousElementByAttribute(this, "anonid", "content").textContent = - this.stringValue; + null + null + null + + + + + + + + + + + this.control.value = this.stringValue; return true; - + + + + + + + + this.control.value = this.accessors.getValue(); + return true; + + + + + + + + @@ -257,8 +286,8 @@ // we create a range around the character we want and surround it // with an var range = document.createRange(); - range.setStart(content.firstChild, location) - range.setEnd(content.firstChild, location+1) + range.setStart(content.firstChild, location); + range.setEnd(content.firstChild, location+1); var u = document.createElementNS("http://www.w3.org/1999/xhtml", "u"); range.surroundContents(u); @@ -275,110 +304,116 @@ - - + The input widget assumes successors bindings implement getElementControl() + method what returns the object: + { + set value(); // set "string" value + get value(); // return "string" value + set readonly(); // set readonly state + focus(); // set focus + } + --> + - - - - - - null - - - - if (!this._inputField) { - this._inputField = - document.getAnonymousElementByAttribute(this, "anonid", "control"); - } - return this._inputField; - - - - - - if (this.getAttribute("incremental") == "true") { - this.accessors.setValue(this.inputField.value); - } - return true; - - - this.inputField.value = this.stringValue; - if (this.accessors.isReadonly()) { - this.inputField.setAttribute("readonly", "readonly"); - } else { - this.inputField.removeAttribute("readonly"); + this.control.readonly = this.accessors.isReadonly(); + // If the value has not changed, no need to update the + // value of the control, because f.x. that makes the textarea widget + // to scroll up. + if (this.control.value != this.stringValue) { + this.control.value = this.stringValue; } + return true; - this.inputField.focus(); + this.control.focus(); return true; + + + + + if (!incremental || this.getAttribute("incremental") == "true") + this.accessors.setValue(this.control.value); + + + - - + + + + - this.inputField.setAttribute("type","checkbox"); var value = this.stringValue; if (value == "true" || value == "1") { - this.inputField.setAttribute("checked", "checked"); + this.control.value = true; } else { - this.inputField.removeAttribute("checked"); - } - - this.inputField.value = value; - if (this.accessors.isReadonly()) { - this.inputField.setAttribute("readonly", "readonly"); - } else { - this.inputField.removeAttribute("readonly"); + this.control.value = false; } - - this.inputField.removeAttribute("onkeypress"); - + this.control.readonly = this.accessors.isReadonly(); return true; - + - if (this.getAttribute("incremental") != "false") { - if (this.inputField.checked) { + this.control.focus(); + return true; + + + + + + + + + - + + + extends="chrome://xforms/content/xforms.xml#xformswidget-base"> + + + if (this.getAttribute("incremental") == "true") { + this.accessors.setValue(this.inputField.value); + } + return true; + + + + null + + + if (!this._inputField) { + this._inputField = + document.getAnonymousElementByAttribute(this, "anonid", "control"); + } + return this._inputField; + + + null @@ -451,7 +506,6 @@ null - if (!this._dateField) { @@ -480,7 +534,6 @@ - + ]]> @@ -922,7 +975,10 @@ - + @@ -948,7 +1004,7 @@ this.select.readonly = this.accessors.isReadonly(); if (this.accessors.isValid()) - this.select.value = this.stringValue.substr(2,2) + this.select.value = this.stringValue.substr(2,2); else this.select.value = ""; @@ -960,26 +1016,26 @@ @@ -1016,7 +1072,10 @@ - + @@ -1042,7 +1101,7 @@ this.select.readonly = this.accessors.isReadonly(); if (this.accessors.isValid()) - this.select.value = this.stringValue.substr(3,2) + this.select.value = this.stringValue.substr(3,2); else this.select.value = ""; @@ -1098,7 +1157,7 @@ if (!this._select) { - this._select = + this._select = document.getAnonymousElementByAttribute(this, "anonid", "control"); } return this._select; @@ -1107,111 +1166,39 @@ - - - - - - this.inputField.setAttribute("type","password"); - this.inputField.value = this.stringValue; - this.inputField.readonly = this.accessors.isReadonly(); - return true; - - - - - - + We don't need in any special base binding for secret widget. All + successors bindings should be extended from base binding for input widget. + --> + + + + + - - - - - - - - null - - - - if (!this._controlField) { - this._controlField = - document.getAnonymousElementByAttribute(this, "anonid", "control"); - } - return this._controlField; - - - - - - if (this.accessors.isReadonly()) { - this.controlField.setAttribute("readonly", "readonly"); - } else { - this.controlField.removeAttribute("readonly"); - } - // If the value has not changed, no need to update the - // value of the control, because that makes the textarea widget - // to scroll up. - if (this.controlField.value != this.stringValue) { - this.controlField.value = this.stringValue; - } - return true; - - - - - - if (this.getAttribute("incremental") == "true") { - this.accessors.setValue(this.controlField.value); - } - return true; - - - - - - this.controlField.focus(); - return true; - - - - - - - - - - - - - var control = - document.getAnonymousElementByAttribute(this, "anonid", "thebutton"); - if (aDisable) { - control.setAttribute("disabled", "disabled"); - } else { - control.removeAttribute("disabled"); - } + this.control.disabled = aDisable; - document.getAnonymousElementByAttribute(this, "anonid", "thebutton").focus(); + this.control.focus(); return true; @@ -1219,36 +1206,13 @@ - - - - - - - - - false + - - - - this._disabled = aDisable; - - - - - - document.getAnonymousElementByAttribute(this, "anonid", "thespan").focus(); - return true; - - - - @@ -1260,15 +1224,16 @@ - this.QueryInterface(Components.interfaces.nsIXFormsCaseElement).widgetAttached(); + this.QueryInterface(Components.interfaces.nsIXFormsCaseElement). + widgetAttached(); null if (!this._container) { - this._container = - document.getAnonymousElementByAttribute(this, "anonid", "container"); + this._container = document. + getAnonymousElementByAttribute(this, "anonid", "container"); } return this._container; @@ -1286,10 +1251,15 @@ return true; + - + + @@ -1378,7 +1348,10 @@ - +