[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:26:08 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 74f6ed6231891d706ee9d71e0d5cdade8f4fab84
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Jul 22 05:38:39 2002 +0000

    JavaScriptCore:
    
            * kjs/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES
    	for some of the changes that we definitely want to contribute upstream.
    
    WebCore:
    
    	* khtml/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES
    	for some of the changes that we definitely want to contribute upstream.
    
            * WebCore.pbproj/project.pbxproj: Add KWQStyle.mm, remove KWQStyle.h, moving contents
    	into qstyle.h.
    
            * kwq/KWQApplication.mm: (QApplication::globalStrut): Remove _logNotYetImplemented().
    
            * kwq/KWQButton.mm: (QButton::QButton): Use plain release, not autorelease.
            * kwq/KWQComboBox.mm: (QComboBox::init): Use plain release, not autorelease.
            * kwq/KWQListBox.mm: (QListBox::QListBox): Use plain release, not autorelease.
            * kwq/KWQPainter.mm: (QPainter::drawArc): Use plain release, not autorelease.
    
            * kwq/KWQKHTMLPartBrowserExtension.mm: Remove import of KWQKHTMLPartImpl.h, now that
    	it's always part of khtml_part.h.
            * kwq/KWQKHTMLPartImpl.cpp: Simplify.
            * kwq/KWQKHTMLPartImpl.h: Add wrapper to allow multiple inclusion. Don't include
    	khtml_part.h any more, since that file now includes this one to minimize changes to
    	KDE code that needs to get to functions in here.
            * kwq/KWQKHTMLPartImpl.mm:
            (KHTMLPart::onURL), (KHTMLPart::nodeActivated), (KHTMLPart::setStatusBarText):
    	Moved here from khtml_part.cpp.
            * kwq/KWQLoaderImpl.mm: Include khtml_part.h instead of KWQKHTMLPartImpl.h.
    
            * kwq/KWQPushButton.mm:
            (buttonFontMetrics), (QPushButton::fontMetrics): Added. Used by the form code to size buttons.
            * kwq/KWQStyle.mm: Added.
            (QStyle::sizeFromContents): Added. Used by the form code to size buttons.
    
            * kwq/KWQStyle.h: Removed.
            * kwq/qt/qstyle.h: Moved contents of KWQStyle.h in here.
            * kwq/qt/qwidget.h: Include <qstyle.h> rather than KWQStyle.h.
    
            * kwq/WebCoreBridge.mm: (-[WebCoreBridge isFrameSet]): Call straight to impl.
    
            * kwq/kdeui/klineedit.h: Add KLineEdit::frameWidth().
            * kwq/qt/qnamespace.h: Remove GUIStyle, MacStyle, and WindowsStyle.
            * kwq/qt/qpaintdevice.h: Add QInternal, QInternal::Printer, and QPaintDevice::devType().
            * kwq/qt/qpainter.h: Add QPainter::device().
            * kwq/qt/qpushbutton.h: Add QPushButton::fontMetrics().
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1623 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 0796ef1..3909950 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,8 @@
+2002-07-21  Darin Adler  <darin at apple.com>
+
+        * kjs/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES
+	for some of the changes that we definitely want to contribute upstream.
+
 2002-07-21  Maciej Stachowiak  <mjs at apple.com>
 
         * Makefile.am: Remove products from symroots on `make clean'.
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index 0796ef1..3909950 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,3 +1,8 @@
+2002-07-21  Darin Adler  <darin at apple.com>
+
+        * kjs/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES
+	for some of the changes that we definitely want to contribute upstream.
+
 2002-07-21  Maciej Stachowiak  <mjs at apple.com>
 
         * Makefile.am: Remove products from symroots on `make clean'.
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 0796ef1..3909950 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,8 @@
+2002-07-21  Darin Adler  <darin at apple.com>
+
+        * kjs/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES
+	for some of the changes that we definitely want to contribute upstream.
+
 2002-07-21  Maciej Stachowiak  <mjs at apple.com>
 
         * Makefile.am: Remove products from symroots on `make clean'.
diff --git a/JavaScriptCore/kjs/array_object.cpp b/JavaScriptCore/kjs/array_object.cpp
index 98d1771..00e27f9 100644
--- a/JavaScriptCore/kjs/array_object.cpp
+++ b/JavaScriptCore/kjs/array_object.cpp
@@ -360,16 +360,19 @@ Value ArrayProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args
           {
             Value jObj = thisObj.get(exec,UString::from(j));
             int cmp;
-            if ( useSortFunction )
-              {
+            if (jObj.type() == UndefinedType) {
+              cmp = 1;
+            } else if (minObj.type() == UndefinedType) {
+              cmp = -1;
+            } else if (useSortFunction) {
                 List l;
                 l.append(jObj);
                 l.append(minObj);
                 Object thisObj = exec->interpreter()->globalObject();
                 cmp = sortFunction.call(exec,thisObj, l ).toInt32(exec);
-              }
-            else
+            } else {
               cmp = (jObj.toString(exec) < minObj.toString(exec)) ? -1 : 1;
+            }
             if ( cmp < 0 )
               {
                 themin = j;
diff --git a/JavaScriptCore/kjs/function.cpp b/JavaScriptCore/kjs/function.cpp
index c99d580..03fadbb 100644
--- a/JavaScriptCore/kjs/function.cpp
+++ b/JavaScriptCore/kjs/function.cpp
@@ -1,7 +1,7 @@
 // -*- c-basic-offset: 2 -*-
 /*
  *  This file is part of the KDE libraries
- *  Copyright (C) 1999-2000 Harri Porten (porten at kde.org)
+ *  Copyright (C) 1999-2002 Harri Porten (porten at kde.org)
  *  Copyright (C) 2001 Peter Kelly (pmk at post.com)
  *
  *  This library is free software; you can redistribute it and/or
@@ -31,12 +31,14 @@
 #include "debugger.h"
 
 #include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
 #include <assert.h>
 #include <string.h>
 
 using namespace KJS;
 
-// ------------------------------ FunctionImp ----------------------------------
+// ----------------------------- FunctionImp ----------------------------------
 
 const ClassInfo FunctionImp::info = {"Function", &InternalFunctionImp::info, 0, 0};
 
@@ -99,7 +101,7 @@ Value FunctionImp::call(ExecState *exec, Object &thisObj, const List &args)
     }
 
     Object func(this);
-    int cont = dbg->callEvent(exec,sid,lineno,func,args);
+    bool cont = dbg->callEvent(exec,sid,lineno,func,args);
     if (!cont) {
       dbg->imp()->abort();
       return Undefined();
@@ -107,36 +109,34 @@ Value FunctionImp::call(ExecState *exec, Object &thisObj, const List &args)
   }
 
   // enter a new execution context
-  ContextImp *ctx = new ContextImp(globalObj, exec, thisObj,
-                                   codeType(), exec->context().imp(), this, args);
-  ExecState *newExec = new ExecState(exec->interpreter(),ctx);
-  newExec->setException(exec->exception()); // could be null
+  ContextImp ctx(globalObj, exec, thisObj, codeType(),
+                 exec->context().imp(), this, args);
+  ExecState newExec(exec->interpreter(), &ctx);
+  newExec.setException(exec->exception()); // could be null
 
   // In order to maintain our "arguments" property, we maintain a list of arguments
   // properties from earlier in the execution stack. Upon return, we restore the
   // previous arguments object using popArgs().
   // Note: this does not appear to be part of the spec
   if (codeType() == FunctionCode) {
-    assert(ctx->activationObject().inherits(&ActivationImp::info));
-    Object argsObj = static_cast<ActivationImp*>(ctx->activationObject().imp())->argumentsObject();
-    put(newExec,"arguments", argsObj, DontDelete|DontEnum|ReadOnly);
-    pushArgs(newExec,argsObj);
+    assert(ctx.activationObject().inherits(&ActivationImp::info));
+    Object argsObj = static_cast<ActivationImp*>(ctx.activationObject().imp())->argumentsObject();
+    put(&newExec, "arguments", argsObj, DontDelete|DontEnum|ReadOnly);
+    pushArgs(&newExec, argsObj);
   }
 
   // assign user supplied arguments to parameters
-  processParameters(newExec,args);
+  processParameters(&newExec, args);
   // add variable declarations (initialized to undefined)
-  processVarDecls(newExec);
+  processVarDecls(&newExec);
 
-  Completion comp = execute(newExec);
+  Completion comp = execute(&newExec);
 
   // if an exception occured, propogate it back to the previous execution object
-  if (newExec->hadException())
-    exec->setException(newExec->exception());
+  if (newExec.hadException())
+    exec->setException(newExec.exception());
   if (codeType() == FunctionCode)
-    popArgs(newExec);
-  delete newExec;
-  delete ctx;
+    popArgs(&newExec);
 
 #ifdef KJS_VERBOSE
   if (comp.complType() == Throw)
@@ -430,34 +430,27 @@ Value GlobalFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args
     break;
   }
   case ParseInt: {
-    String str = args[0].toString(exec);
+    CString cstr = args[0].toString(exec).cstring();
     int radix = args[1].toInt32(exec);
-    if (radix == 0)
-      radix = 10;
-    else if (radix < 2 || radix > 36) {
+
+    char* endptr;
+    errno = 0;
+    long value = strtol(cstr.c_str(), &endptr, radix);
+    if (errno != 0 || endptr == cstr.c_str())
       res = Number(NaN);
-      return res;
-    }
-    /* TODO: use radix */
-    // Can't use toULong(), we want to accept floating point values too
-    double value = str.value().toDouble( true /*tolerant*/ );
-    if ( isNaN(value) )
-        res = Number(NaN);
     else
-        res = Number(static_cast<long>(value)); // remove floating-point part
+      res = Number(value);
     break;
   }
-  case ParseFloat: {
-    String str = args[0].toString(exec);
-    res = Number(str.value().toDouble( true /*tolerant*/ ));
+  case ParseFloat:
+    res = Number(args[0].toString(exec).toDouble( true /*tolerant*/ ));
     break;
-  }
   case IsNaN:
     res = Boolean(isNaN(args[0].toNumber(exec)));
     break;
   case IsFinite: {
-    Number n = args[0].toNumber(exec);
-    res = Boolean(!n.isNaN() && !n.isInf());
+    double n = args[0].toNumber(exec);
+    res = Boolean(!isNaN(n) && !isInf(n));
     break;
   }
   case Escape: {
@@ -484,9 +477,9 @@ Value GlobalFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args
   case UnEscape: {
     UString s, str = args[0].toString(exec);
     int k = 0, len = str.size();
+    UChar u;
     while (k < len) {
       const UChar *c = str.data() + k;
-      UChar u;
       if (*c == UChar('%') && k <= len - 6 && *(c+1) == UChar('u')) {
 	u = Lexer::convertUnicode((c+2)->unicode(), (c+3)->unicode(),
 				  (c+4)->unicode(), (c+5)->unicode());
diff --git a/JavaScriptCore/kjs/internal.cpp b/JavaScriptCore/kjs/internal.cpp
index 366bbb1..8ddecf6 100644
--- a/JavaScriptCore/kjs/internal.cpp
+++ b/JavaScriptCore/kjs/internal.cpp
@@ -1,7 +1,7 @@
 // -*- c-basic-offset: 2 -*-
 /*
  *  This file is part of the KDE libraries
- *  Copyright (C) 1999-2001 Harri Porten (porten at kde.org)
+ *  Copyright (C) 1999-2002 Harri Porten (porten at kde.org)
  *  Copyright (C) 2001 Peter Kelly (pmk at post.com)
  *
  *  This library is free software; you can redistribute it and/or
@@ -836,25 +836,15 @@ void InterpreterImp::initGlobalObject()
   static_cast<ObjectImp*>(global.imp())->setPrototype(b_ObjectPrototype);
 
   // Constructors (Object, Array, etc.)
-
-  ObjectObjectImp *objectObj = new ObjectObjectImp(globExec,objProto,funcProto);
-  b_Object = Object(objectObj);
-  FunctionObjectImp *funcObj = new FunctionObjectImp(globExec,funcProto);
-  b_Function = Object(funcObj);
-  ArrayObjectImp *arrayObj = new ArrayObjectImp(globExec,funcProto,arrayProto);
-  b_Array = Object(arrayObj);
-  StringObjectImp *stringObj = new StringObjectImp(globExec,funcProto,stringProto);
-  b_String = Object(stringObj);
-  BooleanObjectImp *booleanObj = new BooleanObjectImp(globExec,funcProto,booleanProto);
-  b_Boolean = Object(booleanObj);
-  NumberObjectImp *numberObj = new NumberObjectImp(globExec,funcProto,numberProto);
-  b_Number = Object(numberObj);
-  DateObjectImp *dateObj = new DateObjectImp(globExec,funcProto,dateProto);
-  b_Date = Object(dateObj);
-  RegExpObjectImp *regexpObj = new RegExpObjectImp(globExec,regexpProto,funcProto);
-  b_RegExp = Object(regexpObj);
-  ErrorObjectImp *errorObj = new ErrorObjectImp(globExec,funcProto,errorProto);
-  b_Error = Object(errorObj);
+  b_Object = Object(new ObjectObjectImp(globExec, objProto, funcProto));
+  b_Function = Object(new FunctionObjectImp(globExec, funcProto));
+  b_Array = Object(new ArrayObjectImp(globExec, funcProto, arrayProto));
+  b_String = Object(new StringObjectImp(globExec, funcProto, stringProto));
+  b_Boolean = Object(new BooleanObjectImp(globExec, funcProto, booleanProto));
+  b_Number = Object(new NumberObjectImp(globExec, funcProto, numberProto));
+  b_Date = Object(new DateObjectImp(globExec, funcProto, dateProto));
+  b_RegExp = Object(new RegExpObjectImp(globExec, funcProto, regexpProto));
+  b_Error = Object(new ErrorObjectImp(globExec, funcProto, errorProto));
 
   // Error object prototypes
   b_evalErrorPrototype = Object(new NativeErrorPrototypeImp(globExec,errorProto,EvalError,
@@ -1016,7 +1006,7 @@ Completion InterpreterImp::evaluate(const UString &code, const Value &thisV)
       return Completion(Break);
   }
 
-  // no program node means a syntax occurred
+  // no program node means a syntax error occurred
   if (!progNode) {
     Object err = Error::create(globExec,SyntaxError,errMsg.ascii(),errLine);
     err.put(globExec,"sid",Number(sid));
diff --git a/JavaScriptCore/kjs/interpreter.cpp b/JavaScriptCore/kjs/interpreter.cpp
index 34dcd85..4e8e377 100644
--- a/JavaScriptCore/kjs/interpreter.cpp
+++ b/JavaScriptCore/kjs/interpreter.cpp
@@ -299,6 +299,7 @@ Interpreter::CompatMode Interpreter::compatMode() const
 }
 
 #ifdef KJS_DEBUG_MEM
+#include "lexer.h"
 void Interpreter::finalCheck()
 {
   fprintf(stderr,"Interpreter::finalCheck()\n");
@@ -311,6 +312,9 @@ void Interpreter::finalCheck()
   fprintf(stderr,"ListImp::count = %d\n", KJS::ListImp::count);
   Node::finalCheck();
   Collector::finalCheck();
+  Lexer::globalClear();
+  List::globalClear();
+  UString::globalClear();
 }
 #endif
 
diff --git a/JavaScriptCore/kjs/lexer.cpp b/JavaScriptCore/kjs/lexer.cpp
index ce3b4fc..687fb57 100644
--- a/JavaScriptCore/kjs/lexer.cpp
+++ b/JavaScriptCore/kjs/lexer.cpp
@@ -91,6 +91,14 @@ Lexer *Lexer::curr()
   return currLexer;
 }
 
+#ifdef KJS_DEBUG_MEM
+void Lexer::globalClear()
+{
+  delete currLexer;
+  currLexer = 0L;
+}
+#endif
+
 void Lexer::setCode(const UChar *c, unsigned int len)
 {
   yylineno = 1;
diff --git a/JavaScriptCore/kjs/lexer.h b/JavaScriptCore/kjs/lexer.h
index db04cc6..989b54d 100644
--- a/JavaScriptCore/kjs/lexer.h
+++ b/JavaScriptCore/kjs/lexer.h
@@ -111,6 +111,12 @@ namespace KJS {
     static bool isIdentLetter(unsigned short c);
     static bool isDecimalDigit(unsigned short c);
 
+#ifdef KJS_DEBUG_MEM
+    /**
+     * Clear statically allocated resources
+     */
+    static void globalClear();
+#endif
   private:
 
     void record8(unsigned short c);
diff --git a/JavaScriptCore/kjs/math_object.cpp b/JavaScriptCore/kjs/math_object.cpp
index b82f32a..4f40456 100644
--- a/JavaScriptCore/kjs/math_object.cpp
+++ b/JavaScriptCore/kjs/math_object.cpp
@@ -140,13 +140,8 @@ bool MathFuncImp::implementsCall() const
 
 Value MathFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
 {
-  Value v = args[0];
-  Number n = v.toNumber(exec);
-  double arg = n.value();
-
-  Value v2 = args[1];
-  Number n2 = v2.toNumber(exec);
-  double arg2 = n2.value();
+  double arg = args[0].toNumber(exec);
+  double arg2 = args[1].toNumber(exec);
   double result;
 
   switch (id) {
@@ -240,7 +235,7 @@ Value MathFuncImp::call(ExecState *exec, Object &/*thisObj*/, const List &args)
   case MathObjectImp::Round:
     if (isNaN(arg))
       result = arg;
-    if (isInf(arg) || isInf(-arg))
+    else if (isInf(arg) || isInf(-arg))
       result = arg;
     else if (arg == -0.5)
       result = 0;
diff --git a/JavaScriptCore/kjs/nodes.cpp b/JavaScriptCore/kjs/nodes.cpp
index 6143117..3da5576 100644
--- a/JavaScriptCore/kjs/nodes.cpp
+++ b/JavaScriptCore/kjs/nodes.cpp
@@ -1,7 +1,7 @@
 // -*- c-basic-offset: 2 -*-
 /*
  *  This file is part of the KDE libraries
- *  Copyright (C) 1999-2001 Harri Porten (porten at kde.org)
+ *  Copyright (C) 1999-2002 Harri Porten (porten at kde.org)
  *  Copyright (C) 2001 Peter Kelly (pmk at post.com)
  *
  *  This library is free software; you can redistribute it and/or
@@ -73,7 +73,7 @@ using namespace KJS;
     return List(); // will be picked up by KJS_CHECKEXCEPTION
 
 #ifdef KJS_DEBUG_MEM
-std::list<Node *> Node::s_nodes;
+std::list<Node *> * Node::s_nodes = 0L;
 #endif
 // ------------------------------ Node -----------------------------------------
 
@@ -82,28 +82,26 @@ Node::Node()
   line = Lexer::curr()->lineNo();
   refcount = 0;
 #ifdef KJS_DEBUG_MEM
-  s_nodes.push_back( this );
+  if (!s_nodes)
+    s_nodes = new std::list<Node *>;
+  s_nodes->push_back(this);
 #endif
 }
 
 Node::~Node()
 {
 #ifdef KJS_DEBUG_MEM
-  s_nodes.remove( this );
+  s_nodes->remove( this );
 #endif
 }
 
 #ifdef KJS_DEBUG_MEM
 void Node::finalCheck()
 {
-#ifdef APPLE_CHANGES
   fprintf( stderr, "Node::finalCheck(): list count       : %d\n", (int)s_nodes.size() );
-#else
-  fprintf( stderr, "Node::finalCheck(): list count       : %d\n", s_nodes.size() );
-#endif
-  std::list<Node *>::iterator it = s_nodes.begin();
-  for ( uint i = 0; it != s_nodes.end() ; ++it, ++i )
     fprintf( stderr, "[%d] Still having node %p (%s) (refcount %d)\n", i, (void*)*it, typeid( **it ).name(), (*it)->refcount );
+  delete s_nodes;
+  s_nodes = 0L;
 }
 #endif
 
@@ -746,6 +744,16 @@ Value FunctionCallNode::evaluate(ExecState *exec)
     return throwError(exec, TypeError, "Expression does not allow calls.");
   }
 
+#if KJS_MAX_STACK > 0
+  static int depth = 0; // sum of all concurrent interpreters
+  if (++depth > KJS_MAX_STACK) {
+#ifndef NDEBUG
+    printInfo(exec, "Exceeded maximum function call depth", v, line);
+#endif
+    return throwError(exec, RangeError, "Exceeded maximum call stack size.");
+  }
+#endif
+
   Value thisVal;
   if (e.type() == ReferenceType)
     thisVal = e.getBase(exec);
@@ -770,6 +778,10 @@ Value FunctionCallNode::evaluate(ExecState *exec)
   Object thisObj = Object::dynamicCast(thisVal);
   Value result = func.call(exec,thisObj, argList);
 
+#if KJS_MAX_STACK > 0
+  --depth;
+#endif
+
   return result;
 }
 
@@ -3139,7 +3151,6 @@ Completion SourceElementsNode::execute(ExecState *exec)
 {
   KJS_CHECKEXCEPTION
 
-#ifdef APPLE_CHANGES
   Completion c1 = element->execute(exec);
   KJS_CHECKEXCEPTION;
   if (c1.complType() != Normal)
@@ -3156,54 +3167,21 @@ Completion SourceElementsNode::execute(ExecState *exec)
   }
   
   return c1;
-#else
-  if (!elements)
-    return element->execute(exec);
-
-  Completion c1 = elements->execute(exec);
-  KJS_CHECKEXCEPTION
-  if (c1.complType() != Normal)
-    return c1;
-
-  Completion c2 = element->execute(exec);
-  KJS_CHECKEXCEPTION
-
-  // The spec says to return c2 here, but it seems that mozilla returns c1 if
-  // c2 doesn't have a value
-  if (c2.complType() == Normal && c2.value().isNull())
-    return c1;
-  else
-    return c2;
-#endif
 }
 
 // ECMA 14
 void SourceElementsNode::processFuncDecl(ExecState *exec)
 {
-#ifdef APPLE_CHANGES
   for (SourceElementsNode *node = this; node; node = node->elements) {
     node->element->processFuncDecl(exec);
   }
-#else
-  if (elements)
-    elements->processFuncDecl(exec);
-
-  element->processFuncDecl(exec);
-#endif
 }
 
 void SourceElementsNode::processVarDecls(ExecState *exec)
 {
-#ifdef APPLE_CHANGES
   for (SourceElementsNode *node = this; node; node = node->elements) {
     node->element->processVarDecls(exec);
   }
-#else
-  if (elements)
-    elements->processVarDecls(exec);
-
-  element->processVarDecls(exec);
-#endif
 }
 
 ProgramNode::ProgramNode(SourceElementsNode *s): FunctionBodyNode(s) {
diff --git a/JavaScriptCore/kjs/nodes.h b/JavaScriptCore/kjs/nodes.h
index f010a3b..42bb2a6 100644
--- a/JavaScriptCore/kjs/nodes.h
+++ b/JavaScriptCore/kjs/nodes.h
@@ -101,7 +101,7 @@ namespace KJS {
   private:
 #ifdef KJS_DEBUG_MEM
     // List of all nodes, for debugging purposes. Don't remove!
-    static std::list<Node *> s_nodes;
+    static std::list<Node *> *s_nodes;
 #endif
     // disallow assignment
     Node& operator=(const Node&);
diff --git a/JavaScriptCore/kjs/object.h b/JavaScriptCore/kjs/object.h
index de4ea03..c679249 100644
--- a/JavaScriptCore/kjs/object.h
+++ b/JavaScriptCore/kjs/object.h
@@ -27,6 +27,10 @@
 
 // Objects
 
+// maximum global call stack size. Protects against accidental or
+// malicious infinite recursions. Define to -1 if you want no limit.
+#define KJS_MAX_STACK 1000
+
 #include "value.h"
 #include "types.h"
 
diff --git a/JavaScriptCore/kjs/operations.cpp b/JavaScriptCore/kjs/operations.cpp
index 670f721..41c0ef8 100644
--- a/JavaScriptCore/kjs/operations.cpp
+++ b/JavaScriptCore/kjs/operations.cpp
@@ -244,17 +244,17 @@ Value KJS::add(ExecState *exec, const Value &v1, const Value &v2, char oper)
 // ECMA 11.5
 Value KJS::mult(ExecState *exec, const Value &v1, const Value &v2, char oper)
 {
-  Number n1 = v1.toNumber(exec);
-  Number n2 = v2.toNumber(exec);
+  double n1 = v1.toNumber(exec);
+  double n2 = v2.toNumber(exec);
 
   double result;
 
   if (oper == '*')
-    result = n1.value() * n2.value();
+    result = n1 * n2;
   else if (oper == '/')
-    result = n1.value() / n2.value();
+    result = n1 / n2;
   else
-    result = fmod(n1.value(), n2.value());
+    result = fmod(n1, n2);
 
   return Number(result);
 }
diff --git a/JavaScriptCore/kjs/regexp.cpp b/JavaScriptCore/kjs/regexp.cpp
index 496b05d..ad405b7 100644
--- a/JavaScriptCore/kjs/regexp.cpp
+++ b/JavaScriptCore/kjs/regexp.cpp
@@ -28,17 +28,17 @@
 using namespace KJS;
 
 RegExp::RegExp(const UString &p, int f)
-  : pattern(p), flags(f)
+  : pattern(p), flgs(f)
 {
 #ifdef HAVE_PCREPOSIX
   int pcreflags = 0;
   const char *perrormsg;
   int errorOffset;
 
-  if (flags & IgnoreCase)
+  if (flgs & IgnoreCase)
     pcreflags |= PCRE_CASELESS;
 
-  if (flags & Multiline)
+  if (flgs & Multiline)
     pcreflags |= PCRE_MULTILINE;
 
   pcregex = pcre_compile(p.ascii(), pcreflags,
diff --git a/JavaScriptCore/kjs/regexp.h b/JavaScriptCore/kjs/regexp.h
index b525004..dbb626f 100644
--- a/JavaScriptCore/kjs/regexp.h
+++ b/JavaScriptCore/kjs/regexp.h
@@ -44,6 +44,7 @@ namespace KJS {
     enum { None = 0, Global = 1, IgnoreCase = 2, Multiline = 4 };
     RegExp(const UString &p, int f = None);
     ~RegExp();
+    int flags() const { return flgs; }
     UString match(const UString &s, int i = -1, int *pos = 0L, int **ovector = 0L);
     // test is unused. The JS spec says that RegExp.test should use
     // RegExp.exec, so it has to store $1 etc.
@@ -51,7 +52,7 @@ namespace KJS {
     uint subPatterns() const { return nrSubPatterns; }
   private:
     const UString &pattern;
-    int flags;
+    int flgs;
 
 #ifndef HAVE_PCREPOSIX
     regex_t preg;
diff --git a/JavaScriptCore/kjs/regexp_object.cpp b/JavaScriptCore/kjs/regexp_object.cpp
index 603cefb..ecc8981 100644
--- a/JavaScriptCore/kjs/regexp_object.cpp
+++ b/JavaScriptCore/kjs/regexp_object.cpp
@@ -149,8 +149,9 @@ RegExpImp::~RegExpImp()
 // ------------------------------ RegExpObjectImp ------------------------------
 
 RegExpObjectImp::RegExpObjectImp(ExecState *exec,
-                                 RegExpPrototypeImp *regProto,
-                                 FunctionPrototypeImp *funcProto)
+                                 FunctionPrototypeImp *funcProto,
+                                 RegExpPrototypeImp *regProto)
+
   : InternalFunctionImp(funcProto), lastOvector(0L), lastNrSubPatterns(0)
 {
   Value protect(this);
@@ -175,7 +176,7 @@ int **RegExpObjectImp::registerRegexp( const RegExp* re, const UString& s )
   return &lastOvector;
 }
 
-Value RegExpObjectImp::arrayOfMatches(ExecState *exec, const UString &result) const
+Object RegExpObjectImp::arrayOfMatches(ExecState *exec, const UString &result) const
 {
   List list;
   // The returned array contains 'result' as first item, followed by the list of matches
@@ -186,10 +187,13 @@ Value RegExpObjectImp::arrayOfMatches(ExecState *exec, const UString &result) co
       UString substring = lastString.substr( lastOvector[2*i], lastOvector[2*i+1] - lastOvector[2*i] );
       list.append(String(substring));
     }
-  return exec->interpreter()->builtinArray().construct(exec, list);
+  Object arr = exec->interpreter()->builtinArray().construct(exec, list);
+  arr.put(exec, "index", Number(lastOvector[0]));
+  arr.put(exec, "input", String(lastString));
+  return arr;
 }
 
-Value RegExpObjectImp::get(ExecState *, const UString &p) const
+Value RegExpObjectImp::get(ExecState *exec, const UString &p) const
 {
   if (p[0] == '$' && lastOvector)
   {
@@ -205,7 +209,7 @@ Value RegExpObjectImp::get(ExecState *, const UString &p) const
       return String("");
     }
   }
-  return Undefined();
+  return InternalFunctionImp::get(exec, p);
 }
 
 bool RegExpObjectImp::implementsConstruct() const
@@ -216,9 +220,8 @@ bool RegExpObjectImp::implementsConstruct() const
 // ECMA 15.10.4
 Object RegExpObjectImp::construct(ExecState *exec, const List &args)
 {
-  String p = args[0].toString(exec);
-  String f = args[1].toString(exec);
-  UString flags = f.value();
+  String p = args.isEmpty() ? UString("") : args[0].toString(exec);
+  UString flags = args[1].toString(exec);
 
   RegExpPrototypeImp *proto = static_cast<RegExpPrototypeImp*>(exec->interpreter()->builtinRegExpPrototype().imp());
   RegExpImp *dat = new RegExpImp(proto);
@@ -233,7 +236,7 @@ Object RegExpObjectImp::construct(ExecState *exec, const List &args)
   dat->put(exec, "ignoreCase", Boolean(ignoreCase));
   dat->put(exec, "multiline", Boolean(multiline));
 
-  dat->put(exec, "source", String(p.value()));
+  dat->put(exec, "source", p);
   dat->put(exec, "lastIndex", Number(0), DontDelete | DontEnum);
 
   int reflags = RegExp::None;
@@ -254,8 +257,10 @@ bool RegExpObjectImp::implementsCall() const
 }
 
 // ECMA 15.10.3
-Value RegExpObjectImp::call(ExecState */*exec*/, Object &/*thisObj*/, const List &/*args*/)
+Value RegExpObjectImp::call(ExecState *exec, Object &/*thisObj*/,
+			    const List &args)
 {
-  // TODO: implement constructor
-  return Undefined();
+  // TODO: handle RegExp argument case (15.10.3.1)
+
+  return construct(exec, args);
 }
diff --git a/JavaScriptCore/kjs/regexp_object.h b/JavaScriptCore/kjs/regexp_object.h
index e775fea..12d1bff 100644
--- a/JavaScriptCore/kjs/regexp_object.h
+++ b/JavaScriptCore/kjs/regexp_object.h
@@ -64,8 +64,8 @@ namespace KJS {
   class RegExpObjectImp : public InternalFunctionImp {
   public:
     RegExpObjectImp(ExecState *exec,
-                    RegExpPrototypeImp *regProto,
-                    FunctionPrototypeImp *funcProto);
+                    FunctionPrototypeImp *funcProto,
+                    RegExpPrototypeImp *regProto);
     virtual ~RegExpObjectImp();
     virtual bool implementsConstruct() const;
     virtual Object construct(ExecState *exec, const List &args);
@@ -75,7 +75,7 @@ namespace KJS {
     Value get(ExecState *exec, const UString &p) const;
     int ** registerRegexp( const RegExp* re, const UString& s );
     void setSubPatterns(int num) { lastNrSubPatterns = num; }
-    Value arrayOfMatches(ExecState *exec, const UString &result) const;
+    Object arrayOfMatches(ExecState *exec, const UString &result) const;
   private:
     UString lastString;
     int *lastOvector;
diff --git a/JavaScriptCore/kjs/string_object.cpp b/JavaScriptCore/kjs/string_object.cpp
index 7092df0..3564876 100644
--- a/JavaScriptCore/kjs/string_object.cpp
+++ b/JavaScriptCore/kjs/string_object.cpp
@@ -57,8 +57,8 @@ const ClassInfo StringPrototypeImp::info = {"String", &StringInstanceImp::info,
   match			StringProtoFuncImp::Match	DontEnum|Function	1
   replace		StringProtoFuncImp::Replace	DontEnum|Function	2
   search		StringProtoFuncImp::Search	DontEnum|Function	1
-  slice			StringProtoFuncImp::Slice	DontEnum|Function	0
-  split			StringProtoFuncImp::Split	DontEnum|Function	1
+  slice			StringProtoFuncImp::Slice	DontEnum|Function	2
+  split			StringProtoFuncImp::Split	DontEnum|Function	2
   substr		StringProtoFuncImp::Substr	DontEnum|Function	2
   substring		StringProtoFuncImp::Substring	DontEnum|Function	2
   toLowerCase		StringProtoFuncImp::ToLowerCase	DontEnum|Function	0
@@ -196,10 +196,11 @@ Value StringProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &arg
   case Match:
   case Search: {
     u = s;
-    RegExp* reg = 0;
+    RegExp *reg, *tmpReg = 0;
+    RegExpImp *imp = 0;
     if (a0.isA(ObjectType) && a0.toObject(exec).inherits(&RegExpImp::info))
     {
-      RegExpImp* imp = static_cast<RegExpImp *>( a0.toObject(exec).imp() );
+      imp = static_cast<RegExpImp *>( a0.toObject(exec).imp() );
       reg = imp->regExp();
     }
     else
@@ -208,24 +209,40 @@ Value StringProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &arg
        *  If regexp is not an object whose [[Class]] property is "RegExp", it is
        *  replaced with the result of the expression new RegExp(regexp).
        */
-      reg = new RegExp(a0.toString(exec), RegExp::None);
+      reg = tmpReg = new RegExp(a0.toString(exec), RegExp::None);
     }
     RegExpObjectImp* regExpObj = static_cast<RegExpObjectImp*>(exec->interpreter()->builtinRegExp().imp());
-    int **ovector = regExpObj->registerRegexp( reg, u );
+    int **ovector = regExpObj->registerRegexp(reg, u);
     UString mstr = reg->match(u, -1, &pos, ovector);
-    regExpObj->setSubPatterns(reg->subPatterns());
-    if (a0.isA(StringType))
-      delete reg;
     if (id == Search) {
       result = Number(pos);
-      break;
+    } else {
+      // Exec
+      if ((reg->flags() & RegExp::Global) == 0) {
+	// case without 'g' flag is handled like RegExp.prototype.exec
+	if (mstr.isNull())
+	  return Null(); // no match
+	regExpObj->setSubPatterns(reg->subPatterns());
+	result = regExpObj->arrayOfMatches(exec,mstr);
+      } else {
+	// return array of matches
+	List list;
+	int lastIndex = 0;
+	while (pos >= 0) {
+	  list.append(String(mstr));
+	  lastIndex = pos;
+	  pos += mstr.isEmpty() ? 1 : mstr.size();
+	  delete [] *ovector;
+	  mstr = reg->match(u, pos, &pos, ovector);
+	}
+	if (imp)
+	  imp->put(exec, "lastIndex", Number(lastIndex), DontDelete|DontEnum);
+	result = exec->interpreter()->builtinArray().construct(exec, list);
+      }
     }
-    if (mstr.isNull())
-      result = Null();
-    else
-      result = regExpObj->arrayOfMatches(exec,mstr);
-  }
+    delete tmpReg;
     break;
+  }
   case Replace:
     u = s;
     if (a0.type() == ObjectType && a0.toObject(exec).inherits(&RegExpImp::info)) {
@@ -328,12 +345,13 @@ Value StringProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &arg
 	res.put(exec,"length", Number(0));
 	break;
       }
-      int *ovector;
-      int mpos;
       pos = 0;
-      while (1) {
+      while (pos < u.size()) {
 	// TODO: back references
+        int mpos;
+        int *ovector = 0L;
 	UString mstr = reg.match(u, pos, &mpos, &ovector);
+        delete [] ovector; ovector = 0L;
 	if (mpos < 0)
 	  break;
 	pos = mpos + (mstr.isEmpty() ? 1 : mstr.size());
@@ -343,7 +361,6 @@ Value StringProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &arg
 	  i++;
 	}
       }
-      delete [] ovector;
     } else if (a0.type() != UndefinedType) {
       u2 = a0.toString(exec);
       if (u2.isEmpty()) {
diff --git a/JavaScriptCore/kjs/string_object.lut.h b/JavaScriptCore/kjs/string_object.lut.h
index ff1790e..0dbf6fb 100644
--- a/JavaScriptCore/kjs/string_object.lut.h
+++ b/JavaScriptCore/kjs/string_object.lut.h
@@ -15,7 +15,7 @@ const struct HashEntry stringTableEntries[] = {
    { 0, 0, 0, 0, 0 },
    { "concat", StringProtoFuncImp::Concat, DontEnum|Function, 1, &stringTableEntries[26] },
    { 0, 0, 0, 0, 0 },
-   { "split", StringProtoFuncImp::Split, DontEnum|Function, 1, &stringTableEntries[28] },
+   { "split", StringProtoFuncImp::Split, DontEnum|Function, 2, &stringTableEntries[28] },
    { "anchor", StringProtoFuncImp::Anchor, DontEnum|Function, 1, 0 },
    { "charCodeAt", StringProtoFuncImp::CharCodeAt, DontEnum|Function, 1, 0 },
    { "toUpperCase", StringProtoFuncImp::ToUpperCase, DontEnum|Function, 0, 0 },
@@ -31,7 +31,7 @@ const struct HashEntry stringTableEntries[] = {
    { "charAt", StringProtoFuncImp::CharAt, DontEnum|Function, 1, 0 },
    { "fontsize", StringProtoFuncImp::Fontsize, DontEnum|Function, 1, 0 },
    { "substr", StringProtoFuncImp::Substr, DontEnum|Function, 2, 0 },
-   { "slice", StringProtoFuncImp::Slice, DontEnum|Function, 0, &stringTableEntries[30] },
+   { "slice", StringProtoFuncImp::Slice, DontEnum|Function, 2, &stringTableEntries[30] },
    { "substring", StringProtoFuncImp::Substring, DontEnum|Function, 2, 0 },
    { "toLowerCase", StringProtoFuncImp::ToLowerCase, DontEnum|Function, 0, 0 },
    { "big", StringProtoFuncImp::Big, DontEnum|Function, 0, &stringTableEntries[35] },
diff --git a/JavaScriptCore/kjs/types.cpp b/JavaScriptCore/kjs/types.cpp
index 23569fc..c6645c8 100644
--- a/JavaScriptCore/kjs/types.cpp
+++ b/JavaScriptCore/kjs/types.cpp
@@ -269,6 +269,15 @@ const List List::empty()
   return ListImp::empty();
 }
 
+#ifdef KJS_DEBUG_MEM
+void List::globalClear()
+{
+  delete ListImp::emptyList;
+  ListImp::emptyList = 0L;
+}
+#endif
+
+
 // ------------------------------ Completion -----------------------------------
 
 Completion::Completion(ComplType c, const Value& v, const UString &t)
diff --git a/JavaScriptCore/kjs/types.h b/JavaScriptCore/kjs/types.h
index 857c7d7..71df730 100644
--- a/JavaScriptCore/kjs/types.h
+++ b/JavaScriptCore/kjs/types.h
@@ -229,6 +229,9 @@ namespace KJS {
      * function has a @ref KJS::List parameter.
      */
     static const List empty();
+#ifdef KJS_DEBUG_MEM
+    static void globalClear();
+#endif
   };
 
   /**
diff --git a/JavaScriptCore/kjs/ustring.cpp b/JavaScriptCore/kjs/ustring.cpp
index 7906c80..0f04e7b 100644
--- a/JavaScriptCore/kjs/ustring.cpp
+++ b/JavaScriptCore/kjs/ustring.cpp
@@ -341,6 +341,14 @@ char *UString::ascii() const
   return statBuffer;
 }
 
+#ifdef KJS_DEBUG_MEM
+void UString::globalClear()
+{
+  delete [] statBuffer;
+  statBuffer = 0L;
+}
+#endif
+
 UString &UString::operator=(const char *c)
 {
 #ifdef APPLE_CHANGES
diff --git a/JavaScriptCore/kjs/ustring.h b/JavaScriptCore/kjs/ustring.h
index 402f0ea..9fe3e24 100644
--- a/JavaScriptCore/kjs/ustring.h
+++ b/JavaScriptCore/kjs/ustring.h
@@ -402,6 +402,12 @@ namespace KJS {
      * Static instance of a null string.
      */
     static UString null;
+#ifdef KJS_DEBUG_MEM
+    /**
+     * Clear statically allocated resources.
+     */
+    static void globalClear();
+#endif
   private:
     void attach(Rep *r);
     void detach();
diff --git a/JavaScriptCore/kjs/value.cpp b/JavaScriptCore/kjs/value.cpp
index 0d5a241..f7bfc8b 100644
--- a/JavaScriptCore/kjs/value.cpp
+++ b/JavaScriptCore/kjs/value.cpp
@@ -39,7 +39,7 @@
 
 using namespace KJS;
 
-// ------------------------------ ValueImp -------------------------------------
+// ----------------------------- ValueImp -------------------------------------
 
 #if APPLE_CHANGES
 ValueImp::ValueImp() :
@@ -381,7 +381,7 @@ Undefined Undefined::dynamicCast(const Value &v)
   if (v.isNull() || v.type() != UndefinedType)
     return Undefined(0);
 
-  return Undefined(static_cast<UndefinedImp*>(v.imp()));
+  return Undefined();
 }
 
 // ------------------------------ Null -----------------------------------------
@@ -413,7 +413,7 @@ Null Null::dynamicCast(const Value &v)
   if (v.isNull() || v.type() != NullType)
     return Null(0);
 
-  return Null(static_cast<NullImp*>(v.imp()));
+  return Null();
 }
 
 // ------------------------------ Boolean --------------------------------------
@@ -541,17 +541,16 @@ double Number::value() const
 
 int Number::intValue() const
 {
-  assert(rep);
-  return (int)((NumberImp*)rep)->value();
+  return int(value());
 }
 
 bool Number::isNaN() const
 {
-  return KJS::isNaN(((NumberImp*)rep)->value());
+  return KJS::isNaN(value());
 }
 
 bool Number::isInf() const
 {
-  return KJS::isInf(((NumberImp*)rep)->value());
+  return KJS::isInf(value());
 }
 
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index b1a7d4a..db1a945 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,46 @@
+2002-07-21  Darin Adler  <darin at apple.com>
+
+	* khtml/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES
+	for some of the changes that we definitely want to contribute upstream.
+
+        * WebCore.pbproj/project.pbxproj: Add KWQStyle.mm, remove KWQStyle.h, moving contents
+	into qstyle.h.
+
+        * kwq/KWQApplication.mm: (QApplication::globalStrut): Remove _logNotYetImplemented().
+
+        * kwq/KWQButton.mm: (QButton::QButton): Use plain release, not autorelease.
+        * kwq/KWQComboBox.mm: (QComboBox::init): Use plain release, not autorelease.
+        * kwq/KWQListBox.mm: (QListBox::QListBox): Use plain release, not autorelease.
+        * kwq/KWQPainter.mm: (QPainter::drawArc): Use plain release, not autorelease.
+
+        * kwq/KWQKHTMLPartBrowserExtension.mm: Remove import of KWQKHTMLPartImpl.h, now that
+	it's always part of khtml_part.h.
+        * kwq/KWQKHTMLPartImpl.cpp: Simplify.
+        * kwq/KWQKHTMLPartImpl.h: Add wrapper to allow multiple inclusion. Don't include
+	khtml_part.h any more, since that file now includes this one to minimize changes to
+	KDE code that needs to get to functions in here.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KHTMLPart::onURL), (KHTMLPart::nodeActivated), (KHTMLPart::setStatusBarText):
+	Moved here from khtml_part.cpp.
+        * kwq/KWQLoaderImpl.mm: Include khtml_part.h instead of KWQKHTMLPartImpl.h.
+
+        * kwq/KWQPushButton.mm:
+        (buttonFontMetrics), (QPushButton::fontMetrics): Added. Used by the form code to size buttons.
+        * kwq/KWQStyle.mm: Added.
+        (QStyle::sizeFromContents): Added. Used by the form code to size buttons.
+
+        * kwq/KWQStyle.h: Removed.
+        * kwq/qt/qstyle.h: Moved contents of KWQStyle.h in here.
+        * kwq/qt/qwidget.h: Include <qstyle.h> rather than KWQStyle.h.
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge isFrameSet]): Call straight to impl.
+
+        * kwq/kdeui/klineedit.h: Add KLineEdit::frameWidth().
+        * kwq/qt/qnamespace.h: Remove GUIStyle, MacStyle, and WindowsStyle.
+        * kwq/qt/qpaintdevice.h: Add QInternal, QInternal::Printer, and QPaintDevice::devType().
+        * kwq/qt/qpainter.h: Add QPainter::device().
+        * kwq/qt/qpushbutton.h: Add QPushButton::fontMetrics().
+
 2002-07-21  Maciej Stachowiak  <mjs at apple.com>
 
 	Fix a recent regression that made JavaScript window closing
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index b1a7d4a..db1a945 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,46 @@
+2002-07-21  Darin Adler  <darin at apple.com>
+
+	* khtml/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES
+	for some of the changes that we definitely want to contribute upstream.
+
+        * WebCore.pbproj/project.pbxproj: Add KWQStyle.mm, remove KWQStyle.h, moving contents
+	into qstyle.h.
+
+        * kwq/KWQApplication.mm: (QApplication::globalStrut): Remove _logNotYetImplemented().
+
+        * kwq/KWQButton.mm: (QButton::QButton): Use plain release, not autorelease.
+        * kwq/KWQComboBox.mm: (QComboBox::init): Use plain release, not autorelease.
+        * kwq/KWQListBox.mm: (QListBox::QListBox): Use plain release, not autorelease.
+        * kwq/KWQPainter.mm: (QPainter::drawArc): Use plain release, not autorelease.
+
+        * kwq/KWQKHTMLPartBrowserExtension.mm: Remove import of KWQKHTMLPartImpl.h, now that
+	it's always part of khtml_part.h.
+        * kwq/KWQKHTMLPartImpl.cpp: Simplify.
+        * kwq/KWQKHTMLPartImpl.h: Add wrapper to allow multiple inclusion. Don't include
+	khtml_part.h any more, since that file now includes this one to minimize changes to
+	KDE code that needs to get to functions in here.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KHTMLPart::onURL), (KHTMLPart::nodeActivated), (KHTMLPart::setStatusBarText):
+	Moved here from khtml_part.cpp.
+        * kwq/KWQLoaderImpl.mm: Include khtml_part.h instead of KWQKHTMLPartImpl.h.
+
+        * kwq/KWQPushButton.mm:
+        (buttonFontMetrics), (QPushButton::fontMetrics): Added. Used by the form code to size buttons.
+        * kwq/KWQStyle.mm: Added.
+        (QStyle::sizeFromContents): Added. Used by the form code to size buttons.
+
+        * kwq/KWQStyle.h: Removed.
+        * kwq/qt/qstyle.h: Moved contents of KWQStyle.h in here.
+        * kwq/qt/qwidget.h: Include <qstyle.h> rather than KWQStyle.h.
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge isFrameSet]): Call straight to impl.
+
+        * kwq/kdeui/klineedit.h: Add KLineEdit::frameWidth().
+        * kwq/qt/qnamespace.h: Remove GUIStyle, MacStyle, and WindowsStyle.
+        * kwq/qt/qpaintdevice.h: Add QInternal, QInternal::Printer, and QPaintDevice::devType().
+        * kwq/qt/qpainter.h: Add QPainter::device().
+        * kwq/qt/qpushbutton.h: Add QPushButton::fontMetrics().
+
 2002-07-21  Maciej Stachowiak  <mjs at apple.com>
 
 	Fix a recent regression that made JavaScript window closing
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index b1a7d4a..db1a945 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,46 @@
+2002-07-21  Darin Adler  <darin at apple.com>
+
+	* khtml/*: Roll KDE 3.0.2 changes in. Also switch to not using APPLE_CHANGES
+	for some of the changes that we definitely want to contribute upstream.
+
+        * WebCore.pbproj/project.pbxproj: Add KWQStyle.mm, remove KWQStyle.h, moving contents
+	into qstyle.h.
+
+        * kwq/KWQApplication.mm: (QApplication::globalStrut): Remove _logNotYetImplemented().
+
+        * kwq/KWQButton.mm: (QButton::QButton): Use plain release, not autorelease.
+        * kwq/KWQComboBox.mm: (QComboBox::init): Use plain release, not autorelease.
+        * kwq/KWQListBox.mm: (QListBox::QListBox): Use plain release, not autorelease.
+        * kwq/KWQPainter.mm: (QPainter::drawArc): Use plain release, not autorelease.
+
+        * kwq/KWQKHTMLPartBrowserExtension.mm: Remove import of KWQKHTMLPartImpl.h, now that
+	it's always part of khtml_part.h.
+        * kwq/KWQKHTMLPartImpl.cpp: Simplify.
+        * kwq/KWQKHTMLPartImpl.h: Add wrapper to allow multiple inclusion. Don't include
+	khtml_part.h any more, since that file now includes this one to minimize changes to
+	KDE code that needs to get to functions in here.
+        * kwq/KWQKHTMLPartImpl.mm:
+        (KHTMLPart::onURL), (KHTMLPart::nodeActivated), (KHTMLPart::setStatusBarText):
+	Moved here from khtml_part.cpp.
+        * kwq/KWQLoaderImpl.mm: Include khtml_part.h instead of KWQKHTMLPartImpl.h.
+
+        * kwq/KWQPushButton.mm:
+        (buttonFontMetrics), (QPushButton::fontMetrics): Added. Used by the form code to size buttons.
+        * kwq/KWQStyle.mm: Added.
+        (QStyle::sizeFromContents): Added. Used by the form code to size buttons.
+
+        * kwq/KWQStyle.h: Removed.
+        * kwq/qt/qstyle.h: Moved contents of KWQStyle.h in here.
+        * kwq/qt/qwidget.h: Include <qstyle.h> rather than KWQStyle.h.
+
+        * kwq/WebCoreBridge.mm: (-[WebCoreBridge isFrameSet]): Call straight to impl.
+
+        * kwq/kdeui/klineedit.h: Add KLineEdit::frameWidth().
+        * kwq/qt/qnamespace.h: Remove GUIStyle, MacStyle, and WindowsStyle.
+        * kwq/qt/qpaintdevice.h: Add QInternal, QInternal::Printer, and QPaintDevice::devType().
+        * kwq/qt/qpainter.h: Add QPainter::device().
+        * kwq/qt/qpushbutton.h: Add QPushButton::fontMetrics().
+
 2002-07-21  Maciej Stachowiak  <mjs at apple.com>
 
 	Fix a recent regression that made JavaScript window closing
diff --git a/WebCore/WebCore.pbproj/project.pbxproj b/WebCore/WebCore.pbproj/project.pbxproj
index 5484806..cc7760b 100644
--- a/WebCore/WebCore.pbproj/project.pbxproj
+++ b/WebCore/WebCore.pbproj/project.pbxproj
@@ -90,8 +90,8 @@
 		};
 		0867D691FE84028FC02AAC07 = {
 			children = (
-				F58785E802DE377601EA4122,
 				F523D16302DE42AE018635CA,
+				F58785E802DE377601EA4122,
 				F58785E902DE378A01EA4122,
 				089C1665FE841158C02AAC07,
 				0867D69AFE84028FC02AAC07,
@@ -204,7 +204,6 @@
 				F58785B702DE375901EA4122,
 				F58785BC02DE375901EA4122,
 				F58785BF02DE375901EA4122,
-				F58785C502DE375901EA4122,
 				F58785C702DE375901EA4122,
 				F58785CD02DE375901EA4122,
 				F58785D002DE375901EA4122,
@@ -710,6 +709,7 @@
 				F5B2A4FF02E2220F018635CB,
 				F5B2A52E02E22573018635CB,
 				F54A61D402E3523B01A80180,
+				F57B0EE102EBC78B018635CA,
 			);
 			isa = PBXSourcesBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -3598,6 +3598,17 @@
 			settings = {
 			};
 		};
+		F57B0EE002EBC78B018635CA = {
+			isa = PBXFileReference;
+			path = KWQStyle.mm;
+			refType = 4;
+		};
+		F57B0EE102EBC78B018635CA = {
+			fileRef = F57B0EE002EBC78B018635CA;
+			isa = PBXBuildFile;
+			settings = {
+			};
+		};
 		F58784C402DE375801EA4122 = {
 			isa = PBXFileReference;
 			path = KWQApplication.mm;
@@ -4128,11 +4139,6 @@
 			path = KWQStringList.mm;
 			refType = 4;
 		};
-		F587853302DE375901EA4122 = {
-			isa = PBXFileReference;
-			path = KWQStyle.h;
-			refType = 4;
-		};
 		F587853402DE375901EA4122 = {
 			isa = PBXFileReference;
 			path = KWQStyleSheet.mm;
@@ -4934,12 +4940,6 @@
 			settings = {
 			};
 		};
-		F58785C502DE375901EA4122 = {
-			fileRef = F587853302DE375901EA4122;
-			isa = PBXBuildFile;
-			settings = {
-			};
-		};
 		F58785C602DE375901EA4122 = {
 			fileRef = F587853402DE375901EA4122;
 			isa = PBXBuildFile;
@@ -7256,7 +7256,7 @@
 				F58786BA02DE3B8601EA4122,
 				F587853202DE375901EA4122,
 				F58786BB02DE3B8601EA4122,
-				F587853302DE375901EA4122,
+				F57B0EE002EBC78B018635CA,
 				F58786BC02DE3B8601EA4122,
 				F587853402DE375901EA4122,
 				F58786BD02DE3B8601EA4122,
diff --git a/WebCore/khtml/css/css_valueimpl.cpp b/WebCore/khtml/css/css_valueimpl.cpp
index 4bec9e1..3afacaf 100644
--- a/WebCore/khtml/css/css_valueimpl.cpp
+++ b/WebCore/khtml/css/css_valueimpl.cpp
@@ -393,7 +393,7 @@ float CSSPrimitiveValueImpl::computeLengthFloat( khtml::RenderStyle *style, QPai
         dpiY = devMetrics->logicalDpiY();
     if ( !khtml::printpainter && dpiY < 96 )
         dpiY = 96.;
-    
+
     float factor = 1.;
     switch(type)
     {
@@ -653,8 +653,8 @@ CSSImageValueImpl::~CSSImageValueImpl()
 FontFamilyValueImpl::FontFamilyValueImpl( const QString &string)
     : CSSPrimitiveValueImpl( DOMString(string), CSSPrimitiveValue::CSS_STRING)
 {
-    static QRegExp parenReg = QRegExp(" \\(.*\\)$");
-    static QRegExp braceReg = QRegExp(" \\[.*\\]$");
+    static const QRegExp parenReg(" \\(.*\\)$");
+    static const QRegExp braceReg(" \\[.*\\]$");
 
 #ifdef APPLE_CHANGES
     parsedFontName = string;
diff --git a/WebCore/khtml/css/cssstyleselector.cpp b/WebCore/khtml/css/cssstyleselector.cpp
index 2706b4b..2a8a915 100644
--- a/WebCore/khtml/css/cssstyleselector.cpp
+++ b/WebCore/khtml/css/cssstyleselector.cpp
@@ -65,9 +65,7 @@ using namespace DOM;
 #include <qintcache.h>
 #include <stdlib.h>
 
-#ifdef APPLE_CHANGES
 namespace khtml {
-#endif
 
 CSSStyleSelectorList *CSSStyleSelector::defaultStyle = 0;
 CSSStyleSelectorList *CSSStyleSelector::defaultPrintStyle = 0;
@@ -96,11 +94,7 @@ CSSStyleSelector::CSSStyleSelector( DocumentImpl* doc, QString userStyleSheet, S
     strictParsing = _strictParsing;
     settings = view ? view->part()->settings() : 0;
     if(!defaultStyle) loadDefaultStyle(settings);
-#if APPLE_CHANGES
     m_medium = view ? view->mediaType() : QString("all");
-#else
-    m_medium = view ? view->mediaType() : "all";
-#endif
 
     selectors = 0;
     selectorCache = 0;
@@ -271,11 +265,7 @@ static inline void bubbleSort( CSSOrderedProperty **b, CSSOrderedProperty **e )
 	bool swapped = FALSE;
         CSSOrderedProperty **y = e+1;
 	CSSOrderedProperty **x = e;
-#ifdef APPLE_CHANGES
         CSSOrderedProperty **swappedPos = 0; // quiet gcc warning
-#else
-        CSSOrderedProperty **swappedPos;
-#endif
 	do {
 	    if ( !((**(--x)) < (**(--y))) ) {
 		swapped = TRUE;
@@ -2466,11 +2456,7 @@ void CSSStyleSelector::applyRule( DOM::CSSProperty *prop )
             CSSPrimitiveValueImpl *val = static_cast<CSSPrimitiveValueImpl *>(item);
             if(!val->primitiveType() == CSSPrimitiveValue::CSS_STRING) return;
             QString face = static_cast<FontFamilyValueImpl *>(val)->fontName();
-#ifdef APPLE_CHANGES
 	    if ( !face.isEmpty() ) {
-#else
-	    if ( !face.isNull() || face.isEmpty() ) {
-#endif
 		if(face == "serif") {
 		    face = settings->serifFontName();
 		}
@@ -2495,11 +2481,7 @@ void CSSStyleSelector::applyRule( DOM::CSSProperty *prop )
 			fontDirty = true;
 		}
                 return;
-#ifdef APPLE_CHANGES
-	    } // make prepare-ChangeLog happy
-#else
 	    }
-#endif
         }
         break;
     }
@@ -2666,6 +2648,4 @@ void CSSStyleSelector::applyRule( DOM::CSSProperty *prop )
     }
 }
 
-#ifdef APPLE_CHANGES
 } // namespace khtml
-#endif
diff --git a/WebCore/khtml/dom/css_value.cpp b/WebCore/khtml/dom/css_value.cpp
index d8d0085..185f15c 100644
--- a/WebCore/khtml/dom/css_value.cpp
+++ b/WebCore/khtml/dom/css_value.cpp
@@ -25,10 +25,7 @@
 
 #include "css/css_valueimpl.h"
 
-using namespace DOM;
-#ifdef APPLE_CHANGES
 namespace DOM {
-#endif
 
 CSSStyleDeclaration::CSSStyleDeclaration()
 {
@@ -564,6 +561,4 @@ bool Rect::isNull() const
     return (impl == 0);
 }
 
-#ifdef APPLE_CHANGES
 } // namespace DOM
-#endif
diff --git a/WebCore/khtml/dom/dom_doc.cpp b/WebCore/khtml/dom/dom_doc.cpp
index d9e265d..9ea71dc 100644
--- a/WebCore/khtml/dom/dom_doc.cpp
+++ b/WebCore/khtml/dom/dom_doc.cpp
@@ -34,10 +34,7 @@
 
 #include <kdebug.h>
 
-using namespace DOM;
-#ifdef APPLE_CHANGES
 namespace DOM {
-#endif
 
 DOMImplementation::DOMImplementation()
 {
@@ -404,7 +401,9 @@ StyleSheetList Document::styleSheets() const
 
 KHTMLView *Document::view() const
 {
-    return ((DocumentImpl*)impl)->view();
+    if (!impl) return 0;
+
+    return static_cast<DocumentImpl*>(impl)->view();
 }
 
 DOMString Document::completeURL(const DOMString& url)
@@ -551,6 +550,4 @@ DOMString DocumentType::internalSubset() const
     return static_cast<DocumentTypeImpl*>(impl)->internalSubset();
 }
 
-#ifdef APPLE_CHANGES
 } // namespace DOM
-#endif
diff --git a/WebCore/khtml/dom/dom_text.cpp b/WebCore/khtml/dom/dom_text.cpp
index 28f3358..e17fe57 100644
--- a/WebCore/khtml/dom/dom_text.cpp
+++ b/WebCore/khtml/dom/dom_text.cpp
@@ -24,10 +24,7 @@
 #include "dom/dom_text.h"
 #include "xml/dom_textimpl.h"
 
-using namespace DOM;
-#ifdef APPLE_CHANGES
 namespace DOM {
-#endif
 
 CharacterData::CharacterData() : Node()
 {
@@ -239,6 +236,4 @@ Text::Text(TextImpl *i) : CharacterData(i)
 {
 }
 
-#ifdef APPLE_CHANGES
 } // namespace DOM
-#endif
diff --git a/WebCore/khtml/dom/html_element.cpp b/WebCore/khtml/dom/html_element.cpp
index 43619ff..c112b56 100644
--- a/WebCore/khtml/dom/html_element.cpp
+++ b/WebCore/khtml/dom/html_element.cpp
@@ -168,18 +168,10 @@ HTMLCollection HTMLElement::children() const
 
 void HTMLElement::assignOther( const Node &other, int elementId )
 {
-#ifdef APPLE_CHANGES
     if((int)other.elementId() != elementId) {
-#else
-    if(other.elementId() != elementId) {
-#endif
 	if ( impl ) impl->deref();
 	impl = 0;
     } else {
 	Node::operator = (other);
-#ifdef APPLE_CHANGES
-    } // keep prepare-ChangeLog happy
-#else
     }   
-#endif
 }
diff --git a/WebCore/khtml/ecma/kjs_dom.cpp b/WebCore/khtml/ecma/kjs_dom.cpp
index ea6a03b..8de61fd 100644
--- a/WebCore/khtml/ecma/kjs_dom.cpp
+++ b/WebCore/khtml/ecma/kjs_dom.cpp
@@ -20,7 +20,7 @@
 
 #include <khtmlview.h>
 #include "xml/dom2_eventsimpl.h"
-#include "rendering/render_object.h"
+#include "rendering/render_root.h"
 #include "xml/dom_nodeimpl.h"
 #include "xml/dom_docimpl.h"
 #include <kdebug.h>
@@ -235,14 +235,12 @@ Value DOMNode::getValueProperty(ExecState *exec, int token) const
     // make sure our rendering is up to date before
     // we allow a query on these attributes.
     DOM::DocumentImpl* docimpl = node.handle()->getDocument();
-    if ( docimpl )
-    {
+    KHTMLView* v = 0;
+    if ( docimpl ) {
+      v = docimpl->view();
       docimpl->updateRendering();
-#ifdef APPLE_CHANGES
       // Only do a layout if changes have occurred that make it necessary.
-      if ( docimpl->renderer() && !docimpl->renderer()->layouted() )
-#endif
-      if ( docimpl->view() )
+      if ( v && docimpl->renderer() && !docimpl->renderer()->layouted() )
         docimpl->view()->layout();
     }
 
@@ -270,15 +268,13 @@ Value DOMNode::getValueProperty(ExecState *exec, int token) const
         // "Width of the object including padding, but not including margin, border, or scroll bar."
         return Number(rend->height() - rend->borderTop() - rend->borderBottom() );
     case ScrollLeft:
-      if (!rend)
+      if (!rend || !v)
         return Undefined();
-      else
-        return Number(-rend->xPos() + node.ownerDocument().view()->contentsX());
+      return Number(-rend->xPos() + v->contentsX());
     case ScrollTop:
-      if (!rend)
+      if (!rend || !v)
         return Undefined();
-      else
-        return Number(-rend->yPos() + node.ownerDocument().view()->contentsY());
+      return Number(-rend->yPos() + v->contentsY());
     default:
       kdWarning() << "Unhandled token in DOMNode::getValueProperty : " << token << endl;
       break;
@@ -396,11 +392,7 @@ UString DOMNode::toString(ExecState *) const
 
   DOM::Element e = node;
   if ( !e.isNull() ) {
-#ifdef APPLE_CHANGES
     s = UString(e.nodeName().string());
-#else
-    s = e.nodeName().string();
-#endif
   } else
     s = className(); // fallback
 
diff --git a/WebCore/khtml/ecma/kjs_events.cpp b/WebCore/khtml/ecma/kjs_events.cpp
index e554b5c..1a20c8a 100644
--- a/WebCore/khtml/ecma/kjs_events.cpp
+++ b/WebCore/khtml/ecma/kjs_events.cpp
@@ -84,16 +84,6 @@ void JSEventListener::handleEvent(DOM::Event &evt)
       }
     }
 
-#ifdef KWQ_DEBUG_JS
-	fprintf (stdout, "handleEvent() thisObj = %s\n", thisObj.toString(exec).qstring().latin1());
-	{
-		int i;
-		
-		for (i = 0; i < args.size(); i++)
-			fprintf (stdout, "handleEvent() args[%d] = %s\n", i, args.at(i).toString(exec).qstring().latin1());
-	}
-#endif
-
     Window *window = static_cast<Window*>(win.imp());
     // Set the event we're handling in the Window object
     window->setCurrentEvent( &evt );
diff --git a/WebCore/khtml/ecma/kjs_html.cpp b/WebCore/khtml/ecma/kjs_html.cpp
index a740717..94d8291 100644
--- a/WebCore/khtml/ecma/kjs_html.cpp
+++ b/WebCore/khtml/ecma/kjs_html.cpp
@@ -2980,26 +2980,18 @@ void Image::tryPut(ExecState *exec, const UString &propertyName, const Value& va
     String str = value.toString(exec);
     src = str.value();
     if ( img ) img->deref(this);
-#ifndef APPLE_CHANGES
-    img = static_cast<DOM::DocumentImpl*>( doc.handle() )->docLoader()->requestImage( src.string() );
-#else
     img = doc ? doc->docLoader()->requestImage( src.string() ) : 0;
-#endif
     if ( img ) img->ref(this);
   } else {
     DOMObject::tryPut(exec, propertyName, value, attr);
   }
 }
 
-#ifdef APPLE_CHANGES
-
 Image::Image(const DOM::Document &d)
     : doc(static_cast<DOM::DocumentImpl*>(d.handle())), img(0)
 {
 }
 
-#endif
-
 Image::~Image()
 {
   if ( img ) img->deref(this);
diff --git a/WebCore/khtml/ecma/kjs_html.h b/WebCore/khtml/ecma/kjs_html.h
index 81306d3..cb02252 100644
--- a/WebCore/khtml/ecma/kjs_html.h
+++ b/WebCore/khtml/ecma/kjs_html.h
@@ -30,9 +30,7 @@
 #include "ecma/kjs_binding.h"
 #include "ecma/kjs_dom.h"
 
-#ifdef APPLE_CHANGES
 #include <qguardedptr.h>
-#endif
 
 class HTMLElement;
 
@@ -214,11 +212,7 @@ namespace KJS {
 
   class Image : public DOMObject, public khtml::CachedObjectClient {
   public:
-#ifndef APPLE_CHANGES
-    Image(const DOM::Document &d) : doc(d), img(0) { }
-#else
     Image(const DOM::Document &d);
-#endif
     ~Image();
     virtual Value tryGet(ExecState *exec, const UString &propertyName) const;
     Value getValueProperty(ExecState *exec, int token) const;
@@ -229,11 +223,7 @@ namespace KJS {
     enum { Src, Complete };
   private:
     UString src;
-#ifndef APPLE_CHANGES
-    DOM::Document doc;
-#else
     QGuardedPtr<DOM::DocumentImpl> doc;
-#endif
     khtml::CachedImage* img;
   };
 
diff --git a/WebCore/khtml/ecma/kjs_navigator.cpp b/WebCore/khtml/ecma/kjs_navigator.cpp
index cf22476..8fbb398 100644
--- a/WebCore/khtml/ecma/kjs_navigator.cpp
+++ b/WebCore/khtml/ecma/kjs_navigator.cpp
@@ -280,31 +280,25 @@ PluginBase::PluginBase(ExecState *exec)
                 QStringList::Iterator token;
 
                 token = tokens.begin();
-#ifdef APPLE_CHANGES
                 if (token == tokens.end()) {
                     delete mime;
                     continue;
                 }
-#endif
                 mime->type = (*token).lower();
                 //kdDebug(6070) << "mime->type=" << mime->type << endl;
                 ++token;
 
-#ifdef APPLE_CHANGES
                 if (token == tokens.end()) {
                     delete mime;
                     continue;
                 }
-#endif
                 mime->suffixes = *token;
                 ++token;
 
-#ifdef APPLE_CHANGES
                 if (token == tokens.end()) {
                     delete mime;
                     continue;
                 }
-#endif
                 mime->desc = *token;
                 ++token;
 
diff --git a/WebCore/khtml/ecma/kjs_proxy.cpp b/WebCore/khtml/ecma/kjs_proxy.cpp
index 5daea73..20d3038 100644
--- a/WebCore/khtml/ecma/kjs_proxy.cpp
+++ b/WebCore/khtml/ecma/kjs_proxy.cpp
@@ -169,7 +169,7 @@ DOM::EventListener *KJSProxyImpl::createHTMLEventHandler(QString sourceUrl, QStr
   args.append(KJS::String("event"));
   args.append(KJS::String(code));
   Object handlerFunc = constr.construct(m_script->globalExec(), args); // ### is globalExec ok ?
-    
+
   return KJS::Window::retrieveWindow(m_part)->getJSEventListener(handlerFunc,true);
 }
 
diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp
index d0a2a16..f2f2c76 100644
--- a/WebCore/khtml/ecma/kjs_window.cpp
+++ b/WebCore/khtml/ecma/kjs_window.cpp
@@ -48,9 +48,6 @@
 #include "xml/dom2_eventsimpl.h"
 #include "xml/dom_docimpl.h"
 #include "html/html_documentimpl.h"
-#ifdef APPLE_CHANGES
-#include "KWQKHTMLPartImpl.h"
-#endif
 
 using namespace KJS;
 
@@ -204,10 +201,8 @@ const ClassInfo Window::info = { "Window", 0, &WindowTable, 0 };
   personalbar	Window::Personalbar	DontDelete|ReadOnly
   screenX	Window::ScreenX		DontDelete|ReadOnly
   screenY	Window::ScreenY		DontDelete|ReadOnly
-#ifdef APPLE_CHANGES
   screenLeft	Window::ScreenLeft	DontDelete|ReadOnly
   screenTop	Window::ScreenTop	DontDelete|ReadOnly
-#endif
   scrollbars	Window::Scrollbars	DontDelete|ReadOnly
   scroll	Window::Scroll		DontDelete|Function 2
   scrollBy	Window::ScrollBy	DontDelete|Function 2
@@ -473,16 +468,12 @@ Value Window::get(ExecState *exec, const UString &p) const
       return Value(retrieve(m_part->parentPart() ? m_part->parentPart() : (KHTMLPart*)m_part));
     case Personalbar:
       return Undefined(); // ###
-#ifdef APPLE_CHANGES
     case ScreenLeft:
-#endif
     case ScreenX: {
 	  QRect sg = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(m_part->view()));
       return Number(m_part->view()->mapToGlobal(QPoint(0,0)).x() + sg.x());
     }
-#ifdef APPLE_CHANGES
     case ScreenTop:
-#endif
     case ScreenY: {
 	  QRect sg = QApplication::desktop()->screenGeometry(QApplication::desktop()->screenNumber(m_part->view()));
       return Number(m_part->view()->mapToGlobal(QPoint(0,0)).y() + sg.y());
@@ -858,6 +849,10 @@ void Window::scheduleClose()
 
 bool Window::isSafeScript(ExecState *exec) const
 {
+  if (m_part.isNull()) { // part deleted ? can't grant access
+    kdDebug(6070) << "Window::isSafeScript: accessing deleted part !" << endl;
+    return false;
+  }
   KHTMLPart *activePart = static_cast<KJS::ScriptInterpreter *>( exec->interpreter() )->part();
   if (!activePart) {
     kdDebug(6070) << "Window::isSafeScript: current interpreter's part is 0L!" << endl;
@@ -1140,7 +1135,6 @@ Value WindowFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
       // request window (new or existing if framename is set)
       KParts::ReadOnlyPart *newPart = 0L;
       emit part->browserExtension()->createNewWindow("", uargs,winargs,newPart);
-
       if (newPart && newPart->inherits("KHTMLPart")) {
         KHTMLPart *khtmlpart = static_cast<KHTMLPart*>(newPart);
         //qDebug("opener set to %p (this Window's part) in new Window %p  (this Window=%p)",part,win,window);
@@ -1169,9 +1163,7 @@ Value WindowFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
         return Undefined();
     }
   }
-#ifdef APPLE_CHANGES
   case Window::Scroll:
-#endif
   case Window::ScrollBy:
     if(args.size() == 2 && widget)
       widget->scrollBy(args[0].toInt32(exec), args[1].toInt32(exec));
diff --git a/WebCore/khtml/ecma/kjs_window.h b/WebCore/khtml/ecma/kjs_window.h
index 0b4924c..1eeed88 100644
--- a/WebCore/khtml/ecma/kjs_window.h
+++ b/WebCore/khtml/ecma/kjs_window.h
@@ -107,9 +107,7 @@ namespace KJS {
            InnerWidth, Length, _Location, Name, _Navigator, _Konqueror, ClientInformation,
            OffscreenBuffering, Opener, OuterHeight, OuterWidth, PageXOffset, PageYOffset,
            Parent, Personalbar, ScreenX, ScreenY, Scrollbars, Scroll, ScrollBy,
-#ifdef APPLE_CHANGES
            ScreenTop, ScreenLeft,
-#endif
            ScrollTo, MoveBy, MoveTo, ResizeBy, ResizeTo, Self, _Window, Top, _Screen,
            Image, Option, Alert, Confirm, Prompt, Open, SetTimeout, ClearTimeout,
            Focus, Blur, Close, SetInterval, ClearInterval, CaptureEvents, Onabort, Onblur,
diff --git a/WebCore/khtml/html/html_documentimpl.cpp b/WebCore/khtml/html/html_documentimpl.cpp
index 59b9d8b..0280c9d 100644
--- a/WebCore/khtml/html/html_documentimpl.cpp
+++ b/WebCore/khtml/html/html_documentimpl.cpp
@@ -136,12 +136,19 @@ DOMString HTMLDocumentImpl::cookie() const
 #ifdef APPLE_CHANGES
     return KWQKCookieJar::cookie(URL());
 #else
+    long windowId = 0;
+    KHTMLView *v = view ();
+    
+    if ( v && v->topLevelWidget() )
+      windowId = v->topLevelWidget()->winId();
+
     QCString replyType;
     QByteArray params, reply;
     QDataStream stream(params, IO_WriteOnly);
-    stream << URL();
+    stream << URL() << windowId;
     if (!kapp->dcopClient()->call("kcookiejar", "kcookiejar",
-                                  "findDOMCookies(QString)", params, replyType, reply)) {
+                                  "findDOMCookies(QString, int)", params, 
+                                  replyType, reply)) {
          // Maybe it wasn't running (e.g. we're opening local html files)
          KApplication::startServiceByDesktopName( "kcookiejar");
          if (!kapp->dcopClient()->call("kcookiejar", "kcookiejar",
@@ -169,7 +176,12 @@ void HTMLDocumentImpl::setCookie( const DOMString & value )
 #ifdef APPLE_CHANGES
     return KWQKCookieJar::setCookie(URL(), value.string());
 #else
-    long windowId = view() ? view()->winId() : 0;
+    long windowId = 0;
+    KHTMLView *v = view ();
+    
+    if ( v && v->topLevelWidget() )
+      windowId = v->topLevelWidget()->winId();
+     
     QByteArray params;
     QDataStream stream(params, IO_WriteOnly);
     QString fake_header("Set-Cookie: ");
diff --git a/WebCore/khtml/html/html_formimpl.cpp b/WebCore/khtml/html/html_formimpl.cpp
index d319668..31c0732 100644
--- a/WebCore/khtml/html/html_formimpl.cpp
+++ b/WebCore/khtml/html/html_formimpl.cpp
@@ -164,9 +164,6 @@ void HTMLFormElementImpl::i18nData()
     QString foo3 = i18n("When you send a password unencrypted to the Internet, "
                         "it might be possible for others to capture it as plain text.\n"
                         "Do you want to continue?");
-    QString foo4 = i18n("You're about to transfer the following files from "
-                        "your local computer to the Internet.\n"
-                        "Do you really want to continue?");
     QString foo5 = i18n("Your data submission is redirected to "
                         "an insecure site. The data is sent unencrypted.\n"
                         "Do you want to continue?");
@@ -175,7 +172,7 @@ void HTMLFormElementImpl::i18nData()
 }
 
 
-QByteArray HTMLFormElementImpl::formData()
+QByteArray HTMLFormElementImpl::formData(bool& ok)
 {
 #ifdef FORMS_DEBUG
     kdDebug( 6030 ) << "form: formData()" << endl;
@@ -238,6 +235,8 @@ QByteArray HTMLFormElementImpl::formData()
         m_encCharset[i] = m_encCharset[i].latin1() == ' ' ? QChar('-') : m_encCharset[i].lower();
 #endif /* APPLE_CHANGES not defined */
 
+    QStringList fileUploads;
+
     for (QPtrListIterator<HTMLGenericFormElementImpl> it(formElements); it.current(); ++it) {
         HTMLGenericFormElementImpl* current = it.current();
         khtml::encodingList lst;
@@ -281,6 +280,7 @@ QByteArray HTMLFormElementImpl::formData()
                         static_cast<HTMLInputElementImpl*>(current)->inputType() == HTMLInputElementImpl::FILE)
                     {
                         QString path = static_cast<HTMLInputElementImpl*>(current)->value().string();
+                        if (path.length()) fileUploads << path;
                         QString onlyfilename = path.mid(path.findRev('/')+1);
 
                         hstr += ("; filename=\"" + onlyfilename + "\"").ascii();
@@ -306,6 +306,23 @@ QByteArray HTMLFormElementImpl::formData()
             }
         }
     }
+
+#ifndef APPLE_CHANGES
+    if (fileUploads.count()) {
+        int result = KMessageBox::warningContinueCancelList( 0,
+                                                             i18n("You're about to transfer the following files from "
+                                                                  "your local computer to the Internet.\n"
+                                                                  "Do you really want to continue?"),
+                                                             fileUploads);
+
+
+        if (result == KMessageBox::Cancel) {
+            ok = false;
+            return QByteArray();
+        }
+    }
+#endif
+
     if (m_multipart)
         enc_string = ("--" + m_boundary.string() + "--\r\n").ascii();
 
@@ -313,6 +330,7 @@ QByteArray HTMLFormElementImpl::formData()
     form_data.resize( form_data.size() + enc_string.length() );
     memcpy(form_data.data() + old_size, enc_string.data(), enc_string.length() );
 
+    ok = true;
     return form_data;
 }
 
@@ -386,19 +404,19 @@ void HTMLFormElementImpl::submit(  )
         }
     }
 
-    QByteArray form_data = formData();
-    if(m_post)
-    {
-        view->part()->submitForm( "post", m_url.string(), form_data,
-                                  m_target.string(),
-                                  enctype().string(),
-//                                   m_encCharset.isEmpty() ? enctype().string()
-//                                   : QString(enctype().string() + "; charset=" + m_encCharset),
-                                  boundary().string() );
-    }
-    else {
-        view->part()->submitForm( "get", m_url.string(), form_data,
-                                  m_target.string() );
+    bool ok;
+    QByteArray form_data = formData(ok);
+    if (ok) {
+        if(m_post) {
+            view->part()->submitForm( "post", m_url.string(), form_data,
+                                      m_target.string(),
+                                      enctype().string(),
+                                      boundary().string() );
+        }
+        else {
+            view->part()->submitForm( "get", m_url.string(), form_data,
+                                      m_target.string() );
+        }
     }
 
     m_doingsubmit = m_insubmit = false;
@@ -526,8 +544,12 @@ void HTMLGenericFormElementImpl::parseAttribute(AttributeImpl *attr)
         setDisabled( attr->val() != 0 );
         break;
     case ATTR_READONLY:
+    {
+        bool m_oldreadOnly = m_readOnly;
         m_readOnly = attr->val() != 0;
+        if (m_oldreadOnly != m_readOnly) setChanged();
         break;
+    }
     default:
         HTMLElementImpl::parseAttribute(attr);
     }
@@ -598,8 +620,7 @@ void HTMLGenericFormElementImpl::setDisabled( bool _disabled )
 {
     if ( m_disabled != _disabled ) {
         m_disabled = _disabled;
-        if ( m_render && m_render->isWidget() && m_render->layouted() )
-            static_cast<RenderWidget *>(m_render)->widget()->setEnabled( !m_disabled );
+        setChanged();
     }
 }
 
@@ -1016,7 +1037,7 @@ void HTMLInputElementImpl::init()
     case IMAGE:
         break;
     };
-    m_value = getAttribute(ATTR_VALUE);
+    if (m_type != FILE) m_value = getAttribute(ATTR_VALUE);
     if ((uint) m_type <= ISINDEX && !m_value.isEmpty()) {
         QString value = m_value.string();
         // remove newline stuff..
@@ -1246,14 +1267,10 @@ DOMString HTMLInputElementImpl::value() const
 
 void HTMLInputElementImpl::setValue(DOMString val)
 {
-    switch (m_type) {
-    case FILE:
-        // sorry, can't change this!
-        break;
-    default:
-        m_value = (val.isNull() ? DOMString("") : val);
-        setChanged();
-    }
+    if (m_type == FILE) return;
+
+    m_value = (val.isNull() ? DOMString("") : val);
+    setChanged();
 }
 
 void HTMLInputElementImpl::blur()
@@ -1408,7 +1425,7 @@ long HTMLSelectElementImpl::selectedIndex() const
             if (static_cast<HTMLOptionElementImpl*>(items[i])->selected())
                 return o;
             o++;
-    }
+        }
     }
     Q_ASSERT(m_multiple);
     return -1;
diff --git a/WebCore/khtml/html/html_formimpl.h b/WebCore/khtml/html/html_formimpl.h
index 2eea2e3..3de106f 100644
--- a/WebCore/khtml/html/html_formimpl.h
+++ b/WebCore/khtml/html/html_formimpl.h
@@ -66,7 +66,7 @@ public:
 
     long length() const;
 
-    QByteArray formData( );
+    QByteArray formData(bool& ok);
 
     DOMString enctype() const { return m_enctype; }
     void setEnctype( const DOMString & );
@@ -144,6 +144,8 @@ public:
     DOMString name() const;
     void setName(const DOMString& name);
 
+    virtual bool isGenericFormElement() const { return true; }
+
     /*
      * override in derived classes to get the encoded name=value pair
      * for submitting
diff --git a/WebCore/khtml/html/html_headimpl.cpp b/WebCore/khtml/html/html_headimpl.cpp
index 8475c0e..58e359d 100644
--- a/WebCore/khtml/html/html_headimpl.cpp
+++ b/WebCore/khtml/html/html_headimpl.cpp
@@ -40,10 +40,6 @@
 #include <kurl.h>
 #include <kdebug.h>
 
-#ifdef APPLE_CHANGES
-#include "KWQKHTMLPartImpl.h"
-#endif
-
 using namespace khtml;
 
 HTMLBaseElementImpl::HTMLBaseElementImpl(DocumentPtr *doc)
@@ -171,15 +167,16 @@ void HTMLLinkElementImpl::process()
     // IE extension: location of small icon for locationbar / bookmarks
 #ifdef APPLE_CHANGES
     if ( part && rel == "shortcut icon" && !m_url.isEmpty() && !part->parentPart())
-#else
-    if ( part && rel.contains("shortcut icon") && !m_url.isEmpty() && !part->parentPart())
-#endif
     	part->browserExtension()->setIconURL( KURL(m_url.string()) );
 
-#ifdef APPLE_CHANGES
     // Mozilla extension to IE extension: icon specified with type
     if ( part && rel == "icon" && !m_url.isEmpty() && !part->parentPart())
     	part->browserExtension()->setTypedIconURL( KURL(m_url.string()), type );
+#else
+    // Uses both "shortcut icon" and "icon"
+   
+    if ( part && rel.contains("icon") && !m_url.isEmpty() && !part->parentPart())
+        part->browserExtension()->setIconURL( KURL(m_url.string()) );
 #endif
 
     // Stylesheet
diff --git a/WebCore/khtml/html/html_imageimpl.cpp b/WebCore/khtml/html/html_imageimpl.cpp
index c15fbd5..f937d14 100644
--- a/WebCore/khtml/html/html_imageimpl.cpp
+++ b/WebCore/khtml/html/html_imageimpl.cpp
@@ -398,7 +398,7 @@ QRegion HTMLAreaElementImpl::getRegion(int width_, int height_) const
     // what the HTML author tried to tell us.
 
     // a Poly needs at least 3 points (6 coords), so this is correct
-    if ((shape==Poly || shape==Unknown) && m_coordsLen > 4) {
+    if ((shape==Poly || shape==Unknown) && m_coordsLen > 5) {
         // make sure its even
         int len = m_coordsLen >> 1;
         QPointArray points(len);
@@ -419,8 +419,10 @@ QRegion HTMLAreaElementImpl::getRegion(int width_, int height_) const
         int y1 = m_coords[3].minWidth(height_);
         region = QRegion(x0,y0,x1-x0,y1-y0);
     }
-    else
+    else if (shape==Default)
         region = QRegion(0,0,width_,height_);
+    // else
+       // return null region
 
     return region;
 }
diff --git a/WebCore/khtml/html/html_inlineimpl.cpp b/WebCore/khtml/html/html_inlineimpl.cpp
index 801a1a0..a2cd4d3 100644
--- a/WebCore/khtml/html/html_inlineimpl.cpp
+++ b/WebCore/khtml/html/html_inlineimpl.cpp
@@ -125,10 +125,8 @@ void HTMLAnchorElementImpl::defaultEventHandler(EventImpl *evt)
                     state |= Qt::ShiftButton;
                 if ( e->altKey() )
                     state |= Qt::AltButton;
-#ifdef APPLE_CHANGES
                 if ( e->metaKey() )
                     state |= Qt::MetaButton;
-#endif
 
                 if ( e->button() == 0 )
                     button = Qt::LeftButton;
diff --git a/WebCore/khtml/html/html_objectimpl.cpp b/WebCore/khtml/html/html_objectimpl.cpp
index 24fd757..f151d2a 100644
--- a/WebCore/khtml/html/html_objectimpl.cpp
+++ b/WebCore/khtml/html/html_objectimpl.cpp
@@ -341,7 +341,7 @@ void HTMLObjectElementImpl::attach()
     // it was in KDE 3.0.1.
 #else
     KURL u = getDocument()->completeURL(url);
-    for (KHTMLPart* part = w->part(); part; part = part->parentPart())
+    for (KHTMLPart* part = w->part()->parentPart(); part; part = part->parentPart())
         if (part->url() == u) {
             loadplugin = false;
             break;
diff --git a/WebCore/khtml/html/htmlparser.cpp b/WebCore/khtml/html/htmlparser.cpp
index 8da6d47..960d039 100644
--- a/WebCore/khtml/html/htmlparser.cpp
+++ b/WebCore/khtml/html/htmlparser.cpp
@@ -169,14 +169,13 @@ void KHTMLParser::reset()
     haveFrameSet = false;
     haveContent = false;
     inSelect = false;
-    _inline = false;
+    m_inline = false;
 
     form = 0;
     map = 0;
     head = 0;
     end = false;
     isindex = 0;
-    flat = false;
     haveKonqBlock = false;
 
     discard_until = 0;
@@ -201,7 +200,7 @@ void KHTMLParser::parseToken(Token *t)
 #ifdef PARSER_DEBUG
     kdDebug( 6035 ) << "\n\n==> parser: processing token " << getTagName(t->id).string() << "(" << t->id << ")"
                     << " current = " << getTagName(current->id()).string() << "(" << current->id() << ")" << endl;
-    kdDebug(6035) << "inline=" << _inline << " inBody=" << inBody << " haveFrameSet=" << haveFrameSet << endl;
+    kdDebug(6035) << "inline=" << m_inline << " inBody=" << inBody << " haveFrameSet=" << haveFrameSet << endl;
 #endif
 
     // holy shit. apparently some sites use </br> instead of <br>
@@ -209,8 +208,6 @@ void KHTMLParser::parseToken(Token *t)
     if(t->id == ID_BR+ID_CLOSE_TAG && document->document()->parseMode() != DocumentImpl::Strict)
         t->id -= ID_CLOSE_TAG;
 
-    flat = t->flat;
-
     if(t->id > ID_CLOSE_TAG)
     {
         processCloseTag(t);
@@ -250,7 +247,7 @@ void KHTMLParser::parseToken(Token *t)
         popOneBlock();
     }
 
-    if ( !insertNode(n) ) {
+    if ( !insertNode(n, t->flat) ) {
         // we couldn't insert the node...
 #ifdef PARSER_DEBUG
         kdDebug( 6035 ) << "insertNode failed current=" << current->id() << ", new=" << n->id() << "!" << endl;
@@ -273,7 +270,7 @@ void KHTMLParser::parseToken(Token *t)
     }
 }
 
-bool KHTMLParser::insertNode(NodeImpl *n)
+bool KHTMLParser::insertNode(NodeImpl *n, bool flat)
 {
     int id = n->id();
 
@@ -308,7 +305,7 @@ bool KHTMLParser::insertNode(NodeImpl *n)
             }
 #endif
             //_inline = current->isInline();
-            if(current->isInline()) _inline = true;
+            if(current->isInline()) m_inline = true;
         }
         else {
 #if SPEED_DEBUG < 2
@@ -325,7 +322,6 @@ bool KHTMLParser::insertNode(NodeImpl *n)
             if(n->renderer())
                 n->renderer()->close();
 #endif
-            flat = false;
         }
 
 #if SPEED_DEBUG < 1
@@ -705,8 +701,7 @@ bool KHTMLParser::insertNode(NodeImpl *n)
         default:
             if(current->isDocumentNode())
             {
-                if(current->firstChild() == 0)
-                {
+                if(current->firstChild() == 0) {
                     e = new HTMLHtmlElementImpl(document);
                     insertNode(e);
                     handled = true;
@@ -788,7 +783,7 @@ NodeImpl *KHTMLParser::getElement(Token* t)
                     ->addCSSProperty(CSS_PROP_DISPLAY, "none");
             inBody = false;
         }
-        if ( (haveContent || haveFrameSet) && current->id() == ID_HTML) 
+        if ( (haveContent || haveFrameSet) && current->id() == ID_HTML)
             break;
         n = new HTMLFrameSetElementImpl(document);
         haveFrameSet = true;
@@ -822,7 +817,7 @@ NodeImpl *KHTMLParser::getElement(Token* t)
             isindex = n;
             n = 0;
         } else
-            flat = true;
+            t->flat = true;
         break;
     case ID_KEYGEN:
         n = new HTMLKeygenElementImpl(document, form);
@@ -932,6 +927,9 @@ NodeImpl *KHTMLParser::getElement(Token* t)
 
 // anchor
     case ID_A:
+        if (blockStack && blockStack->id == ID_A)
+            popBlock(ID_A);
+
         n = new HTMLAnchorElementImpl(document);
         break;
 
@@ -1094,11 +1092,6 @@ void KHTMLParser::processCloseTag(Token *t)
     case ID_MAP+ID_CLOSE_TAG:
         map = 0;
         break;
-    case ID_HEAD+ID_CLOSE_TAG:
-        //inBody = true;
-        // don't close head neither. the creation of body will do it for us.
-        // fixes some sites, that define stylesheets after </head>
-        return;
     case ID_SELECT+ID_CLOSE_TAG:
         inSelect = false;
         break;
@@ -1185,16 +1178,10 @@ void KHTMLParser::popOneBlock()
 
 #if SPEED_DEBUG < 1
     if((Elem->node != current)) {
-        if (current->maintainsState()) {
-#ifdef APPLE_CHANGES
-            if (document->document()){
-#endif
+        if (current->maintainsState() && document->document()){
             document->document()->registerMaintainsState(current);
             QString state(document->document()->nextState());
             if (!state.isNull()) current->restoreState(state);
-#ifdef APPLE_CHANGES
-            }
-#endif
         }
         if (current->renderer())
             current->renderer()->close();
@@ -1207,7 +1194,7 @@ void KHTMLParser::popOneBlock()
     // we only set inline to false, if the element we close is a block level element.
     // This helps getting cases as <p><b>bla</b> <b>bla</b> right.
     if(!current->isInline())
-        _inline = false;
+        m_inline = false;
     current = Elem->node;
 
     delete Elem;
@@ -1284,8 +1271,7 @@ void KHTMLParser::startBody()
         document->document()->renderer()->closeEntireTree();
 
     if( isindex ) {
-        flat = true; // don't decend into this node
-        insertNode( isindex );
+        insertNode( isindex, true /* don't decend into this node */ );
         isindex = 0;
     }
 }
diff --git a/WebCore/khtml/html/htmlparser.h b/WebCore/khtml/html/htmlparser.h
index 124c787..1e324cd 100644
--- a/WebCore/khtml/html/htmlparser.h
+++ b/WebCore/khtml/html/htmlparser.h
@@ -37,6 +37,7 @@
 #include <qdatetime.h>
 #endif
 
+
 #include "dom/dom_string.h"
 #include "xml/dom_nodeimpl.h"
 #include "html/html_documentimpl.h"
@@ -83,7 +84,7 @@ public:
     void reset();
 
     bool skipMode() const { return (discard_until != 0); }
-    bool noSpaces() const { return (!_inline  || !inBody); }
+    bool noSpaces() const { return (!m_inline  || !inBody); }
     bool selectMode() const { return inSelect; }
 
     DOM::HTMLDocumentImpl *doc() const { return static_cast<DOM::HTMLDocumentImpl *>(document->document()); }
@@ -101,7 +102,7 @@ protected:
 
     void processCloseTag(khtml::Token *);
 
-    bool insertNode(DOM::NodeImpl *n);
+    bool insertNode(DOM::NodeImpl *n, bool flat = false);
 
     /*
      * The currently active element (the one new elements will be added to)
@@ -152,9 +153,8 @@ protected:
     bool inBody;
     bool haveContent;
     bool haveFrameSet;
-    bool _inline;
+    bool m_inline;
     bool end;
-    bool flat;
     bool haveKonqBlock;
     bool inSelect;
 
diff --git a/WebCore/khtml/html/htmltokenizer.cpp b/WebCore/khtml/html/htmltokenizer.cpp
index 0e7df42..66c8600 100644
--- a/WebCore/khtml/html/htmltokenizer.cpp
+++ b/WebCore/khtml/html/htmltokenizer.cpp
@@ -461,10 +461,9 @@ void HTMLTokenizer::scriptExecution( const QString& str, QString scriptURL,
         return;
 #endif
     bool oldscript = script;
-    script = false;
-    QString url;
-    
     m_executingScript++;
+    script = false;
+    QString url;    
     if (scriptURL.isNull())
       url = static_cast<DocumentImpl*>(view->part()->document().handle())->URL();
     else
@@ -1549,12 +1548,7 @@ void HTMLTokenizer::finish()
 
 void HTMLTokenizer::processToken()
 {
-#ifdef APPLE_CHANGES
-    KJSProxy *jsProxy = (view && view->part()) ? view->part()->jScript() : 0L;
-#else
-    KJSProxy *jsProxy = view ? view->part()->jScript() : 0L;
-#endif
-    
+    KJSProxy *jsProxy = (view && view->part()) ? view->part()->jScript() : 0L;    
     if (jsProxy)
         jsProxy->setEventHandlerLineno(tagStartLineno);
     if ( dest > buffer )
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index 49deaa3..e2c582e 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -31,7 +31,6 @@
 #define DIRECT_LINKAGE_TO_ECMA
 #define QT_NO_CLIPBOARD
 #define QT_NO_DRAGANDDROP
-#include <KWQKHTMLPartImpl.h>
 #endif
 
 #include "khtml_pagecache.h"
@@ -282,9 +281,6 @@ KHTMLPart::~KHTMLPart()
   d->m_redirectionTimer.stop();
 #endif
 
-  if ( d->m_job )
-    d->m_job->kill();
-
   if (!d->m_bComplete)
     closeURL();
 
@@ -1372,14 +1368,6 @@ void KHTMLPart::begin( const KURL &url, int xOffset, int yOffset )
   d->m_doc->setBaseURL( baseurl.url() );
   d->m_doc->docLoader()->setShowAnimations( KHTMLFactory::defaultHTMLSettings()->showAnimations() );
 
-  // Inherit domain from parent
-  KHTMLPart* parent = parentPart();
-  if (d->m_doc->isHTMLDocument() && parent && parent->d->m_doc && parent->d->m_doc->isHTMLDocument()) {
-    DOMString domain = static_cast<HTMLDocumentImpl*>(parent->d->m_doc)->domain();
-    kdDebug() << "KHTMLPart::begin setting frame domain to " << domain.string() << endl;
-    static_cast<HTMLDocumentImpl*>(d->m_doc)->setDomain( domain, true );
-  }
-
   d->m_paUseStylesheet->setItems(QStringList());
   d->m_paUseStylesheet->setEnabled( false );
 
@@ -1471,7 +1459,6 @@ void KHTMLPart::end()
 #endif
 }
 
-
 #ifndef APPLE_CHANGES
 
 void KHTMLPart::paint(QPainter *p, const QRect &rc, int yOff, bool *more)
@@ -1655,7 +1642,10 @@ void KHTMLPart::checkCompleted()
   d->m_paUseStylesheet->setItems( sheets );
   d->m_paUseStylesheet->setEnabled( !sheets.isEmpty() );
   if (!sheets.isEmpty())
+  {
     d->m_paUseStylesheet->setCurrentItem(kMax(sheets.findIndex(d->m_sheetUsed), 0));
+    slotUseStylesheet();
+  }
 
   if (!parentPart())
       emit setStatusBarText(i18n("Done."));
@@ -1676,6 +1666,30 @@ void KHTMLPart::checkEmitLoadEvent()
   for (; it != end; ++it )
     if ( !(*it).m_bCompleted ) // still got a frame running -> too early
       return;
+
+
+  // All frames completed -> set their domain to the frameset's domain
+  // This must only be done when loading the frameset initially (#22039),
+  // not when following a link in a frame (#44162).
+  if ( d->m_doc && d->m_doc->isHTMLDocument() )
+  {
+    DOMString domain = static_cast<HTMLDocumentImpl*>(d->m_doc)->domain();
+    ConstFrameIt it = d->m_frames.begin();
+    ConstFrameIt end = d->m_frames.end();
+    for (; it != end; ++it )
+    {
+      KParts::ReadOnlyPart *p = (*it).m_part;
+      if ( p && p->inherits( "KHTMLPart" ))
+      {
+        KHTMLPart* htmlFrame = static_cast<KHTMLPart *>(p);
+        if (htmlFrame->d->m_doc && htmlFrame->d->m_doc->isHTMLDocument() )
+        {
+          kdDebug() << "KHTMLPart::checkCompleted setting frame domain to " << domain.string() << endl;
+          static_cast<HTMLDocumentImpl*>(htmlFrame->d->m_doc)->setDomain( domain, true );
+        }
+      }
+    }
+  }
 #endif
 
   d->m_bLoadEventEmitted = true;
@@ -1758,7 +1772,7 @@ void KHTMLPart::slotRedirect()
     args.reload = true;
 
   args.setLockHistory( d->m_redirectLockHistory );
-  urlSelected( u, 0, 0, QString::null, args );
+  urlSelected( u, 0, 0, "_self", args );
 #endif
 }
 
@@ -2070,11 +2084,8 @@ QString KHTMLPart::selectedText() const
           case ID_H6:
             if (!hasNewLine)
                text += "\n";
-#ifdef APPLE_CHANGES
-            // The extra newline is needed at the start, not the end, of these types of tags.
-#else
-            text += "\n";
-#endif
+            // An extra newline is needed at the start, not the end, of these types of tags,
+            // so don't add another here.
             hasNewLine = true;
             break;
         }
@@ -2132,7 +2143,7 @@ void KHTMLPart::slotClearSelection()
 }
 
 #ifdef APPLE_CHANGES
-void KHTMLPart::overURL( const QString &url, const QString &target, int modifierState)
+void KHTMLPart::overURL( const QString &url, const QString &target, int modifierState )
 #else
 void KHTMLPart::overURL( const QString &url, const QString &target, bool shiftPressed )
 #endif
@@ -2151,7 +2162,7 @@ void KHTMLPart::overURL( const QString &url, const QString &target, bool shiftPr
 
   if ( url.isEmpty() )
   {
-    emit setStatusBarText(url);
+    emit setStatusBarText(completeURL(url).htmlURL());
     return;
   }
 
@@ -2176,7 +2187,7 @@ void KHTMLPart::overURL( const QString &url, const QString &target, bool shiftPr
 
   if ( u.isMalformed() )
   {
-    emit setStatusBarText(u.prettyURL());
+    emit setStatusBarText(u.htmlURL());
     return;
   }
 
@@ -2192,7 +2203,7 @@ void KHTMLPart::overURL( const QString &url, const QString &target, bool shiftPr
     struct stat lbuff;
     if (ok) ok = !lstat( path.data(), &lbuff );
 
-    QString text = u.url();
+    QString text = u.htmlURL();
     QString text2 = text;
 
     if (ok && S_ISLNK( lbuff.st_mode ) )
@@ -2268,8 +2279,12 @@ void KHTMLPart::overURL( const QString &url, const QString &target, bool shiftPr
           mailtoMsg += i18n(" - CC: ") + KURL::decode_string((*it).mid(3));
         else if ((*it).startsWith(QString::fromLatin1("bcc=")))
           mailtoMsg += i18n(" - BCC: ") + KURL::decode_string((*it).mid(4));
-      emit setStatusBarText(mailtoMsg.replace(QRegExp("([\n\r\t]|[ ]{10})"), ""));
-			return;
+      mailtoMsg.replace(QRegExp("&"), QString("&amp;"));
+      mailtoMsg.replace(QRegExp("<"), QString("&lt;"));
+      mailtoMsg.replace(QRegExp(">"), QString("&gt;"));
+      mailtoMsg.replace(QRegExp("([\n\r\t]|[ ]{10})"), "");
+      emit setStatusBarText(mailtoMsg);
+      return;
     }
    // Is this check neccessary at all? (Frerich)
 #if 0
@@ -2294,7 +2309,7 @@ void KHTMLPart::overURL( const QString &url, const QString &target, bool shiftPr
         }
       }
 #endif
-    emit setStatusBarText(u.prettyURL() + extra);
+    emit setStatusBarText(u.htmlURL() + extra);
   }
 #endif
 }
@@ -2970,7 +2985,7 @@ void KHTMLPart::submitForm( const char *action, const QString &url, const QByteA
    */
 
   // This causes crashes... needs to be fixed.
-  if (u.protocol() != "https" && u.protocol() != "mailto") {
+  if (!d->m_submitForm && u.protocol() != "https" && u.protocol() != "mailto") {
 	if (d->m_ssl_in_use) {    // Going from SSL -> nonSSL
 		int rc = KMessageBox::warningContinueCancel(NULL, i18n("Warning:  This is a secure form but it is attempting to send your data back unencrypted."
 					"\nA third party may be able to intercept and view this information."
@@ -3004,7 +3019,7 @@ void KHTMLPart::submitForm( const char *action, const QString &url, const QByteA
     }
   }
 
-  if (u.protocol() == "mailto") {
+  if (!d->m_submitForm && u.protocol() == "mailto") {
      int rc = KMessageBox::warningContinueCancel(NULL, 
                  i18n("This site is attempting to submit form data via email."),
                  i18n("KDE"), 
@@ -3441,8 +3456,6 @@ void KHTMLPart::saveState( QDataStream &stream )
          << d->m_ssl_cipher_bits
          << d->m_ssl_cert_state;
 
-  // Save frame data
-  stream << (Q_UINT32)d->m_frames.count();
 
   QStringList frameNameLst, frameServiceTypeLst, frameServiceNameLst;
   KURL::List frameURLLst;
@@ -3452,23 +3465,25 @@ void KHTMLPart::saveState( QDataStream &stream )
   ConstFrameIt end = d->m_frames.end();
   for (; it != end; ++it )
   {
+    if ( !(*it).m_part )
+       continue;
+
     frameNameLst << (*it).m_name;
     frameServiceTypeLst << (*it).m_serviceType;
     frameServiceNameLst << (*it).m_serviceName;
-    if ( (*it).m_part )
-      frameURLLst << (*it).m_part->url();
-    else
-      frameURLLst << KURL();
+    frameURLLst << (*it).m_part->url();
 
     QByteArray state;
     QDataStream frameStream( state, IO_WriteOnly );
 
-    if ( (*it).m_part && (*it).m_extension )
+    if ( (*it).m_extension )
       (*it).m_extension->saveState( frameStream );
 
     frameStateBufferLst << state;
   }
 
+  // Save frame data
+  stream << (Q_UINT32) frameNameLst.count();
   stream << frameNameLst << frameServiceTypeLst << frameServiceNameLst << frameURLLst << frameStateBufferLst;
 }
 
@@ -3567,7 +3582,7 @@ void KHTMLPart::restoreState( QDataStream &stream )
       if ( child->m_part )
       {
         child->m_bCompleted = false;
-        if ( child->m_extension )
+        if ( child->m_extension && !(*fBufferIt).isEmpty() )
         {
           QDataStream frameStream( *fBufferIt, IO_ReadOnly );
           child->m_extension->restoreState( frameStream );
@@ -3623,6 +3638,7 @@ void KHTMLPart::restoreState( QDataStream &stream )
       if ( (*childFrame).m_part )
       {
         if ( (*childFrame).m_extension )
+        if ( (*childFrame).m_extension && !(*fBufferIt).isEmpty() )
         {
           QDataStream frameStream( *fBufferIt, IO_ReadOnly );
           (*childFrame).m_extension->restoreState( frameStream );
@@ -3830,7 +3846,8 @@ QStringList KHTMLPart::frameNames() const
   ConstFrameIt it = d->m_frames.begin();
   ConstFrameIt end = d->m_frames.end();
   for (; it != end; ++it )
-    res += (*it).m_name;
+    if (!(*it).m_bPreloaded)
+      res += (*it).m_name;
 
   return res;
 }
@@ -3847,7 +3864,8 @@ QPtrList<KParts::ReadOnlyPart> KHTMLPart::frames() const
   ConstFrameIt it = d->m_frames.begin();
   ConstFrameIt end = d->m_frames.end();
   for (; it != end; ++it )
-     res.append( (*it).m_part );
+    if (!(*it).m_bPreloaded)
+      res.append( (*it).m_part );
 
   return res;
 #endif
@@ -3873,7 +3891,6 @@ bool KHTMLPart::openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs
 #endif
 }
 
-
 void KHTMLPart::setDNDEnabled( bool b )
 {
   d->m_bDnd = b;
@@ -4071,9 +4088,7 @@ void KHTMLPart::khtmlMouseMoveEvent( khtml::MouseMoveEvent *event )
       }
 
       // normal link
-#ifdef APPLE_CHANGES
-      if ( TRUE )
-#else
+#ifndef APPLE_CHANGES
       if ( d->m_overURL.isEmpty() || d->m_overURL != url || d->m_overURLTarget != target )
 #endif
       {
@@ -4402,6 +4417,8 @@ void KHTMLPart::slotAutoScroll()
 
 void KHTMLPart::selectAll()
 {
+  if(!d->m_doc) return;
+
   NodeImpl *first;
   if (d->m_doc->isHTMLDocument())
     first = static_cast<HTMLDocumentImpl*>(d->m_doc)->body();
@@ -4651,39 +4668,6 @@ bool KHTMLPart::restored() const
   return d->m_restored;
 }
 
-#ifdef APPLE_CHANGES
-
-void KHTMLPart::onURL(const QString &)
-{
-}
-
-void KHTMLPart::nodeActivated(const DOM::Node &aNode)
-{
-}
-
-void KHTMLPart::setTitle(const DOMString &title)
-{
-    impl->setTitle(title);
-}
-
-bool KHTMLPart::isFrameSet()
-{
-    return impl->isFrameSet();
-}
-
-void KHTMLPart::setStatusBarText(const QString &status)
-{
-    impl->setStatusBarText(status);
-}
-
-
-void KHTMLPart::detachView()
-{
-    impl->setView(0);
-}
-
-#endif
-
 using namespace KParts;
 #include "khtml_part.moc"
 
diff --git a/WebCore/khtml/khtml_part.h b/WebCore/khtml/khtml_part.h
index d48af11..becd7c6 100644
--- a/WebCore/khtml/khtml_part.h
+++ b/WebCore/khtml/khtml_part.h
@@ -34,6 +34,10 @@
 
 #include <qregexp.h>
 
+#ifdef APPLE_CHANGES
+#include <KWQKHTMLPartImpl.h>
+#endif
+
 class KHTMLPartPrivate;
 class KHTMLPartBrowserExtension;
 class KJSProxy;
@@ -41,10 +45,6 @@ class KHTMLView;
 class KHTMLSettings;
 class KJavaAppletContext;
 
-#ifdef APPLE_CHANGES
-class KWQKHTMLPartImpl;
-#endif
-
 namespace DOM
 {
   class HTMLDocument;
@@ -1091,9 +1091,6 @@ private:
 
 #ifdef APPLE_CHANGES
 public:
-  bool isFrameSet();
-  void setTitle(const DOM::DOMString &);
-  void detachView(); 
   void setStatusBarText(const QString &);
   KWQKHTMLPartImpl *impl;
   friend class KWQKHTMLPartImpl;
diff --git a/WebCore/khtml/khtmlview.cpp b/WebCore/khtml/khtmlview.cpp
index 5aeab75..1903b80 100644
--- a/WebCore/khtml/khtmlview.cpp
+++ b/WebCore/khtml/khtmlview.cpp
@@ -245,7 +245,7 @@ KHTMLView::~KHTMLView()
         killTimer(d->repaintTimerId);
         d->timerId = 0;
         d->repaintTimerId = 0;
-        m_part->detachView();
+        m_part->impl->setView(0);
         m_part->deref();
 #endif
     }
@@ -397,7 +397,7 @@ void KHTMLView::layout()
 
          if (document->isHTMLDocument()) {
              NodeImpl *body = static_cast<HTMLDocumentImpl*>(document)->body();
-            if(body && body->renderer() && body->id() == ID_FRAMESET) {
+             if(body && body->renderer() && body->id() == ID_FRAMESET) {
                  QScrollView::setVScrollBarMode(AlwaysOff);
                  QScrollView::setHScrollBarMode(AlwaysOff);
                  body->renderer()->setLayouted(false);
@@ -456,7 +456,7 @@ void KHTMLView::viewportMousePressEvent( QMouseEvent *_mouse )
 
     if (!swallowEvent) {
 	khtml::MousePressEvent event( _mouse, xm, ym, mev.url, mev.target, mev.innerNode );
-        QApplication::sendEvent( m_part, &event );
+	QApplication::sendEvent( m_part, &event );
 
 	emit m_part->nodeActivated(mev.innerNode);
     }
@@ -764,9 +764,7 @@ void KHTMLView::contentsContextMenuEvent ( QContextMenuEvent *_ce )
         targetNode->renderer()->absolutePosition(absx,absy);
         QPoint pos(xm-absx,ym-absy);
 
-#ifndef APPLE_CHANGES
         QWidget *w = static_cast<RenderWidget*>(targetNode->renderer())->widget();
-#endif
         QContextMenuEvent cme(_ce->reason(),pos,_ce->globalPos(),_ce->state());
         setIgnoreEvents(true);
         QApplication::sendEvent(w,&cme);
@@ -1008,7 +1006,7 @@ void KHTMLView::print()
     if(printer->setup(this)) {
         viewport()->setCursor( waitCursor ); // only viewport(), no QApplication::, otherwise we get the busy cursor in kdeprint's dialogs
         // set up KPrinter
-        printer->setFullPage(true);
+        printer->setFullPage(false);
         printer->setCreator("KDE 3.0 HTML Library");
         QString docname = m_part->xmlDocImpl()->URL();
         if ( !docname.isEmpty() )
@@ -1021,10 +1019,19 @@ void KHTMLView::print()
         m_part->xmlDocImpl()->setPaintDevice( printer );
         QString oldMediaType = mediaType();
         setMediaType( "print" );
+        // We ignore margin settings for html and body when printing
+        // and use the default margins from the print-system
+        // (In Qt 3.0.x the default margins are hardcoded in Qt)
         m_part->xmlDocImpl()->setPrintStyleSheet( printer->option("kde-khtml-printfriendly") == "true" ?
                                                   "* { background-image: none !important;"
-                                                  "    background-color: transparent !important;"
-                                                  "    color: black !important }" : "" );
+                                                  "    background-color: white !important;"
+                                                  "    color: black !important; }"
+                                                  "body { margin: 0px !important; }"
+                                                  "html { margin: 0px !important; }" :
+                                                  "body { margin: 0px !important; }"
+                                                  "html { margin: 0px !important; }"
+                                                  );
+
 
         QPaintDeviceMetrics metrics( printer );
 
@@ -1056,8 +1063,6 @@ void KHTMLView::print()
         // the whole thing.
         int pageHeight = metrics.height();
         int pageWidth = metrics.width();
-        // We print the bottom 'overlap' units again at the top of the next page.
-        int overlap = 30;
         p->setClipRect(0,0, pageWidth, pageHeight);
         if(root->docWidth() > metrics.width()) {
             double scale = ((double) metrics.width())/((double) root->docWidth());
@@ -1066,19 +1071,20 @@ void KHTMLView::print()
 #endif
             pageHeight = (int) (pageHeight/scale);
             pageWidth = (int) (pageWidth/scale);
-            overlap = (int) (overlap/scale);
         }
         kdDebug(6000) << "printing: scaled html width = " << pageWidth
                       << " height = " << pageHeight << endl;
         int top = 0;
         while(top < root->docHeight()) {
             if(top > 0) printer->newPage();
+            root->setTruncatedAt(top+pageHeight);
 
             root->print(p, 0, top, pageWidth, pageHeight, 0, 0);
-            p->translate(0,-(pageHeight-overlap));
             if (top + pageHeight >= root->docHeight())
                 break; // Stop if we have printed everything
-            top += (pageHeight-overlap);
+
+            p->translate(0, top - root->truncatedAt());
+            top = root->truncatedAt();
         }
 
         p->end();
@@ -1461,7 +1467,6 @@ void KHTMLView::timerEvent ( QTimerEvent *e )
 
 //        kdDebug() << "scheduled repaint "<< d->repaintTimerId  << endl;
     killTimer(d->repaintTimerId);
-
     updateContents( d->updateRect );
 
     d->repaintTimerId = 0;
diff --git a/WebCore/khtml/misc/decoder.cpp b/WebCore/khtml/misc/decoder.cpp
index 88a0cea..158dd31 100644
--- a/WebCore/khtml/misc/decoder.cpp
+++ b/WebCore/khtml/misc/decoder.cpp
@@ -522,11 +522,10 @@ QString Decoder::decode(const char *data, int len)
         out = m_decoder->toUnicode(data, len);
     }
 
-    if (out.isNull()){
-        fprintf (stderr, "ERROR:  decoded string is null\n");
-    }
-    else if (out.length() == 0){
-        fprintf (stderr, "ERROR:  decoded string length == 0\n");
+    if (out.isNull()) {
+        fprintf(stderr, "ERROR:  decoded string is null\n");
+    } else if (out.length() == 0) {
+        fprintf(stderr, "ERROR:  decoded string length == 0\n");
     }
     // the hell knows, why the output does sometimes have a QChar::null at
     // the end...
diff --git a/WebCore/khtml/misc/helper.cpp b/WebCore/khtml/misc/helper.cpp
index 7caedd3..b9ebe10 100644
--- a/WebCore/khtml/misc/helper.cpp
+++ b/WebCore/khtml/misc/helper.cpp
@@ -67,19 +67,11 @@ static const colorMap cmap[] = {
 };
 
 struct uiColors {
-#ifdef APPLE_CHANGES
     const char * name;
     const char * configGroup;
     const char * configEntry;
     QPalette::ColorGroup group;
     QColorGroup::ColorRole role;
-#else
-    const char * const name;
-    const char * const configGroup;
-    const char * const configEntry;
-    const QPalette::ColorGroup group;
-    const QColorGroup::ColorRole role;
-#endif
 };
 
 const char * const wmgroup = "WM";
diff --git a/WebCore/khtml/misc/htmlhashes.cpp b/WebCore/khtml/misc/htmlhashes.cpp
index b815ca0..7a871c5 100644
--- a/WebCore/khtml/misc/htmlhashes.cpp
+++ b/WebCore/khtml/misc/htmlhashes.cpp
@@ -19,7 +19,6 @@
     Boston, MA 02111-1307, USA.
 */
 #include "htmlhashes.h"
-
 #include "htmltags.c"
 #include "htmlattrs.c"
 
diff --git a/WebCore/khtml/misc/loader.cpp b/WebCore/khtml/misc/loader.cpp
index 9c6a3f5..97e5928 100644
--- a/WebCore/khtml/misc/loader.cpp
+++ b/WebCore/khtml/misc/loader.cpp
@@ -144,6 +144,7 @@ CachedCSSStyleSheet::CachedCSSStyleSheet(const DOMString &url, const QString &st
     m_sheet = DOMString(stylesheet_data);
 }
 
+
 CachedCSSStyleSheet::~CachedCSSStyleSheet()
 {
 }
@@ -675,7 +676,11 @@ void CachedImage::movieStatus(int status)
     {
         const QImage& im = m->frameImage();
         monochrome = ( ( im.depth() <= 8 ) && ( im.numColors() - int( im.hasAlphaBuffer() ) <= 2 ) );
-        if(im.width() < 5 && im.height() < 5 && im.hasAlphaBuffer()) // only evaluate for small images
+        for (int i = 0; monochrome && i < im.numColors(); ++i)
+            if (im.colorTable()[i] != qRgb(0xff, 0xff, 0xff) &&
+                im.colorTable()[i] != qRgb(0x00, 0x00, 0x00))
+                monochrome = false;
+        if((im.width() < 5 || im.height() < 5) && im.hasAlphaBuffer()) // only evaluate for small images
         {
             QImage am = im.createAlphaMask();
             if(am.depth() == 1)
@@ -709,7 +714,7 @@ void CachedImage::movieStatus(int status)
 
             // monochrome alphamasked images are usually about 10000 times
             // faster to draw, so this is worth the hack
-            if ( p && monochrome && p->depth() > 1 )
+            if (p && monochrome && p->depth() > 1 )
             {
                 QPixmap* pix = new QPixmap;
                 pix->convertFromImage( p->convertToImage().convertDepth( 1 ), MonoOnly|AvoidDither );
@@ -791,7 +796,7 @@ void CachedImage::clear()
 }
 
 void CachedImage::data ( QBuffer &_buffer, bool eof )
-{    
+{
 #ifdef CACHE_DEBUG
     kdDebug( 6060 ) << this << "in CachedImage::data(buffersize " << _buffer.buffer().size() <<", eof=" << eof << endl;
 #endif
@@ -846,10 +851,7 @@ void CachedImage::data ( QBuffer &_buffer, bool eof )
         QSize s = pixmap_size();
         m_size = s.width() * s.height() * 2;
     }
-#endif // !APPLE_CHANGES
-
-#ifdef APPLE_CHANGES
-
+#else // APPLE_CHANGES
     bool canDraw = false;
     if (!eof) {
         // If we didn't get all the data for the image we will always
@@ -982,7 +984,7 @@ CachedImage *DocLoader::requestImage( const DOM::DOMString &url)
 
     bool reload = needReload(fullURL);
 
-#if APPLE_CHANGES
+#ifdef APPLE_CHANGES
     CachedImage *cachedObject = Cache::requestImage(this, url, reload, m_expireDate);
     KWQCheckCacheObjectStatus(this, cachedObject);
     return cachedObject;
@@ -998,7 +1000,7 @@ CachedCSSStyleSheet *DocLoader::requestStyleSheet( const DOM::DOMString &url, co
 
     bool reload = needReload(fullURL);
 
-#if APPLE_CHANGES
+#ifdef APPLE_CHANGES
     CachedCSSStyleSheet *cachedObject = Cache::requestStyleSheet(this, url, reload, m_expireDate, charset);
     KWQCheckCacheObjectStatus(this, cachedObject);
     return cachedObject;
@@ -1014,7 +1016,7 @@ CachedScript *DocLoader::requestScript( const DOM::DOMString &url, const QString
 
     bool reload = needReload(fullURL);
 
-#if APPLE_CHANGES
+#ifdef APPLE_CHANGES
     CachedScript *cachedObject = Cache::requestScript(this, url, reload, m_expireDate, charset);
     KWQCheckCacheObjectStatus(this, cachedObject);
     return cachedObject;
@@ -1595,8 +1597,8 @@ void Cache::flush(bool force)
         --it; // Update iterator, we might delete the current entry later on.
         CachedObject *o = cache->find( url );
 
-#if APPLE_CHANGES
-        if( !o ) {
+#ifdef APPLE_CHANGES
+        if (!o) {
             continue;
         }
 #endif
diff --git a/WebCore/khtml/rendering/bidi.cpp b/WebCore/khtml/rendering/bidi.cpp
index 8fc8655..04a0d06 100644
--- a/WebCore/khtml/rendering/bidi.cpp
+++ b/WebCore/khtml/rendering/bidi.cpp
@@ -1169,11 +1169,9 @@ BidiIterator RenderFlow::findNextLineBreak(BidiIterator &start)
             // IMPORTANT: pos is > length here!
             tmpW += t->width(lastSpace, pos - lastSpace, f);
             }
-#ifdef APPLE_CHANGES
 #if 0
             }
 #endif
-#endif
         } else
             KHTMLAssert( false );
 
diff --git a/WebCore/khtml/rendering/font.cpp b/WebCore/khtml/rendering/font.cpp
index af79681..f671b6c 100644
--- a/WebCore/khtml/rendering/font.cpp
+++ b/WebCore/khtml/rendering/font.cpp
@@ -216,9 +216,13 @@ void Font::update( QPaintDeviceMetrics* devMetrics ) const
             size = (int)((bestSize*lDpiY) / 72);
     }
 
+    // make sure we don't bust up X11
+    size = KMAX(0, KMIN(255, size));
+
 //      qDebug("setting font to %s, italic=%d, weight=%d, size=%d", fontDef.family.latin1(), fontDef.italic,
 //   	   fontDef.weight, size );
 
+
     f.setPixelSize( size );
 #endif
 
diff --git a/WebCore/khtml/rendering/render_box.cpp b/WebCore/khtml/rendering/render_box.cpp
index 0e17df9..b3322a4 100644
--- a/WebCore/khtml/rendering/render_box.cpp
+++ b/WebCore/khtml/rendering/render_box.cpp
@@ -294,7 +294,7 @@ void RenderBox::calcClip(QPainter* p, int tx, int ty)
 	if ( style()->jsClipMode() )
 	    clipw = w + tx + bl;
 	else
-	    clipw -= w;
+	    clipw -= m_width - bl - br - w;
     }
     if (!style()->clipTop().isVariable())
     {
@@ -308,7 +308,7 @@ void RenderBox::calcClip(QPainter* p, int tx, int ty)
 	if ( style()->jsClipMode() )
 	    cliph = h + ty + bt;
 	else
-	    cliph -= h;
+            cliph -= m_height - bt - bb - h;
     }
     //kdDebug( 6040 ) << "setting clip("<<clipx<<","<<clipy<<","<<clipw<<","<<cliph<<")"<<endl;
 
diff --git a/WebCore/khtml/rendering/render_container.cpp b/WebCore/khtml/rendering/render_container.cpp
index b0d3374..49230a3 100644
--- a/WebCore/khtml/rendering/render_container.cpp
+++ b/WebCore/khtml/rendering/render_container.cpp
@@ -286,4 +286,54 @@ void RenderContainer::layout()
     setLayouted();
 }
 
+void RenderContainer::removeLeftoverAnonymousBoxes()
+{
+    // we have to go over all child nodes and remove anonymous boxes, that do _not_
+    // have inline children to keep the tree flat
+    RenderObject *child = firstChild();
+    while( child ) {
+	RenderObject *next = child->nextSibling();
+	
+	if ( child->isFlow() && child->isAnonymousBox() && !child->childrenInline() ) {
+	    RenderObject *firstAnChild = child->firstChild();
+	    RenderObject *lastAnChild = child->lastChild();
+	    if ( firstAnChild ) {
+		RenderObject *o = firstAnChild;
+		while( o ) {
+		    o->setParent( this );
+		    o = o->nextSibling();
+		}
+		firstAnChild->setPreviousSibling( child->previousSibling() );
+		lastAnChild->setNextSibling( child->nextSibling() );
+		if ( child->previousSibling() )
+		    child->previousSibling()->setNextSibling( firstAnChild );
+		if ( child->nextSibling() )
+		    child->nextSibling()->setPreviousSibling( lastAnChild );
+	    } else {
+		if ( child->previousSibling() )
+		    child->previousSibling()->setNextSibling( child->nextSibling() );
+		if ( child->nextSibling() )
+		    child->nextSibling()->setPreviousSibling( child->previousSibling() );
+		
+	    }
+	    if ( child == firstChild() )
+		m_first = firstAnChild;
+	    if ( child == lastChild() )
+		m_last = lastAnChild;
+	    child->setParent( 0 );
+	    child->setPreviousSibling( 0 );
+	    child->setNextSibling( 0 );
+	    if ( !child->isText() ) {
+		RenderContainer *c = static_cast<RenderContainer *>(child);
+		c->m_first = 0;
+		c->m_next = 0;
+	    }
+	    delete child;
+	}
+	child = next;
+    }
+    if ( parent() )
+	parent()->removeLeftoverAnonymousBoxes();
+}
+    
 #undef DEBUG_LAYOUT
diff --git a/WebCore/khtml/rendering/render_container.h b/WebCore/khtml/rendering/render_container.h
index 371a7e9..b893f69 100644
--- a/WebCore/khtml/rendering/render_container.h
+++ b/WebCore/khtml/rendering/render_container.h
@@ -50,6 +50,8 @@ public:
     virtual void layout();
     virtual void calcMinMaxWidth() { setMinMaxKnown( true ); }
 
+    virtual void removeLeftoverAnonymousBoxes();
+    
 private:
 
     void setFirstChild(RenderObject *first) { m_first = first; }
diff --git a/WebCore/khtml/rendering/render_flow.cpp b/WebCore/khtml/rendering/render_flow.cpp
index 3aa1180..fc8481f 100644
--- a/WebCore/khtml/rendering/render_flow.cpp
+++ b/WebCore/khtml/rendering/render_flow.cpp
@@ -201,7 +201,7 @@ void RenderFlow::printSpecialObjects( QPainter *p, int x, int y, int w, int h, i
     QPtrListIterator<SpecialObject> it(*specialObjects);
     for ( ; (r = it.current()); ++it ) {
         // A special object may be registered with several different objects... so we only print the
-        // object if we are it's containing block
+        // object if we are its containing block
        if (r->node->isPositioned() && r->node->containingBlock() == this) {
            r->node->print(p, x, y, w, h, tx , ty);
        } else if ( ( r->node->isFloating() && !r->noPaint ) ) {
@@ -533,9 +533,7 @@ void RenderFlow::insertSpecialObject(RenderObject *o)
 	// We should never get here, as insertSpecialObject() should only ever be called with positioned or floating
 	// objects.
 	KHTMLAssert(false);
-#ifdef APPLE_CHANGES
         newObj = 0; // keep gcc's uninitialized variable warnings happy
-#endif
     }
 
     newObj->count = specialObjects->count();
@@ -1261,6 +1259,8 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
     kdDebug( 6040 ) << "current height = " << m_height << endl;
 #endif
     setLayouted( false );
+    
+    bool madeBoxesNonInline = FALSE;
 
     if ( newChild->isPositioned() ) {
 	m_blockBidi = false;
@@ -1326,13 +1326,15 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
         else {
             // Trying to insert a block child into an anonymous block box which contains only
             // inline elements... move all of the anonymous box's inline children into other
-            // anonmous boxes which become children of this
+            // anonymous boxes which become children of this
 
             RenderObject *anonBox = beforeChild->parent();
             KHTMLAssert (anonBox->isFlow()); // ### RenderTableSection the only exception - should never happen here
 
-	    if ( anonBox->childrenInline() )
+	    if ( anonBox->childrenInline() ) {
 		static_cast<RenderFlow*>(anonBox)->makeChildrenNonInline(beforeChild);
+		madeBoxesNonInline = true;
+	    }
             beforeChild = beforeChild->parent();
 
             RenderObject *child;
@@ -1359,13 +1361,15 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
             setOverhangingContents();
     }
 
-    // RenderFlow has to either have all of it's children inline, or all of it's children as blocks.
-    // So, if our children are currently inline and block child has to be inserted, we move all our
+    // RenderFlow has to either have all of its children inline, or all of its children as blocks.
+    // So, if our children are currently inline and a block child has to be inserted, we move all our
     // inline children into anonymous block boxes
     if ( m_childrenInline && !newChild->isInline() && !newChild->isSpecial() )
     {
-	if ( m_childrenInline )
+	if ( m_childrenInline ) {
 	    makeChildrenNonInline(beforeChild);
+	    madeBoxesNonInline = true;
+	}
         if (beforeChild) {
 	    if ( beforeChild->parent() != this ) {
 		beforeChild = beforeChild->parent();
@@ -1427,7 +1431,7 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
     if(!newChild->isInline()) // block child
     {
         // If we are inline ourselves and have become block, we have to make sure our parent
-        // makes the necessary adjustments so that all of it's other children are moved into
+        // makes the necessary adjustments so that all of its other children are moved into
         // anonymous block boxes where necessary
         if (style()->display() == INLINE)
         {
@@ -1435,6 +1439,7 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
 	    RenderObject *p = parent();
             if (p && p->isFlow() && p->childrenInline() ) {
                 static_cast<RenderFlow*>(p)->makeChildrenNonInline();
+		madeBoxesNonInline = true;
             }
         }
     }
@@ -1445,7 +1450,9 @@ void RenderFlow::addChild(RenderObject *newChild, RenderObject *beforeChild)
     newChild->setLayouted( false );
     newChild->setMinMaxKnown( false );
     insertPseudoChild(RenderStyle::AFTER, newChild, beforeChild);
-
+    
+    if ( madeBoxesNonInline )
+	removeLeftoverAnonymousBoxes();
 }
 
 void RenderFlow::makeChildrenNonInline(RenderObject *box2Start)
@@ -1500,14 +1507,14 @@ void RenderFlow::makeChildrenNonInline(RenderObject *box2Start)
         child = next;
     }
 
-
     if (isInline()) {
         setInline(false);
         if (parent()->isFlow()) {
             KHTMLAssert(parent()->childrenInline());
 	    static_cast<RenderFlow *>(parent())->makeChildrenNonInline();
         }
-    }
+    } 
+    
     setLayouted(false);
 }
 
diff --git a/WebCore/khtml/rendering/render_form.cpp b/WebCore/khtml/rendering/render_form.cpp
index 7d854f5..7340090 100644
--- a/WebCore/khtml/rendering/render_form.cpp
+++ b/WebCore/khtml/rendering/render_form.cpp
@@ -173,8 +173,9 @@ void RenderFormElement::layout()
     calcHeight();
 
     if ( m_widget )
-        m_widget->resize( m_width-borderLeft()-borderRight()-paddingLeft()-paddingRight(),
-                          m_height-borderLeft()-borderRight()-paddingLeft()-paddingRight());
+        resizeWidget(m_widget,
+                     m_width-borderLeft()-borderRight()-paddingLeft()-paddingRight(),
+                     m_height-borderLeft()-borderRight()-paddingLeft()-paddingRight());
 
     if ( !style()->width().isPercent() )
         setLayouted();
@@ -341,21 +342,21 @@ void RenderSubmitButton::calcMinMaxWidth()
     KHTMLAssert( !minMaxKnown() );
 
     QString raw = rawText();
-    static_cast<QPushButton*>(m_widget)->setText(raw);
-    static_cast<QPushButton*>(m_widget)->setFont(style()->font());
-
-    // this is a QLineEdit/RenderLineEdit compatible sizehint
-    QFontMetrics fm = QFontMetrics( m_widget->font() );
-    m_widget->constPolish();
-    QSize ts = fm.size( ShowPrefix, raw );
-    int h = ts.height() + 8;
-    int w = ts.width() + 2*fm.width( ' ' );
-    if ( m_widget->style().styleHint(QStyle::SH_GUIStyle) == Qt::WindowsStyle && h < 26 )
-        h = 22;
-    QSize s = QSize( w + 8, h ).expandedTo( m_widget->minimumSizeHint()).expandedTo( QApplication::globalStrut() );
-
-    setIntrinsicWidth( s.width() );
-    setIntrinsicHeight( s.height() );
+    QPushButton* pb = static_cast<QPushButton*>(m_widget);
+    pb->setText(raw);
+    pb->setFont(style()->font());
+
+    bool empty = raw.isEmpty();
+    if ( empty )
+        raw = QString::fromLatin1("XXXX");
+    QFontMetrics fm = pb->fontMetrics();
+    int margin = pb->style().pixelMetric( QStyle::PM_ButtonMargin, pb);
+    QSize s(pb->style().sizeFromContents(
+                QStyle::CT_PushButton, pb, fm.size( ShowPrefix, raw))
+            .expandedTo(QApplication::globalStrut()));
+    
+    setIntrinsicWidth( s.width() - margin / 2 );
+    setIntrinsicHeight( s.height() - margin / 2);
 
     RenderButton::calcMinMaxWidth();
 }
@@ -526,26 +527,11 @@ void RenderLineEdit::calcMinMaxWidth()
 
     int size = element()->size();
 
-    int h = fm.height();
+    int h = fm.lineSpacing();
     int w = fm.width( 'x' ) * (size > 0 ? size : 17); // "some"
-    if ( widget()->frame() ) {
-        h += 8;
-        // ### this is not really portable between all styles.
-        // I think one should try to find a generic solution which
-        // works with all possible styles. Lars.
-        // ### well, it is. it's the 1:1 copy of QLineEdit::sizeHint()
-        // the only reason that made me including this thingie is
-        // that I cannot get a sizehint for a specific number of characters
-        // in the lineedit from it. It's not my fault, it's Qt's. Dirk
-        if ( m_widget->style().styleHint(QStyle::SH_GUIStyle) == Qt::WindowsStyle && h < 26 )
-            h = 22;
-        s = QSize( w + 8, h ).expandedTo( QApplication::globalStrut() );
-    } else
-#ifdef APPLE_CHANGES
-	s = QSize( w + 6, h + 4 );
-#else
-	s = QSize( w + 4, h + 4 ).expandedTo( QApplication::globalStrut() );
-#endif
+    s = QSize(w + 2 + 2*widget()->frameWidth(),
+              QMAX(h, 14) + 2 + 2*widget()->frameWidth())
+        .expandedTo(QApplication::globalStrut());
 
     setIntrinsicWidth( s.width() );
     setIntrinsicHeight( s.height() );
@@ -571,6 +557,7 @@ void RenderLineEdit::updateFromElement()
         widget()->setCursorPosition(pos);
         widget()->blockSignals(false);
     }
+    widget()->setReadOnly(element()->readOnly());
 
     RenderFormElement::updateFromElement();
 }
@@ -636,17 +623,12 @@ void RenderFileButton::calcMinMaxWidth()
     QSize s;
     int size = element()->size();
 
-    int h = fm.height();
-    int w = fm.width( 'x' ) * (size > 0 ? size : 17);
-    w += fm.width( m_button->text() ) + 2*fm.width( ' ' );
-
-    if ( m_edit->frame() ) {
-        h += 8;
-        if ( m_widget->style().styleHint(QStyle::SH_GUIStyle) == Qt::WindowsStyle && h < 26 )
-            h = 22;
-        s = QSize( w + 8, h );
-    } else
-        s = QSize( w + 4, h + 4 );
+    int h = fm.lineSpacing();
+    int w = fm.width( 'x' ) * (size > 0 ? size : 17); // "some"
+    w += 6 + fm.width( m_button->text() ) + 2*fm.width( ' ' );
+    s = QSize(w + 2 + 2*m_edit->frameWidth(),
+              QMAX(h, 14) + 2 + 2*m_edit->frameWidth())
+        .expandedTo(QApplication::globalStrut());
 
     setIntrinsicWidth( s.width() );
     setIntrinsicHeight( s.height() );
@@ -1097,7 +1079,7 @@ void RenderSelect::updateSelection()
     }
     else {
         bool found = false;
-        int firstOption = listItems.size();
+        unsigned firstOption = listItems.size();
         i = listItems.size();
         while (i--)
             if (listItems[i]->id() == ID_OPTION) {
@@ -1120,7 +1102,7 @@ void RenderSelect::updateSelection()
 // -------------------------------------------------------------------------
 
 TextAreaWidget::TextAreaWidget(int wrap, QWidget* parent)
-    : QTextEdit(parent)
+    : KTextEdit(parent)
 {
     if(wrap != DOM::HTMLTextAreaElementImpl::ta_NoWrap) {
         setWordWrap(QTextEdit::WidgetWidth);
@@ -1156,7 +1138,7 @@ bool TextAreaWidget::event( QEvent *e )
             }
         }
     }
-    return QTextEdit::event( e );
+    return KTextEdit::event( e );
 }
 
 // -------------------------------------------------------------------------
diff --git a/WebCore/khtml/rendering/render_form.h b/WebCore/khtml/rendering/render_form.h
index 757df0f..014af55 100644
--- a/WebCore/khtml/rendering/render_form.h
+++ b/WebCore/khtml/rendering/render_form.h
@@ -43,6 +43,7 @@ class QListboxItem;
 #include <kcombobox.h>
 #include "dom/dom_misc.h"
 
+typedef class QTextEdit KTextEdit;
 class KHTMLPartBrowserExtension;
 
 #ifdef APPLE_CHANGES
@@ -393,7 +394,7 @@ protected slots:
 
 // -------------------------------------------------------------------------
 
-class TextAreaWidget : public QTextEdit
+class TextAreaWidget : public KTextEdit
 {
 public:
     TextAreaWidget(int wrap, QWidget* parent);
diff --git a/WebCore/khtml/rendering/render_image.cpp b/WebCore/khtml/rendering/render_image.cpp
index 656bc40..3ac0d34 100644
--- a/WebCore/khtml/rendering/render_image.cpp
+++ b/WebCore/khtml/rendering/render_image.cpp
@@ -41,6 +41,7 @@
 #include "html/dtd.h"
 #include "xml/dom2_eventsimpl.h"
 #include "html/html_documentimpl.h"
+#include <math.h>
 
 using namespace DOM;
 using namespace khtml;
@@ -314,6 +315,19 @@ void RenderImage::layout()
     calcWidth();
     calcHeight();
 
+    // if they are variable width and we calculate a huge height or width, we assume they
+    // actually wanted the intrinsic width.
+    if ( m_width > 2048 && !style()->width().isFixed() )
+	m_width = intrinsicWidth();
+    if ( m_height > 2048 && !style()->height().isFixed() )
+	m_height = intrinsicHeight();
+    // limit total size to not run out of memory when doing the xform call.
+    if ( m_width * m_height > 2048*2048 ) {
+	float scale = sqrt( m_width*m_height / ( 2048.*2048. ) );
+	m_width = (int) (m_width/scale);
+	m_height = (int) (m_height/scale);
+    }
+    
     if ( m_width != oldwidth || m_height != oldheight )
         resizeCache = QPixmap();
 
diff --git a/WebCore/khtml/rendering/render_list.cpp b/WebCore/khtml/rendering/render_list.cpp
index 855d42c..c5272bb 100644
--- a/WebCore/khtml/rendering/render_list.cpp
+++ b/WebCore/khtml/rendering/render_list.cpp
@@ -20,7 +20,9 @@
  * Boston, MA 02111-1307, USA.
  *
  */
+
 #include "render_list.h"
+#include "rendering/render_root.h"
 
 #include <qpainter.h>
 
@@ -293,8 +295,8 @@ void RenderListMarker::print(QPainter *p, int _x, int _y, int _w, int _h,
     printObject(p, _x, _y, _w, _h, _tx, _ty);
 }
 
-void RenderListMarker::printObject(QPainter *p, int, int,
-                                    int, int, int _tx, int _ty)
+void RenderListMarker::printObject(QPainter *p, int, int _y,
+                                    int, int _h, int _tx, int _ty)
 {
     if (style()->visibility() != VISIBLE) return;
 
@@ -305,12 +307,31 @@ void RenderListMarker::printObject(QPainter *p, int, int,
     const QFontMetrics fm = p->fontMetrics();
 #ifdef APPLE_CHANGES
     // Why does khtml draw such large dots, squares, circle, etc for list items?
-    // These seem much bigger than competing browsers.  I've reduced the size.
+    // These seem much bigger than competing browsers. This change reduces the size.
+    // FIXME: Does this change cause positioning problems?
     int offset = fm.ascent()/3;
-#else /* APPLE_CHANGES not defined */
+#else
     int offset = fm.ascent()*2/3;
-#endif /* APPLE_CHANGES not defined */
+#endif
 
+    bool isPrinting = (p->device()->devType() == QInternal::Printer);
+    if (isPrinting)
+    {
+        if (_ty < _y)
+        {
+            // This has been printed already we suppose.
+            return;
+        }
+        if (_ty + m_height + paddingBottom() + borderBottom() >= _y+_h)
+        {
+            RenderRoot *rootObj = root();
+            if (_ty < rootObj->truncatedAt())
+                rootObj->setTruncatedAt(_ty);
+            // Let's print this on the next page.
+            return; 
+        }
+    }
+    
 
     int xoff = 0;
     int yoff = fm.ascent() - offset;
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index b91651e..fb1175a 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -536,6 +536,7 @@ QString RenderObject::information() const
     if (layouted()) ts << "lt ";
     if (m_recalcMinMax) ts << "rmm ";
     if (mouseInside()) ts << "mi ";
+    if (style() && style()->zIndex()) ts << "zI: " << style()->zIndex();
     if (element() && element()->active()) ts << "act ";
     if (element() && element()->hasAnchor()) ts << "anchor ";
     if (element() && element()->focused()) ts << "focus ";
@@ -841,7 +842,7 @@ bool RenderObject::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty)
     bool inner = !info.innerNode();
 
     // ### table should have its own, more performant method
-    if (isPositioned() || isInline() || isRoot() || isTableRow() || isTableSection() || inside || mouseInside() ) {
+    if (overhangingContents() || isInline() || isRoot() || isTableRow() || isTableSection() || inside || mouseInside() ) {
         for (RenderObject* child = lastChild(); child; child = child->previousSibling())
             if (!child->isPositioned() && child->nodeAtPoint(info, _x, _y, _tx+xPos(), _ty+yPos()))
                 inside = true;
@@ -1034,3 +1035,8 @@ void RenderObject::scheduleRelayout()
     if ( view )
 	view->scheduleRelayout();
 }
+
+
+void RenderObject::removeLeftoverAnonymousBoxes()
+{
+}
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index c4e2908..6936e71 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -42,6 +42,7 @@ class KHTMLView;
 #define KHTMLAssert( x ) if( !(x) ) { \
     const RenderObject *o = this; while( o->parent() ) o = o->parent(); \
     o->printTree(); \
+    qDebug(" this object = %p", this ); \
     assert( false ); \
 }
 #else
@@ -228,7 +229,7 @@ public:
     virtual short baselinePosition( bool firstLine ) const;
 
     /*
-     * Print the object and it's children, clipped by (x|y|w|h).
+     * Print the object and its children, clipped by (x|y|w|h).
      * (tx|ty) is the calculated position of the parent
      */
     virtual void print( QPainter *p, int x, int y, int w, int h, int tx, int ty);
@@ -267,7 +268,7 @@ public:
 
     /*
      * This function should cause the Element to calculate its
-     * width and height and the layout of it's content
+     * width and height and the layout of its content
      *
      * when the Element calls setLayouted(true), layout() is no
      * longer called during relayouts, as long as there is no
@@ -439,7 +440,6 @@ public:
     const QFontMetrics &fontMetrics(bool firstLine) const {
 	return style( firstLine )->fontMetrics();
     }
-
 protected:
     virtual void selectionStartEnd(int& spos, int& epos);
 
@@ -458,6 +458,8 @@ protected:
     void invalidateVerticalPositions();
     short getVerticalPosition( bool firstLine ) const;
 
+    virtual void removeLeftoverAnonymousBoxes();
+    
 private:
     RenderStyle* m_style;
     DOM::NodeImpl* m_node;
diff --git a/WebCore/khtml/rendering/render_root.h b/WebCore/khtml/rendering/render_root.h
index 33ae82c..7761e0c 100644
--- a/WebCore/khtml/rendering/render_root.h
+++ b/WebCore/khtml/rendering/render_root.h
@@ -66,6 +66,8 @@ public:
     bool printingMode() const { return m_printingMode; }
     void setPrintImages(bool enable) { m_printImages = enable; }
     bool printImages() const { return m_printImages; }
+    void setTruncatedAt(int y) { m_truncatedAt = y; }
+    int truncatedAt() const { return m_truncatedAt; }
 
     virtual void setWidth( int width ) { m_rootWidth = m_width = width; }
     virtual void setHeight( int height ) { m_rootHeight = m_height = height; }
@@ -89,6 +91,7 @@ protected:
     // used to ignore viewport width when printing to the printer
     bool m_printingMode;
     bool m_printImages;
+    int m_truncatedAt;
 };
 
 };
diff --git a/WebCore/khtml/rendering/render_style.cpp b/WebCore/khtml/rendering/render_style.cpp
index ee3eff6..435c6bf 100644
--- a/WebCore/khtml/rendering/render_style.cpp
+++ b/WebCore/khtml/rendering/render_style.cpp
@@ -54,7 +54,7 @@ StyleBoxData::StyleBoxData()
 StyleBoxData::StyleBoxData(const StyleBoxData& o )
     : Shared<StyleBoxData>(),
       width( o.width ), height( o.height ),
-      min_width( o.min_width ), max_width( o.max_width ), 
+      min_width( o.min_width ), max_width( o.max_width ),
       min_height ( o.min_height ), max_height( o.max_height ),
       z_index( o.z_index )
 {
@@ -81,7 +81,7 @@ StyleVisualData::StyleVisualData()
 StyleVisualData::~StyleVisualData() {
 }
 
-StyleVisualData::StyleVisualData(const StyleVisualData& o ) 
+StyleVisualData::StyleVisualData(const StyleVisualData& o )
     : Shared<StyleVisualData>(),
       clip( o.clip ), colspan( o.colspan ),
       counter_increment( o.counter_increment ), counter_reset( o.counter_reset ),
@@ -96,7 +96,7 @@ StyleBackgroundData::StyleBackgroundData()
 {
 }
 
-StyleBackgroundData::StyleBackgroundData(const StyleBackgroundData& o ) 
+StyleBackgroundData::StyleBackgroundData(const StyleBackgroundData& o )
     : Shared<StyleBackgroundData>(),
       color( o.color ), image( o.image ),
       x_position( o.x_position ), y_position( o.y_position ),
@@ -122,14 +122,14 @@ StyleInheritedData::StyleInheritedData()
 {
 }
 
-StyleInheritedData::~StyleInheritedData() 
-{ 
+StyleInheritedData::~StyleInheritedData()
+{
 }
 
 StyleInheritedData::StyleInheritedData(const StyleInheritedData& o )
     : Shared<StyleInheritedData>(),
       indent( o.indent ), line_height( o.line_height ), style_image( o.style_image ),
-      cursor_image( o.cursor_image ), font( o.font ), 
+      cursor_image( o.cursor_image ), font( o.font ),
       color( o.color ), decoration_color( o.decoration_color ),
       border_spacing( o.border_spacing )
 {
@@ -137,7 +137,7 @@ StyleInheritedData::StyleInheritedData(const StyleInheritedData& o )
 
 bool StyleInheritedData::operator==(const StyleInheritedData& o) const
 {
-    return 
+    return
 	indent == o.indent &&
 	line_height == o.line_height &&
 	border_spacing == o.border_spacing &&
@@ -213,8 +213,7 @@ RenderStyle::~RenderStyle()
         prev->pseudoStyle = 0;
         prev->deref();
     }
-    if ( content )
-	delete content;
+    delete content;
 }
 
 bool RenderStyle::operator==(const RenderStyle& o) const
@@ -433,7 +432,7 @@ void RenderStyle::cleanup()
 
 void RenderStyle::setContent(CachedObject* o)
 {
-    if ( !content ) 
+    if ( !content )
 	content = new ContentData;
     else
 	content->clearContent();
@@ -459,7 +458,7 @@ void RenderStyle::setClip( Length top, Length right, Length bottom, Length left
 
 void RenderStyle::setContent(DOM::DOMStringImpl* s)
 {
-    if ( !content ) 
+    if ( !content )
 	content = new ContentData;
     else
 	content->clearContent();
diff --git a/WebCore/khtml/rendering/render_text.cpp b/WebCore/khtml/rendering/render_text.cpp
index 05034ff..bc65a93 100644
--- a/WebCore/khtml/rendering/render_text.cpp
+++ b/WebCore/khtml/rendering/render_text.cpp
@@ -23,7 +23,9 @@
 //#define DEBUG_LAYOUT
 //#define BIDI_DEBUG
 
+#include "rendering/render_root.h"
 #include "rendering/render_text.h"
+#include "rendering/render_root.h"
 #include "rendering/break_lines.h"
 #include "xml/dom_nodeimpl.h"
 
@@ -511,20 +513,17 @@ void RenderText::printObject( QPainter *p, int /*x*/, int y, int /*w*/, int h,
     TextSlave f(0, y-ty);
     int si = m_lines.findFirstMatching(&f);
     // something matching found, find the first one to print
+    bool isPrinting = (p->device()->devType() == QInternal::Printer);
     if(si >= 0)
     {
         // Move up until out of area to be printed
         while(si > 0 && m_lines[si-1]->checkVerticalPoint(y, ty, h, m_lineHeight))
             si--;
 
-        //QConstString cstr(str->s, str->l);
-        //kdDebug(6040) << this << " RenderText text '" << (const char *)cstr.string().utf8() << "'" << endl;
-        //kdDebug(6040) << this << " RenderText::printObject y=" << y << " ty=" << ty << " h=" << h << " first line is " << si << endl;
-
         // Now calculate startPos and endPos, for printing selection.
         // We print selection while endPos > 0
         int endPos, startPos;
-        if (selectionState() != SelectionNone) {
+        if (!isPrinting && (selectionState() != SelectionNone)) {
             if (selectionState() == SelectionInside) {
                 //kdDebug(6040) << this << " SelectionInside -> 0 to end" << endl;
                 startPos = 0;
@@ -555,12 +554,33 @@ void RenderText::printObject( QPainter *p, int /*x*/, int y, int /*w*/, int h,
         // know we can stop
         do {
             s = m_lines[si];
+
+	    if (isPrinting)
+	    {
+                int lh = lineHeight( false ) + paddingBottom() + borderBottom();
+                if (ty+s->m_y < y)
+                {
+                   // This has been printed already we suppose.
+                   continue;
+                }
+
+                if (ty+lh+s->m_y > y+h)
+                {
+                   RenderRoot *rootObj = root();
+                   if (ty+s->m_y < rootObj->truncatedAt())
+                      rootObj->setTruncatedAt(ty+s->m_y);
+                   // Let's stop here.
+                   break;
+                }
+            }
+
             RenderStyle* _style = pseudoStyle && s->m_firstLine ? pseudoStyle : style();
 
             if(_style->font() != p->font()) {
                 p->setFont(_style->font());
 		font = &_style->htmlFont();
 	    }
+
             if((hasSpecialObjects()  &&
                 (parent()->isInline() || pseudoStyle)) &&
                (!pseudoStyle || s->m_firstLine))
@@ -580,7 +600,7 @@ void RenderText::printObject( QPainter *p, int /*x*/, int y, int /*w*/, int h,
                 s->printDecoration(p, this, tx, ty, d, si == 0, si == ( int ) m_lines.count()-1);
             }
 
-            if (selectionState() != SelectionNone ) {
+            if (!isPrinting && (selectionState() != SelectionNone)) {
 		int offset = s->m_start;
 		int sPos = QMAX( startPos - offset, 0 );
 		int ePos = QMIN( endPos - offset, s->m_len );
@@ -812,7 +832,7 @@ short RenderText::baselinePosition( bool firstLine ) const
 void RenderText::position(int x, int y, int from, int len, int width, bool reverse, bool firstLine, int spaceAdd)
 {
     // ### should not be needed!!!
-    if(len == 0 || (len == 1 && *(str->s+from) == '\n') ) return;
+    assert(!(len == 0 || (str->l && len == 1 && *(str->s+from) == '\n') ));
 
     reverse = reverse && !style()->visuallyOrdered();
 
@@ -823,7 +843,7 @@ void RenderText::position(int x, int y, int from, int len, int width, bool rever
         width -= marginLeft();
     }
 
-    if(from + len == int(str->l) && parent()->isInline() && parent()->lastChild()==this)
+    if(from + len >= int(str->l) && parent()->isInline() && parent()->lastChild()==this)
         width -= marginRight();
 
 #ifdef DEBUG_LAYOUT
diff --git a/WebCore/khtml/xml/dom_docimpl.cpp b/WebCore/khtml/xml/dom_docimpl.cpp
index bca7404..394698e 100644
--- a/WebCore/khtml/xml/dom_docimpl.cpp
+++ b/WebCore/khtml/xml/dom_docimpl.cpp
@@ -185,11 +185,15 @@ DocumentImpl *DOMImplementationImpl::createDocument( const DOMString &namespaceU
     return doc;
 }
 
-CSSStyleSheetImpl *DOMImplementationImpl::createCSSStyleSheet(DOMStringImpl */*title*/, DOMStringImpl */*media*/,
+CSSStyleSheetImpl *DOMImplementationImpl::createCSSStyleSheet(DOMStringImpl */*title*/, DOMStringImpl *media,
                                                               int &/*exceptioncode*/)
 {
-    // ### implement
-    return 0;
+    // ### TODO : title should be set, and media could have wrong syntax, in which case we should
+	// generate an exception.
+	CSSStyleSheetImpl *parent = 0L;
+	CSSStyleSheetImpl *sheet = new CSSStyleSheetImpl(parent, DOMString());
+	sheet->setMedia(new MediaListImpl(sheet, media));
+	return sheet;
 }
 
 DocumentImpl *DOMImplementationImpl::createDocument( KHTMLView *v )
@@ -367,7 +371,7 @@ ProcessingInstructionImpl *DocumentImpl::createProcessingInstruction ( const DOM
 
 Attr DocumentImpl::createAttribute( NodeImpl::Id id )
 {
-    return new AttrImpl(0, new AttributeImpl(id, DOMString("").implementation()));
+    return new AttrImpl(0, docPtr(), new AttributeImpl(id, DOMString("").implementation()));
 }
 
 EntityReferenceImpl *DocumentImpl::createEntityReference ( const DOMString &name )
@@ -375,11 +379,72 @@ EntityReferenceImpl *DocumentImpl::createEntityReference ( const DOMString &name
     return new EntityReferenceImpl(docPtr(), name.implementation());
 }
 
-NodeImpl *DocumentImpl::importNode( NodeImpl */*importedNode*/, bool /*deep*/,
-                                           int &/*exceptioncode*/ )
+NodeImpl *DocumentImpl::importNode(NodeImpl *importedNode, bool deep, int &exceptioncode)
 {
-    // ### implement
-    return 0;
+	NodeImpl *result = 0;
+
+	if(importedNode->nodeType() == Node::ELEMENT_NODE)
+	{
+		ElementImpl *tempElementImpl = createElementNS(getDocument()->namespaceURI(id()), importedNode->nodeName());
+		result = tempElementImpl;
+
+		if(static_cast<ElementImpl *>(importedNode)->attributes(true) && static_cast<ElementImpl *>(importedNode)->attributes(true)->length())
+		{
+			NamedNodeMapImpl *attr = static_cast<ElementImpl *>(importedNode)->attributes();
+
+			for(unsigned int i = 0; i < attr->length(); i++)
+			{
+				DOM::DOMString qualifiedName = attr->item(i)->nodeName();
+				DOM::DOMString value = attr->item(i)->nodeValue();
+
+				int colonpos = qualifiedName.find(':');
+				DOMString localName = qualifiedName;
+				if(colonpos >= 0)
+				{
+					localName.remove(0, colonpos + 1);
+					// ### extract and set new prefix
+				}
+
+				NodeImpl::Id nodeId = getDocument()->attrId(getDocument()->namespaceURI(id()), localName.implementation(), false /* allocate */);
+				tempElementImpl->setAttribute(nodeId, value.implementation(), exceptioncode);
+
+				if(exceptioncode != 0)
+					break;
+			}
+		}
+	}
+	else if(importedNode->nodeType() == Node::TEXT_NODE)
+	{
+		result = createTextNode(importedNode->nodeValue());
+		deep = false;
+	}
+	else if(importedNode->nodeType() == Node::CDATA_SECTION_NODE)
+	{
+		result = createCDATASection(importedNode->nodeValue());
+		deep = false;
+	}
+	else if(importedNode->nodeType() == Node::ENTITY_REFERENCE_NODE)
+		result = createEntityReference(importedNode->nodeName());
+	else if(importedNode->nodeType() == Node::PROCESSING_INSTRUCTION_NODE)
+	{
+		result = createProcessingInstruction(importedNode->nodeName(), importedNode->nodeValue());
+		deep = false;
+	}
+	else if(importedNode->nodeType() == Node::COMMENT_NODE)
+	{
+		result = createComment(importedNode->nodeValue());
+		deep = false;
+	}
+	else
+		exceptioncode = DOMException::NOT_SUPPORTED_ERR;
+
+	if(deep)
+	{
+		for(Node n = importedNode->firstChild(); !n.isNull(); n = n.nextSibling())
+			result->appendChild(importNode(n.handle(), true, exceptioncode), exceptioncode);
+	}
+
+	return result;
 }
 
 ElementImpl *DocumentImpl::createElementNS( const DOMString &_namespaceURI, const DOMString &_qualifiedName )
@@ -447,12 +512,13 @@ void DocumentImpl::setTitle(DOMString _title)
     m_title = _title;
 
 #ifdef APPLE_CHANGES
-    view()->part()->setTitle(_title);
+    view()->part()->impl->setTitle(_title);
 #else
     QString titleStr = m_title.string();
     for (int i = 0; i < titleStr.length(); ++i)
         if (titleStr[i] < ' ')
             titleStr[i] = ' ';
+    titleStr = titleStr.stripWhiteSpace();
     titleStr.compose();
     if ( !view()->part()->parentPart() ) {
 	if (titleStr.isNull() || titleStr.isEmpty()) {
@@ -1766,6 +1832,12 @@ void DocumentImpl::recalcStyleSelector()
 	    // Get the current preferred styleset.  This is the
 	    // set of sheets that will be enabled.
             QString sheetUsed = view()->part()->d->m_sheetUsed;
+            if ( n->id() == ID_LINK )
+                sheet = static_cast<HTMLLinkElementImpl*>(n)->sheet();
+            else
+                // <STYLE> element
+                sheet = static_cast<HTMLStyleElementImpl*>(n)->sheet();
+
 
 	    // Check to see if this sheet belongs to a styleset
 	    // (thus making it PREFERRED or ALTERNATE rather than
diff --git a/WebCore/khtml/xml/dom_elementimpl.cpp b/WebCore/khtml/xml/dom_elementimpl.cpp
index 8f123a0..ba43e1b 100644
--- a/WebCore/khtml/xml/dom_elementimpl.cpp
+++ b/WebCore/khtml/xml/dom_elementimpl.cpp
@@ -47,12 +47,12 @@ using namespace DOM;
 using namespace khtml;
 
 void AttributeImpl::allocateImpl(ElementImpl* e) {
-    _impl = new AttrImpl(e, this);
+    _impl = new AttrImpl(e, e->docPtr(), this);
     _impl->ref();
 }
 
-AttrImpl::AttrImpl(ElementImpl* element, AttributeImpl* a)
-    : NodeBaseImpl(element->docPtr()),
+AttrImpl::AttrImpl(ElementImpl* element, DocumentPtr* docPtr, AttributeImpl* a)
+    : NodeBaseImpl(docPtr),
       m_element(element),
       m_attribute(a)
 {
@@ -130,7 +130,7 @@ void AttrImpl::setNodeValue( const DOMString &v, int &exceptioncode )
 
 NodeImpl *AttrImpl::cloneNode ( bool /*deep*/)
 {
-    return new AttrImpl(0,  new AttributeImpl(m_attribute->id(), m_attribute->val()));
+	return new AttrImpl(0, docPtr(), new AttributeImpl(m_attribute->id(), m_attribute->val()));
 }
 
 // DOM Section 1.1.1
diff --git a/WebCore/khtml/xml/dom_elementimpl.h b/WebCore/khtml/xml/dom_elementimpl.h
index 032f316..2d566ee 100644
--- a/WebCore/khtml/xml/dom_elementimpl.h
+++ b/WebCore/khtml/xml/dom_elementimpl.h
@@ -106,7 +106,7 @@ class AttrImpl : public NodeBaseImpl
     friend class NamedAttrMapImpl;
 
 public:
-    AttrImpl(ElementImpl* element, AttributeImpl* a);
+    AttrImpl(ElementImpl* element, DocumentPtr* docPtr, AttributeImpl* a);
     ~AttrImpl();
 
 private:
diff --git a/WebCore/khtml/xml/xml_tokenizer.cpp b/WebCore/khtml/xml/xml_tokenizer.cpp
index 846e645..f560c1d 100644
--- a/WebCore/khtml/xml/xml_tokenizer.cpp
+++ b/WebCore/khtml/xml/xml_tokenizer.cpp
@@ -92,7 +92,7 @@ bool XMLHandler::startElement( const QString& namespaceURI, const QString& /*loc
             return false;
     }
     if (m_currentNode->addChild(newElement)) {
-        if (m_view)
+        if (m_view && !newElement->attached())
             newElement->attach();
         m_currentNode = newElement;
         return true;
@@ -130,7 +130,7 @@ bool XMLHandler::startCDATA()
 
     NodeImpl *newNode = m_doc->document()->createCDATASection("");
     if (m_currentNode->addChild(newNode)) {
-        if (m_view)
+        if (m_view && !newNode->attached())
             newNode->attach();
         m_currentNode = newNode;
         return true;
@@ -224,7 +224,7 @@ bool XMLHandler::enterText()
 {
     NodeImpl *newNode = m_doc->document()->createTextNode("");
     if (m_currentNode->addChild(newNode)) {
-        if (m_view)
+        if (m_view && !newNode->attached())
             newNode->attach();
         m_currentNode = newNode;
         return true;
@@ -325,7 +325,6 @@ void XMLTokenizer::end()
 
 void XMLTokenizer::finish()
 {
-    kdDebug() << kdBacktrace() << endl;
     // parse xml file
     XMLHandler handler(m_doc,m_view);
     QXmlInputSource source;
diff --git a/WebCore/kwq/KWQApplication.mm b/WebCore/kwq/KWQApplication.mm
index 7b45431..83ba9e7 100644
--- a/WebCore/kwq/KWQApplication.mm
+++ b/WebCore/kwq/KWQApplication.mm
@@ -57,7 +57,6 @@ QRect QDesktopWidget::screenGeometry(int screenNumber)
 
 QSize QApplication::globalStrut()
 {
-    _logNotYetImplemented();
     return QSize(0,0);
 }
 
diff --git a/WebCore/kwq/KWQButton.mm b/WebCore/kwq/KWQButton.mm
index 266f12f..ded8899 100644
--- a/WebCore/kwq/KWQButton.mm
+++ b/WebCore/kwq/KWQButton.mm
@@ -29,7 +29,9 @@
 
 QButton::QButton(QWidget *parent)
 {
-    setView ([[[KWQNSButton alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: this] autorelease]);
+    KWQNSButton *button = [[KWQNSButton alloc] initWithFrame:NSMakeRect (0,0,0,0) widget:this];
+    setView(button);
+    [button release];
 }
 
 void QButton::setText(const QString &s)
diff --git a/WebCore/kwq/KWQComboBox.mm b/WebCore/kwq/KWQComboBox.mm
index 4d80239..a8f6ad8 100644
--- a/WebCore/kwq/KWQComboBox.mm
+++ b/WebCore/kwq/KWQComboBox.mm
@@ -45,10 +45,11 @@ void QComboBox::init(bool isEditable)
 {
     KWQNSComboBox *comboBox;
     
-    comboBox = [[[KWQNSComboBox alloc] initWithFrame: NSMakeRect (0,0,0,0) widget: this] autorelease];
+    comboBox = [[KWQNSComboBox alloc] initWithFrame:NSMakeRect(0,0,0,0) widget:this];
     //if (isEditable == FALSE)
     //    [comboBox setEditable: NO];
-    setView (comboBox);
+    setView(comboBox);
+    [comboBox release];
     
     items = [[NSMutableArray alloc] init];
 }
diff --git a/WebCore/kwq/KWQKHTMLPart.cpp b/WebCore/kwq/KWQKHTMLPart.cpp
index 75ee543..de6bfa7 100644
--- a/WebCore/kwq/KWQKHTMLPart.cpp
+++ b/WebCore/kwq/KWQKHTMLPart.cpp
@@ -22,32 +22,23 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
+
 #include <KWQKHTMLPartImpl.h>
-#include <khtmlpart_p.h>
 
-#include <dom_nodeimpl.h>
-#include <htmltokenizer.h>
 #include <html_documentimpl.h>
 #include <html_elementimpl.h>
-#include <render_root.h>
+#include <htmltokenizer.h>
+#include <khtmlpart_p.h>
 
-using namespace DOM;
-using namespace khtml;
+using DOM::DocumentImpl;
+using DOM::HTMLDocumentImpl;
+using DOM::NodeImpl;
 
 bool KWQKHTMLPartImpl::isFrameSet()
 {
-    DOM::DocumentImpl *document = d->m_doc;
-    khtml::RenderRoot* root = static_cast<khtml::RenderRoot *>(document->renderer());
-
-    if ( !root )
-        return 0;
-
-    if (document->isHTMLDocument()) {
-        NodeImpl *body = static_cast<HTMLDocumentImpl*>(document)->body();
-        if(body && body->renderer() && body->id() == ID_FRAMESET) {
-            return 1;
-        }
-    }
-    
-    return 0;
+    DocumentImpl *document = d->m_doc;
+    if (!document->isHTMLDocument())
+        return false;
+    NodeImpl *body = static_cast<HTMLDocumentImpl *>(document)->body();
+    return body && body->renderer() && body->id() == ID_FRAMESET;
 }
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index f7677a4..920d95f 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -23,7 +23,28 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <khtml_part.h>
+#ifndef KWQKHTMLPARTIMPL_H
+#define KWQKHTMLPARTIMPL_H
+
+#include <qobject.h>
+#include <kurl.h>
+
+class KHTMLPart;
+class KHTMLPartPrivate;
+class KHTMLView;
+
+namespace KParts {
+    class ReadOnlyPart;
+    class URLArgs;
+}
+
+namespace DOM {
+    class DOMString;
+}
+
+namespace khtml {
+    class RenderPart;
+}
 
 #ifdef __OBJC__
 @class WebCoreBridge;
@@ -99,3 +120,5 @@ private:
     
     friend class KHTMLPart;
 };
+
+#endif
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 4e75302..07ccda0 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -53,6 +53,19 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
     }
 }
 
+void KHTMLPart::onURL(const QString &)
+{
+}
+
+void KHTMLPart::nodeActivated(const DOM::Node &aNode)
+{
+}
+
+void KHTMLPart::setStatusBarText(const QString &status)
+{
+    impl->setStatusBarText(status);
+}
+
 KWQKHTMLPartImpl::KWQKHTMLPartImpl(KHTMLPart *p)
     : part(p)
     , d(part->d)
diff --git a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
index d17b351..0facdd3 100644
--- a/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
+++ b/WebCore/kwq/KWQKHTMLPartBrowserExtension.mm
@@ -26,7 +26,6 @@
 #import <khtml_ext.h>
 #import <khtml_part.h>
 #import <WebCoreBridge.h>
-#import <KWQKHTMLPartImpl.h>
 
 KHTMLPartBrowserExtension::KHTMLPartBrowserExtension(KHTMLPart *part)
 {
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.cpp b/WebCore/kwq/KWQKHTMLPartImpl.cpp
index 75ee543..de6bfa7 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.cpp
+++ b/WebCore/kwq/KWQKHTMLPartImpl.cpp
@@ -22,32 +22,23 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
+
 #include <KWQKHTMLPartImpl.h>
-#include <khtmlpart_p.h>
 
-#include <dom_nodeimpl.h>
-#include <htmltokenizer.h>
 #include <html_documentimpl.h>
 #include <html_elementimpl.h>
-#include <render_root.h>
+#include <htmltokenizer.h>
+#include <khtmlpart_p.h>
 
-using namespace DOM;
-using namespace khtml;
+using DOM::DocumentImpl;
+using DOM::HTMLDocumentImpl;
+using DOM::NodeImpl;
 
 bool KWQKHTMLPartImpl::isFrameSet()
 {
-    DOM::DocumentImpl *document = d->m_doc;
-    khtml::RenderRoot* root = static_cast<khtml::RenderRoot *>(document->renderer());
-
-    if ( !root )
-        return 0;
-
-    if (document->isHTMLDocument()) {
-        NodeImpl *body = static_cast<HTMLDocumentImpl*>(document)->body();
-        if(body && body->renderer() && body->id() == ID_FRAMESET) {
-            return 1;
-        }
-    }
-    
-    return 0;
+    DocumentImpl *document = d->m_doc;
+    if (!document->isHTMLDocument())
+        return false;
+    NodeImpl *body = static_cast<HTMLDocumentImpl *>(document)->body();
+    return body && body->renderer() && body->id() == ID_FRAMESET;
 }
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.h b/WebCore/kwq/KWQKHTMLPartImpl.h
index f7677a4..920d95f 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.h
+++ b/WebCore/kwq/KWQKHTMLPartImpl.h
@@ -23,7 +23,28 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <khtml_part.h>
+#ifndef KWQKHTMLPARTIMPL_H
+#define KWQKHTMLPARTIMPL_H
+
+#include <qobject.h>
+#include <kurl.h>
+
+class KHTMLPart;
+class KHTMLPartPrivate;
+class KHTMLView;
+
+namespace KParts {
+    class ReadOnlyPart;
+    class URLArgs;
+}
+
+namespace DOM {
+    class DOMString;
+}
+
+namespace khtml {
+    class RenderPart;
+}
 
 #ifdef __OBJC__
 @class WebCoreBridge;
@@ -99,3 +120,5 @@ private:
     
     friend class KHTMLPart;
 };
+
+#endif
diff --git a/WebCore/kwq/KWQKHTMLPartImpl.mm b/WebCore/kwq/KWQKHTMLPartImpl.mm
index 4e75302..07ccda0 100644
--- a/WebCore/kwq/KWQKHTMLPartImpl.mm
+++ b/WebCore/kwq/KWQKHTMLPartImpl.mm
@@ -53,6 +53,19 @@ static void recursive(const DOM::Node &pNode, const DOM::Node &node)
     }
 }
 
+void KHTMLPart::onURL(const QString &)
+{
+}
+
+void KHTMLPart::nodeActivated(const DOM::Node &aNode)
+{
+}
+
+void KHTMLPart::setStatusBarText(const QString &status)
+{
+    impl->setStatusBarText(status);
+}
+
 KWQKHTMLPartImpl::KWQKHTMLPartImpl(KHTMLPart *p)
     : part(p)
     , d(part->d)
diff --git a/WebCore/kwq/KWQKLineEdit.h b/WebCore/kwq/KWQKLineEdit.h
index fcd7cf1..c3d4c9c 100644
--- a/WebCore/kwq/KWQKLineEdit.h
+++ b/WebCore/kwq/KWQKLineEdit.h
@@ -38,6 +38,8 @@ public:
 
     void setContextMenuEnabled(bool showMenu);
     KCompletionBox *completionBox(bool create);
+    
+    int frameWidth() const { return 2; }
 };
 
 #endif
diff --git a/WebCore/kwq/KWQListBox.mm b/WebCore/kwq/KWQListBox.mm
index b48fbec..bc9bea8 100644
--- a/WebCore/kwq/KWQListBox.mm
+++ b/WebCore/kwq/KWQListBox.mm
@@ -93,7 +93,7 @@
 QListBox::QListBox(QWidget *parent)
     : QScrollView(parent), m_insertingItems(false)
 {
-    NSBrowser *browser =  [[[NSBrowser alloc] initWithFrame: NSMakeRect (0,0,1,1)] autorelease];
+    NSBrowser *browser =  [[NSBrowser alloc] initWithFrame: NSMakeRect (0,0,1,1)];
     KWQBrowserDelegate *delegate = [[KWQBrowserDelegate alloc] initWithListBox: this];
 
     head = 0L;
@@ -108,6 +108,8 @@ QListBox::QListBox(QWidget *parent)
     [browser addColumn];
     
     setView (browser);
+    
+    [browser release];
 }
 
 
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index 19341a9..a3a5134 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -28,7 +28,7 @@
 #import <jobclasses.h>
 #import <loader.h>
 
-#import <KWQKHTMLPartImpl.h>
+#import <khtml_part.h>
 
 #import <WebCoreBridge.h>
 #import <WebCoreResourceLoader.h>
diff --git a/WebCore/kwq/KWQLoaderImpl.mm b/WebCore/kwq/KWQLoaderImpl.mm
index 19341a9..a3a5134 100644
--- a/WebCore/kwq/KWQLoaderImpl.mm
+++ b/WebCore/kwq/KWQLoaderImpl.mm
@@ -28,7 +28,7 @@
 #import <jobclasses.h>
 #import <loader.h>
 
-#import <KWQKHTMLPartImpl.h>
+#import <khtml_part.h>
 
 #import <WebCoreBridge.h>
 #import <WebCoreResourceLoader.h>
diff --git a/WebCore/kwq/KWQNamespace.h b/WebCore/kwq/KWQNamespace.h
index 58d4991..2ee8ffa 100644
--- a/WebCore/kwq/KWQNamespace.h
+++ b/WebCore/kwq/KWQNamespace.h
@@ -75,11 +75,6 @@ public:
         SolidPattern,
     };
 
-    enum GUIStyle {
-        MacStyle,
-        WindowsStyle,
-    };
-
     enum Key {
         Key_Escape = 0x1000,            
         Key_Tab = 0x1001,
diff --git a/WebCore/kwq/KWQPaintDevice.h b/WebCore/kwq/KWQPaintDevice.h
index 9635951..368f9be 100644
--- a/WebCore/kwq/KWQPaintDevice.h
+++ b/WebCore/kwq/KWQPaintDevice.h
@@ -28,6 +28,13 @@
 
 class QPaintDeviceMetrics;
 
-class QPaintDevice { };
+struct QInternal {
+    enum DeviceType { NotPrinter, Printer };
+};
+
+class QPaintDevice {
+public:
+    static QInternal::DeviceType devType() { return QInternal::NotPrinter; }
+};
 
 #endif
diff --git a/WebCore/kwq/KWQPainter.h b/WebCore/kwq/KWQPainter.h
index 2fcde27..714d81b 100644
--- a/WebCore/kwq/KWQPainter.h
+++ b/WebCore/kwq/KWQPainter.h
@@ -49,6 +49,8 @@ public:
     QPainter();
     ~QPainter();
     
+    QPaintDevice *device() const { return 0; }
+    
     const QFont &font() const;
     void setFont(const QFont &);
     QFontMetrics fontMetrics() const;
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index 1d620af..e68ee6a 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -239,7 +239,7 @@ void QPainter::drawArc (int x, int y, int w, int h, int a, int alen)
             KWQDEBUG("ERROR (INCOMPLETE IMPLEMENTATION) void QPainter::drawArc (int x, int y, int w, int h, int a, int alen)\nOnly supports drawing arcs on a circle.\n");
         }
         
-        NSBezierPath *path = [[[NSBezierPath alloc] init] autorelease];
+        NSBezierPath *path = [[NSBezierPath alloc] init];
         float fa = (float)a / 16;
         float falen =  fa + (float)alen / 16;
         [path appendBezierPathWithArcWithCenter:NSMakePoint(x + w / 2, y + h / 2) 
@@ -250,6 +250,7 @@ void QPainter::drawArc (int x, int y, int w, int h, int a, int alen)
     
         _setColorFromPen();
         [path stroke];
+        [path release];
     }
 }
 
diff --git a/WebCore/kwq/KWQPushButton.h b/WebCore/kwq/KWQPushButton.h
index 621d327..997ccd7 100644
--- a/WebCore/kwq/KWQPushButton.h
+++ b/WebCore/kwq/KWQPushButton.h
@@ -34,6 +34,10 @@ class QPushButton : public QButton {
 public:
     QPushButton(QWidget *w) : QButton(w) { }
     QPushButton(const QString &text, QWidget *parent);
+    
+    // This could be in QWidget, but if we put it here we don't need a
+    // fully general implementation, and it's currently used only for this case.
+    QFontMetrics fontMetrics() const;
 };
 
 #endif
diff --git a/WebCore/kwq/KWQPushButton.mm b/WebCore/kwq/KWQPushButton.mm
index f9f7cf4..2e4da68 100644
--- a/WebCore/kwq/KWQPushButton.mm
+++ b/WebCore/kwq/KWQPushButton.mm
@@ -29,3 +29,19 @@ QPushButton::QPushButton(const QString &text, QWidget *parent) : QButton(parent)
 {
     setText(text);
 }
+
+static QFontMetrics buttonFontMetrics()
+{
+    NSFont *nsfont = [NSFont systemFontOfSize:13];
+    QFont font;
+    font.setFamily(QString::fromNSString([nsfont familyName]));
+    font.setPixelSize(13);
+    return font;
+}
+
+QFontMetrics QPushButton::fontMetrics() const
+{
+    // Buttons use the system font at 13 point, not the font from the widget.
+    static QFontMetrics metrics = buttonFontMetrics();
+    return metrics;
+}
diff --git a/WebCore/kwq/KWQStyle.h b/WebCore/kwq/KWQStyle.h
index e69de29..fdb5cf5 100644
--- a/WebCore/kwq/KWQStyle.h
+++ b/WebCore/kwq/KWQStyle.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2001, 2002 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef KWQSTYLE_H_
+#define KWQSTYLE_H_
+
+#include <qobject.h>
+#include <qsize.h>
+
+class QWidget;
+
+class QStyle : public QObject {
+public:
+    enum PixelMetric { 
+	PM_IndicatorWidth,
+	PM_IndicatorHeight,
+	PM_ExclusiveIndicatorWidth,
+	PM_ExclusiveIndicatorHeight,
+        PM_DefaultFrameWidth,
+        PM_ButtonMargin
+    };
+    
+    enum ContentType {
+        CT_PushButton
+    };
+
+    int pixelMetric(PixelMetric metric, QWidget * = 0) const {
+        switch (metric) {
+	case PM_IndicatorWidth:
+	case PM_IndicatorHeight:
+	case PM_ExclusiveIndicatorWidth:
+	case PM_ExclusiveIndicatorHeight:
+        case PM_DefaultFrameWidth:
+            return 22; // FIXME! Shouldn't be hardcoded. Perhaps shouldn't all be same.
+        case PM_ButtonMargin:
+            return 0;
+        }
+        return 0;
+    }
+    
+    QSize sizeFromContents(ContentType, QWidget *, const QSize &) const;
+};
+
+#endif
diff --git a/WebCore/kwq/KWQKLibrary.h b/WebCore/kwq/KWQStyle.mm
similarity index 89%
copy from WebCore/kwq/KWQKLibrary.h
copy to WebCore/kwq/KWQStyle.mm
index f5e7453..fed50dc 100644
--- a/WebCore/kwq/KWQKLibrary.h
+++ b/WebCore/kwq/KWQStyle.mm
@@ -23,10 +23,11 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#include <global.h>
+#include <qstyle.h>
 
-class KLibrary
+#include <qwidget.h>
+
+QSize QStyle::sizeFromContents(ContentType, QWidget *, const QSize &s) const
 {
-public:
-    void unload() { }
-};
+    return QSize(s.width() + 28, 32);
+}
diff --git a/WebCore/kwq/KWQWidget.h b/WebCore/kwq/KWQWidget.h
index fd18554..c3eff4a 100644
--- a/WebCore/kwq/KWQWidget.h
+++ b/WebCore/kwq/KWQWidget.h
@@ -35,7 +35,7 @@
 #include <qfont.h>
 #include <qcursor.h>
 #include <qevent.h>
-#include <KWQStyle.h>
+#include <qstyle.h>
 
 #ifdef __OBJC__
 @class NSView;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 443f1dd..5cb381e 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -27,7 +27,7 @@
 
 #import <WebCoreFrameBridge.h>
 
-#import <KWQKHTMLPartImpl.h>
+#import <khtml_part.h>
 #import <khtmlview.h>
 #import <dom_docimpl.h>
 #import <render_root.h>
@@ -134,7 +134,7 @@
 
 - (BOOL)isFrameSet
 {
-    return part->isFrameSet();
+    return part->impl->isFrameSet();
 }
 
 - (void)reapplyStyles
diff --git a/WebCore/kwq/kdeui/klineedit.h b/WebCore/kwq/kdeui/klineedit.h
index fcd7cf1..c3d4c9c 100644
--- a/WebCore/kwq/kdeui/klineedit.h
+++ b/WebCore/kwq/kdeui/klineedit.h
@@ -38,6 +38,8 @@ public:
 
     void setContextMenuEnabled(bool showMenu);
     KCompletionBox *completionBox(bool create);
+    
+    int frameWidth() const { return 2; }
 };
 
 #endif
diff --git a/WebCore/kwq/qt/qnamespace.h b/WebCore/kwq/qt/qnamespace.h
index 58d4991..2ee8ffa 100644
--- a/WebCore/kwq/qt/qnamespace.h
+++ b/WebCore/kwq/qt/qnamespace.h
@@ -75,11 +75,6 @@ public:
         SolidPattern,
     };
 
-    enum GUIStyle {
-        MacStyle,
-        WindowsStyle,
-    };
-
     enum Key {
         Key_Escape = 0x1000,            
         Key_Tab = 0x1001,
diff --git a/WebCore/kwq/qt/qpaintdevice.h b/WebCore/kwq/qt/qpaintdevice.h
index 9635951..368f9be 100644
--- a/WebCore/kwq/qt/qpaintdevice.h
+++ b/WebCore/kwq/qt/qpaintdevice.h
@@ -28,6 +28,13 @@
 
 class QPaintDeviceMetrics;
 
-class QPaintDevice { };
+struct QInternal {
+    enum DeviceType { NotPrinter, Printer };
+};
+
+class QPaintDevice {
+public:
+    static QInternal::DeviceType devType() { return QInternal::NotPrinter; }
+};
 
 #endif
diff --git a/WebCore/kwq/qt/qpainter.h b/WebCore/kwq/qt/qpainter.h
index 2fcde27..714d81b 100644
--- a/WebCore/kwq/qt/qpainter.h
+++ b/WebCore/kwq/qt/qpainter.h
@@ -49,6 +49,8 @@ public:
     QPainter();
     ~QPainter();
     
+    QPaintDevice *device() const { return 0; }
+    
     const QFont &font() const;
     void setFont(const QFont &);
     QFontMetrics fontMetrics() const;
diff --git a/WebCore/kwq/qt/qpushbutton.h b/WebCore/kwq/qt/qpushbutton.h
index 621d327..997ccd7 100644
--- a/WebCore/kwq/qt/qpushbutton.h
+++ b/WebCore/kwq/qt/qpushbutton.h
@@ -34,6 +34,10 @@ class QPushButton : public QButton {
 public:
     QPushButton(QWidget *w) : QButton(w) { }
     QPushButton(const QString &text, QWidget *parent);
+    
+    // This could be in QWidget, but if we put it here we don't need a
+    // fully general implementation, and it's currently used only for this case.
+    QFontMetrics fontMetrics() const;
 };
 
 #endif
diff --git a/WebCore/kwq/qt/qstyle.h b/WebCore/kwq/qt/qstyle.h
index e69de29..fdb5cf5 100644
--- a/WebCore/kwq/qt/qstyle.h
+++ b/WebCore/kwq/qt/qstyle.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2001, 2002 Apple Computer, Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef KWQSTYLE_H_
+#define KWQSTYLE_H_
+
+#include <qobject.h>
+#include <qsize.h>
+
+class QWidget;
+
+class QStyle : public QObject {
+public:
+    enum PixelMetric { 
+	PM_IndicatorWidth,
+	PM_IndicatorHeight,
+	PM_ExclusiveIndicatorWidth,
+	PM_ExclusiveIndicatorHeight,
+        PM_DefaultFrameWidth,
+        PM_ButtonMargin
+    };
+    
+    enum ContentType {
+        CT_PushButton
+    };
+
+    int pixelMetric(PixelMetric metric, QWidget * = 0) const {
+        switch (metric) {
+	case PM_IndicatorWidth:
+	case PM_IndicatorHeight:
+	case PM_ExclusiveIndicatorWidth:
+	case PM_ExclusiveIndicatorHeight:
+        case PM_DefaultFrameWidth:
+            return 22; // FIXME! Shouldn't be hardcoded. Perhaps shouldn't all be same.
+        case PM_ButtonMargin:
+            return 0;
+        }
+        return 0;
+    }
+    
+    QSize sizeFromContents(ContentType, QWidget *, const QSize &) const;
+};
+
+#endif
diff --git a/WebCore/kwq/qt/qwidget.h b/WebCore/kwq/qt/qwidget.h
index fd18554..c3eff4a 100644
--- a/WebCore/kwq/qt/qwidget.h
+++ b/WebCore/kwq/qt/qwidget.h
@@ -35,7 +35,7 @@
 #include <qfont.h>
 #include <qcursor.h>
 #include <qevent.h>
-#include <KWQStyle.h>
+#include <qstyle.h>
 
 #ifdef __OBJC__
 @class NSView;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list