[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 07:04:09 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit d0ba328e24c1667252563167b5c81c745214e4cb
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 19 23:45:44 2002 +0000
JavaScriptCore:
- next step towards atomic identifiers; Identifier is no longer derived from UString
* kjs/identifier.h: Remove base class and add _ustring member.
* kjs/identifier.cpp: Add null and an == that works with const char *.
* kjs/property_map.cpp: Get rep through _ustring.
* kjs/function.cpp: (FunctionImp::parameterString): Call ustring().
* kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto.
* kjs/nodes.cpp:
(PropertyNode::evaluate): Ditto.
(VarDeclNode::evaluate): Ditto.
(ForInNode::execute): Ditto.
* kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier.
* kjs/reference.cpp: (Reference::getValue): Call ustring().
* kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring().
WebCore:
- next step towards atomic identifiers; Identifier is no longer derived from UString
* khtml/ecma/kjs_binding.cpp:
(Identifier::string): Added.
(Identifier::qstring): Added.
* khtml/ecma/kjs_binding.h:
* khtml/ecma/kjs_css.cpp:
(jsNameToProp):
(DOMCSSStyleDeclaration::tryPut):
(DOMStyleSheet::tryPut):
(DOMStyleSheetList::tryGet):
(DOMMediaList::tryGet):
(DOMCSSRuleList::tryGet):
(DOMCSSValueList::tryGet):
* khtml/ecma/kjs_dom.cpp:
(DOMNodeList::hasProperty):
(DOMNodeList::tryGet):
(DOMNodeListFunc::DOMNodeListFunc):
(DOMElement::tryGet):
(DOMNamedNodeMap::hasProperty):
(DOMNamedNodeMap::tryGet):
(DOMNamedNodesCollection::tryGet):
* khtml/ecma/kjs_html.cpp:
(KJS::HTMLDocument::tryGet):
(HTMLElementFunction::HTMLElementFunction):
(KJS::HTMLElement::putValue):
(KJS::HTMLCollection::hasProperty):
(KJS::HTMLCollection::tryGet):
(KJS::HTMLSelectCollection::tryPut):
(OptionConstructorImp::OptionConstructorImp):
* khtml/ecma/kjs_navigator.cpp:
(Plugins::get):
(MimeTypes::get):
(Plugin::get):
* khtml/ecma/kjs_window.cpp:
(WindowFunc::tryCall):
(FrameArray::get):
Use lengthPropertyName instead of "length" for better speed.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 62cb872..8856ebb 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,23 @@
2002-11-19 Darin Adler <darin at apple.com>
+ - next step towards atomic identifiers; Identifier is no longer derived from UString
+
+ * kjs/identifier.h: Remove base class and add _ustring member.
+ * kjs/identifier.cpp: Add null and an == that works with const char *.
+ * kjs/property_map.cpp: Get rep through _ustring.
+
+ * kjs/function.cpp: (FunctionImp::parameterString): Call ustring().
+ * kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto.
+ * kjs/nodes.cpp:
+ (PropertyNode::evaluate): Ditto.
+ (VarDeclNode::evaluate): Ditto.
+ (ForInNode::execute): Ditto.
+ * kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier.
+ * kjs/reference.cpp: (Reference::getValue): Call ustring().
+ * kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring().
+
+2002-11-19 Darin Adler <darin at apple.com>
+
- fixed memory trasher
* kjs/ustring.cpp: (UString::from): Fix "end of buffer" computation.
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index 62cb872..8856ebb 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,5 +1,23 @@
2002-11-19 Darin Adler <darin at apple.com>
+ - next step towards atomic identifiers; Identifier is no longer derived from UString
+
+ * kjs/identifier.h: Remove base class and add _ustring member.
+ * kjs/identifier.cpp: Add null and an == that works with const char *.
+ * kjs/property_map.cpp: Get rep through _ustring.
+
+ * kjs/function.cpp: (FunctionImp::parameterString): Call ustring().
+ * kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto.
+ * kjs/nodes.cpp:
+ (PropertyNode::evaluate): Ditto.
+ (VarDeclNode::evaluate): Ditto.
+ (ForInNode::execute): Ditto.
+ * kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier.
+ * kjs/reference.cpp: (Reference::getValue): Call ustring().
+ * kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring().
+
+2002-11-19 Darin Adler <darin at apple.com>
+
- fixed memory trasher
* kjs/ustring.cpp: (UString::from): Fix "end of buffer" computation.
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 62cb872..8856ebb 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,5 +1,23 @@
2002-11-19 Darin Adler <darin at apple.com>
+ - next step towards atomic identifiers; Identifier is no longer derived from UString
+
+ * kjs/identifier.h: Remove base class and add _ustring member.
+ * kjs/identifier.cpp: Add null and an == that works with const char *.
+ * kjs/property_map.cpp: Get rep through _ustring.
+
+ * kjs/function.cpp: (FunctionImp::parameterString): Call ustring().
+ * kjs/function_object.cpp: (FunctionProtoFuncImp::call): Ditto.
+ * kjs/nodes.cpp:
+ (PropertyNode::evaluate): Ditto.
+ (VarDeclNode::evaluate): Ditto.
+ (ForInNode::execute): Ditto.
+ * kjs/nodes2string.cpp: (SourceStream::operator<<): Add overload for Identifier.
+ * kjs/reference.cpp: (Reference::getValue): Call ustring().
+ * kjs/regexp_object.cpp: (RegExpObjectImp::get): Call ustring().
+
+2002-11-19 Darin Adler <darin at apple.com>
+
- fixed memory trasher
* kjs/ustring.cpp: (UString::from): Fix "end of buffer" computation.
diff --git a/JavaScriptCore/kjs/function.cpp b/JavaScriptCore/kjs/function.cpp
index 5363502..c7c1732 100644
--- a/JavaScriptCore/kjs/function.cpp
+++ b/JavaScriptCore/kjs/function.cpp
@@ -173,7 +173,7 @@ UString FunctionImp::parameterString() const
while (*p) {
if (!s.isEmpty())
s += ", ";
- s += (*p)->name;
+ s += (*p)->name.ustring();
p = &(*p)->next;
}
diff --git a/JavaScriptCore/kjs/function_object.cpp b/JavaScriptCore/kjs/function_object.cpp
index 4f7c27b..f51fa3f 100644
--- a/JavaScriptCore/kjs/function_object.cpp
+++ b/JavaScriptCore/kjs/function_object.cpp
@@ -94,11 +94,11 @@ Value FunctionProtoFuncImp::call(ExecState *exec, Object &thisObj, const List &a
if (thisObj.inherits(&DeclaredFunctionImp::info)) {
DeclaredFunctionImp *fi = static_cast<DeclaredFunctionImp*>
(thisObj.imp());
- return String("function " + fi->name() + "(" +
+ return String("function " + fi->name().ustring() + "(" +
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() + "()");
+ result = String("function " + static_cast<FunctionImp*>(thisObj.imp())->name().ustring() + "()");
}
else {
result = String("(Internal function)");
diff --git a/JavaScriptCore/kjs/identifier.cpp b/JavaScriptCore/kjs/identifier.cpp
index 96c0379..97d68f4 100644
--- a/JavaScriptCore/kjs/identifier.cpp
+++ b/JavaScriptCore/kjs/identifier.cpp
@@ -21,3 +21,13 @@
#include "identifier.h"
+namespace KJS {
+
+Identifier Identifier::null;
+
+bool operator==(const Identifier &a, const char *b)
+{
+ return a._ustring == b;
+}
+
+} // namespace KJS
diff --git a/JavaScriptCore/kjs/identifier.h b/JavaScriptCore/kjs/identifier.h
index ef606b0..3af67df 100644
--- a/JavaScriptCore/kjs/identifier.h
+++ b/JavaScriptCore/kjs/identifier.h
@@ -26,12 +26,50 @@
namespace KJS {
- class Identifier : public UString {
- public:
- Identifier() { }
- Identifier(const char *s) : UString(s) { }
- Identifier(const UString &s) : UString(s) { }
- };
+ class Identifier {
+ friend class PropertyMap;
+ public:
+ Identifier() { }
+ Identifier(const char *s) : _ustring(s) { }
+ Identifier(const UString &s) : _ustring(s) { }
+
+ const UString &ustring() const { return _ustring; }
+ DOM::DOMString string() const;
+ QString qstring() const;
+
+ const UChar *data() const { return _ustring.data(); }
+ int size() const { return _ustring.size(); }
+
+ const char *ascii() const { return _ustring.ascii(); }
+
+ static Identifier from(unsigned y) { return UString::from(y); }
+
+ bool isNull() const { return _ustring.isNull(); }
+ bool isEmpty() const { return _ustring.isEmpty(); }
+
+ unsigned long toULong(bool *ok) const { return _ustring.toULong(ok); }
+ double toDouble() const { return _ustring.toDouble(); }
+
+ static Identifier null;
+
+ friend bool operator==(const Identifier &, const Identifier &);
+ friend bool operator!=(const Identifier &, const Identifier &);
+
+ friend bool operator==(const Identifier &, const char *);
+
+ private:
+ UString _ustring;
+ };
+
+ inline bool operator==(const Identifier &a, const Identifier &b)
+ {
+ return a._ustring == b._ustring;
+ }
+
+ inline bool operator!=(const Identifier &a, const Identifier &b)
+ {
+ return a._ustring != b._ustring;
+ }
}
diff --git a/JavaScriptCore/kjs/nodes.cpp b/JavaScriptCore/kjs/nodes.cpp
index c353e52..5065caf 100644
--- a/JavaScriptCore/kjs/nodes.cpp
+++ b/JavaScriptCore/kjs/nodes.cpp
@@ -460,8 +460,9 @@ Value PropertyNode::evaluate(ExecState */*exec*/)
if (str.isNull()) {
s = String(UString::from(numeric));
- } else
- s = String(str);
+ } else {
+ s = String(str.ustring());
+ }
return s;
}
@@ -1636,7 +1637,7 @@ Value VarDeclNode::evaluate(ExecState *exec)
// "var location" creates a dynamic property instead of activating window.location.
variable.put(exec, ident, val, DontDelete | Internal);
- return String(ident);
+ return String(ident.ustring());
}
void VarDeclNode::processVarDecls(ExecState *exec)
@@ -2098,7 +2099,7 @@ Completion ForInNode::execute(ExecState *exec)
Reference ref = lexpr->evaluateReference(exec);
KJS_CHECKEXCEPTION
- ref.putValue(exec,String(name));
+ ref.putValue(exec, String(name.ustring()));
c = statement->execute(exec);
if (c.isValueCompletion())
diff --git a/JavaScriptCore/kjs/nodes2string.cpp b/JavaScriptCore/kjs/nodes2string.cpp
index cc2ace2..8a79b50 100644
--- a/JavaScriptCore/kjs/nodes2string.cpp
+++ b/JavaScriptCore/kjs/nodes2string.cpp
@@ -33,7 +33,9 @@ namespace KJS {
};
UString toString() const { return str; }
- SourceStream& operator<<(const KJS::UString &);
+ SourceStream& operator<<(const Identifier &);
+ SourceStream& operator<<(const UString &);
+ SourceStream& operator<<(const char *);
SourceStream& operator<<(char);
SourceStream& operator<<(Format f);
SourceStream& operator<<(const Node *);
@@ -51,12 +53,24 @@ SourceStream& SourceStream::operator<<(char c)
return *this;
}
-SourceStream& SourceStream::operator<<(const KJS::UString &s)
+SourceStream& SourceStream::operator<<(const char *s)
+{
+ str += UString(s);
+ return *this;
+}
+
+SourceStream& SourceStream::operator<<(const UString &s)
{
str += s;
return *this;
}
+SourceStream& SourceStream::operator<<(const Identifier &s)
+{
+ str += s.ustring();
+ return *this;
+}
+
SourceStream& SourceStream::operator<<(const Node *n)
{
if (n)
diff --git a/JavaScriptCore/kjs/property_map.cpp b/JavaScriptCore/kjs/property_map.cpp
index 3df4a2e..e24f3cc 100644
--- a/JavaScriptCore/kjs/property_map.cpp
+++ b/JavaScriptCore/kjs/property_map.cpp
@@ -97,16 +97,16 @@ ValueImp *PropertyMap::get(const Identifier &name, int &attributes) const
{
if (!_table) {
UString::Rep *key = _singleEntry.key;
- if (key && keysMatch(name.rep, key)) {
+ if (key && keysMatch(name._ustring.rep, key)) {
attributes = _singleEntry.attributes;
return _singleEntry.value;
}
return 0;
}
- int i = hash(name.rep);
+ int i = hash(name._ustring.rep);
while (UString::Rep *key = _table[i].key) {
- if (keysMatch(name.rep, key)) {
+ if (keysMatch(name._ustring.rep, key)) {
attributes = _table[i].attributes;
return _table[i].value;
}
@@ -119,14 +119,14 @@ ValueImp *PropertyMap::get(const Identifier &name) const
{
if (!_table) {
UString::Rep *key = _singleEntry.key;
- if (key && keysMatch(name.rep, key))
+ if (key && keysMatch(name._ustring.rep, key))
return _singleEntry.value;
return 0;
}
- int i = hash(name.rep);
+ int i = hash(name._ustring.rep);
while (UString::Rep *key = _table[i].key) {
- if (keysMatch(name.rep, key))
+ if (keysMatch(name._ustring.rep, key))
return _table[i].value;
i = (i + 1) & _tableSizeHashMask;
}
@@ -138,13 +138,13 @@ void PropertyMap::put(const Identifier &name, ValueImp *value, int attributes)
if (!_table) {
UString::Rep *key = _singleEntry.key;
if (key) {
- if (keysMatch(name.rep, key)) {
+ if (keysMatch(name._ustring.rep, key)) {
_singleEntry.value = value;
return;
}
} else {
- name.rep->ref();
- _singleEntry.key = name.rep;
+ name._ustring.rep->ref();
+ _singleEntry.key = name._ustring.rep;
_singleEntry.value = value;
_singleEntry.attributes = attributes;
_keyCount = 1;
@@ -155,9 +155,9 @@ void PropertyMap::put(const Identifier &name, ValueImp *value, int attributes)
if (_keyCount * 2 >= _tableSize)
expand();
- int i = hash(name.rep);
+ int i = hash(name._ustring.rep);
while (UString::Rep *key = _table[i].key) {
- if (keysMatch(name.rep, key)) {
+ if (keysMatch(name._ustring.rep, key)) {
// Put a new value in an existing hash table entry.
_table[i].value = value;
// Attributes are intentionally not updated.
@@ -167,8 +167,8 @@ void PropertyMap::put(const Identifier &name, ValueImp *value, int attributes)
}
// Create a new hash table entry.
- name.rep->ref();
- _table[i].key = name.rep;
+ name._ustring.rep->ref();
+ _table[i].key = name._ustring.rep;
_table[i].value = value;
_table[i].attributes = attributes;
++_keyCount;
@@ -215,7 +215,7 @@ void PropertyMap::remove(const Identifier &name)
if (!_table) {
key = _singleEntry.key;
- if (key && keysMatch(name.rep, key)) {
+ if (key && keysMatch(name._ustring.rep, key)) {
key->deref();
_singleEntry.key = 0;
_keyCount = 0;
@@ -224,9 +224,9 @@ void PropertyMap::remove(const Identifier &name)
}
// Find the thing to remove.
- int i = hash(name.rep);
+ int i = hash(name._ustring.rep);
while ((key = _table[i].key)) {
- if (keysMatch(name.rep, key))
+ if (keysMatch(name._ustring.rep, key))
break;
i = (i + 1) & _tableSizeHashMask;
}
diff --git a/JavaScriptCore/kjs/reference.cpp b/JavaScriptCore/kjs/reference.cpp
index 6191ce2..4f598b3 100644
--- a/JavaScriptCore/kjs/reference.cpp
+++ b/JavaScriptCore/kjs/reference.cpp
@@ -105,7 +105,7 @@ Value Reference::getValue(ExecState *exec) const
Value o = getBase(exec);
if (o.isNull() || o.type() == NullType) {
- UString m = I18N_NOOP("Can't find variable: ") + getPropertyName(exec);
+ UString m = I18N_NOOP("Can't find variable: ") + getPropertyName(exec).ustring();
Object err = Error::create(exec, ReferenceError, m.ascii());
exec->setException(err);
return err;
diff --git a/JavaScriptCore/kjs/regexp_object.cpp b/JavaScriptCore/kjs/regexp_object.cpp
index 81f030a..52e2d98 100644
--- a/JavaScriptCore/kjs/regexp_object.cpp
+++ b/JavaScriptCore/kjs/regexp_object.cpp
@@ -195,10 +195,11 @@ Object RegExpObjectImp::arrayOfMatches(ExecState *exec, const UString &result) c
Value RegExpObjectImp::get(ExecState *exec, const Identifier &p) const
{
- if (p[0] == '$' && lastOvector)
+ UString s = p.ustring();
+ if (s[0] == '$' && lastOvector)
{
bool ok;
- unsigned long i = p.substr(1).toULong(&ok);
+ unsigned long i = s.substr(1).toULong(&ok);
if (ok)
{
if (i < lastNrSubPatterns + 1)
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 2990151..653c899 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,45 @@
+2002-11-19 Darin Adler <darin at apple.com>
+
+ - next step towards atomic identifiers; Identifier is no longer derived from UString
+
+ * khtml/ecma/kjs_binding.cpp:
+ (Identifier::string): Added.
+ (Identifier::qstring): Added.
+
+ * khtml/ecma/kjs_binding.h:
+ * khtml/ecma/kjs_css.cpp:
+ (jsNameToProp):
+ (DOMCSSStyleDeclaration::tryPut):
+ (DOMStyleSheet::tryPut):
+ (DOMStyleSheetList::tryGet):
+ (DOMMediaList::tryGet):
+ (DOMCSSRuleList::tryGet):
+ (DOMCSSValueList::tryGet):
+ * khtml/ecma/kjs_dom.cpp:
+ (DOMNodeList::hasProperty):
+ (DOMNodeList::tryGet):
+ (DOMNodeListFunc::DOMNodeListFunc):
+ (DOMElement::tryGet):
+ (DOMNamedNodeMap::hasProperty):
+ (DOMNamedNodeMap::tryGet):
+ (DOMNamedNodesCollection::tryGet):
+ * khtml/ecma/kjs_html.cpp:
+ (KJS::HTMLDocument::tryGet):
+ (HTMLElementFunction::HTMLElementFunction):
+ (KJS::HTMLElement::putValue):
+ (KJS::HTMLCollection::hasProperty):
+ (KJS::HTMLCollection::tryGet):
+ (KJS::HTMLSelectCollection::tryPut):
+ (OptionConstructorImp::OptionConstructorImp):
+ * khtml/ecma/kjs_navigator.cpp:
+ (Plugins::get):
+ (MimeTypes::get):
+ (Plugin::get):
+ * khtml/ecma/kjs_window.cpp:
+ (WindowFunc::tryCall):
+ (FrameArray::get):
+ Use lengthPropertyName instead of "length" for better speed.
+
2002-11-19 David Hyatt <hyatt at apple.com>
Fix backgrounds not painting in deployment builds.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 2990151..653c899 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,45 @@
+2002-11-19 Darin Adler <darin at apple.com>
+
+ - next step towards atomic identifiers; Identifier is no longer derived from UString
+
+ * khtml/ecma/kjs_binding.cpp:
+ (Identifier::string): Added.
+ (Identifier::qstring): Added.
+
+ * khtml/ecma/kjs_binding.h:
+ * khtml/ecma/kjs_css.cpp:
+ (jsNameToProp):
+ (DOMCSSStyleDeclaration::tryPut):
+ (DOMStyleSheet::tryPut):
+ (DOMStyleSheetList::tryGet):
+ (DOMMediaList::tryGet):
+ (DOMCSSRuleList::tryGet):
+ (DOMCSSValueList::tryGet):
+ * khtml/ecma/kjs_dom.cpp:
+ (DOMNodeList::hasProperty):
+ (DOMNodeList::tryGet):
+ (DOMNodeListFunc::DOMNodeListFunc):
+ (DOMElement::tryGet):
+ (DOMNamedNodeMap::hasProperty):
+ (DOMNamedNodeMap::tryGet):
+ (DOMNamedNodesCollection::tryGet):
+ * khtml/ecma/kjs_html.cpp:
+ (KJS::HTMLDocument::tryGet):
+ (HTMLElementFunction::HTMLElementFunction):
+ (KJS::HTMLElement::putValue):
+ (KJS::HTMLCollection::hasProperty):
+ (KJS::HTMLCollection::tryGet):
+ (KJS::HTMLSelectCollection::tryPut):
+ (OptionConstructorImp::OptionConstructorImp):
+ * khtml/ecma/kjs_navigator.cpp:
+ (Plugins::get):
+ (MimeTypes::get):
+ (Plugin::get):
+ * khtml/ecma/kjs_window.cpp:
+ (WindowFunc::tryCall):
+ (FrameArray::get):
+ Use lengthPropertyName instead of "length" for better speed.
+
2002-11-19 David Hyatt <hyatt at apple.com>
Fix backgrounds not painting in deployment builds.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 2990151..653c899 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,45 @@
+2002-11-19 Darin Adler <darin at apple.com>
+
+ - next step towards atomic identifiers; Identifier is no longer derived from UString
+
+ * khtml/ecma/kjs_binding.cpp:
+ (Identifier::string): Added.
+ (Identifier::qstring): Added.
+
+ * khtml/ecma/kjs_binding.h:
+ * khtml/ecma/kjs_css.cpp:
+ (jsNameToProp):
+ (DOMCSSStyleDeclaration::tryPut):
+ (DOMStyleSheet::tryPut):
+ (DOMStyleSheetList::tryGet):
+ (DOMMediaList::tryGet):
+ (DOMCSSRuleList::tryGet):
+ (DOMCSSValueList::tryGet):
+ * khtml/ecma/kjs_dom.cpp:
+ (DOMNodeList::hasProperty):
+ (DOMNodeList::tryGet):
+ (DOMNodeListFunc::DOMNodeListFunc):
+ (DOMElement::tryGet):
+ (DOMNamedNodeMap::hasProperty):
+ (DOMNamedNodeMap::tryGet):
+ (DOMNamedNodesCollection::tryGet):
+ * khtml/ecma/kjs_html.cpp:
+ (KJS::HTMLDocument::tryGet):
+ (HTMLElementFunction::HTMLElementFunction):
+ (KJS::HTMLElement::putValue):
+ (KJS::HTMLCollection::hasProperty):
+ (KJS::HTMLCollection::tryGet):
+ (KJS::HTMLSelectCollection::tryPut):
+ (OptionConstructorImp::OptionConstructorImp):
+ * khtml/ecma/kjs_navigator.cpp:
+ (Plugins::get):
+ (MimeTypes::get):
+ (Plugin::get):
+ * khtml/ecma/kjs_window.cpp:
+ (WindowFunc::tryCall):
+ (FrameArray::get):
+ Use lengthPropertyName instead of "length" for better speed.
+
2002-11-19 David Hyatt <hyatt at apple.com>
Fix backgrounds not painting in deployment builds.
diff --git a/WebCore/khtml/ecma/kjs_binding.cpp b/WebCore/khtml/ecma/kjs_binding.cpp
index 4b214a2..ba68fc1 100644
--- a/WebCore/khtml/ecma/kjs_binding.cpp
+++ b/WebCore/khtml/ecma/kjs_binding.cpp
@@ -233,6 +233,16 @@ QConstString UString::qconststring() const
return QConstString((QChar*) data(), size());
}
+DOM::DOMString Identifier::string() const
+{
+ return DOM::DOMString((QChar*) data(), size());
+}
+
+QString Identifier::qstring() const
+{
+ return QString((QChar*) data(), size());
+}
+
DOM::Node KJS::toNode(const Value& val)
{
Object obj = Object::dynamicCast(val);
diff --git a/WebCore/khtml/ecma/kjs_binding.h b/WebCore/khtml/ecma/kjs_binding.h
index 40f64a0..4ff0194 100644
--- a/WebCore/khtml/ecma/kjs_binding.h
+++ b/WebCore/khtml/ecma/kjs_binding.h
@@ -310,7 +310,7 @@ namespace KJS {
ClassFunc(ExecState *exec, int i, int len) \
: DOMFunction( /*proto? */ ), id(i) { \
Value protect(this); \
- put(exec,"length",Number(len),DontDelete|ReadOnly|DontEnum); \
+ put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum); \
} \
/** You need to implement that one */ \
virtual Value tryCall(ExecState *exec, Object &thisObj, const List &args); \
diff --git a/WebCore/khtml/ecma/kjs_css.cpp b/WebCore/khtml/ecma/kjs_css.cpp
index 637c7d4..810673e 100644
--- a/WebCore/khtml/ecma/kjs_css.cpp
+++ b/WebCore/khtml/ecma/kjs_css.cpp
@@ -30,7 +30,7 @@
using namespace KJS;
#include <kdebug.h>
-static QString jsNameToProp( const UString &p )
+static QString jsNameToProp( const Identifier &p )
{
QString prop = p.qstring();
int i = prop.length();
@@ -312,7 +312,7 @@ Value DOMStyleSheetList::tryGet(ExecState *exec, const Identifier &p) const
#ifdef KJS_VERBOSE
kdDebug(6070) << "DOMStyleSheetList::tryGet " << p.qstring() << endl;
#endif
- if (p == "length")
+ if (p == lengthPropertyName)
return Number(styleSheetList.length());
else if (p == "item")
return lookupOrCreateFunction<DOMStyleSheetListFunc>(exec,p,this,DOMStyleSheetList::Item,1,DontDelete|Function);
@@ -417,7 +417,7 @@ Value DOMMediaList::tryGet(ExecState *exec, const Identifier &p) const
{
if (p == "mediaText")
return getString(mediaList.mediaText());
- else if (p == "length")
+ else if (p == lengthPropertyName)
return Number(mediaList.length());
bool ok;
@@ -544,7 +544,7 @@ DOMCSSRuleList::~DOMCSSRuleList()
Value DOMCSSRuleList::tryGet(ExecState *exec, const Identifier &p) const
{
Value result;
- if (p == "length")
+ if (p == lengthPropertyName)
return Number(cssRuleList.length());
else if (p == "item")
return lookupOrCreateFunction<DOMCSSRuleListFunc>(exec,p,this,DOMCSSRuleList::Item,1,DontDelete|Function);
@@ -1063,7 +1063,7 @@ Value DOMCSSValueList::tryGet(ExecState *exec, const Identifier &p) const
Value result;
DOM::CSSValueList valueList = static_cast<DOM::CSSValueList>(cssValue);
- if (p == "length")
+ if (p == lengthPropertyName)
return Number(valueList.length());
else if (p == "item")
return lookupOrCreateFunction<DOMCSSValueListFunc>(exec,p,this,DOMCSSValueList::Item,1,DontDelete|Function);
diff --git a/WebCore/khtml/ecma/kjs_dom.cpp b/WebCore/khtml/ecma/kjs_dom.cpp
index 21c297d..b77b951 100644
--- a/WebCore/khtml/ecma/kjs_dom.cpp
+++ b/WebCore/khtml/ecma/kjs_dom.cpp
@@ -489,7 +489,7 @@ DOMNodeList::~DOMNodeList()
// ## this breaks "for (..in..)" though.
bool DOMNodeList::hasProperty(ExecState *exec, const Identifier &p) const
{
- if (p == "length" || p == "item")
+ if (p == lengthPropertyName || p == "item")
return true;
return ObjectImp::hasProperty(exec, p);
}
@@ -501,7 +501,7 @@ Value DOMNodeList::tryGet(ExecState *exec, const Identifier &p) const
#endif
Value result;
- if (p == "length")
+ if (p == lengthPropertyName)
result = Number(list.length());
else if (p == "item") {
// No need for a complete hashtable for a single func, but we still want
@@ -568,7 +568,7 @@ DOMNodeListFunc::DOMNodeListFunc(ExecState *exec, int i, int len)
: DOMFunction(), id(i)
{
Value protect(this);
- put(exec,"length",Number(len),DontDelete|ReadOnly|DontEnum);
+ put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
}
// Not a prototype class currently, but should probably be converted to one
@@ -1099,14 +1099,14 @@ DOMNamedNodeMap::~DOMNamedNodeMap()
// ## this breaks "for (..in..)" though.
bool DOMNamedNodeMap::hasProperty(ExecState *exec, const Identifier &p) const
{
- if (p == "length")
+ if (p == lengthPropertyName)
return true;
return DOMObject::hasProperty(exec, p);
}
Value DOMNamedNodeMap::tryGet(ExecState* exec, const Identifier &p) const
{
- if (p == "length")
+ if (p == lengthPropertyName)
return Number(map.length());
// array index ?
@@ -1480,7 +1480,7 @@ DOMNamedNodesCollection::DOMNamedNodesCollection(ExecState *, const QValueList<D
Value DOMNamedNodesCollection::tryGet(ExecState *exec, const Identifier &propertyName) const
{
- if (propertyName == "length")
+ if (propertyName == lengthPropertyName)
return Number(m_nodes.count());
// index?
bool ok;
diff --git a/WebCore/khtml/ecma/kjs_html.cpp b/WebCore/khtml/ecma/kjs_html.cpp
index 038da03..ddd5879 100644
--- a/WebCore/khtml/ecma/kjs_html.cpp
+++ b/WebCore/khtml/ecma/kjs_html.cpp
@@ -208,7 +208,7 @@ Value KJS::HTMLDocument::tryGet(ExecState *exec, const Identifier &propertyName)
// To be implemented. Meanwhile, return an object with a length property set to 0
kdWarning() << "KJS::HTMLDocument document.scripts called - not implemented" << endl;
Object obj( new ObjectImp() );
- obj.put( exec, "length", Number(0) );
+ obj.put( exec, lengthPropertyName, Number(0) );
return obj;
}
case All:
@@ -1762,7 +1762,7 @@ HTMLElementFunction::HTMLElementFunction(ExecState *exec, int i, int len)
: DOMFunction(), id(i)
{
Value protect(this);
- put(exec,"length",Number(len),DontDelete|ReadOnly|DontEnum);
+ put(exec,lengthPropertyName,Number(len),DontDelete|ReadOnly|DontEnum);
}
Value KJS::HTMLElementFunction::tryCall(ExecState *exec, Object &thisObj, const List &args)
@@ -2078,7 +2078,7 @@ void KJS::HTMLElement::putValue(ExecState *exec, int token, const Value& value,
case SelectLength: { // read-only according to the NS spec, but webpages need it writeable
Object coll = Object::dynamicCast( getSelectHTMLCollection(exec, select.options(), select) );
if ( !coll.isNull() )
- coll.put(exec,"length",value);
+ coll.put(exec,lengthPropertyName,value);
return;
}
// read-only: form
@@ -2655,7 +2655,7 @@ HTMLCollection::~HTMLCollection()
// ## this breaks "for (..in..)" though.
bool KJS::HTMLCollection::hasProperty(ExecState *exec, const Identifier &p) const
{
- if (p == "selectedIndex" || p == "length")
+ if (p == "selectedIndex" || p == lengthPropertyName)
return true;
return DOMObject::hasProperty(exec, p);
}
@@ -2665,7 +2665,7 @@ Value KJS::HTMLCollection::tryGet(ExecState *exec, const Identifier &propertyNam
#ifdef KJS_VERBOSE
kdDebug() << "KJS::HTMLCollection::tryGet " << propertyName.ascii() << endl;
#endif
- if (propertyName == "length")
+ if (propertyName == lengthPropertyName)
return Number(collection.length());
else if (propertyName == "selectedIndex" &&
collection.item(0).elementId() == ID_OPTION) {
@@ -2853,7 +2853,7 @@ void KJS::HTMLSelectCollection::tryPut(ExecState *exec, const Identifier &proper
return;
}
// resize ?
- else if (propertyName == "length") {
+ else if (propertyName == lengthPropertyName) {
long newLen = value.toInteger(exec);
long diff = element.length() - newLen;
@@ -2912,7 +2912,7 @@ OptionConstructorImp::OptionConstructorImp(ExecState *exec, const DOM::Document
// no. of arguments for constructor
// ## is 4 correct ? 0 to 4, it seems to be
- put(exec,"length", Number(4), ReadOnly|DontDelete|DontEnum);
+ put(exec,lengthPropertyName, Number(4), ReadOnly|DontDelete|DontEnum);
}
bool OptionConstructorImp::implementsConstruct() const
diff --git a/WebCore/khtml/ecma/kjs_navigator.cpp b/WebCore/khtml/ecma/kjs_navigator.cpp
index bb8dfca..d2daebd 100644
--- a/WebCore/khtml/ecma/kjs_navigator.cpp
+++ b/WebCore/khtml/ecma/kjs_navigator.cpp
@@ -373,7 +373,7 @@ Value Plugins::get(ExecState *exec, const Identifier &propertyName) const
#endif
if (propertyName == "refresh")
return lookupOrCreateFunction<PluginsFunc>(exec,propertyName,this,0,0,DontDelete|Function);
- else if ( propertyName =="length" )
+ else if ( propertyName ==lengthPropertyName )
return Number(plugins->count());
else {
@@ -400,7 +400,7 @@ Value MimeTypes::get(ExecState *exec, const Identifier &propertyName) const
#ifdef KJS_VERBOSE
kdDebug(6070) << "MimeTypes::get " << propertyName.qstring() << endl;
#endif
- if( propertyName=="length" )
+ if( propertyName==lengthPropertyName )
return Number( mimes->count() );
else {
@@ -436,7 +436,7 @@ Value Plugin::get(ExecState *exec, const Identifier &propertyName) const
return String( m_info->file );
else if ( propertyName == "description" )
return String( m_info->desc );
- else if ( propertyName == "length" )
+ else if ( propertyName == lengthPropertyName )
return Number( m_info->mimes.count() );
else {
diff --git a/WebCore/khtml/ecma/kjs_window.cpp b/WebCore/khtml/ecma/kjs_window.cpp
index 2666972..ddffe55 100644
--- a/WebCore/khtml/ecma/kjs_window.cpp
+++ b/WebCore/khtml/ecma/kjs_window.cpp
@@ -1347,7 +1347,7 @@ Value WindowFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
// To conform to the SPEC, we only ask if the window
// has more than one entry in the history (NS does that too).
History history(exec,part);
- if ( history.get( exec, "length" ).toInt32(exec) <= 1
+ if ( history.get( exec, lengthPropertyName ).toInt32(exec) <= 1
#if APPLE_CHANGES
// FIXME: How are we going to handle this?
#else
@@ -1530,7 +1530,7 @@ Value FrameArray::get(ExecState *exec, const Identifier &p) const
QPtrList<KParts::ReadOnlyPart> frames = part->frames();
int len = frames.count();
- if (p == "length")
+ if (p == lengthPropertyName)
return Number(len);
else if (p== "location") // non-standard property, but works in NS and IE
{
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list