Commit b70665a4 authored by darin's avatar darin

Merged KDE 3.0 final code in and:

JavaScriptCore:

	* kjs/internal.cpp:
	* kjs/property_map.cpp:
	* kjs/ustring.h:
	Removed some unneeded <config.h> includes so we are more similar
	to the real KDE sources.

	Merged changes from KDE 3.0 final and did some build fixes.

	* JavaScriptCore.pbproj/project.pbxproj: Added nodes2string.cpp.

	* kjs/grammar.*: Regenerated.
	* kjs/*.lut.h: Regenerated.

WebCore:

	* src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration):
	Remove some minor gratuitous diffs vs. KDE.

	* src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration):
        Richard updated to reflect changes in KDE.

	* src/kdelibs/khtml/css/css_valueimpl.cpp:
	(FontFamilyValueImpl::FontFamilyValueImpl): Fix comment.
	* src/kdelibs/khtml/css/cssstyleselector.cpp: Remove some gratuitous diffs vs. KDE.
	* src/kdelibs/khtml/html/html_objectimpl.cpp:
	(HTMLEmbedElementImpl::parseAttribute): Remove unneeded copy from KWQ's early days.
	* src/kdelibs/khtml/html/html_tableimpl.cpp:
	(HTMLTableElementImpl::parseAttribute),
	(HTMLTablePartElementImpl::parseAttribute): Remove unneeded copy from KWQ's early days.
	* src/kdelibs/khtml/html/htmltokenizer.cpp: (HTMLTokenizer::processToken): Redo the
	APPLE_CHANGES ifdef here.
	* src/kdelibs/khtml/khtmlpart_p.h: Update to latest kde.
	* src/kdelibs/khtml/khtmlview.cpp: (KHTMLView::KHTMLView): Add ifdef APPLE_CHANGES.
	(KHTMLView::~KHTMLView): Add ifdef APPLE_CHANGES.
	(KHTMLView::print): Remove code left in here during merge process.
	* src/kwq/KWQKHTMLPart.mm: Remove unused setFontSizes(), fontSizes(), and
	resetFontSizes(). After the merge is landed, remove more.
	* src/libwebcore.exp: Export updateStyleSelector() for WebKit.

	Fix text to it displays at the right font size.

	* src/kdelibs/khtml/css/cssstyleselector.cpp:
	(CSSStyleSelector::computeFontSizes): Apply the same SCREEN_RESOLUTION hack here
	that we do elsewhere.
	* src/kdelibs/khtml/rendering/font.cpp: (Font::width): Use kMin instead of max (oops).
	(Font::update): Turn off font database chicanery.
	* src/kwq/KWQKHTMLPart.mm: (KHTMLPart::zoomFactor): Use zoom factor 100, not 1.

	More fixes so text displays (still at wrong font size).

	* src/kdelibs/khtml/rendering/font.cpp: (max): New helper.
	(Font::drawText): Simplified implementation for now.
	(Font::width): Simplified implementation for now.
	* src/kwq/KWQColorGroup.mm: Reinstated QCOLOR_GROUP_SIZE.

	* src/kwq/qt/qfontmetrics.h: Removed charWidth and changed _width to take QChar *.
	* src/kwq/KWQFontMetrics.mm: Removed charWidth and changed _width to take QChar *.

	Merged changes from KDE 3.0 final. Other fixes to get things compiling.

	* src/kdelibs/khtml/css/css_valueimpl.cpp:
	(CSSStyleDeclarationImpl::setProperty): Fix unused variable.
	* src/kdelibs/khtml/khtmlview.cpp: (KHTMLView::contentsContextMenuEvent):
	Fix unused variable.
	* src/kdelibs/khtml/rendering/font.cpp: (Font::drawText), (Font::width),
	(Font::update): Disable special "nsbp" logic for now. We can reenable it
	if necessary.
	* src/kdelibs/khtml/rendering/render_replaced.cpp: Fix mismerge.
	* src/kdelibs/khtml/rendering/render_text.cpp: (RenderText::nodeAtPoint):
	Fix unused variable.
	* src/kwq/KWQApplication.mm: (QDesktopWidget::width), (QApplication::desktop):
	Fix mismerge.
	* src/kwq/KWQColorGroup.mm: Fix QCOLOR_GROUP_SIZE.
	* src/kwq/KWQFontMetrics.mm: (QFontMetrics::lineSpacing): New.
	(QFontMetrics::width): Remove unused optimization.
	* src/kwq/qt/qfontmetrics.h: Add lineSpacing().

        Merged changes from previous merge pass.

        2002-03-25  Darin Adler  <darin@apple.com>

        Last bit of making stuff compile and link. Probably will drop the merge now
        and take it up again when it's time to merge in KDE 3.0 final.

	* src/kwq/KWQEvent.mm: (QFocusEvent::reason): New.
	* src/kwq/KWQPainter.mm: (QPainter::drawText): New overload.

        2002-03-25  Darin Adler  <darin@apple.com>

	* src/kdelibs/khtml/rendering/font.cpp: (Font::width): Make it call _width so we
        don't lose the optimization.

	* src/kwq/KWQApplication.mm: (QDesktopWidget::screenNumber): New.
	(QDesktopWidget::screenGeometry): New.
        (QApplication::style): New.
	* src/kwq/KWQColorGroup.mm: (QColorGroup::highlight): New.
	(QColorGroup::highlightedText): New.
	* src/kwq/KWQFont.mm: (QFont::setPixelSize): New.
	* src/kwq/KWQFontMetrics.mm: (QFontMetrics::charWidth): New.
	* src/kwq/KWQKGlobal.mm: (KGlobal::locale): Implement.
        (KLocale::KLocale): New.
	(KLocale::languageList): New.
	* src/kwq/KWQKHTMLPart.mm: (KHTMLPart::sheetUsed): New.
	(KHTMLPart::setSheetUsed): New.
        (KHTMLPart::zoomFactor): New.
	* src/kwq/KWQKHTMLSettings.mm: (KHTMLSettings::mediumFontSize): New.
	* src/kwq/KWQScrollView.mm: (QScrollView::childX): New.
        (QScrollView::childY): New.

	* src/kwq/qt/qapplication.h: style() returns a QStyle &.
	* src/kwq/qt/qpalette.h: Add Highlight and HighlightedText.

        2002-03-24  Darin Adler  <darin@apple.com>

        More compiling. Still won't link.

	* src/kdelibs/khtml/khtmlview.cpp: Disable printing and drag and drop code.
	* src/kdelibs/khtml/rendering/render_text.cpp: (TextSlave::printDecoration):
        Temporarily turn off our smarter underlining since it relies on access to the
        string, and TextSlave doesn't have that any more.
	(RenderText::nodeAtPoint): Get rid of a workaround we don't need any more for
        a bug that was fixed by KDE folks.
	* src/kwq/KWQApplication.mm: (QApplication::desktop): Make the desktop be a
        QDesktopWidget.
	* src/kwq/qt/qnamespace.h: Add MetaButton.
	* src/kwq/qt/qtooltip.h: Add a maybeTip virtual function member and a virtual
        destructor.

        2002-03-24  Darin Adler  <darin@apple.com>

        Some fixes to get more stuff to compile.

	* src/kdelibs/khtml/ecma/kjs_dom.cpp: (DOMDocument::getValueProperty):
        Don't try to look at the private m_bComplete to display "complete". Just do
        "loading" and "loaded".
        * src/kdelibs/khtml/khtmlpart_p.h: #ifdef this all out for APPLE_CHANGES.
	* src/kdelibs/khtml/rendering/font.cpp: (Font::update): Add an explicit cast to
        int to avoid float -> int warning.
	* src/kdelibs/khtml/rendering/render_table.cpp: (RenderTable::calcColMinMax):
        Add an explicit cast to int to avoid uint compared with int warning.
	* src/kdelibs/khtml/xml/dom_docimpl.cpp: (DocumentImpl::recalcStyleSelector):
        Use sheetUsed() and setSheetUsed() functions on KHTMLPart intead of getting
        at private fields the way the real KDE code does.

        * src/kwq/KWQKHTMLPart.h: Declare zoomFactor(), sheetUsed(), and setSheetUsed().
	* src/kwq/KWQStyle.h: Add PM_DefaultFramWidth as another metric.
	* src/kwq/kdecore/klocale.h: Add languageList().
	* src/kwq/khtml/khtml_settings.h: Add mediumFontSize().
	* src/kwq/qt/qapplication.h: Add style() and QDesktopWidget.
	* src/kwq/qt/qevent.h: Add reason().
	* src/kwq/qt/qfont.h: Add setPixelSize(int).
	* src/kwq/qt/qfontmetrics.h: Add charWidth() and _charWidth() functions.
	* src/kwq/qt/qpainter.h: Add drawText() overload with position parameter.
	* src/kwq/qt/qpalette.h: Add highlight() and highlightedText().
	* src/kwq/qt/qscrollview.h: Add childX() and childY().

	* src/kwq/KWQApplication.mm: Change KWQDesktopWidget to QDesktopWidget.

WebKit:

	* WebView.subproj/IFPreferences.h:
	* WebView.subproj/IFPreferences.mm: (+[IFPreferences load]): Remove the old
	WebKitFontSizes preference.
	(-[IFPreferences mediumFontSize]), (-[IFPreferences setMediumFontSize:]): New.

	* WebView.subproj/IFWebView.mm: (-[IFWebView reapplyStyles]): Call
	updateStyleSelector() instead of recalcStyle().

        Merged changes from previous merge branch.

        2002-03-25  Darin Adler  <darin@apple.com>

	* WebView.subproj/IFPreferences.mm: (+[IFPreferences load]):
        Add WebKitMediumFontSizePreferenceKey.

WebBrowser:

	* Preferences.subproj/TextPreferences.m: (-[TextPreferences defaultFontSize]),
	(-[TextPreferences setDefaultFontSize:]): Just get and set the new mediumFontSize
	preference rather than doing the whole fontSizes preference dance.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f9108c43
2002-04-15 Darin Adler <darin@apple.com>
* kjs/internal.cpp:
* kjs/property_map.cpp:
* kjs/ustring.h:
Removed some unneeded <config.h> includes so we are more similar
to the real KDE sources.
2002-04-15 Darin Adler <darin@apple.com>
Merged changes from KDE 3.0 final and did some build fixes.
* JavaScriptCore.pbproj/project.pbxproj: Added nodes2string.cpp.
* kjs/grammar.*: Regenerated.
* kjs/*.lut.h: Regenerated.
2002-04-08 Darin Adler <darin@apple.com>
Reviwed by: Maciej Stachowiak <mjs@apple.com>
......
2002-04-15 Darin Adler <darin@apple.com>
* kjs/internal.cpp:
* kjs/property_map.cpp:
* kjs/ustring.h:
Removed some unneeded <config.h> includes so we are more similar
to the real KDE sources.
2002-04-15 Darin Adler <darin@apple.com>
Merged changes from KDE 3.0 final and did some build fixes.
* JavaScriptCore.pbproj/project.pbxproj: Added nodes2string.cpp.
* kjs/grammar.*: Regenerated.
* kjs/*.lut.h: Regenerated.
2002-04-08 Darin Adler <darin@apple.com>
Reviwed by: Maciej Stachowiak <mjs@apple.com>
......
2002-04-15 Darin Adler <darin@apple.com>
* kjs/internal.cpp:
* kjs/property_map.cpp:
* kjs/ustring.h:
Removed some unneeded <config.h> includes so we are more similar
to the real KDE sources.
2002-04-15 Darin Adler <darin@apple.com>
Merged changes from KDE 3.0 final and did some build fixes.
* JavaScriptCore.pbproj/project.pbxproj: Added nodes2string.cpp.
* kjs/grammar.*: Regenerated.
* kjs/*.lut.h: Regenerated.
2002-04-08 Darin Adler <darin@apple.com>
Reviwed by: Maciej Stachowiak <mjs@apple.com>
......
......@@ -250,6 +250,7 @@
F692A8C10255597D01FF60F7,
F692A8C30255597D01FF60F7,
F692A8CB02555BA201FF60F7,
F5FFE657026B47A6018635CA,
);
isa = PBXSourcesBuildPhase;
};
......@@ -339,6 +340,7 @@
F692A86C0255597D01FF60F7,
F692A86D0255597D01FF60F7,
F692A86E0255597D01FF60F7,
F5FFE656026B47A6018635CA,
F692A8700255597D01FF60F7,
F692A8710255597D01FF60F7,
F692A8720255597D01FF60F7,
......@@ -432,6 +434,18 @@
isa = PBXBuildStyle;
name = Unoptimized;
};
F5FFE656026B47A6018635CA = {
isa = PBXFileReference;
name = nodes2string.cpp;
path = kjs/nodes2string.cpp;
refType = 4;
};
F5FFE657026B47A6018635CA = {
fileRef = F5FFE656026B47A6018635CA;
isa = PBXBuildFile;
settings = {
};
};
//F50
//F51
//F52
......
......@@ -58,7 +58,7 @@ void ArrayInstanceImp::put(ExecState *exec, const UString &propertyName, const V
// shrink array
for (unsigned int u = newLen; u < oldLen; u++) {
UString p = UString::from(u);
if (hasProperty(exec, p, false))
if (hasOwnProperty(exec, p))
deleteProperty(exec, p);
}
ObjectImp::put(exec, "length", Number(newLen), DontEnum | DontDelete);
......@@ -74,7 +74,7 @@ void ArrayInstanceImp::put(ExecState *exec, const UString &propertyName, const V
return;
// do we need to update/create the length property ?
if (hasProperty(exec, "length", false)) {
if (hasOwnProperty(exec, "length")) {
Value len = get(exec, "length");
if (idx < len.toUInt32(exec))
return;
......@@ -87,6 +87,18 @@ void ArrayInstanceImp::putDirect(ExecState *exec, const UString &propertyName, c
{
ObjectImp::put(exec,propertyName,value,attr);
}
bool ArrayInstanceImp::hasOwnProperty(ExecState *exec,
const UString &propertyName)
{
// disable this object's prototype temporarily for the hasProperty() call
Value protoBackup = prototype();
setPrototype(Undefined());
bool b = hasProperty(exec, propertyName);
setPrototype(protoBackup);
return b;
}
// ------------------------------ ArrayPrototypeImp ----------------------------
const ClassInfo ArrayPrototypeImp::info = {"Array", &ArrayInstanceImp::info, &arrayTable, 0};
......
......@@ -17,7 +17,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#ifndef _ARRAY_OBJECT_H_
......@@ -34,6 +33,11 @@ namespace KJS {
virtual void put(ExecState *exec, const UString &propertyName, const Value &value, int attr = None);
virtual void putDirect(ExecState *exec, const UString &propertyName, const Value &value, int attr = None);
/**
* A shallow hasProperty() variant that doesn't look at the prototype's
* properties.
*/
virtual bool hasOwnProperty(ExecState *exec, const UString &propertyName);
virtual const ClassInfo *classInfo() const { return &info; }
static const ClassInfo info;
......
......@@ -17,7 +17,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#ifndef _BOOL_OBJECT_H_
......
......@@ -18,7 +18,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#include "collector.h"
......
......@@ -18,7 +18,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#ifndef _KJSCOLLECTOR_H_
......@@ -80,7 +79,9 @@ namespace KJS {
static bool outOfMemory() { return memLimitReached; }
#ifdef KJS_DEBUG_MEM
/** Check that nothing is left when the last interpreter gets deleted */
/**
* Check that nothing is left when the last interpreter gets deleted
*/
static void finalCheck();
/**
* @internal
......
......@@ -17,7 +17,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#ifdef HAVE_CONFIG_H
......@@ -174,8 +173,8 @@ Value DateProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args)
UString s;
const int bufsize=100;
char timebuffer[bufsize];
char *oldlocale = setlocale(LC_TIME,NULL);
if (!oldlocale)
CString oldlocale = setlocale(LC_TIME,NULL);
if (!oldlocale.c_str())
oldlocale = setlocale(LC_ALL, NULL);
Value v = thisObj.internalValue();
double milli = v.toNumber(exec);
......@@ -205,7 +204,7 @@ Value DateProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &args)
t = gmtime(&tv);
strftime(timebuffer, bufsize, "%a, %d-%b-%y %H:%M:%S %Z", t);
}
setlocale(LC_TIME,oldlocale);
setlocale(LC_TIME,oldlocale.c_str());
result = String(timebuffer);
break;
case ToLocaleString:
......
......@@ -17,7 +17,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#ifndef _DATE_OBJECT_H_
......@@ -26,6 +25,8 @@
#include "internal.h"
#include "function_object.h"
#include <sys/time.h>
namespace KJS {
class DateInstanceImp : public ObjectImp {
......@@ -119,7 +120,7 @@ namespace KJS {
// helper functions
Value parseDate(const String &s);
time_t KRFCDate_parseDate(const UString &_date);
time_t KRFCDate_parseDate(const UString &_date);
Value timeClip(const Value &t);
}; // namespace
......
......@@ -18,7 +18,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#include "debugger.h"
......
......@@ -18,7 +18,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#ifndef _KJSDEBUGGER_H_
......
......@@ -17,7 +17,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#ifndef _ERROR_OBJECT_H_
......
......@@ -57,15 +57,19 @@ FunctionImp::FunctionImp(ExecState *exec, const UString &n)
{
Value protect(this);
argStack = new ListImp();
Value protectArgStack( argStack ); // this also calls setGcAllowed on argStack
//fprintf(stderr,"FunctionImp::FunctionImp this=%p argStack=%p\n");
put(exec,"arguments",Null(),ReadOnly|DontDelete|DontEnum);
}
FunctionImp::~FunctionImp()
{
argStack->setGcAllowed();
// The function shouldn't be deleted while it is still executed; argStack
// should be set to 0 by the last call to popArgs()
assert(argStack->isEmpty());
//assert(argStack->isEmpty());
// Accessing argStack from here is a problem though.
// When the function isn't used anymore, it's not marked, and neither is the
// argStack, so both can be deleted - in any order!
delete param;
}
......@@ -171,6 +175,20 @@ void FunctionImp::addParameter(const UString &n)
*p = new Parameter(n);
}
UString FunctionImp::parameterString() const
{
UString s;
const Parameter * const *p = &param;
while (*p) {
if (!s.isEmpty())
s += ", ";
s += (*p)->name;
p = &(*p)->next;
}
return s;
}
// ECMA 10.1.3q
void FunctionImp::processParameters(ExecState *exec, const List &args)
......
......@@ -18,7 +18,6 @@
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* $Id$
*/
#ifndef _KJS_FUNCTION_H_
......@@ -46,6 +45,8 @@ namespace KJS {
virtual Value call(ExecState *exec, Object &thisObj, const List &args);
void addParameter(const UString &n);
// parameters in string representation, e.g. (a, b, c)
UString parameterString() const;
virtual CodeType codeType() const = 0;
virtual Completion execute(ExecState *exec) = 0;
......
......@@ -83,7 +83,6 @@ Value FunctionProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &a
switch (id) {
case ToString: {
// ### also make this work for internal functions
// ### return the text of the function body (see 15.3.4.2)
if (thisObj.isNull() || !thisObj.inherits(&InternalFunctionImp::info)) {
#ifndef NDEBUG
fprintf(stderr,"attempted toString() call on null or non-function object\n");
......@@ -92,7 +91,12 @@ Value FunctionProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &a
exec->setException(err);
return err;
}
if (thisObj.inherits(&FunctionImp::info) &&
if (thisObj.inherits(&DeclaredFunctionImp::info)) {
DeclaredFunctionImp *fi = static_cast<DeclaredFunctionImp*>
(thisObj.imp());
return String("function " + fi->name() + "(" +
fi->parameterString() + ") " + fi->body->toString());
} else if (thisObj.inherits(&FunctionImp::info) &&
!static_cast<FunctionImp*>(thisObj.imp())->name().isNull()) {
result = String("function " + static_cast<FunctionImp*>(thisObj.imp())->name() + "()");
}
......@@ -126,7 +130,7 @@ Value FunctionProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &a
Object argArrayObj = Object::dynamicCast(argArray);
unsigned int length = argArrayObj.get(exec,"length").toUInt32(exec);
for (uint i = 0; i < length; i++)
for (unsigned int i = 0; i < length; i++)
applyArgs.append(argArrayObj.get(exec,UString::from(i)));
}
else {
......
......@@ -17,7 +17,6 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id$
*/
#ifndef _FUNCTION_OBJECT_H_
......
This diff is collapsed.
......@@ -236,7 +236,8 @@ CallExpr:
MemberExpr Arguments { $$ = new FunctionCallNode($1, $2); }
| CallExpr Arguments { $$ = new FunctionCallNode($1, $2); }
| CallExpr '[' Expr ']' { $$ = new AccessorNode1($1, $3); }
| CallExpr '.' IDENT { $$ = new AccessorNode2($1, $3); }
| CallExpr '.' IDENT { $$ = new AccessorNode2($1, $3);
delete $3; }
;
Arguments:
......
......@@ -21,8 +21,6 @@
*
*/
#include <config.h>
#include <stdio.h>
#include <math.h>
#include <assert.h>
......@@ -474,6 +472,9 @@ ListImp::~ListImp()
clear();
delete hook;
if ( emptyList == this )
emptyList = 0L;
}
void ListImp::mark()
......@@ -757,11 +758,6 @@ void InterpreterImp::globalClear()
BooleanImp::staticFalse->deref();
BooleanImp::staticFalse->setGcAllowed();
BooleanImp::staticFalse = 0L;
#ifdef APPLE_CHANGES
ListImp::emptyList->setGcAllowed();
ListImp::emptyList->deref();
ListImp::emptyList = 0;
#endif
}
InterpreterImp::InterpreterImp(Interpreter *interp, const Object &glob)
......@@ -786,7 +782,13 @@ InterpreterImp::InterpreterImp(Interpreter *interp, const Object &glob)
m_compatMode = Interpreter::NativeMode;
// initialize properties of the global object
initGlobalObject();
recursion = 0;
}