[XForms] select1 and datepicker dropdowns affected by postion style. Bug 355314, r=surkov+olli

git-svn-id: svn://10.0.0.236/trunk@213433 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
aaronr%us.ibm.com 2006-10-10 16:49:49 +00:00
parent a582a2be5f
commit 58f52d5816
3 changed files with 29 additions and 4 deletions

View File

@ -255,13 +255,36 @@
// 100% width, and innerWidth will always give use the browser size
var windowWidth = this.ownerDocument.defaultView.innerWidth;
var position = dropmarkerBox.x - pickerWidth + dropmarkerBox.width;
var p = this.control.offsetParent;
var compStyle =
this.ownerDocument.defaultView.getComputedStyle(p, null);
var relative = compStyle.getPropertyValue("position") == "relative";
if (!relative) {
relative = compStyle.getPropertyValue("position") == "absolute";
}
// reset position if it will bleed to the left or right
var position;
if (relative) {
position = this.dropmarker.offsetLeft - pickerWidth + dropmarkerBox.width;
} else {
position = dropmarkerBox.x - pickerWidth + dropmarkerBox.width;
}
// Reset the position if it will bleed to the left or right.
if (position < 0) {
position = 0;
} else if ((position + pickerWidth) > windowWidth) {
position = windowWidth - pickerWidth;
if (relative) {
// Can't base our position on the window width since our position
// will be set relative to the offsetParent. So let's set the
// position to be the left-most part of the button that triggers
// the dropdown. We'll assume that at least that much of the
// button is visible since the user navigated to it and triggered
// it.
position = this.dropmarker.offsetLeft - pickerWidth;
} else {
position = windowWidth - pickerWidth;
}
}
this.picker.style.left = position + "px";

View File

@ -506,7 +506,8 @@
var p = this.container.offsetParent;
var compStyle =
document.defaultView.getComputedStyle(p, null);
if (compStyle.getPropertyValue("position") != "absolute") {
if (compStyle.getPropertyValue("position") != "absolute" &&
compStyle.getPropertyValue("position") != "relative") {
adjust = document.documentElement.offsetTop;
x = containerBox.x;
y = containerBox.y;

View File

@ -250,6 +250,7 @@ xul|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#boolean"] {
/* input type="xsd:date" */
html|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] html|span[mozType|calendar] {
-moz-binding: url('chrome://xforms/content/widgets-xhtml.xml#calendar-full');
z-index: 2147481647;
}
html|*:root input[mozType|type="http://www.w3.org/2001/XMLSchema#date"] {