[XForms] range undefined @step should be "1" for xsd:integer. Bug 332221, r=doronr+smaug

This commit is contained in:
allan%beaufour.dk 2006-05-30 09:30:31 +00:00
parent f6fdbdd282
commit fd520e884c

View File

@ -62,6 +62,7 @@
<html:span anonid="labelBegin" style="margin-right: 3px;"></html:span>
<!-- width and height set by CSS? -->
<html:canvas tabindex="0" anonid="canvas" width="260" height="40"
class="xf-value"
onkeydown="this.parentNode.handleKey(event)"
onmousedown="this.parentNode.handleMouseDown(event)"
onmouseup="this.parentNode.handleMouseUp(event)"
@ -159,6 +160,11 @@
return this.delegate.reportError("rangeSetSliderNaN");
}
if (this.isIncremental && aMode == "move") {
// Incremental moves are actually sets.
aMode = "set";
}
var outOfRange = false;
if (aMode != "move") {
if (aMode == "set" &&
@ -283,7 +289,8 @@
if (xpos > (this.barwidth + this.margin)) {
xpos = this.barwidth;
}
this.setSlider(this.calcMousePos(this, xpos), "move");
var mode = this.isIncremental ? null : "move"
this.setSlider(this.calcMousePos(this, xpos), mode);
return;
}
]]>
@ -318,7 +325,8 @@
if (xpos > (this.barwidth + this.margin)) {
xpos = this.barwidth + this.margin;
}
this.setSlider(this.calcMousePos(this, xpos), "move");
var mode = this.isIncremental ? null : "move"
this.setSlider(this.calcMousePos(this, xpos), mode);
]]>
</body>
</method>
@ -432,6 +440,16 @@
this.rStep = -this.rStep;
}
// Sanitize @step for xsd:integer
// XXX: we need a schemavalidator.isDerivedFrom(type, "xsd:integer");
if (this.getAttribute("type") == "http://www.w3.org/2001/XMLSchema#integer") {
if (!this.rStep) {
this.rStep = 1;
} else {
this.rStep = Math.round(this.rStep);
}
}
// set labels
aLabelBegin.appendChild(document.createTextNode(this.rBegin));
aLabelEnd.appendChild(document.createTextNode(this.rEnd));