+2005-05-23 Adele Peterson <adele@apple.com>
+
+ Reviewed by Darin.
+
+ fix for <rdar://problem/4122661> Regression: 10.3.8-10.3.9: Next lesson doesn't work on Dale Carnegie Action Systems page
+
+ * khtml/ecma/kjs_window.cpp: (KJS::WindowFunc::tryCall): added checks for NaN, in case it is passed into window.open for screenx, screeny, left, top, height, or width.
+
2005-05-23 David Harrison <harrison@apple.com>
Reviewed by Darin.
#include "css/css_stylesheetimpl.h"
#include "misc/htmltags.h"
+// Must include <cmath> instead of <math.h> because of a bug in the
+// gcc 3.3 library version of <math.h> where if you include both
+// <cmath> and <math.h> the macros necessary for functions like
+// isnan are not defined.
+#include <cmath>
+
using DOM::DocumentImpl;
using DOM::DOMString;
using DOM::ElementImpl;
using khtml::TypingCommand;
+using std::isnan;
+
namespace KJS {
////////////////////// History Object ////////////////////////
if (key == "left" || key == "screenx") {
bool ok;
double d = val.toDouble(&ok);
- if (d != 0 || ok) {
+ if ((d != 0 || ok) && !isnan(d)) {
d += screen.x();
if (d < screen.x() || d > screen.right())
d = screen.x(); // only safe choice until size is determined
} else if (key == "top" || key == "screeny") {
bool ok;
double d = val.toDouble(&ok);
- if (d != 0 || ok) {
+ if ((d != 0 || ok) && !isnan(d)) {
d += screen.y();
if (d < screen.y() || d > screen.bottom())
d = screen.y(); // only safe choice until size is determined
} else if (key == "height") {
bool ok;
double d = val.toDouble(&ok);
- if (d != 0 || ok) {
+ if ((d != 0 || ok) && !isnan(d)) {
#if !APPLE_CHANGES
d += 2*qApp->style().pixelMetric( QStyle::PM_DefaultFrameWidth ) + 2;
#endif
} else if (key == "width") {
bool ok;
double d = val.toDouble(&ok);
- if (d != 0 || ok) {
+ if ((d != 0 || ok) && !isnan(d)) {
#if !APPLE_CHANGES
d += 2*qApp->style().pixelMetric( QStyle::PM_DefaultFrameWidth ) + 2;
#endif