[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 05:58:35 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 46befdc15f9171080f387f719019a97e5aaae628
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Mar 24 22:23:26 2002 +0000
Merged kdelibs from KDE 3.0 RC 3 into our 3.0 beta 2-based sources.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/kjs/nodes2string.cpp b/JavaScriptCore/kjs/nodes2string.cpp
new file mode 100644
index 0000000..617813a
--- /dev/null
+++ b/JavaScriptCore/kjs/nodes2string.cpp
@@ -0,0 +1,596 @@
+// -*- c-basic-offset: 2 -*-
+/*
+ * This file is part of the KDE libraries
+ * Copyright (C) 2002 Harri Porten (porten at kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "nodes.h"
+
+namespace KJS {
+ /**
+ * A simple text streaming class that helps with code indentation.
+ */
+ class SourceStream {
+ public:
+ enum Format {
+ Endl, Indent, Unindent
+ };
+
+ UString toString() const { return str; }
+ SourceStream& operator<<(const KJS::UString &);
+ SourceStream& operator<<(Format f);
+ SourceStream& operator<<(const Node *);
+ private:
+ UString str; /* TODO: buffer */
+ UString ind;
+ };
+};
+
+using namespace KJS;
+
+SourceStream& SourceStream::operator<<(const KJS::UString &s)
+{
+ str += s;
+ return *this;
+}
+
+SourceStream& SourceStream::operator<<(const Node *n)
+{
+ if (n)
+ n->streamTo(*this);
+ return *this;
+}
+
+SourceStream& SourceStream::operator<<(Format f)
+{
+ if (f == Endl)
+ str += "\n" + ind;
+ else if (f == Indent)
+ ind += " ";
+ else
+ ind = ind.substr(0, ind.size() - 2);
+
+ return *this;
+}
+
+UString Node::toString() const
+{
+ SourceStream str;
+ streamTo(str);
+
+ return str.toString();
+}
+
+void NullNode::streamTo(SourceStream &s) const { s << "null"; }
+
+void BooleanNode::streamTo(SourceStream &s) const
+{
+ s << (value ? "true" : "false");
+}
+
+void NumberNode::streamTo(SourceStream &s) const { s << UString::from(value); }
+
+void StringNode::streamTo(SourceStream &s) const
+{
+ s << '"' << value << '"';
+}
+
+void RegExpNode::streamTo(SourceStream &s) const { s << pattern; }
+
+void ThisNode::streamTo(SourceStream &s) const { s << "this"; }
+
+void ResolveNode::streamTo(SourceStream &s) const { s << ident; }
+
+void ElisionNode::streamTo(SourceStream &s) const
+{
+ if (elision)
+ s << elision << ",";
+ else
+ s << ",";
+}
+
+void ElementNode::streamTo(SourceStream &s) const
+{
+ if (list)
+ s << list << ",";
+ s << elision << node;
+}
+
+void ArrayNode::streamTo(SourceStream &s) const
+{
+ s << "[" << element << elision << "]";
+}
+
+void ObjectLiteralNode::streamTo(SourceStream &s) const
+{
+ if (list)
+ s << "{ " << list << " }";
+ else
+ s << "{ }";
+}
+
+void PropertyValueNode::streamTo(SourceStream &s) const
+{
+ if (list)
+ s << list << ", ";
+ s << name << ": " << assign;
+}
+
+void PropertyNode::streamTo(SourceStream &s) const
+{
+ if (str.isNull())
+ s << UString::from(numeric);
+ else
+ s << str;
+}
+
+void AccessorNode1::streamTo(SourceStream &s) const
+{
+ s << expr1 << "[" << expr2 << "]";
+}
+
+void AccessorNode2::streamTo(SourceStream &s) const
+{
+ s << expr << "." << ident;
+}
+
+void ArgumentListNode::streamTo(SourceStream &s) const
+{
+ if (list)
+ s << list << ", ";
+ s << expr;
+}
+
+void ArgumentsNode::streamTo(SourceStream &s) const
+{
+ s << "(" << list << ")";
+}
+
+void NewExprNode::streamTo(SourceStream &s) const
+{
+ s << "new " << expr << args;
+}
+
+void FunctionCallNode::streamTo(SourceStream &s) const
+{
+ s << expr << args;
+}
+
+void PostfixNode::streamTo(SourceStream &s) const
+{
+ s << expr;
+ if (oper == OpPlusPlus)
+ s << "++";
+ else
+ s << "--";
+}
+
+void DeleteNode::streamTo(SourceStream &s) const
+{
+ s << "delete " << expr;
+}
+
+void VoidNode::streamTo(SourceStream &s) const
+{
+ s << "void " << expr;
+}
+
+void TypeOfNode::streamTo(SourceStream &s) const
+{
+ s << "typeof " << expr;
+}
+
+void PrefixNode::streamTo(SourceStream &s) const
+{
+ s << expr << (oper == OpPlusPlus ? "++" : "--");
+}
+
+void UnaryPlusNode::streamTo(SourceStream &s) const
+{
+ s << "+" << expr;
+}
+
+void NegateNode::streamTo(SourceStream &s) const
+{
+ s << "-" << expr;
+}
+
+void BitwiseNotNode::streamTo(SourceStream &s) const
+{
+ s << "~" << expr;
+}
+
+void LogicalNotNode::streamTo(SourceStream &s) const
+{
+ s << "!" << expr;
+}
+
+void MultNode::streamTo(SourceStream &s) const
+{
+ s << term1 << oper << term2;
+}
+
+void AddNode::streamTo(SourceStream &s) const
+{
+ s << term1 << oper << term2;
+}
+
+void ShiftNode::streamTo(SourceStream &s) const
+{
+ s << term1;
+ if (oper == OpLShift)
+ s << "<<";
+ else if (oper == OpRShift)
+ s << ">>";
+ else
+ s << ">>>";
+ s << term2;
+}
+
+void RelationalNode::streamTo(SourceStream &s) const
+{
+ s << expr1;
+ switch (oper) {
+ case OpLess:
+ s << " < ";
+ break;
+ case OpGreater:
+ s << " > ";
+ break;
+ case OpLessEq:
+ s << " <= ";
+ break;
+ case OpGreaterEq:
+ s << " >= ";
+ break;
+ case OpInstanceOf:
+ s << " instanceof ";
+ break;
+ case OpIn:
+ s << " in ";
+ break;
+ default:
+ ;
+ }
+ s << expr2;
+}
+
+void EqualNode::streamTo(SourceStream &s) const
+{
+ s << expr1;
+ switch (oper) {
+ case OpEqEq:
+ s << " == ";
+ break;
+ case OpNotEq:
+ s << " != ";
+ break;
+ case OpStrEq:
+ s << " === ";
+ break;
+ case OpStrNEq:
+ s << " !== ";
+ break;
+ default:
+ ;
+ }
+ s << expr2;
+}
+
+void BitOperNode::streamTo(SourceStream &s) const
+{
+ s << expr1;
+ if (oper == OpBitAnd)
+ s << " & ";
+ else if (oper == OpBitXOr)
+ s << " ^ ";
+ else
+ s << " | ";
+ s << expr2;
+}
+
+void BinaryLogicalNode::streamTo(SourceStream &s) const
+{
+ s << expr1 << (oper == OpAnd ? " && " : " || ") << expr2;
+}
+
+void ConditionalNode::streamTo(SourceStream &s) const
+{
+ s << logical << " ? " << expr1 << " : " << expr2;
+}
+
+void AssignNode::streamTo(SourceStream &s) const
+{
+ s << left;
+ const char *opStr;
+ switch (oper) {
+ case OpEqual:
+ opStr = " = ";
+ break;
+ case OpMultEq:
+ opStr = " *= ";
+ break;
+ case OpDivEq:
+ opStr = " /= ";
+ break;
+ case OpPlusEq:
+ opStr = " += ";
+ break;
+ case OpMinusEq:
+ opStr = " -= ";
+ break;
+ case OpLShift:
+ opStr = " <<= ";
+ break;
+ case OpRShift:
+ opStr = " >>= ";
+ break;
+ case OpURShift:
+ opStr = " >>= ";
+ break;
+ case OpAndEq:
+ opStr = " &= ";
+ break;
+ case OpXOrEq:
+ opStr = " ^= ";
+ break;
+ case OpOrEq:
+ opStr = " |= ";
+ break;
+ case OpModEq:
+ opStr = " %= ";
+ break;
+ default:
+ opStr = " ?= ";
+ }
+ s << opStr << expr;
+}
+
+void CommaNode::streamTo(SourceStream &s) const
+{
+ s << expr1 << ", " << expr2;
+}
+
+void StatListNode::streamTo(SourceStream &s) const
+{
+ s << list << statement;
+}
+
+void AssignExprNode::streamTo(SourceStream &s) const
+{
+ s << " = " << expr;
+}
+
+void VarDeclNode::streamTo(SourceStream &s) const
+{
+ s << ident << init;
+}
+
+void VarDeclListNode::streamTo(SourceStream &s) const
+{
+ if (list)
+ s << list << ", ";
+ s << var;
+}
+
+void VarStatementNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "var " << list << ";";
+}
+
+void BlockNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "{" << SourceStream::Indent
+ << source << SourceStream::Unindent << SourceStream::Endl << "}";
+}
+
+void EmptyStatementNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << ";";
+}
+
+void ExprStatementNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << expr << ";";
+}
+
+void IfNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "if (" << expr << ")" << SourceStream::Indent
+ << statement1 << SourceStream::Unindent;
+ if (statement2)
+ s << SourceStream::Endl << "else" << SourceStream::Indent
+ << statement2 << SourceStream::Unindent;
+}
+
+void DoWhileNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "do " << SourceStream::Indent
+ << statement << SourceStream::Unindent << SourceStream::Endl
+ << "while (" << expr << ");";
+}
+
+void WhileNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "while (" << expr << ")" << SourceStream::Indent
+ << statement << SourceStream::Unindent;
+}
+
+void ForNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "for ("
+ << expr1 // TODO: doesn't properly do "var i = 0"
+ << "; " << expr2
+ << "; " << expr3
+ << ")" << SourceStream::Indent << statement << SourceStream::Unindent;
+}
+
+void ForInNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "for (";
+ if (varDecl)
+ s << "var " << varDecl;
+ if (init)
+ s << " = " << init;
+ s << " in " << expr << ")" << SourceStream::Indent
+ << statement << SourceStream::Unindent;
+}
+
+void ContinueNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "continue";
+ if (!ident.isNull())
+ s << " " << ident;
+ s << ";";
+}
+
+void BreakNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "break";
+ if (!ident.isNull())
+ s << " " << ident;
+ s << ";";
+}
+
+void ReturnNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "return";
+ if (value)
+ s << " " << value;
+ s << ";";
+}
+
+void WithNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "with (" << expr << ") "
+ << statement;
+}
+
+void CaseClauseNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl;
+ if (expr)
+ s << "case " << expr;
+ else
+ s << "default";
+ s << ":" << SourceStream::Indent;
+ if (list)
+ s << list;
+ s << SourceStream::Unindent;
+}
+
+void ClauseListNode::streamTo(SourceStream &s) const
+{
+ const ClauseListNode *l = this;
+ do {
+ s << l;
+ l = l->nx;
+ } while (l);
+}
+
+void CaseBlockNode::streamTo(SourceStream &s) const
+{
+ const ClauseListNode *cl = list1;
+ while (cl) {
+ s << cl->clause();
+ cl = cl->next();
+ }
+ if (def)
+ s << def;
+ cl = list2;
+ while (cl) {
+ s << cl->clause();
+ cl = cl->next();
+ }
+}
+
+void SwitchNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "switch (" << expr << ") {"
+ << SourceStream::Indent << block << SourceStream::Unindent
+ << SourceStream::Endl << "}";
+}
+
+void LabelNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << label << ":" << SourceStream::Indent
+ << statement << SourceStream::Unindent;
+}
+
+void ThrowNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "throw " << expr << ";";
+}
+
+void CatchNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "catch (" << ident << ")" << block;
+}
+
+void FinallyNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "finally " << block;
+}
+
+void TryNode::streamTo(SourceStream &s) const
+{
+ s << "try " << block
+ << _catch
+ << _final;
+}
+
+void ParameterNode::streamTo(SourceStream &s) const
+{
+ s << id;
+ if (next)
+ s << ", " << next;
+}
+
+void FunctionBodyNode::streamTo(SourceStream &s) const {
+ s << SourceStream::Endl << "{" << SourceStream::Indent
+ << source << SourceStream::Unindent << SourceStream::Endl << "}";
+}
+
+void FuncDeclNode::streamTo(SourceStream &s) const {
+ s << "function " << ident << "(";
+ if (param)
+ s << param;
+ s << ")" << body;
+}
+
+void FuncExprNode::streamTo(SourceStream &s) const
+{
+ s << "function " << "("
+ << param
+ << ")" << body;
+}
+
+void SourceElementNode::streamTo(SourceStream &s) const
+{
+ if (statement)
+ s << statement;
+ else
+ s << function;
+}
+
+void SourceElementsNode::streamTo(SourceStream &s) const
+{
+ s << elements << element;
+}
+
diff --git a/WebCore/khtml/rendering/font.cpp b/WebCore/khtml/rendering/font.cpp
new file mode 100644
index 0000000..553bd98
--- /dev/null
+++ b/WebCore/khtml/rendering/font.cpp
@@ -0,0 +1,164 @@
+/**
+ * This file is part of the html renderer for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll at kde.org)
+ * (C) 1999 Antti Koivisto (koivisto at kde.org)
+ * (C) 2000 Dirk Mueller (mueller at kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#include "font.h"
+#include "khtml_factory.h"
+#include "khtml_settings.h"
+
+#include <kdebug.h>
+#include <kglobal.h>
+
+#include <qpainter.h>
+#include <qfontdatabase.h>
+#include <qpaintdevicemetrics.h>
+
+using namespace khtml;
+
+void Font::drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len,
+ int toAdd, QPainter::TextDirection d, int from, int to, QColor bg ) const
+{
+ // ### fixme for RTL
+ if ( !letterSpacing && !wordSpacing && !toAdd && from==-1 ) {
+ // simply draw it
+ p->drawText( x, y, QConstString(str, slen).string(), pos, len, d );
+ } else {
+ int numSpaces = 0;
+ if ( toAdd ) {
+ for( int i = 0; i < len; i++ )
+ if ( str[i+pos].direction() == QChar::DirWS )
+ numSpaces++;
+ }
+
+ QConstString cstr( str, slen );
+ QString s( cstr.string() );
+ if ( d == QPainter::RTL ) {
+ x += width( str, slen, pos, len ) + toAdd;
+ }
+ for( int i = 0; i < len; i++ ) {
+ int chw = fm.charWidth( s, pos+i );
+ if ( letterSpacing )
+ chw += letterSpacing;
+ if ( (wordSpacing || toAdd) && str[i+pos].isSpace() ) {
+ chw += wordSpacing;
+ if ( numSpaces ) {
+ int a = toAdd/numSpaces;
+ chw += a;
+ toAdd -= a;
+ numSpaces--;
+ }
+ }
+ if ( d == QPainter::RTL )
+ x -= chw;
+ if ( to==-1 || (i>=from && i<to) )
+ {
+ if ( bg.isValid() )
+ p->fillRect( x, y-fm.ascent(), chw, fm.height(), bg );
+
+ p->drawText( x, y, s, pos+i, 1, d );
+ }
+ if ( d != QPainter::RTL )
+ x += chw;
+ }
+ }
+}
+
+
+int Font::width( QChar *chs, int slen, int pos, int len ) const
+{
+ // ### might be a little inaccurate
+ int w = fm.width( QConstString( chs+pos, slen-pos).string(), len );
+
+ if ( letterSpacing )
+ w += len*letterSpacing;
+
+ if ( wordSpacing ) {
+ // add amount
+ for( int i = 0; i < len; i++ ) {
+ if( chs[i+pos].isSpace() )
+ w += wordSpacing;
+ }
+ }
+ return w;
+}
+
+int Font::width( QChar *chs, int slen, int pos ) const
+{
+ int w = fm.charWidth( QConstString( chs, slen).string(), pos );
+
+ if ( letterSpacing )
+ w += letterSpacing;
+
+ if ( wordSpacing && (chs+pos)->isSpace() )
+ w += wordSpacing;
+ return w;
+}
+
+
+void Font::update( QPaintDeviceMetrics* devMetrics ) const
+{
+ f.setFamily( fontDef.family.isEmpty() ? KHTMLFactory::defaultHTMLSettings()->stdFontName() : fontDef.family );
+ f.setItalic( fontDef.italic );
+ f.setWeight( fontDef.weight );
+
+ QFontDatabase db;
+
+ int size = fontDef.size;
+ int lDpiY = kMax(devMetrics->logicalDpiY(), 96);
+
+ // ok, now some magic to get a nice unscaled font
+ // all other font properties should be set before this one!!!!
+ if( !db.isSmoothlyScalable(f.family(), db.styleString(f)) )
+ {
+ QValueList<int> pointSizes = db.smoothSizes(f.family(), db.styleString(f));
+ // lets see if we find a nice looking font, which is not too far away
+ // from the requested one.
+ // kdDebug(6080) << "khtml::setFontSize family = " << f.family() << " size requested=" << size << endl;
+
+ QValueList<int>::Iterator it;
+ float diff = 1; // ### 100% deviation
+ float bestSize = 0;
+ for( it = pointSizes.begin(); it != pointSizes.end(); ++it )
+ {
+ float newDiff = ((*it)*(lDpiY/72.) - float(size))/float(size);
+ //kdDebug( 6080 ) << "smooth font size: " << *it << " diff=" << newDiff << endl;
+ if(newDiff < 0) newDiff = -newDiff;
+ if(newDiff < diff)
+ {
+ diff = newDiff;
+ bestSize = *it;
+ }
+ }
+ //kdDebug( 6080 ) << "best smooth font size: " << bestSize << " diff=" << diff << endl;
+ if ( bestSize != 0 && diff < 0.2 ) // 20% deviation, otherwise we use a scaled font...
+ size = (bestSize*lDpiY) / 72;
+ }
+
+// qDebug("setting font to %s, italic=%d, weight=%d, size=%d", fontDef.family.latin1(), fontDef.italic,
+// fontDef.weight, size );
+
+ f.setPixelSize( size );
+
+ fm = QFontMetrics( f );
+}
diff --git a/WebCore/khtml/rendering/font.h b/WebCore/khtml/rendering/font.h
new file mode 100644
index 0000000..e84c7ae
--- /dev/null
+++ b/WebCore/khtml/rendering/font.h
@@ -0,0 +1,99 @@
+/*
+ * This file is part of the html renderer for KDE.
+ *
+ * Copyright (C) 2000 Lars Knoll (knoll at kde.org)
+ * (C) 2000 Antti Koivisto (koivisto at kde.org)
+ * (C) 2000 Dirk Mueller (mueller at kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifndef KHTMLFONT_H
+#define KHTMLFONT_H
+
+#include <qfont.h>
+#include <qfontmetrics.h>
+#include <qpainter.h>
+
+class QPaintDeviceMetrics;
+
+
+namespace khtml
+{
+class RenderStyle;
+class CSSStyleSelector;
+
+class FontDef
+{
+public:
+ FontDef()
+ : size( 0 ), italic( false ), smallCaps( false ), weight( 50 ) {}
+ bool operator == ( const FontDef &other ) const {
+ return ( family == other.family &&
+ size == other.size &&
+ italic == other.italic &&
+ smallCaps == other.smallCaps &&
+ weight == other.weight );
+ }
+
+ QString family;
+ short int size;
+ bool italic : 1;
+ bool smallCaps : 1;
+ unsigned int weight : 8;
+};
+
+
+class Font
+{
+ friend class RenderStyle;
+ friend class CSSStyleSelector;
+
+public:
+ Font() : fontDef(), f(), fm( f ), scFont( 0 ), letterSpacing( 0 ), wordSpacing( 0 ) {}
+ Font( const FontDef &fd )
+ : fontDef( fd ), f(), fm( f ), scFont( 0 ), letterSpacing( 0 ), wordSpacing( 0 )
+ {}
+
+ bool operator == ( const Font &other ) const {
+ return (fontDef == other.fontDef &&
+ letterSpacing == other.letterSpacing &&
+ wordSpacing == other.wordSpacing );
+ }
+
+ void update( QPaintDeviceMetrics *devMetrics ) const;
+
+ void drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len, int width,
+ QPainter::TextDirection d, int from=-1, int to=-1, QColor bg=QColor() ) const;
+
+ int width( QChar *str, int slen, int pos, int len ) const;
+ int width( QChar *str, int slen, int pos ) const;
+
+private:
+ FontDef fontDef;
+ mutable QFont f;
+ mutable QFontMetrics fm;
+ QFont *scFont;
+ short letterSpacing;
+ short wordSpacing;
+};
+
+};
+
+
+#endif
diff --git a/WebCore/src/kdelibs/khtml/rendering/font.cpp b/WebCore/src/kdelibs/khtml/rendering/font.cpp
new file mode 100644
index 0000000..553bd98
--- /dev/null
+++ b/WebCore/src/kdelibs/khtml/rendering/font.cpp
@@ -0,0 +1,164 @@
+/**
+ * This file is part of the html renderer for KDE.
+ *
+ * Copyright (C) 1999 Lars Knoll (knoll at kde.org)
+ * (C) 1999 Antti Koivisto (koivisto at kde.org)
+ * (C) 2000 Dirk Mueller (mueller at kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#include "font.h"
+#include "khtml_factory.h"
+#include "khtml_settings.h"
+
+#include <kdebug.h>
+#include <kglobal.h>
+
+#include <qpainter.h>
+#include <qfontdatabase.h>
+#include <qpaintdevicemetrics.h>
+
+using namespace khtml;
+
+void Font::drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len,
+ int toAdd, QPainter::TextDirection d, int from, int to, QColor bg ) const
+{
+ // ### fixme for RTL
+ if ( !letterSpacing && !wordSpacing && !toAdd && from==-1 ) {
+ // simply draw it
+ p->drawText( x, y, QConstString(str, slen).string(), pos, len, d );
+ } else {
+ int numSpaces = 0;
+ if ( toAdd ) {
+ for( int i = 0; i < len; i++ )
+ if ( str[i+pos].direction() == QChar::DirWS )
+ numSpaces++;
+ }
+
+ QConstString cstr( str, slen );
+ QString s( cstr.string() );
+ if ( d == QPainter::RTL ) {
+ x += width( str, slen, pos, len ) + toAdd;
+ }
+ for( int i = 0; i < len; i++ ) {
+ int chw = fm.charWidth( s, pos+i );
+ if ( letterSpacing )
+ chw += letterSpacing;
+ if ( (wordSpacing || toAdd) && str[i+pos].isSpace() ) {
+ chw += wordSpacing;
+ if ( numSpaces ) {
+ int a = toAdd/numSpaces;
+ chw += a;
+ toAdd -= a;
+ numSpaces--;
+ }
+ }
+ if ( d == QPainter::RTL )
+ x -= chw;
+ if ( to==-1 || (i>=from && i<to) )
+ {
+ if ( bg.isValid() )
+ p->fillRect( x, y-fm.ascent(), chw, fm.height(), bg );
+
+ p->drawText( x, y, s, pos+i, 1, d );
+ }
+ if ( d != QPainter::RTL )
+ x += chw;
+ }
+ }
+}
+
+
+int Font::width( QChar *chs, int slen, int pos, int len ) const
+{
+ // ### might be a little inaccurate
+ int w = fm.width( QConstString( chs+pos, slen-pos).string(), len );
+
+ if ( letterSpacing )
+ w += len*letterSpacing;
+
+ if ( wordSpacing ) {
+ // add amount
+ for( int i = 0; i < len; i++ ) {
+ if( chs[i+pos].isSpace() )
+ w += wordSpacing;
+ }
+ }
+ return w;
+}
+
+int Font::width( QChar *chs, int slen, int pos ) const
+{
+ int w = fm.charWidth( QConstString( chs, slen).string(), pos );
+
+ if ( letterSpacing )
+ w += letterSpacing;
+
+ if ( wordSpacing && (chs+pos)->isSpace() )
+ w += wordSpacing;
+ return w;
+}
+
+
+void Font::update( QPaintDeviceMetrics* devMetrics ) const
+{
+ f.setFamily( fontDef.family.isEmpty() ? KHTMLFactory::defaultHTMLSettings()->stdFontName() : fontDef.family );
+ f.setItalic( fontDef.italic );
+ f.setWeight( fontDef.weight );
+
+ QFontDatabase db;
+
+ int size = fontDef.size;
+ int lDpiY = kMax(devMetrics->logicalDpiY(), 96);
+
+ // ok, now some magic to get a nice unscaled font
+ // all other font properties should be set before this one!!!!
+ if( !db.isSmoothlyScalable(f.family(), db.styleString(f)) )
+ {
+ QValueList<int> pointSizes = db.smoothSizes(f.family(), db.styleString(f));
+ // lets see if we find a nice looking font, which is not too far away
+ // from the requested one.
+ // kdDebug(6080) << "khtml::setFontSize family = " << f.family() << " size requested=" << size << endl;
+
+ QValueList<int>::Iterator it;
+ float diff = 1; // ### 100% deviation
+ float bestSize = 0;
+ for( it = pointSizes.begin(); it != pointSizes.end(); ++it )
+ {
+ float newDiff = ((*it)*(lDpiY/72.) - float(size))/float(size);
+ //kdDebug( 6080 ) << "smooth font size: " << *it << " diff=" << newDiff << endl;
+ if(newDiff < 0) newDiff = -newDiff;
+ if(newDiff < diff)
+ {
+ diff = newDiff;
+ bestSize = *it;
+ }
+ }
+ //kdDebug( 6080 ) << "best smooth font size: " << bestSize << " diff=" << diff << endl;
+ if ( bestSize != 0 && diff < 0.2 ) // 20% deviation, otherwise we use a scaled font...
+ size = (bestSize*lDpiY) / 72;
+ }
+
+// qDebug("setting font to %s, italic=%d, weight=%d, size=%d", fontDef.family.latin1(), fontDef.italic,
+// fontDef.weight, size );
+
+ f.setPixelSize( size );
+
+ fm = QFontMetrics( f );
+}
diff --git a/WebCore/src/kdelibs/khtml/rendering/font.h b/WebCore/src/kdelibs/khtml/rendering/font.h
new file mode 100644
index 0000000..e84c7ae
--- /dev/null
+++ b/WebCore/src/kdelibs/khtml/rendering/font.h
@@ -0,0 +1,99 @@
+/*
+ * This file is part of the html renderer for KDE.
+ *
+ * Copyright (C) 2000 Lars Knoll (knoll at kde.org)
+ * (C) 2000 Antti Koivisto (koivisto at kde.org)
+ * (C) 2000 Dirk Mueller (mueller at kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * $Id$
+ */
+
+#ifndef KHTMLFONT_H
+#define KHTMLFONT_H
+
+#include <qfont.h>
+#include <qfontmetrics.h>
+#include <qpainter.h>
+
+class QPaintDeviceMetrics;
+
+
+namespace khtml
+{
+class RenderStyle;
+class CSSStyleSelector;
+
+class FontDef
+{
+public:
+ FontDef()
+ : size( 0 ), italic( false ), smallCaps( false ), weight( 50 ) {}
+ bool operator == ( const FontDef &other ) const {
+ return ( family == other.family &&
+ size == other.size &&
+ italic == other.italic &&
+ smallCaps == other.smallCaps &&
+ weight == other.weight );
+ }
+
+ QString family;
+ short int size;
+ bool italic : 1;
+ bool smallCaps : 1;
+ unsigned int weight : 8;
+};
+
+
+class Font
+{
+ friend class RenderStyle;
+ friend class CSSStyleSelector;
+
+public:
+ Font() : fontDef(), f(), fm( f ), scFont( 0 ), letterSpacing( 0 ), wordSpacing( 0 ) {}
+ Font( const FontDef &fd )
+ : fontDef( fd ), f(), fm( f ), scFont( 0 ), letterSpacing( 0 ), wordSpacing( 0 )
+ {}
+
+ bool operator == ( const Font &other ) const {
+ return (fontDef == other.fontDef &&
+ letterSpacing == other.letterSpacing &&
+ wordSpacing == other.wordSpacing );
+ }
+
+ void update( QPaintDeviceMetrics *devMetrics ) const;
+
+ void drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, int len, int width,
+ QPainter::TextDirection d, int from=-1, int to=-1, QColor bg=QColor() ) const;
+
+ int width( QChar *str, int slen, int pos, int len ) const;
+ int width( QChar *str, int slen, int pos ) const;
+
+private:
+ FontDef fontDef;
+ mutable QFont f;
+ mutable QFontMetrics fm;
+ QFont *scFont;
+ short letterSpacing;
+ short wordSpacing;
+};
+
+};
+
+
+#endif
diff --git a/WebCore/src/kdelibs/kjs/nodes2string.cpp b/WebCore/src/kdelibs/kjs/nodes2string.cpp
new file mode 100644
index 0000000..617813a
--- /dev/null
+++ b/WebCore/src/kdelibs/kjs/nodes2string.cpp
@@ -0,0 +1,596 @@
+// -*- c-basic-offset: 2 -*-
+/*
+ * This file is part of the KDE libraries
+ * Copyright (C) 2002 Harri Porten (porten at kde.org)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "nodes.h"
+
+namespace KJS {
+ /**
+ * A simple text streaming class that helps with code indentation.
+ */
+ class SourceStream {
+ public:
+ enum Format {
+ Endl, Indent, Unindent
+ };
+
+ UString toString() const { return str; }
+ SourceStream& operator<<(const KJS::UString &);
+ SourceStream& operator<<(Format f);
+ SourceStream& operator<<(const Node *);
+ private:
+ UString str; /* TODO: buffer */
+ UString ind;
+ };
+};
+
+using namespace KJS;
+
+SourceStream& SourceStream::operator<<(const KJS::UString &s)
+{
+ str += s;
+ return *this;
+}
+
+SourceStream& SourceStream::operator<<(const Node *n)
+{
+ if (n)
+ n->streamTo(*this);
+ return *this;
+}
+
+SourceStream& SourceStream::operator<<(Format f)
+{
+ if (f == Endl)
+ str += "\n" + ind;
+ else if (f == Indent)
+ ind += " ";
+ else
+ ind = ind.substr(0, ind.size() - 2);
+
+ return *this;
+}
+
+UString Node::toString() const
+{
+ SourceStream str;
+ streamTo(str);
+
+ return str.toString();
+}
+
+void NullNode::streamTo(SourceStream &s) const { s << "null"; }
+
+void BooleanNode::streamTo(SourceStream &s) const
+{
+ s << (value ? "true" : "false");
+}
+
+void NumberNode::streamTo(SourceStream &s) const { s << UString::from(value); }
+
+void StringNode::streamTo(SourceStream &s) const
+{
+ s << '"' << value << '"';
+}
+
+void RegExpNode::streamTo(SourceStream &s) const { s << pattern; }
+
+void ThisNode::streamTo(SourceStream &s) const { s << "this"; }
+
+void ResolveNode::streamTo(SourceStream &s) const { s << ident; }
+
+void ElisionNode::streamTo(SourceStream &s) const
+{
+ if (elision)
+ s << elision << ",";
+ else
+ s << ",";
+}
+
+void ElementNode::streamTo(SourceStream &s) const
+{
+ if (list)
+ s << list << ",";
+ s << elision << node;
+}
+
+void ArrayNode::streamTo(SourceStream &s) const
+{
+ s << "[" << element << elision << "]";
+}
+
+void ObjectLiteralNode::streamTo(SourceStream &s) const
+{
+ if (list)
+ s << "{ " << list << " }";
+ else
+ s << "{ }";
+}
+
+void PropertyValueNode::streamTo(SourceStream &s) const
+{
+ if (list)
+ s << list << ", ";
+ s << name << ": " << assign;
+}
+
+void PropertyNode::streamTo(SourceStream &s) const
+{
+ if (str.isNull())
+ s << UString::from(numeric);
+ else
+ s << str;
+}
+
+void AccessorNode1::streamTo(SourceStream &s) const
+{
+ s << expr1 << "[" << expr2 << "]";
+}
+
+void AccessorNode2::streamTo(SourceStream &s) const
+{
+ s << expr << "." << ident;
+}
+
+void ArgumentListNode::streamTo(SourceStream &s) const
+{
+ if (list)
+ s << list << ", ";
+ s << expr;
+}
+
+void ArgumentsNode::streamTo(SourceStream &s) const
+{
+ s << "(" << list << ")";
+}
+
+void NewExprNode::streamTo(SourceStream &s) const
+{
+ s << "new " << expr << args;
+}
+
+void FunctionCallNode::streamTo(SourceStream &s) const
+{
+ s << expr << args;
+}
+
+void PostfixNode::streamTo(SourceStream &s) const
+{
+ s << expr;
+ if (oper == OpPlusPlus)
+ s << "++";
+ else
+ s << "--";
+}
+
+void DeleteNode::streamTo(SourceStream &s) const
+{
+ s << "delete " << expr;
+}
+
+void VoidNode::streamTo(SourceStream &s) const
+{
+ s << "void " << expr;
+}
+
+void TypeOfNode::streamTo(SourceStream &s) const
+{
+ s << "typeof " << expr;
+}
+
+void PrefixNode::streamTo(SourceStream &s) const
+{
+ s << expr << (oper == OpPlusPlus ? "++" : "--");
+}
+
+void UnaryPlusNode::streamTo(SourceStream &s) const
+{
+ s << "+" << expr;
+}
+
+void NegateNode::streamTo(SourceStream &s) const
+{
+ s << "-" << expr;
+}
+
+void BitwiseNotNode::streamTo(SourceStream &s) const
+{
+ s << "~" << expr;
+}
+
+void LogicalNotNode::streamTo(SourceStream &s) const
+{
+ s << "!" << expr;
+}
+
+void MultNode::streamTo(SourceStream &s) const
+{
+ s << term1 << oper << term2;
+}
+
+void AddNode::streamTo(SourceStream &s) const
+{
+ s << term1 << oper << term2;
+}
+
+void ShiftNode::streamTo(SourceStream &s) const
+{
+ s << term1;
+ if (oper == OpLShift)
+ s << "<<";
+ else if (oper == OpRShift)
+ s << ">>";
+ else
+ s << ">>>";
+ s << term2;
+}
+
+void RelationalNode::streamTo(SourceStream &s) const
+{
+ s << expr1;
+ switch (oper) {
+ case OpLess:
+ s << " < ";
+ break;
+ case OpGreater:
+ s << " > ";
+ break;
+ case OpLessEq:
+ s << " <= ";
+ break;
+ case OpGreaterEq:
+ s << " >= ";
+ break;
+ case OpInstanceOf:
+ s << " instanceof ";
+ break;
+ case OpIn:
+ s << " in ";
+ break;
+ default:
+ ;
+ }
+ s << expr2;
+}
+
+void EqualNode::streamTo(SourceStream &s) const
+{
+ s << expr1;
+ switch (oper) {
+ case OpEqEq:
+ s << " == ";
+ break;
+ case OpNotEq:
+ s << " != ";
+ break;
+ case OpStrEq:
+ s << " === ";
+ break;
+ case OpStrNEq:
+ s << " !== ";
+ break;
+ default:
+ ;
+ }
+ s << expr2;
+}
+
+void BitOperNode::streamTo(SourceStream &s) const
+{
+ s << expr1;
+ if (oper == OpBitAnd)
+ s << " & ";
+ else if (oper == OpBitXOr)
+ s << " ^ ";
+ else
+ s << " | ";
+ s << expr2;
+}
+
+void BinaryLogicalNode::streamTo(SourceStream &s) const
+{
+ s << expr1 << (oper == OpAnd ? " && " : " || ") << expr2;
+}
+
+void ConditionalNode::streamTo(SourceStream &s) const
+{
+ s << logical << " ? " << expr1 << " : " << expr2;
+}
+
+void AssignNode::streamTo(SourceStream &s) const
+{
+ s << left;
+ const char *opStr;
+ switch (oper) {
+ case OpEqual:
+ opStr = " = ";
+ break;
+ case OpMultEq:
+ opStr = " *= ";
+ break;
+ case OpDivEq:
+ opStr = " /= ";
+ break;
+ case OpPlusEq:
+ opStr = " += ";
+ break;
+ case OpMinusEq:
+ opStr = " -= ";
+ break;
+ case OpLShift:
+ opStr = " <<= ";
+ break;
+ case OpRShift:
+ opStr = " >>= ";
+ break;
+ case OpURShift:
+ opStr = " >>= ";
+ break;
+ case OpAndEq:
+ opStr = " &= ";
+ break;
+ case OpXOrEq:
+ opStr = " ^= ";
+ break;
+ case OpOrEq:
+ opStr = " |= ";
+ break;
+ case OpModEq:
+ opStr = " %= ";
+ break;
+ default:
+ opStr = " ?= ";
+ }
+ s << opStr << expr;
+}
+
+void CommaNode::streamTo(SourceStream &s) const
+{
+ s << expr1 << ", " << expr2;
+}
+
+void StatListNode::streamTo(SourceStream &s) const
+{
+ s << list << statement;
+}
+
+void AssignExprNode::streamTo(SourceStream &s) const
+{
+ s << " = " << expr;
+}
+
+void VarDeclNode::streamTo(SourceStream &s) const
+{
+ s << ident << init;
+}
+
+void VarDeclListNode::streamTo(SourceStream &s) const
+{
+ if (list)
+ s << list << ", ";
+ s << var;
+}
+
+void VarStatementNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "var " << list << ";";
+}
+
+void BlockNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "{" << SourceStream::Indent
+ << source << SourceStream::Unindent << SourceStream::Endl << "}";
+}
+
+void EmptyStatementNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << ";";
+}
+
+void ExprStatementNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << expr << ";";
+}
+
+void IfNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "if (" << expr << ")" << SourceStream::Indent
+ << statement1 << SourceStream::Unindent;
+ if (statement2)
+ s << SourceStream::Endl << "else" << SourceStream::Indent
+ << statement2 << SourceStream::Unindent;
+}
+
+void DoWhileNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "do " << SourceStream::Indent
+ << statement << SourceStream::Unindent << SourceStream::Endl
+ << "while (" << expr << ");";
+}
+
+void WhileNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "while (" << expr << ")" << SourceStream::Indent
+ << statement << SourceStream::Unindent;
+}
+
+void ForNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "for ("
+ << expr1 // TODO: doesn't properly do "var i = 0"
+ << "; " << expr2
+ << "; " << expr3
+ << ")" << SourceStream::Indent << statement << SourceStream::Unindent;
+}
+
+void ForInNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "for (";
+ if (varDecl)
+ s << "var " << varDecl;
+ if (init)
+ s << " = " << init;
+ s << " in " << expr << ")" << SourceStream::Indent
+ << statement << SourceStream::Unindent;
+}
+
+void ContinueNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "continue";
+ if (!ident.isNull())
+ s << " " << ident;
+ s << ";";
+}
+
+void BreakNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "break";
+ if (!ident.isNull())
+ s << " " << ident;
+ s << ";";
+}
+
+void ReturnNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "return";
+ if (value)
+ s << " " << value;
+ s << ";";
+}
+
+void WithNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "with (" << expr << ") "
+ << statement;
+}
+
+void CaseClauseNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl;
+ if (expr)
+ s << "case " << expr;
+ else
+ s << "default";
+ s << ":" << SourceStream::Indent;
+ if (list)
+ s << list;
+ s << SourceStream::Unindent;
+}
+
+void ClauseListNode::streamTo(SourceStream &s) const
+{
+ const ClauseListNode *l = this;
+ do {
+ s << l;
+ l = l->nx;
+ } while (l);
+}
+
+void CaseBlockNode::streamTo(SourceStream &s) const
+{
+ const ClauseListNode *cl = list1;
+ while (cl) {
+ s << cl->clause();
+ cl = cl->next();
+ }
+ if (def)
+ s << def;
+ cl = list2;
+ while (cl) {
+ s << cl->clause();
+ cl = cl->next();
+ }
+}
+
+void SwitchNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "switch (" << expr << ") {"
+ << SourceStream::Indent << block << SourceStream::Unindent
+ << SourceStream::Endl << "}";
+}
+
+void LabelNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << label << ":" << SourceStream::Indent
+ << statement << SourceStream::Unindent;
+}
+
+void ThrowNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "throw " << expr << ";";
+}
+
+void CatchNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "catch (" << ident << ")" << block;
+}
+
+void FinallyNode::streamTo(SourceStream &s) const
+{
+ s << SourceStream::Endl << "finally " << block;
+}
+
+void TryNode::streamTo(SourceStream &s) const
+{
+ s << "try " << block
+ << _catch
+ << _final;
+}
+
+void ParameterNode::streamTo(SourceStream &s) const
+{
+ s << id;
+ if (next)
+ s << ", " << next;
+}
+
+void FunctionBodyNode::streamTo(SourceStream &s) const {
+ s << SourceStream::Endl << "{" << SourceStream::Indent
+ << source << SourceStream::Unindent << SourceStream::Endl << "}";
+}
+
+void FuncDeclNode::streamTo(SourceStream &s) const {
+ s << "function " << ident << "(";
+ if (param)
+ s << param;
+ s << ")" << body;
+}
+
+void FuncExprNode::streamTo(SourceStream &s) const
+{
+ s << "function " << "("
+ << param
+ << ")" << body;
+}
+
+void SourceElementNode::streamTo(SourceStream &s) const
+{
+ if (statement)
+ s << statement;
+ else
+ s << function;
+}
+
+void SourceElementsNode::streamTo(SourceStream &s) const
+{
+ s << elements << element;
+}
+
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list