diff --git a/mozilla/extensions/xforms/jar.mn b/mozilla/extensions/xforms/jar.mn index 43e31aeb1ab..b2d786c8f6d 100755 --- a/mozilla/extensions/xforms/jar.mn +++ b/mozilla/extensions/xforms/jar.mn @@ -26,6 +26,9 @@ xforms.jar: content/xforms/select.xml (resources/content/select.xml) content/xforms/select-xhtml.xml (resources/content/select-xhtml.xml) content/xforms/select-xul.xml (resources/content/select-xul.xml) + content/xforms/selects.xml (resources/content/selects.xml) + content/xforms/selects-xhtml.xml (resources/content/selects-xhtml.xml) + content/xforms/selects-xul.xml (resources/content/selects-xul.xml) content/xforms/bindingex.css (resources/content/bindingex.css) content/xforms/bindingex.xul (resources/content/bindingex.xul) content/xforms/calendar.png (resources/content/calendar.png) diff --git a/mozilla/extensions/xforms/nsIXFormsItemElement.idl b/mozilla/extensions/xforms/nsIXFormsItemElement.idl index b4404167eff..6d82fdb6550 100644 --- a/mozilla/extensions/xforms/nsIXFormsItemElement.idl +++ b/mozilla/extensions/xforms/nsIXFormsItemElement.idl @@ -43,7 +43,7 @@ /** * Interface implemented by the item element. */ -[scriptable, uuid(ec8d3556-8ed2-4143-88d1-6b7b2c8b0b3b)] +[scriptable, uuid(e7e65a10-bf37-488f-9c74-add34abdd309)] interface nsIXFormsItemElement : nsISupports { /** @@ -83,4 +83,14 @@ interface nsIXFormsItemElement : nsISupports */ readonly attribute nsIDOMNode copyNode; + /** + * Compare given DOM node and copy node (i.e. node that the contained copy + * element is bound to. + * + * @param nsIDOMNode aNode - given DOM node to compare with copy node + * + * @return boolean - return true if given node equals in copy node + */ + boolean copyNodeEquals(in nsIDOMNode aNode); }; + diff --git a/mozilla/extensions/xforms/nsXFormsItemElement.cpp b/mozilla/extensions/xforms/nsXFormsItemElement.cpp index e3038ca1716..59e69ca079c 100644 --- a/mozilla/extensions/xforms/nsXFormsItemElement.cpp +++ b/mozilla/extensions/xforms/nsXFormsItemElement.cpp @@ -487,6 +487,19 @@ nsXFormsItemElement::SetIsCopyItem(PRBool aIsCopyItem) return NS_OK; } +NS_IMETHODIMP +nsXFormsItemElement::CopyNodeEquals(nsIDOMNode *aNode, PRBool *aIsCopyNode) +{ + NS_ENSURE_ARG(aNode); + NS_ENSURE_ARG_POINTER(aIsCopyNode); + + nsCOMPtr selectedNode; + nsresult rv = SelectItemByNode(aNode, getter_AddRefs(selectedNode)); + *aIsCopyNode = !!(selectedNode); + + return rv; +} + NS_HIDDEN_(nsresult) NS_NewXFormsItemElement(nsIXTFElement **aResult) { diff --git a/mozilla/extensions/xforms/resources/content/select-xhtml.xml b/mozilla/extensions/xforms/resources/content/select-xhtml.xml index 4b5f9a4c10d..1e3846f57f7 100644 --- a/mozilla/extensions/xforms/resources/content/select-xhtml.xml +++ b/mozilla/extensions/xforms/resources/content/select-xhtml.xml @@ -54,6 +54,11 @@ @@ -70,22 +75,6 @@ - - - - - - - - - - - - - - - @@ -100,22 +89,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - for (var i = this.control.childNodes.length; i > 0; i--) { - this.control.removeChild(this.control.childNodes[i-1]); - } - - - - - - - - - throw Components.results.NS_ERROR_NOT_IMPLEMENTED; - - - - - - - - var mainDiv = document.createElementNS(this.XHTML_NS, "div"); - - var labelDiv = document.createElementNS(this.XHTML_NS, "div"); - if (aLabel) { - labelDiv.className = "select-choice-label"; - labelDiv.appendChild(aLabel.cloneNode(true)); - } - mainDiv.appendChild(labelDiv); - - var contentDiv = document.createElementNS(this.XHTML_NS, "div"); - contentDiv.className = "select-choice-content"; - mainDiv.appendChild(contentDiv); - - if (aGroup) { - aGroup.appendChild(mainDiv); - } else { - this.control.appendChild(mainDiv); - } - - return contentDiv; - - - - - - - aItem.firstChild.checked = true; - - - - - - - aItem.firstChild.checked = false; - - - - - - - return aItem.firstChild.checked; - - - - - - - aItem.firstChild.focus(); - - - - - - - return aElement.getAttribute("anonid") == "wcontrol"; - - - - - - - if (event.originalTarget.getAttribute("anonid") == "wcontrol") - this.updateInstanceData(true); - - - - if (event.originalTarget.getAttribute("anonid") == "wcontrol") - this.updateInstanceData(false); - - - - - - - - - - - - - - - - - - - - - var div = document.createElementNS(this.XHTML_NS, "div"); - div.setAttribute("anonid", "itemcontainer"); - - var input = document.createElementNS(this.XHTML_NS, "input"); - input.setAttribute("type", "checkbox"); - input.setAttribute("value", aValue); - input.setAttribute("anonid", "wcontrol"); - if (this.readonly) - input.setAttribute("disabled", "true"); - - div.appendChild(input); - if (aLabel) { - div.appendChild(aLabel.cloneNode(true)); - } - - if (aGroup) { - aGroup.appendChild(div); - } else { - this.control.appendChild(div); - } - return div; - - - - - - - if (event.originalTarget.getAttribute("anonid") == "itemcontainer") { - event.originalTarget.firstChild.checked = - !event.originalTarget.firstChild.checked; - this.updateInstanceData(true); - } - - @@ -394,13 +210,6 @@ controls. --> - - - - @@ -410,59 +219,5 @@ - - - - - - - - - - - - - - - var div = document.createElementNS(this.XHTML_NS, "div"); - div.setAttribute("anonid", "itemcontainer"); - - var input = document.createElementNS(this.XHTML_NS, "input"); - input.setAttribute("type", "radio"); - input.setAttribute("value", aValue); - input.setAttribute("name", "radioControlForXFormsSelect1"); - input.setAttribute("anonid", "wcontrol"); - if (this.readonly) - input.setAttribute('disabled', 'true'); - div.appendChild(input); - - if (aLabel) - div.appendChild(aLabel.cloneNode(true)); - - if (aGroup) { - aGroup.appendChild(div); - } else { - this.control.appendChild(div); - } - - return div; - - - - - - - - - - - diff --git a/mozilla/extensions/xforms/resources/content/select-xul.xml b/mozilla/extensions/xforms/resources/content/select-xul.xml index c03dd4a3a60..660feb091e4 100644 --- a/mozilla/extensions/xforms/resources/content/select-xul.xml +++ b/mozilla/extensions/xforms/resources/content/select-xul.xml @@ -54,6 +54,10 @@ The section contains xforms select and select1 controls implementations for XUL. All controls are inherited from interface bindings realized in select.xml file. + + XXX: Element select of minimal appearance is not implemented (see bug 332928). + + select/select1 of full appearance are implemented in selects-xul.xml file. --> - - - - - - - - @@ -241,150 +233,6 @@ - - - - - - - - - - - for (var i = this.control.childNodes.length; i > 0; i--) { - this.control.removeChild(this.control.childNodes[i-1]); - } - - - - - - - - - var box = this.ownerDocument.createElementNS(this.XUL_NS, "hbox"); - box.setAttribute("align", "center"); - - var checkbox = this.ownerDocument.createElementNS(this.XUL_NS, "checkbox"); - checkbox.setAttribute("value", aValue); - checkbox.setAttribute("anonid", "wcontrol"); - if (this.readonly) - checkbox.setAttribute("disabled", "true"); - - box.appendChild(checkbox); - if (aLabel) { - // since label node can contains textnodes then we use - // 'description' element as container for label node. - var description = this.ownerDocument. - createElementNS(this.XUL_NS, "description"); - description.setAttribute("anonid", "labelcontainer"); - description.appendChild(aLabel.cloneNode(true)); - box.appendChild(description); - } - - if (aGroup) { - aGroup.appendChild(box); - } else { - this.control.appendChild(box); - } - - return box; - - - - - - - - var mainBox = this.ownerDocument.createElementNS(this.XUL_NS, "vbox"); - - var labelBox = this.ownerDocument.createElementNS(this.XUL_NS, "hbox"); - if (aLabel) { - labelBox.className = "select-choice-label"; - labelBox.appendChild(aLabel.cloneNode(true)); - } - mainBox.appendChild(labelBox); - - var contentBox = this.ownerDocument.createElementNS(this.XUL_NS, "vbox"); - contentBox.className = "select-choice-content"; - mainBox.appendChild(contentBox); - - if (aGroup) { - aGroup.appendChild(mainBox); - } else { - this.control.appendChild(mainBox); - } - - return contentBox; - - - - - - - aItem.firstChild.checked = true; - - - - - - - aItem.firstChild.checked = false; - - - - - - - return aItem.firstChild.checked; - - - - - - - aItem.firstChild.focus(); - - - - - - - return aElement.getAttribute("anonid") == "wcontrol"; - - - - - - - if (event.originalTarget.getAttribute("anonid") == "labelcontainer") { - event.originalTarget.previousSibling.checked = - !event.originalTarget.previousSibling.checked; - this.updateInstanceData(true); - } - - - - if (event.originalTarget.getAttribute("anonid") == "wcontrol") - this.updateInstanceData(true); - - - - if (event.originalTarget.getAttribute("anonid") == "wcontrol") - this.updateInstanceData(false); - - - - - - - - - - - - - - - - - - for (var i = this.control.childNodes.length; i > 0; i--) { - this.control.removeChild(this.control.childNodes[i-1]); - } - - - - - - - - - var box = this.ownerDocument.createElementNS(this.XUL_NS, "hbox"); - box.setAttribute("align", "center"); - - var radio = this.ownerDocument.createElementNS(this.XUL_NS, "radio"); - radio.setAttribute("value", aValue); - radio.setAttribute("anonid", "wcontrol"); - if (this.readonly) - radio.setAttribute("disabled", "true"); - - box.appendChild(radio); - if (aLabel) { - // since label node can contains textnodes then we use - // 'description' element as container for label node. - var description = this.ownerDocument. - createElementNS(this.XUL_NS, "description"); - description.setAttribute("anonid", "labelcontainer"); - description.appendChild(aLabel.cloneNode(true)); - box.appendChild(description); - } - - if (aGroup) { - aGroup.appendChild(box); - } else { - this.control.appendChild(box); - } - - return box; - - - - - - - - var mainBox = this.ownerDocument.createElementNS(this.XUL_NS, "vbox"); - - var labelBox = this.ownerDocument.createElementNS(this.XUL_NS, "hbox"); - if (aLabel) { - labelBox.className = "select-choice-label"; - labelBox.appendChild(aLabel.cloneNode(true)); - } - mainBox.appendChild(labelBox); - - var contentBox = this.ownerDocument.createElementNS(this.XUL_NS, "vbox"); - contentBox.className = "select-choice-content"; - mainBox.appendChild(contentBox); - - if (aGroup) { - aGroup.appendChild(mainBox); - } else { - this.control.appendChild(mainBox); - } - - return contentBox; - - - - - - - // there are a cases when 'radio' binding isn't created yet, therefore - // we use setTimeout. - window.setTimeout( - function(list, item) { - list.selectedItem = item; - }, - 0, - this.control, aItem.firstChild - ); - - - - - - - if (aItem.firstChild.selected) - this.control.selectedItem = null; - - - - - - - return aItem.firstChild.selected; - - - - - - - if (event.originalTarget.getAttribute("anonid") == "labelcontainer") { - this.control.selectedItem = event.originalTarget.previousSibling; - this.updateInstanceData(true); - } - - - - if (event.originalTarget.getAttribute("anonid") == "wcontrol") - this.updateInstanceData(true); - - - - if (event.originalTarget.getAttribute("anonid") == "control") - this.updateInstanceData(false); - - - - - diff --git a/mozilla/extensions/xforms/resources/content/select.xml b/mozilla/extensions/xforms/resources/content/select.xml index af6d3c42fd3..6295698c6f8 100644 --- a/mozilla/extensions/xforms/resources/content/select.xml +++ b/mozilla/extensions/xforms/resources/content/select.xml @@ -39,8 +39,12 @@ - - ***** END LICENSE BLOCK ***** --> - - - @@ -873,15 +872,13 @@ - var ev = document.createEvent("Events"); - ev.initEvent(aName, true, false); - var elm = aElement; + @@ -1224,61 +1221,4 @@ - - - - - - - - - - - - - null - - - - - if (this.isItemElement(event.originalTarget)) - this.currentItem = event.originalTarget; - - - - diff --git a/mozilla/extensions/xforms/resources/content/select1.xml b/mozilla/extensions/xforms/resources/content/select1.xml index b4f17f75f31..fae72ca8347 100644 --- a/mozilla/extensions/xforms/resources/content/select1.xml +++ b/mozilla/extensions/xforms/resources/content/select1.xml @@ -1145,30 +1145,6 @@ - - - - - - - - - - null - - - - if (!this._anonymousItemSetContent) { - this._anonymousItemSetContent = - document.getAnonymousElementByAttribute(this, "anonid", "insertion"); - } - return this._anonymousItemSetContent; - - - - - diff --git a/mozilla/extensions/xforms/resources/content/xforms.css b/mozilla/extensions/xforms/resources/content/xforms.css index fb4205b285e..b972de0644b 100755 --- a/mozilla/extensions/xforms/resources/content/xforms.css +++ b/mozilla/extensions/xforms/resources/content/xforms.css @@ -49,7 +49,9 @@ refresh, model, instance, submission, -bind { +bind, +value, +copy { display: none !important; } @@ -61,10 +63,16 @@ html|*:root switch:not(:disabled), html|*:root case, html|*:root select1:not([appearance]) item, html|*:root select1[appearance='minimal'] item, +select1[appearance="full"] item, +select[appearance="full"] item, html|*:root select1:not([appearance]) itemset, html|*:root select1[appearance='minimal'] itemset, +select1[appearance="full"] itemset, +select[appearance="full"] itemset, html|*:root select1:not([appearance]) choices, -html|*:root select1[appearance='minimal'] choices { +html|*:root select1[appearance='minimal'] choices, +select1[appearance="full"] choices, +select[appearance="full"] choices { display: block; } @@ -90,19 +98,30 @@ xul|*:root case { display: -moz-box; } +html|*:root select[appearance="full"] itemset contextcontainer, +html|*:root select1[appearance="full"] itemset contextcontainer { + display: inline; +} + contextcontainer-inline { display: inline; } -select item, xul|*:root select1 item, -html|*:root select1[appearance='compact'] item, -html|*:root select1[appearance='full'] item, -select itemset, xul|*:root select1 itemset, -html|*:root select1[appearance='compact'] itemset, -html|*:root select1[appearance='full'] itemset, -select choices, xul|*:root select1 choices, -html|*:root select1[appearance='compact'] choices, -html|*:root select1[appearance='full'] choices { +xul|*:root select1:not([appearance]) item, +xul|*:root select1[appearance='minimal'] item, +select1[appearance='compact'] item, +select:not([appearance]) item, +select[appearance='compact'] item, +xul|*:root select1:not([appearance]) itemset, +xul|*:root select1[appearance='minimal'] itemset, +select1[appearance='compact'] itemset, +select:not([appearance]) itemset, +select[appearance='compact'] itemset, +xul|*:root select1:not([appearance]) choices, +xul|*:root select1[appearance='minimal'] choices, +select1[appearance='compact'] choices, +select:not([appearance]) choices, +select[appearance='compact'] choices { display: none; } @@ -489,7 +508,7 @@ xul|*:root case xul|box[anonid="control"] { /* itemset widget */ select1 itemset, select itemset { - -moz-binding: url('chrome://xforms/content/select1.xml#xformswidget-itemset'); + -moz-binding: url('chrome://xforms/content/selects.xml#itemset'); } /* select1 appearance='minimal' (default) */ @@ -527,17 +546,24 @@ xul|*:root select1[appearance="compact"] xul|box[anonid="control"] { /* select1 appearance='full' */ html|*:root select1[appearance="full"] { - -moz-binding: url('chrome://xforms/content/select-xhtml.xml#xformswidget-select1-full'); + -moz-binding: url('chrome://xforms/content/selects-xhtml.xml#select1-full'); } -html|*:root select1[appearance="full"] html|span[anonid="control"] { - -moz-binding: url('chrome://xforms/content/select-xhtml.xml#controlwidget-select1-full'); +html|*:root select1[appearance="full"] item { + -moz-binding: url('chrome://xforms/content/selects-xhtml.xml#select1-full-item'); } xul|*:root select1[appearance="full"] { - -moz-binding: url('chrome://xforms/content/select-xul.xml#xformswidget-select1-full'); + -moz-binding: url('chrome://xforms/content/selects-xul.xml#select1-full'); } -xul|*:root select1[appearance="full"] xul|box[anonid="control"] { - -moz-binding: url('chrome://xforms/content/select-xul.xml#controlwidget-select1-full'); +xul|*:root select1[appearance="full"] xul|radiogroup { + -moz-binding: url('chrome://xforms/content/selects-xul.xml#select1-full-radiogroup') !important; +} + +xul|*:root select1[appearance="full"] item { + -moz-binding: url('chrome://xforms/content/selects-xul.xml#select1-full-item'); +} +xul|*:root select1[appearance="full"] item xul|radio { + -moz-binding: url('chrome://xforms/content/selects-xul.xml#select1-full-item-radio') !important; } /* select1[appearance='minimal'] for xhtml styles (most of the select1 specific @@ -628,27 +654,34 @@ html|*:root item[_moz_active] { background: Highlight; } +/* styles for select1[appearance="minimal", select1[appearance="full"], + select[appearance="full"] */ html|*:root select1:not([appearance]) choices > label, -html|*:root select1[appearance='minimal'] choices > label { +html|*:root select1[appearance='minimal'] choices > label, +select[appearance="full"] choices > label, +select1[appearance="full"] choices > label { display: block; font: -moz-list; line-height: normal !important; font-style: italic; font-weight: bold; - font-size: inherit; -moz-user-select: none; text-indent: 0; } -html|*:root select1:not([appearance]) choices > item -html|*:root select1[appearance='minimal'] choices > item, +html|*:root select1:not([appearance]) choices > item, html|*:root select1:not([appearance]) choices > itemset, -html|*:root select1[appearance='minimal'] choices > itemset, html|*:root select1:not([appearance]) choices > choices, -html|*:root select1[appearance='minimal'] choices > choices { +html|*:root select1[appearance='minimal'] choices > item, +html|*:root select1[appearance='minimal'] choices > itemset, +html|*:root select1[appearance='minimal'] choices > choices, +select[appearance="full"] choices > item, +select[appearance="full"] choices > itemset, +select[appearance="full"] choices > choices, +select1[appearance="full"] choices > item, +select1[appearance="full"] choices > itemset, +select1[appearance="full"] choices > choices { padding-left: 20px; - font-style: normal; - font-weight: normal; } /* select appearance="compact" (default) */ @@ -668,29 +701,20 @@ xul|*:root select xul|box[anonid="control"] { /* select appearance="full" */ html|*:root select[appearance="full"] { - -moz-binding: url('chrome://xforms/content/select-xhtml.xml#xformswidget-select-full'); + -moz-binding: url('chrome://xforms/content/selects-xhtml.xml#select-full'); } -html|*:root select[appearance="full"] html|span[anonid="control"] { - -moz-binding: url('chrome://xforms/content/select-xhtml.xml#controlwidget-select-full'); +html|*:root select[appearance="full"] item { + -moz-binding: url('chrome://xforms/content/selects-xhtml.xml#select-full-item'); } xul|*:root select[appearance="full"] { - -moz-binding: url('chrome://xforms/content/select-xul.xml#xformswidget-select-full'); + -moz-binding: url('chrome://xforms/content/selects-xul.xml#select-full'); } -xul|*:root select[appearance="full"] xul|box[anonid="control"] { - -moz-binding: url('chrome://xforms/content/select-xul.xml#controlwidget-select-full'); +xul|*:root select[appearance="full"] item { + -moz-binding: url('chrome://xforms/content/selects-xul.xml#select-full-item'); } /* select, select1 styles*/ -select *|*.select-choice-label, select1 *|*.select-choice-label { - font: -moz-list; - font-style: italic; - font-weight: bold; -} - -select *|*.select-choice-content, select1 *|*.select-choice-content { - padding-left: 10px; -} /* XXX: selectors are wrong, styles don't work (bug 351797). */ xul|*:root select1[appearance="full"] xul|box xul|radiogroup:focus xul|radio[selected] + label, @@ -708,6 +732,16 @@ xul|*:root select, xul|*:root select1 { margin: 2px 4px; } +xul|*:root select1 item label { + margin: 2px 4px; + padding-top: 1px; + padding-bottom: 1px; +} + +item[disabled] label { + color: graytext; +} + /* upload widgets */ html|*:root upload { -moz-binding: url('chrome://xforms/content/xforms-xhtml.xml#xformswidget-upload-disabled');