[XForms] Use classes instead of attributes for temporary pseudoelement support. Bug 312980, r=doronr+smaug

This commit is contained in:
allan%beaufour.dk 2005-10-25 20:12:56 +00:00
parent 40151bda2b
commit 9eb9a7f31c
4 changed files with 21 additions and 9 deletions

View File

@ -82,9 +82,12 @@ protected:
/** The context size for the element */
PRInt32 mContextSize;
/** Does this element have the repeat-index? */
PRBool mHasIndex;
public:
nsXFormsContextContainer()
: mContextPosition(1), mContextSize(1) {}
: mContextPosition(1), mContextSize(1), mHasIndex(PR_FALSE) {}
NS_DECL_ISUPPORTS_INHERITED
@ -260,12 +263,13 @@ NS_IMETHODIMP
nsXFormsContextContainer::SetIndexState(PRBool aHasIndex)
{
if (mElement) {
NS_NAMED_LITERAL_STRING(repIndex, "repeat-index");
mHasIndex = aHasIndex;
NS_NAMED_LITERAL_STRING(classStr, "class");
if (aHasIndex) {
mElement->SetAttribute(repIndex,
NS_LITERAL_STRING("1"));
mElement->SetAttribute(classStr,
NS_LITERAL_STRING("xf-repeat-item xf-repeat-index"));
} else {
mElement->RemoveAttribute(repIndex);
mElement->SetAttribute(classStr, NS_LITERAL_STRING("xf-repeat-item"));
}
}
return NS_OK;
@ -273,8 +277,10 @@ nsXFormsContextContainer::SetIndexState(PRBool aHasIndex)
NS_IMETHODIMP
nsXFormsContextContainer::GetIndexState(PRBool *aHasIndex)
{
return mElement->HasAttribute(NS_LITERAL_STRING("repeat-index"), aHasIndex);
{
NS_ENSURE_ARG(aHasIndex);
*aHasIndex = mHasIndex;
return NS_OK;
}
// Factory

View File

@ -83,6 +83,7 @@
<children includes="label"/>
</html:span>
<html:select xbl:inherits="style"
class="xf-value"
onchange="this.parentNode.parentNode.selectionChanged();"
onfocus="this.parentNode.parentNode.dispatchDOMUIEvent('DOMFocusIn');"
onblur="this.parentNode.parentNode.handleBlur(); this.parentNode.parentNode.dispatchDOMUIEvent('DOMFocusOut');"
@ -526,6 +527,7 @@
<children includes="label"/>
</html:td>
<html:td anonid="checkbox-group"
class="xf-value"
onchange="this.parentNode.parentNode.parentNode.selectionChanged();">
</html:td>
</html:tr>

View File

@ -67,7 +67,7 @@
onclick="this.parentNode.parentNode.handleControlClick();"
onkeypress="this.parentNode.parentNode.handleKeyPress(event);"
onkeyup="this.parentNode.parentNode.handleKeyUp(event);"
/><html:input class="-moz-xforms-select1-dropdown"
/><html:input class="-moz-xforms-select1-dropdown xf-value"
type="button"
anonid="dropmarker"
tabindex="-1"

View File

@ -127,7 +127,7 @@
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
<content>
<children includes="label"/>
<html:span anonid="content"></html:span>
<html:span class="xf-value" anonid="content"></html:span>
<children/>
</content>
@ -177,6 +177,7 @@
<content>
<children includes="label"/>
<html:input anonid="control"
class="xf-value"
onblur="this.parentNode.delegate.value = this.value; this.parentNode.dispatchDOMUIEvent('DOMFocusOut')"
onfocus="this.parentNode.dispatchDOMUIEvent('DOMFocusIn')"
onclick="this.parentNode._change();"
@ -293,6 +294,7 @@
<content>
<children includes="label"/>
<html:textarea anonid="control"
class="xf-value"
onblur="this.parentNode.delegate.value = this.value; this.parentNode.dispatchDOMUIEvent('DOMFocusOut')"
onfocus="this.parentNode.dispatchDOMUIEvent('DOMFocusIn')"
onkeyup="this.parentNode._change();"
@ -455,6 +457,7 @@
<content>
<children includes="label"/>
<html:input anonid="upload_text_control"
class="xf-value"
readonly="true"
xbl:inherits="accesskey"/>
<html:button anonid="upload_browse_button"
@ -544,6 +547,7 @@
<content>
<children includes="label"/>
<html:input readonly="true"
class="xf-value"
xbl:inherits="accesskey"/>
<html:button type="button"
disabled="true"