Reported against rev383.
In IE6, probably in "quirks-mode", the Core.getWindowSize() does not work
because there browser-capabilities decision path is not complete.
(as a result, on IE6 dialogs are badly centered, sometimes completely
outside of window visible area)
By applying the algorithm described here:
http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
i made a patch fixing the above problem:
I note that my patch is just a Quick 'n Dirty solution.
A more corrrect aproach would be to restructure the getWindowSize() code so as
to have a separate path only for the js-attributes that indeed differ
among browsers,
and a common path for the common ones.
Index: src/js/main/jsCore.js.xml
===================================================================
--- src/js/main/jsCore.js.xml (revision 383)
+++ src/js/main/jsCore.js.xml (working copy)
@@ -207,6 +207,16 @@
myOffsetY = Math.max(document.documentElement.clientHeight,
document.body.clientHeight); // body margins ?
myScrollX = document.body.parentNode.scrollLeft;
myScrollY = document.body.parentNode.scrollTop;
+ } else if( document.body && (
document.body.clientWidth || document.body.clientHeight ) ) {
+ //IE 4 compatible
+ myWidth = document.body.clientWidth;
+ myHeight = document.body.clientHeight;
+ myOffsetX =
Math.max(document.documentElement.clientWidth,
document.body.clientWidth); // body margins ?
+ myOffsetY =
Math.max(document.documentElement.clientHeight,
document.body.clientHeight); // body margins ?
+ myScrollX = document.body.parentNode.scrollLeft;
+ myScrollY = document.body.parentNode.scrollTop;
+ } else {
+ DebugConsole.write("Error: Cannot determine window-size!");
}
return {
height : myHeight,
---------------------
In order to test it, the xform i attached in the previous patch about
XFDialog demonstrates the problem since it usew the getWindowSize to
center the dialog.
I include it here just for reference:
-------------
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="xsltforms/xsltforms.xsl" encoding="UTF-8"
type="text/xsl"?>
<html lang="el" xml:lang="el"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:ev="http://www.w3.org/2001/xml-events"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.w3.org/2002/xforms
http://www.w3.org/MarkUp/Forms/2007/XForms-11-Schema.xsd
http://www.w3.org/2001/xml-events
http://www.w3.org/MarkUp/SCHEMA/xml-events-attribs-1.xsd
"
>
<head>
<title>Dialog Test</title>
<xf:model id="model-main" >
<xf:instance id="inst-doc" >
<doc>
<text>
Some Text
</text>
</doc>
</xf:instance>
<xf:bind id="bind-text" nodeset="text" />
</xf:model>
</head>
<body>
<xf:trigger>
<xf:label>Show Dialog...</xf:label>
<xf:show ev:event="DOMActivate" dialog="dlg-1" />
</xf:trigger>
<!-- A debug-aid dialog helping to collect the instance-documents
in XML. -->
<xf:dialog id="dlg-1" >
<xf:label>
Some Label:
</xf:label>
<xf:textarea bind="bind-text" style="width: 600px; height: 480px;"/>
<xf:trigger>
<xf:label>Ok</xf:label>
<xf:hide ev:event="DOMActivate" dialog="dlg-1" />
</xf:trigger>
</xf:dialog>
</body>
</html>
|