patch: floats in window.open properties
Maciej Stachowiak
mjs at apple.com
Tue Oct 28 15:07:26 CET 2003
This is needed to make some web sites work:
-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/ChangeLog,v
retrieving revision 1.2138
diff -u -p -r1.2138 ChangeLog
--- ChangeLog 2003/10/28 22:21:43 1.2138
+++ ChangeLog 2003/10/28 23:02:41
@@ -2,6 +2,17 @@
Reviewed by John.
+ - fixed 3421393 - window.open does not handle non-integral height/width (small window at saabusa.com)
+
+ * khtml/ecma/kjs_window.cpp:
+ (WindowFunc::tryCall): Parse width, height, top and left as
+ floating point and then cast to int instead of parsing as int to
+ match other browsers and avoid rejecting floating point numbers.
+
+2003-10-28 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by John.
+
- fixed 3464528 - addEventListener does not work for buttons, text areas, or inputs
* khtml/rendering/render_form.cpp:
Index: khtml/ecma/kjs_window.cpp
===================================================================
RCS file: /local/home/cvs/Labyrinth/WebCore/khtml/ecma/kjs_window.cpp,v
retrieving revision 1.86
diff -u -p -r1.86 khtml/ecma/kjs_window.cpp
--- khtml/ecma/kjs_window.cpp 2003/09/29 20:27:41 1.86
+++ khtml/ecma/kjs_window.cpp 2003/10/28 23:02:42
@@ -1189,21 +1189,21 @@ Value WindowFunc::tryCall(ExecState *exe
QRect screen = QApplication::desktop()->screenGeometry(scnum);
if (key == "left" || key == "screenx") {
- winargs.x = val.toInt() + screen.x();
+ winargs.x = (int)val.toFloat() + screen.x();
if (winargs.x < screen.x() || winargs.x > screen.right())
winargs.x = screen.x(); // only safe choice until size is determined
#if APPLE_CHANGES
winargs.xSet = true;
#endif
} else if (key == "top" || key == "screeny") {
- winargs.y = val.toInt() + screen.y();
+ winargs.y = (int)val.toFloat() + screen.y();
if (winargs.y < screen.y() || winargs.y > screen.bottom())
winargs.y = screen.y(); // only safe choice until size is determined
#if APPLE_CHANGES
winargs.ySet = true;
#endif
} else if (key == "height") {
- winargs.height = val.toInt() + 2*qApp->style().pixelMetric( QStyle::PM_DefaultFrameWidth ) + 2;
+ winargs.height = (int)val.toFloat() + 2*qApp->style().pixelMetric( QStyle::PM_DefaultFrameWidth ) + 2;
if (winargs.height > screen.height()) // should actually check workspace
winargs.height = screen.height();
if (winargs.height < 100)
@@ -1212,7 +1212,7 @@ Value WindowFunc::tryCall(ExecState *exe
winargs.heightSet = true;
#endif
} else if (key == "width") {
- winargs.width = val.toInt() + 2*qApp->style().pixelMetric( QStyle::PM_DefaultFrameWidth ) + 2;
+ winargs.width = (int)val.toFloat() + 2*qApp->style().pixelMetric( QStyle::PM_DefaultFrameWidth ) + 2;
if (winargs.width > screen.width()) // should actually check workspace
winargs.width = screen.width();
if (winargs.width < 100)
More information about the Khtml-devel
mailing list