[webkit-changes] cvs commit: WebKitTools/Scripts run-webkit-tests
Darin
darin at opensource.apple.com
Fri Dec 16 00:08:24 PST 2005
darin 05/12/16 00:08:23
Modified: . ChangeLog
kjs internal.cpp internal.h interpreter.cpp
interpreter.h protect.h
. ChangeLog
khtml khtml_part.cpp khtml_part.h
khtml/ecma kjs_dom.cpp kjs_events.cpp kjs_events.h
kjs_html.cpp kjs_proxy.cpp kjs_proxy.h
kjs_window.cpp kjs_window.h xmlhttprequest.cpp
khtml/html html_baseimpl.cpp html_elementimpl.cpp
html_elementimpl.h html_formimpl.cpp
html_headimpl.cpp html_headimpl.h
html_imageimpl.cpp html_objectimpl.cpp
khtml/xml dom_docimpl.cpp dom_docimpl.h
kwq WebCoreScriptDebugger.mm
Scripts run-webkit-tests
Log:
JavaScriptCore:
Reviewed by Maciej.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5688
speed up JavaScript parsing by not creating a UString just to parse
* kjs/internal.h:
* kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer
and length rather than a UString.
* kjs/interpreter.h:
* kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
* kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a
"convert to raw pointer" operator in this class.
WebCore:
Reviewed by Maciej.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5688
speed up JavaScript parsing by not creating a UString just to parse
* khtml/ecma/kjs_dom.cpp: (KJS::DOMNode::getListener): Use listenerObj instead of
listenerObjImp.
* khtml/ecma/kjs_html.cpp: (KJS::Image::getValueProperty): Ditto.
* khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::getValueProperty): Ditto.
* khtml/ecma/kjs_window.h:
* khtml/ecma/kjs_window.cpp:
(KJS::Window::getListener): Ditto.
(KJS::Window::getJSLazyEventListener): Take code as a DOMString, not QString.
* khtml/ecma/kjs_events.cpp:
(KJS::jsStringOrUndefined): Renamed function and moved it to the top of the file.
(KJS::JSAbstractEventListener::handleEvent): Cleaned up function, removed double
logging, and fixed code path to not use UString::ascii().
(KJS::JSUnprotectedEventListener::JSUnprotectedEventListener): Updated since type
of the window object is now Window.
(KJS::JSUnprotectedEventListener::~JSUnprotectedEventListener): Ditto.
(KJS::JSUnprotectedEventListener::windowObj): Ditto.
(KJS::JSEventListener::JSEventListener): Ditto.
(KJS::JSEventListener::~JSEventListener): Ditto.
(KJS::JSEventListener::windowObj): Ditto.
(KJS::JSLazyEventListener::JSLazyEventListener): Ditto. Also changed code to be
a DOMString instead of a QString.
(KJS::JSLazyEventListener::handleEvent): Removed function because the base class
handleEvent already calls listenerObj which takes care of parseCode -- no need to
do an additional parseCode here.
(KJS::JSLazyEventListener::parseCode): Rearrange and clean up a bit. Code is now
a DOMString instead of a QString.
(KJS::Clipboard::Clipboard): Remove explicit ref since we now use a RefPtr for
the clipboard object.
(KJS::Clipboard::getValueProperty): Update to call jsStringOrUndefined.
* khtml/ecma/kjs_events.h: Reformatted the file. Changed windowObj functions to
return Window* instead of ObjectImp*. Removed listenerObjImp function. Removed
destructors from many classes that don't need them. Used a RefPtr for the
ClipboardImpl in a Clipboard object.
* khtml/ecma/kjs_proxy.h:
* khtml/ecma/kjs_proxy.cpp:
(KJSProxyImpl::evaluate): Take filename and code as DOMString instead of QString.
(KJSProxyImpl::createHTMLEventHandler): Take URL and code as DOMString.
* khtml/xml/dom_docimpl.h:
* khtml/xml/dom_docimpl.cpp:
(DocumentImpl::createHTMLEventListener): Take a DOMString rather than a QString for the
JavaScript code.
(DocumentImpl::setHTMLWindowEventListener): Added an overload that takes an attribute
pointer. Calls through after extracting the code from the attribute value.
* khtml/html/html_elementimpl.h:
* khtml/html/html_elementimpl.cpp: (HTMLElementImpl::setHTMLEventListener): New
version of function that takes an attribute pointer; calls through to the base class
after extracting the code from the attribute value.
* khtml/html/html_baseimpl.cpp:
(HTMLBodyElementImpl::parseMappedAttribute): Change to use new setHTMLWindowEventListener
and setHTMLEventListener that takes an attribute pointer.
(HTMLFrameElementImpl::parseMappedAttribute): Ditto.
(HTMLFrameSetElementImpl::parseMappedAttribute): Ditto.
* khtml/html/html_elementimpl.cpp: (HTMLElementImpl::parseMappedAttribute): Ditto.
* khtml/html/html_formimpl.cpp:
(DOM::HTMLFormElementImpl::parseMappedAttribute): Ditto.
(DOM::HTMLButtonElementImpl::parseMappedAttribute): Ditto.
(DOM::HTMLInputElementImpl::parseMappedAttribute): Ditto.
(DOM::HTMLLabelElementImpl::parseMappedAttribute): Ditto.
(DOM::HTMLSelectElementImpl::parseMappedAttribute): Ditto.
(DOM::HTMLTextAreaElementImpl::parseMappedAttribute): Ditto.
* khtml/html/html_imageimpl.cpp:
(DOM::HTMLImageElementImpl::parseMappedAttribute): Ditto.
* khtml/html/html_objectimpl.cpp:
(DOM::HTMLObjectElementImpl::parseMappedAttribute): Ditto.
* khtml/html/html_headimpl.h:
* khtml/html/html_headimpl.cpp:
(HTMLScriptElementImpl::notifyFinished): Don't convert URL to QString since we now take
a DOMString.
(HTMLScriptElementImpl::evaluateScript): Change to take script as a DOMString.
* khtml/khtml_part.h:
* khtml/khtml_part.cpp: (KHTMLPart::createHTMLEventListener): Take a DOMString rather than
a QString for the JavaScript code.
* kwq/WebCoreScriptDebugger.mm: (-[WebCoreScriptCallFrame evaluateWebScript:]): Change
code path so it doesn't convert an NSString to UTF-8 to get it into the JavaScript
machinery. Use QString::fromNSString instead for now.
Revision Changes Path
1.905 +17 -0 JavaScriptCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/JavaScriptCore/ChangeLog,v
retrieving revision 1.904
retrieving revision 1.905
diff -u -r1.904 -r1.905
--- ChangeLog 14 Dec 2005 01:14:25 -0000 1.904
+++ ChangeLog 16 Dec 2005 08:08:03 -0000 1.905
@@ -1,3 +1,20 @@
+2005-12-15 Darin Adler <darin at apple.com>
+
+ Reviewed by Maciej.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5688
+ speed up JavaScript parsing by not creating a UString just to parse
+
+ * kjs/internal.h:
+ * kjs/internal.cpp: (KJS::InterpreterImp::evaluate): Change to take a character pointer
+ and length rather than a UString.
+
+ * kjs/interpreter.h:
+ * kjs/interpreter.cpp: (Interpreter::evaluate): Ditto.
+
+ * kjs/protect.h: Remove uneeded "convert to bool" operator since we already have a
+ "convert to raw pointer" operator in this class.
+
=== Safari-521~5 ===
2005-12-13 Geoffrey Garen <ggaren at apple.com>
1.84 +14 -29 JavaScriptCore/kjs/internal.cpp
Index: internal.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/internal.cpp,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- internal.cpp 13 Dec 2005 21:24:51 -0000 1.83
+++ internal.cpp 16 Dec 2005 08:08:05 -0000 1.84
@@ -632,65 +632,50 @@
JSLock lock;
// Parser::parse() returns 0 in a syntax error occurs, so we just check for that
- RefPtr<ProgramNode> progNode = Parser::parse(UString(), 0, code.data(),code.size(),0,0,0);
+ RefPtr<ProgramNode> progNode = Parser::parse(UString(), 0, code.data(), code.size(), 0, 0, 0);
return progNode;
}
-Completion InterpreterImp::evaluate(const UString &code, JSValue *thisV, const UString &sourceURL, int startingLineNumber)
+Completion InterpreterImp::evaluate(const UChar* code, int codeLength, JSValue* thisV, const UString& sourceURL, int startingLineNumber)
{
JSLock lock;
// prevent against infinite recursion
- if (recursion >= 20) {
-#if APPLE_CHANGES
- Completion result = Completion(Throw, Error::create(&globExec, GeneralError, "Recursion too deep"));
- return result;
-#else
- return Completion(Throw,Error::create(&globExec, GeneralError, "Recursion too deep"));
-#endif
- }
+ if (recursion >= 20)
+ return Completion(Throw, Error::create(&globExec, GeneralError, "Recursion too deep"));
// parse the source code
int sid;
int errLine;
UString errMsg;
- RefPtr<ProgramNode> progNode = Parser::parse(sourceURL, startingLineNumber, code.data(),code.size(),&sid,&errLine,&errMsg);
+ RefPtr<ProgramNode> progNode = Parser::parse(sourceURL, startingLineNumber, code, codeLength, &sid, &errLine, &errMsg);
// notify debugger that source has been parsed
if (dbg) {
- bool cont = dbg->sourceParsed(&globExec, sid, sourceURL, code, errLine);
+ bool cont = dbg->sourceParsed(&globExec, sid, sourceURL, UString(code, codeLength), errLine);
if (!cont)
return Completion(Break);
}
// no program node means a syntax error occurred
- if (!progNode) {
- JSObject *err = Error::create(&globExec, SyntaxError, errMsg, errLine, sid, &sourceURL);
- return Completion(Throw,err);
- }
+ if (!progNode)
+ return Completion(Throw, Error::create(&globExec, SyntaxError, errMsg, errLine, sid, &sourceURL));
globExec.clearException();
recursion++;
- JSObject *globalObj = globalObject();
- JSObject *thisObj = globalObject();
+ JSObject* globalObj = globalObject();
+ JSObject* thisObj = globalObj;
- if (thisV) {
- // "this" must be an object... use same rules as Function.prototype.apply()
- if (thisV->isUndefinedOrNull())
- thisObj = globalObject();
- else {
+ // "this" must be an object... use same rules as Function.prototype.apply()
+ if (thisV && !thisV->isUndefinedOrNull())
thisObj = thisV->toObject(&globExec);
- }
- }
Completion res;
- if (globExec.hadException()) {
- // the thisArg->toObject() conversion above might have thrown an exception - if so,
- // propagate it back
+ if (globExec.hadException())
+ // the thisV->toObject() conversion above might have thrown an exception - if so, propagate it
res = Completion(Throw, globExec.exception());
- }
else {
// execute the code
ContextImp ctx(globalObj, this, thisObj);
1.48 +1 -1 JavaScriptCore/kjs/internal.h
Index: internal.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/internal.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -r1.47 -r1.48
--- internal.h 11 Dec 2005 02:05:44 -0000 1.47
+++ internal.h 16 Dec 2005 08:08:05 -0000 1.48
@@ -254,7 +254,7 @@
ExecState *globalExec() { return &globExec; }
bool checkSyntax(const UString &code);
- Completion evaluate(const UString &code, JSValue *thisV, const UString &sourceURL, int startingLineNumber);
+ Completion evaluate(const UChar* code, int codeLength, JSValue* thisV, const UString& sourceURL, int startingLineNumber);
Debugger *debugger() const { return dbg; }
void setDebugger(Debugger *d) { dbg = d; }
1.35 +12 -16 JavaScriptCore/kjs/interpreter.cpp
Index: interpreter.cpp
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/interpreter.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- interpreter.cpp 11 Dec 2005 02:05:44 -0000 1.34
+++ interpreter.cpp 16 Dec 2005 08:08:05 -0000 1.35
@@ -109,28 +109,24 @@
return rep->checkSyntax(code);
}
-Completion Interpreter::evaluate(const UString &code, JSValue *thisV, const UString &)
+Completion Interpreter::evaluate(const UString& sourceURL, int startingLineNumber, const UString& code, JSValue* thisV)
{
- return evaluate(UString(), 0, code, thisV);
+ return evaluate(sourceURL, startingLineNumber, code.data(), code.size());
}
-Completion Interpreter::evaluate(const UString &sourceURL, int startingLineNumber, const UString &code, JSValue *thisV)
+Completion Interpreter::evaluate(const UString& sourceURL, int startingLineNumber, const UChar* code, int codeLength, JSValue* thisV)
{
- Completion comp = rep->evaluate(code,thisV, sourceURL, startingLineNumber);
+ Completion comp = rep->evaluate(code, codeLength, thisV, sourceURL, startingLineNumber);
-#if APPLE_CHANGES
- if (shouldPrintExceptions() && comp.complType() == Throw) {
- JSLock lock;
- ExecState *exec = rep->globalExec();
- char *f = strdup(sourceURL.ascii());
- const char *message = comp.value()->toObject(exec)->toString(exec).ascii();
- printf("[%d] %s:%s\n", getpid(), f, message);
-
- free(f);
- }
-#endif
+ if (shouldPrintExceptions() && comp.complType() == Throw) {
+ JSLock lock;
+ ExecState *exec = rep->globalExec();
+ CString f = sourceURL.UTF8String();
+ CString message = comp.value()->toObject(exec)->toString(exec).UTF8String();
+ printf("[%d] %s:%s\n", getpid(), f.c_str(), message.c_str());
+ }
- return comp;
+ return comp;
}
JSObject *Interpreter::builtinObject() const
1.32 +12 -21 JavaScriptCore/kjs/interpreter.h
Index: interpreter.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/interpreter.h,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- interpreter.h 11 Dec 2005 02:05:44 -0000 1.31
+++ interpreter.h 16 Dec 2005 08:08:05 -0000 1.32
@@ -203,10 +203,8 @@
* execution. This should either be jsNull() or an Object.
* @return A completion object representing the result of the execution.
*/
- Completion evaluate(const UString &sourceURL, int startingLineNumber, const UString &code, JSValue *thisV = NULL);
-
- // Overload of evaluate to keep JavaScriptGlue both source and binary compatible.
- Completion evaluate(const UString &code, JSValue *thisV = NULL, const UString &sourceFilename = UString());
+ Completion evaluate(const UString& sourceURL, int startingLineNumber, const UChar* code, int codeLength, JSValue* thisV = 0);
+ Completion evaluate(const UString& sourceURL, int startingLineNumber, const UString& code, JSValue* thisV = 0);
/**
* @internal
@@ -359,15 +357,12 @@
static void finalCheck();
#endif
-#if APPLE_CHANGES
static bool shouldPrintExceptions();
static void setShouldPrintExceptions(bool);
-#endif
void saveBuiltins (SavedBuiltins &) const;
void restoreBuiltins (const SavedBuiltins &);
-#if APPLE_CHANGES
/**
* Determine if the value is a global object (for any interpreter). This may
* be difficult to determine for multiple uses of JSC in a process that are
@@ -394,8 +389,7 @@
*/
virtual bool isSafeScript (const Interpreter *target) { return true; }
- virtual void *createLanguageInstanceForValue (ExecState *exec, int language, JSObject *value, const Bindings::RootObject *origin, const Bindings::RootObject *current);
-#endif
+ virtual void *createLanguageInstanceForValue(ExecState*, int language, JSObject* value, const Bindings::RootObject* origin, const Bindings::RootObject* current);
// This is a workaround to avoid accessing the global variables for these identifiers in
// important property lookup functions, to avoid taking PIC branches in Mach-O binaries
@@ -434,10 +428,7 @@
class ExecState {
friend class InterpreterImp;
friend class FunctionImp;
-#if APPLE_CHANGES
- friend class RuntimeMethod;
-#endif
-
+ friend class RuntimeMethodImp;
friend class GlobalFuncImp;
public:
/**
@@ -465,17 +456,17 @@
*/
Context context() const { return _context; }
- void setException(JSValue *e) { _exception = e; }
- void clearException() { _exception = NULL; }
- JSValue *exception() const { return _exception; }
+ void setException(JSValue* e) { _exception = e; }
+ void clearException() { _exception = 0; }
+ JSValue* exception() const { return _exception; }
bool hadException() const { return _exception; }
private:
- ExecState(Interpreter *interp, ContextImp *con)
- : _interpreter(interp), _context(con), _exception(NULL) { }
- Interpreter *_interpreter;
- ContextImp *_context;
- JSValue *_exception;
+ ExecState(Interpreter* interp, ContextImp* con)
+ : _interpreter(interp), _context(con), _exception(0) { }
+ Interpreter* _interpreter;
+ ContextImp* _context;
+ JSValue* _exception;
};
} // namespace
1.17 +0 -9 JavaScriptCore/kjs/protect.h
Index: protect.h
===================================================================
RCS file: /cvs/root/JavaScriptCore/kjs/protect.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- protect.h 13 Dec 2005 11:06:04 -0000 1.16
+++ protect.h 16 Dec 2005 08:08:05 -0000 1.17
@@ -68,15 +68,6 @@
bool operator!() const { return m_ptr == NULL; }
- // this type conversion operator allows implicit conversion to
- // bool but not to other integer types
-
- typedef T * (ProtectedPtr::*UnspecifiedBoolType)() const;
- operator UnspecifiedBoolType() const
- {
- return m_ptr ? &ProtectedPtr::get : 0;
- }
-
ProtectedPtr &operator=(const ProtectedPtr &);
ProtectedPtr &operator=(T *);
1.545 +92 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.544
retrieving revision 1.545
diff -u -r1.544 -r1.545
--- ChangeLog 16 Dec 2005 07:51:07 -0000 1.544
+++ ChangeLog 16 Dec 2005 08:08:06 -0000 1.545
@@ -1,5 +1,97 @@
2005-12-15 Darin Adler <darin at apple.com>
+ Reviewed by Maciej.
+
+ - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=5688
+ speed up JavaScript parsing by not creating a UString just to parse
+
+ * khtml/ecma/kjs_dom.cpp: (KJS::DOMNode::getListener): Use listenerObj instead of
+ listenerObjImp.
+ * khtml/ecma/kjs_html.cpp: (KJS::Image::getValueProperty): Ditto.
+ * khtml/ecma/xmlhttprequest.cpp: (KJS::XMLHttpRequest::getValueProperty): Ditto.
+ * khtml/ecma/kjs_window.h:
+ * khtml/ecma/kjs_window.cpp:
+ (KJS::Window::getListener): Ditto.
+ (KJS::Window::getJSLazyEventListener): Take code as a DOMString, not QString.
+
+ * khtml/ecma/kjs_events.cpp:
+ (KJS::jsStringOrUndefined): Renamed function and moved it to the top of the file.
+ (KJS::JSAbstractEventListener::handleEvent): Cleaned up function, removed double
+ logging, and fixed code path to not use UString::ascii().
+ (KJS::JSUnprotectedEventListener::JSUnprotectedEventListener): Updated since type
+ of the window object is now Window.
+ (KJS::JSUnprotectedEventListener::~JSUnprotectedEventListener): Ditto.
+ (KJS::JSUnprotectedEventListener::windowObj): Ditto.
+ (KJS::JSEventListener::JSEventListener): Ditto.
+ (KJS::JSEventListener::~JSEventListener): Ditto.
+ (KJS::JSEventListener::windowObj): Ditto.
+ (KJS::JSLazyEventListener::JSLazyEventListener): Ditto. Also changed code to be
+ a DOMString instead of a QString.
+ (KJS::JSLazyEventListener::handleEvent): Removed function because the base class
+ handleEvent already calls listenerObj which takes care of parseCode -- no need to
+ do an additional parseCode here.
+ (KJS::JSLazyEventListener::parseCode): Rearrange and clean up a bit. Code is now
+ a DOMString instead of a QString.
+ (KJS::Clipboard::Clipboard): Remove explicit ref since we now use a RefPtr for
+ the clipboard object.
+ (KJS::Clipboard::getValueProperty): Update to call jsStringOrUndefined.
+
+ * khtml/ecma/kjs_events.h: Reformatted the file. Changed windowObj functions to
+ return Window* instead of ObjectImp*. Removed listenerObjImp function. Removed
+ destructors from many classes that don't need them. Used a RefPtr for the
+ ClipboardImpl in a Clipboard object.
+
+ * khtml/ecma/kjs_proxy.h:
+ * khtml/ecma/kjs_proxy.cpp:
+ (KJSProxyImpl::evaluate): Take filename and code as DOMString instead of QString.
+ (KJSProxyImpl::createHTMLEventHandler): Take URL and code as DOMString.
+
+ * khtml/xml/dom_docimpl.h:
+ * khtml/xml/dom_docimpl.cpp:
+ (DocumentImpl::createHTMLEventListener): Take a DOMString rather than a QString for the
+ JavaScript code.
+ (DocumentImpl::setHTMLWindowEventListener): Added an overload that takes an attribute
+ pointer. Calls through after extracting the code from the attribute value.
+
+ * khtml/html/html_elementimpl.h:
+ * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::setHTMLEventListener): New
+ version of function that takes an attribute pointer; calls through to the base class
+ after extracting the code from the attribute value.
+
+ * khtml/html/html_baseimpl.cpp:
+ (HTMLBodyElementImpl::parseMappedAttribute): Change to use new setHTMLWindowEventListener
+ and setHTMLEventListener that takes an attribute pointer.
+ (HTMLFrameElementImpl::parseMappedAttribute): Ditto.
+ (HTMLFrameSetElementImpl::parseMappedAttribute): Ditto.
+ * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::parseMappedAttribute): Ditto.
+ * khtml/html/html_formimpl.cpp:
+ (DOM::HTMLFormElementImpl::parseMappedAttribute): Ditto.
+ (DOM::HTMLButtonElementImpl::parseMappedAttribute): Ditto.
+ (DOM::HTMLInputElementImpl::parseMappedAttribute): Ditto.
+ (DOM::HTMLLabelElementImpl::parseMappedAttribute): Ditto.
+ (DOM::HTMLSelectElementImpl::parseMappedAttribute): Ditto.
+ (DOM::HTMLTextAreaElementImpl::parseMappedAttribute): Ditto.
+ * khtml/html/html_imageimpl.cpp:
+ (DOM::HTMLImageElementImpl::parseMappedAttribute): Ditto.
+ * khtml/html/html_objectimpl.cpp:
+ (DOM::HTMLObjectElementImpl::parseMappedAttribute): Ditto.
+
+ * khtml/html/html_headimpl.h:
+ * khtml/html/html_headimpl.cpp:
+ (HTMLScriptElementImpl::notifyFinished): Don't convert URL to QString since we now take
+ a DOMString.
+ (HTMLScriptElementImpl::evaluateScript): Change to take script as a DOMString.
+
+ * khtml/khtml_part.h:
+ * khtml/khtml_part.cpp: (KHTMLPart::createHTMLEventListener): Take a DOMString rather than
+ a QString for the JavaScript code.
+
+ * kwq/WebCoreScriptDebugger.mm: (-[WebCoreScriptCallFrame evaluateWebScript:]): Change
+ code path so it doesn't convert an NSString to UTF-8 to get it into the JavaScript
+ machinery. Use QString::fromNSString instead for now.
+
+2005-12-15 Darin Adler <darin at apple.com>
+
- fix crash caused by my last check-in
* khtml/ecma/domparser.cpp: (KJS::DOMParserProtoFunc::callAsFunction):
1.368 +4 -5 WebCore/khtml/khtml_part.cpp
Index: khtml_part.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/khtml_part.cpp,v
retrieving revision 1.367
retrieving revision 1.368
diff -u -r1.367 -r1.368
--- khtml_part.cpp 15 Dec 2005 22:31:23 -0000 1.367
+++ khtml_part.cpp 16 Dec 2005 08:08:11 -0000 1.368
@@ -2831,14 +2831,13 @@
return ret;
}
-void KHTMLPart::slotPartRemoved( KParts::Part *part )
+void KHTMLPart::slotPartRemoved(KParts::Part *part)
{
-// kdDebug(6050) << "KHTMLPart::slotPartRemoved " << part << endl;
- if ( part == d->m_activeFrame )
- d->m_activeFrame = 0L;
+ if (part == d->m_activeFrame)
+ d->m_activeFrame = 0;
}
-DOM::EventListener *KHTMLPart::createHTMLEventListener( QString code, NodeImpl *node )
+DOM::EventListener *KHTMLPart::createHTMLEventListener(const DOMString& code, NodeImpl *node)
{
if (KJSProxyImpl *proxy = jScript())
return proxy->createHTMLEventHandler(code, node);
1.145 +1 -1 WebCore/khtml/khtml_part.h
Index: khtml_part.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/khtml_part.h,v
retrieving revision 1.144
retrieving revision 1.145
diff -u -r1.144 -r1.145
--- khtml_part.h 15 Dec 2005 22:31:26 -0000 1.144
+++ khtml_part.h 16 Dec 2005 08:08:11 -0000 1.145
@@ -1154,7 +1154,7 @@
bool requestObject( khtml::ChildFrame *child, const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
- DOM::EventListener *createHTMLEventListener( QString code, DOM::NodeImpl *node );
+ DOM::EventListener *createHTMLEventListener(const DOM::DOMString& code, DOM::NodeImpl *node);
public:
DOM::DocumentImpl *xmlDocImpl() const;
1.120 +1 -1 WebCore/khtml/ecma/kjs_dom.cpp
Index: kjs_dom.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_dom.cpp,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -r1.119 -r1.120
--- kjs_dom.cpp 13 Dec 2005 21:29:28 -0000 1.119
+++ kjs_dom.cpp 16 Dec 2005 08:08:12 -0000 1.120
@@ -629,7 +629,7 @@
{
DOM::EventListener *listener = m_impl->getHTMLEventListener(eventType);
JSEventListener *jsListener = static_cast<JSEventListener*>(listener);
- if ( jsListener && jsListener->listenerObjImp() )
+ if (jsListener && jsListener->listenerObj())
return jsListener->listenerObj();
else
return jsNull();
1.78 +146 -237 WebCore/khtml/ecma/kjs_events.cpp
Index: kjs_events.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_events.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -r1.77 -r1.78
--- kjs_events.cpp 14 Dec 2005 23:31:45 -0000 1.77
+++ kjs_events.cpp 16 Dec 2005 08:08:12 -0000 1.78
@@ -36,224 +36,190 @@
#include <kdebug.h>
-using namespace DOM::EventNames;
-
-using DOM::AtomicString;
-using DOM::ClipboardEventImpl;
-using DOM::DocumentImpl;
-using DOM::DOMString;
-using DOM::EventImpl;
-using DOM::EventListenerEvent;
-using DOM::KeyboardEventImpl;
-using DOM::MouseEventImpl;
-using DOM::UIEventImpl;
-using DOM::MutationEventImpl;
-using DOM::MouseRelatedEventImpl;
-using DOM::NodeImpl;
-using DOM::WheelEventImpl;
-
-using khtml::RenderObject;
+using namespace DOM;
+using namespace EventNames;
+using namespace khtml;
namespace KJS {
-// -------------------------------------------------------------------------
-
-JSAbstractEventListener::JSAbstractEventListener(bool _html)
- : html(_html)
+static JSValue* jsStringOrUndefined(const DOMString& str)
{
+ return str.isNull() ? jsUndefined() : jsString(str);
}
-JSAbstractEventListener::~JSAbstractEventListener()
+// -------------------------------------------------------------------------
+
+JSAbstractEventListener::JSAbstractEventListener(bool _html)
+ : html(_html)
{
}
void JSAbstractEventListener::handleEvent(EventListenerEvent ele, bool isWindowEvent)
{
#ifdef KJS_DEBUGGER
- if (KJSDebugWin::instance() && KJSDebugWin::instance()->inSession())
- return;
+ if (KJSDebugWin::instance() && KJSDebugWin::instance()->inSession())
+ return;
#endif
- EventImpl *evt = ele;
+ EventImpl *event = ele;
- JSObject *listener = listenerObj();
- JSObject *win = windowObj();
+ JSObject* listener = listenerObj();
+ if (!listener)
+ return;
+
+ Window* window = windowObj();
+ KHTMLPart* part = window->part();
+ if (!part)
+ return;
+ KJSProxyImpl* proxy = part->jScript();
+ if (!proxy)
+ return;
- KHTMLPart *part = static_cast<Window*>(win)->part();
- KJSProxyImpl *proxy = 0;
- if (part)
- proxy = part->jScript();
- if (!proxy)
- return;
-
- JSLock lock;
+ JSLock lock;
- ScriptInterpreter *interpreter = proxy->interpreter();
- ExecState *exec = interpreter->globalExec();
+ ScriptInterpreter* interpreter = proxy->interpreter();
+ ExecState* exec = interpreter->globalExec();
- bool hasHandleEvent = false;
- JSValue *handleEventFuncValue = 0;
- JSObject *handleEventFunc = 0;
-
- handleEventFuncValue = listener->get(exec, "handleEvent");
- if (handleEventFuncValue->isObject()) {
- handleEventFunc = static_cast<JSObject *>(handleEventFuncValue);
-
- if (handleEventFunc->implementsCall())
- hasHandleEvent = true;
- }
+ bool hasHandleEvent = false;
+ JSValue* handleEventFuncValue = listener->get(exec, "handleEvent");
+ JSObject* handleEventFunc = 0;
+ if (handleEventFuncValue->isObject()) {
+ handleEventFunc = static_cast<JSObject*>(handleEventFuncValue);
+ if (!handleEventFunc->implementsCall())
+ handleEventFunc = 0;
+ }
- if (listener->implementsCall() || hasHandleEvent) {
- ref();
-
- List args;
- args.append(getDOMEvent(exec,evt));
+ if (handleEventFunc || listener->implementsCall()) {
+ ref();
- Window *window = static_cast<Window*>(win);
- // Set the event we're handling in the Window object
- window->setCurrentEvent(evt);
- // ... and in the interpreter
- interpreter->setCurrentEvent(evt);
+ List args;
+ args.append(getDOMEvent(exec, event));
- JSObject *thisObj;
- if (isWindowEvent) {
- thisObj = win;
- } else {
- thisObj = static_cast<JSObject *>(getDOMNode(exec, evt->currentTarget()));
- }
+ // Set the event we're handling in the Window object
+ window->setCurrentEvent(event);
+ // ... and in the interpreter
+ interpreter->setCurrentEvent(event);
- JSValue *retval;
- if (hasHandleEvent)
- retval = handleEventFunc->call(exec, listener, args);
- else
- retval = listener->call(exec, thisObj, args);
-
- window->setCurrentEvent( 0 );
- interpreter->setCurrentEvent( 0 );
- if ( exec->hadException() ) {
- char *message = exec->exception()->toObject(exec)->get(exec, messagePropertyName)->toString(exec).ascii();
- int lineNumber = exec->exception()->toObject(exec)->get(exec, "line")->toInt32(exec);
- QString sourceURL;
- {
- // put this in a block to make sure UString is deallocated inside the lock
- UString uSourceURL = exec->exception()->toObject(exec)->get(exec, "sourceURL")->toString(exec);
- sourceURL = uSourceURL.qstring();
- }
- if (Interpreter::shouldPrintExceptions()) {
- printf("(event handler):%s\n", message);
- }
- KWQ(part)->addMessageToConsole(message, lineNumber, sourceURL);
-
- if (Interpreter::shouldPrintExceptions())
- printf("(event handler):%s\n", message);
- exec->clearException();
- } else {
- if (!retval->isUndefinedOrNull() && evt->storesResultAsString())
- evt->storeResult(retval->toString(exec).domString());
+ JSValue* retval;
+ if (hasHandleEvent)
+ retval = handleEventFunc->call(exec, listener, args);
+ else {
+ JSObject* thisObj;
+ if (isWindowEvent)
+ thisObj = window;
+ else
+ thisObj = static_cast<JSObject*>(getDOMNode(exec, event->currentTarget()));
+ retval = listener->call(exec, thisObj, args);
+ }
+
+ window->setCurrentEvent(0);
+ interpreter->setCurrentEvent(0);
+
+ if (exec->hadException()) {
+ JSObject* exception = exec->exception()->toObject(exec);
+ QString message = exception->get(exec, messagePropertyName)->toString(exec).qstring();
+ int lineNumber = exception->get(exec, "line")->toInt32(exec);
+ QString sourceURL = exception->get(exec, "sourceURL")->toString(exec).qstring();
+ if (Interpreter::shouldPrintExceptions())
+ printf("(event handler):%s\n", message.local8Bit().data());
+ KWQ(part)->addMessageToConsole(message, lineNumber, sourceURL);
+ exec->clearException();
+ } else {
+ if (!retval->isUndefinedOrNull() && event->storesResultAsString())
+ event->storeResult(retval->toString(exec).domString());
if (html) {
QVariant ret = ValueToVariant(exec, retval);
- if (ret.type() == QVariant::Bool && ret.toBool() == false)
- evt->preventDefault();
+ if (ret.type() == QVariant::Bool && !ret.toBool())
+ event->preventDefault();
}
- }
-
- DOM::DocumentImpl::updateDocumentsRendering();
- deref();
- }
+ }
+
+ DocumentImpl::updateDocumentsRendering();
+ deref();
+ }
}
-DOM::DOMString JSAbstractEventListener::eventListenerType()
+DOMString JSAbstractEventListener::eventListenerType()
{
if (html)
return "_khtml_HTMLEventListener";
- else
- return "_khtml_JSEventListener";
+ return "_khtml_JSEventListener";
}
// -------------------------------------------------------------------------
-JSUnprotectedEventListener::JSUnprotectedEventListener(JSObject *_listener, JSObject *_win, bool _html)
+JSUnprotectedEventListener::JSUnprotectedEventListener(JSObject* _listener, Window* _win, bool _html)
: JSAbstractEventListener(_html)
, listener(_listener)
, win(_win)
{
- if (_listener) {
- static_cast<Window*>(win)->jsUnprotectedEventListeners.insert(_listener, this);
- }
+ if (_listener)
+ _win->jsUnprotectedEventListeners.insert(_listener, this);
}
JSUnprotectedEventListener::~JSUnprotectedEventListener()
{
- if (listener) {
- if (win) {
- static_cast<Window*>(win)->jsUnprotectedEventListeners.remove(listener);
- }
- }
+ if (listener && win)
+ win->jsUnprotectedEventListeners.remove(listener);
}
-JSObject *JSUnprotectedEventListener::listenerObj() const
+JSObject* JSUnprotectedEventListener::listenerObj() const
{
return listener;
}
-JSObject *JSUnprotectedEventListener::windowObj() const
+Window* JSUnprotectedEventListener::windowObj() const
{
return win;
}
void JSUnprotectedEventListener::clearWindowObj()
{
- win = NULL;
+ win = 0;
}
-
void JSUnprotectedEventListener::mark()
{
- JSObject *listenerImp = listener;
- if (listenerImp && !listenerImp->marked())
- listenerImp->mark();
+ if (listener && !listener->marked())
+ listener->mark();
}
// -------------------------------------------------------------------------
-JSEventListener::JSEventListener(JSObject *_listener, JSObject *_win, bool _html)
- : JSAbstractEventListener(_html)
- , listener(_listener)
- , win(_win)
+JSEventListener::JSEventListener(JSObject* _listener, Window* _win, bool _html)
+ : JSAbstractEventListener(_html)
+ , listener(_listener)
+ , win(_win)
{
if (_listener)
- static_cast<Window*>(_win)->jsEventListeners.insert(_listener, this);
+ _win->jsEventListeners.insert(_listener, this);
}
JSEventListener::~JSEventListener()
{
- if (JSObject *l = listener) {
- JSObject *w = win;
- if (w) {
- static_cast<Window *>(w)->jsEventListeners.remove(l);
- }
- }
+ if (listener && win)
+ win->jsEventListeners.remove(listener);
}
-JSObject *JSEventListener::listenerObj() const
+JSObject* JSEventListener::listenerObj() const
{
return listener;
}
-JSObject *JSEventListener::windowObj() const
+Window* JSEventListener::windowObj() const
{
return win;
}
void JSEventListener::clearWindowObj()
{
- win = NULL;
+ win = 0;
}
// -------------------------------------------------------------------------
-JSLazyEventListener::JSLazyEventListener(QString _code, JSObject *_win, NodeImpl *_originalNode, int lineno)
- : JSEventListener(NULL, _win, true),
+JSLazyEventListener::JSLazyEventListener(const DOMString& _code, Window* _win, NodeImpl* _originalNode, int lineno)
+ : JSEventListener(0, _win, true),
code(_code),
parsed(false)
{
@@ -268,22 +234,13 @@
originalNode = _originalNode;
}
-void JSLazyEventListener::handleEvent(EventListenerEvent evt, bool isWindowEvent)
+JSObject* JSLazyEventListener::listenerObj() const
{
parseCode();
- JSObject *listenerObj = listener;
- if (listenerObj)
- JSEventListener::handleEvent(evt, isWindowEvent);
+ return listener;
}
-
-JSObject *JSLazyEventListener::listenerObj() const
-{
- parseCode();
- return listener;
-}
-
-JSValue *JSLazyEventListener::eventParameterName() const
+JSValue* JSLazyEventListener::eventParameterName() const
{
static ProtectedPtr<JSValue> eventString = jsString("event");
return eventString.get();
@@ -291,68 +248,59 @@
void JSLazyEventListener::parseCode() const
{
- if (!parsed) {
- JSObject *w = win;
- KHTMLPart *part = static_cast<Window *>(w)->part();
+ if (parsed)
+ return;
+ parsed = true;
+
+ KHTMLPart *part = windowObj()->part();
KJSProxyImpl *proxy = 0;
if (part)
- proxy = part->jScript();
+ proxy = part->jScript();
if (proxy) {
- ScriptInterpreter *interpreter = proxy->interpreter();
- ExecState *exec = interpreter->globalExec();
-
- JSLock lock;
- JSObject *constr = interpreter->builtinFunction();
- List args;
-
- UString sourceURL(part->m_url.url());
- args.append(eventParameterName());
- args.append(jsString(code));
- listener = constr->construct(exec, args, sourceURL, lineNumber); // ### is globalExec ok ?
-
- if (exec->hadException()) {
- exec->clearException();
-
- // failed to parse, so let's just make this listener a no-op
- listener = NULL;
- } else if (originalNode) {
- // Add the event's home element to the scope
- // (and the document, and the form - see HTMLElement::eventHandlerScope)
- ScopeChain scope = listener->scope();
-
- JSObject *thisObj;
- { // scope
- JSLock lock;
- thisObj = static_cast<JSObject *>(getDOMNode(exec, originalNode));
- }
+ ScriptInterpreter* interpreter = proxy->interpreter();
+ ExecState* exec = interpreter->globalExec();
- if (thisObj) {
- static_cast<DOMNode*>(thisObj)->pushEventHandlerScope(exec, scope);
- listener->setScope(scope);
+ JSLock lock;
+ JSObject* constr = interpreter->builtinFunction();
+ List args;
+
+ UString sourceURL(part->m_url.url());
+ args.append(eventParameterName());
+ args.append(jsString(code));
+ listener = constr->construct(exec, args, sourceURL, lineNumber); // ### is globalExec ok ?
+
+ if (exec->hadException()) {
+ exec->clearException();
+
+ // failed to parse, so let's just make this listener a no-op
+ listener = 0;
+ } else if (originalNode) {
+ // Add the event's home element to the scope
+ // (and the document, and the form - see HTMLElement::eventHandlerScope)
+ ScopeChain scope = listener->scope();
+
+ JSValue* thisObj = getDOMNode(exec, originalNode);
+ if (thisObj->isObject()) {
+ static_cast<DOMNode*>(thisObj)->pushEventHandlerScope(exec, scope);
+ listener->setScope(scope);
+ }
}
- }
}
// no more need to keep the unparsed code around
- code = QString();
-
- if (JSObject *l = listener) {
- JSObject *w = win;
- static_cast<Window *>(w)->jsEventListeners.insert(l, const_cast<JSLazyEventListener *>(this));
- }
-
- parsed = true;
- }
+ code = DOMString();
+
+ if (listener)
+ windowObj()->jsEventListeners.insert(listener, const_cast<JSLazyEventListener*>(this));
}
-JSValue *getNodeEventListener(NodeImpl *n, const AtomicString &eventType)
+JSValue* getNodeEventListener(NodeImpl* n, const AtomicString& eventType)
{
- JSAbstractEventListener *listener = static_cast<JSAbstractEventListener *>(n->getHTMLEventListener(eventType));
- if (listener)
- if (JSValue *obj = listener->listenerObjImp())
- return obj;
- return jsNull();
+ if (JSAbstractEventListener* listener = static_cast<JSAbstractEventListener*>(n->getHTMLEventListener(eventType)))
+ if (JSValue* obj = listener->listenerObj())
+ return obj;
+ return jsNull();
}
// -------------------------------------------------------------------------
@@ -635,10 +583,6 @@
setPrototype(DOMUIEventProto::self(exec));
}
-DOMUIEvent::~DOMUIEvent()
-{
-}
-
bool DOMUIEvent::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticValueSlot<DOMUIEvent, DOMEvent>(exec, &DOMUIEventTable, this, propertyName, slot);
@@ -726,10 +670,6 @@
setPrototype(DOMMouseEventProto::self(exec));
}
-DOMMouseEvent::~DOMMouseEvent()
-{
-}
-
bool DOMMouseEvent::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticValueSlot<DOMMouseEvent, DOMUIEvent>(exec, &DOMMouseEventTable, this, propertyName, slot);
@@ -856,15 +796,6 @@
setPrototype(DOMKeyboardEventProto::self(exec));
}
-DOMKeyboardEvent::~DOMKeyboardEvent()
-{
-}
-
-const ClassInfo* DOMKeyboardEvent::classInfo() const
-{
- return &info;
-}
-
bool DOMKeyboardEvent::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticValueSlot<DOMKeyboardEvent, DOMUIEvent>(exec, &DOMKeyboardEventTable, this, propertyName, slot);
@@ -968,10 +899,6 @@
setPrototype(DOMMutationEventProto::self(exec));
}
-DOMMutationEvent::~DOMMutationEvent()
-{
-}
-
bool DOMMutationEvent::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
{
return getStaticValueSlot<DOMMutationEvent, DOMEvent>(exec, &DOMMutationEventTable, this, propertyName, slot);
@@ -1118,24 +1045,6 @@
: clipboard(cb)
{
setPrototype(ClipboardProto::self(exec));
-
- if (clipboard)
- clipboard->ref();
-}
-
-Clipboard::~Clipboard()
-{
- if (clipboard)
- clipboard->deref();
-}
-
-static JSValue *stringOrUndefined(const DOM::DOMString &str)
-{
- if (str.isNull()) {
- return jsUndefined();
- } else {
- return jsString(str);
- }
}
bool Clipboard::getOwnPropertySlot(ExecState *exec, const Identifier& propertyName, PropertySlot& slot)
@@ -1148,10 +1057,10 @@
switch (token) {
case DropEffect:
assert(clipboard->isForDragging() || clipboard->dropEffect().isNull());
- return stringOrUndefined(clipboard->dropEffect());
+ return jsStringOrUndefined(clipboard->dropEffect());
case EffectAllowed:
assert(clipboard->isForDragging() || clipboard->effectAllowed().isNull());
- return stringOrUndefined(clipboard->effectAllowed());
+ return jsStringOrUndefined(clipboard->effectAllowed());
case Types:
{
QStringList qTypes = clipboard->types();
1.38 +186 -196 WebCore/khtml/ecma/kjs_events.h
Index: kjs_events.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_events.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- kjs_events.h 14 Dec 2005 23:31:45 -0000 1.37
+++ kjs_events.h 16 Dec 2005 08:08:12 -0000 1.38
@@ -39,212 +39,202 @@
namespace KJS {
- class Window;
- class Clipboard;
+ class Window;
+ class Clipboard;
- class JSAbstractEventListener : public DOM::EventListener {
- public:
- JSAbstractEventListener(bool _html = false);
- virtual ~JSAbstractEventListener();
- virtual void handleEvent(DOM::EventListenerEvent evt, bool isWindowEvent);
- virtual DOM::DOMString eventListenerType();
- virtual JSObject *listenerObj() const = 0;
- virtual JSObject *windowObj() const = 0;
- JSObject *listenerObjImp() const { return listenerObj(); }
- protected:
- bool html;
- };
-
- class JSUnprotectedEventListener : public JSAbstractEventListener {
- public:
- JSUnprotectedEventListener(JSObject *_listener, JSObject *_win, bool _html = false);
- virtual ~JSUnprotectedEventListener();
- virtual JSObject *listenerObj() const;
- virtual JSObject *windowObj() const;
- void clearWindowObj();
- void mark();
- protected:
- JSObject *listener;
- JSObject *win;
- };
-
- class JSEventListener : public JSAbstractEventListener {
- public:
- JSEventListener(JSObject *_listener, JSObject *_win, bool _html = false);
- virtual ~JSEventListener();
- virtual JSObject *listenerObj() const;
- virtual JSObject *windowObj() const;
- void clearWindowObj();
- protected:
- mutable ProtectedPtr<JSObject> listener;
- ProtectedPtr<JSObject> win;
- };
-
- class JSLazyEventListener : public JSEventListener {
- public:
- JSLazyEventListener(QString _code, JSObject *_win, DOM::NodeImpl *node, int lineno = 0);
- virtual void handleEvent(DOM::EventListenerEvent evt, bool isWindowEvent);
- JSObject *listenerObj() const;
-
- protected:
- virtual JSValue *eventParameterName() const;
-
- private:
- void parseCode() const;
-
- mutable QString code;
- mutable bool parsed;
- int lineNumber;
- DOM::NodeImpl *originalNode;
- };
-
- JSValue *getNodeEventListener(DOM::NodeImpl *n, const DOM::AtomicString &eventType);
-
- // Constructor for Event - currently only used for some global vars
- class EventConstructor : public DOMObject {
- public:
- EventConstructor(ExecState *) { }
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
- // no put - all read-only
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- };
-
- JSValue *getEventConstructor(ExecState *exec);
-
- class DOMEvent : public DOMObject {
- public:
- DOMEvent(ExecState *exec, DOM::EventImpl *e);
- ~DOMEvent();
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName,
- JSValue *value, int attr = None);
- void putValueProperty(ExecState *exec, int token, JSValue *value, int);
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- enum { Type, Target, CurrentTarget, EventPhase, Bubbles,
- Cancelable, TimeStamp, StopPropagation, PreventDefault, InitEvent,
- // MS IE equivalents
- SrcElement, ReturnValue, CancelBubble, ClipboardData, DataTransfer };
- DOM::EventImpl *impl() const { return m_impl.get(); }
- protected:
- RefPtr<DOM::EventImpl> m_impl;
- mutable Clipboard *clipboard;
- };
-
- JSValue *getDOMEvent(ExecState *exec, DOM::EventImpl *e);
-
- DOM::EventImpl *toEvent(JSValue *); // returns 0 if value is not a DOMEvent object
-
- // Constructor object EventException
- class EventExceptionConstructor : public DOMObject {
- public:
- EventExceptionConstructor(ExecState *) { }
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
- // no put - all read-only
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- };
-
- JSValue *getEventExceptionConstructor(ExecState *exec);
-
- class DOMUIEvent : public DOMEvent {
- public:
- DOMUIEvent(ExecState *exec, DOM::UIEventImpl *ue);
- ~DOMUIEvent();
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
- // no put - all read-only
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- enum { View, Detail, KeyCode, CharCode, LayerX, LayerY, PageX, PageY, Which, InitUIEvent };
- };
-
- class DOMMouseEvent : public DOMUIEvent {
- public:
- DOMMouseEvent(ExecState *exec, DOM::MouseEventImpl *me);
- ~DOMMouseEvent();
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
- virtual void mark();
- // no put - all read-only
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- enum { ScreenX, ScreenY, ClientX, X, ClientY, Y, OffsetX, OffsetY,
- CtrlKey, ShiftKey, AltKey,
- MetaKey, Button, RelatedTarget, FromElement, ToElement,
- InitMouseEvent };
- };
-
- class DOMKeyboardEvent : public DOMUIEvent {
- public:
- DOMKeyboardEvent(ExecState *exec, DOM::KeyboardEventImpl *ke);
- ~DOMKeyboardEvent();
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
- // no put - all read-only
- virtual const ClassInfo* classInfo() const;
- static const ClassInfo info;
- enum { KeyIdentifier, KeyLocation, CtrlKey, ShiftKey, AltKey, MetaKey, AltGraphKey, InitKeyboardEvent};
- };
-
- // Constructor object MutationEvent
- class MutationEventConstructor : public DOMObject {
- public:
- MutationEventConstructor(ExecState *) { }
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
- // no put - all read-only
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- };
-
- JSValue *getMutationEventConstructor(ExecState *exec);
-
- class DOMMutationEvent : public DOMEvent {
- public:
- DOMMutationEvent(ExecState *exec, DOM::MutationEventImpl *me);
- ~DOMMutationEvent();
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
- // no put - all read-only
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- enum { AttrChange, RelatedNode, AttrName, PrevValue, NewValue,
- InitMutationEvent };
- };
+ class JSAbstractEventListener : public DOM::EventListener {
+ public:
+ JSAbstractEventListener(bool HTML = false);
+ virtual void handleEvent(DOM::EventListenerEvent, bool isWindowEvent);
+ virtual DOM::DOMString eventListenerType();
+ virtual JSObject* listenerObj() const = 0;
+ virtual Window* windowObj() const = 0;
+ private:
+ bool html;
+ };
+
+ class JSUnprotectedEventListener : public JSAbstractEventListener {
+ public:
+ JSUnprotectedEventListener(JSObject* listener, Window*, bool HTML = false);
+ virtual ~JSUnprotectedEventListener();
+ virtual JSObject* listenerObj() const;
+ virtual Window* windowObj() const;
+ void clearWindowObj();
+ virtual void mark();
+ private:
+ JSObject* listener;
+ Window* win;
+ };
+
+ class JSEventListener : public JSAbstractEventListener {
+ public:
+ JSEventListener(JSObject* listener, Window*, bool HTML = false);
+ virtual ~JSEventListener();
+ virtual JSObject* listenerObj() const;
+ virtual Window* windowObj() const;
+ void clearWindowObj();
+ protected:
+ mutable ProtectedPtr<JSObject> listener;
+ private:
+ ProtectedPtr<Window> win;
+ };
+
+ class JSLazyEventListener : public JSEventListener {
+ public:
+ JSLazyEventListener(const DOM::DOMString& code, Window*, DOM::NodeImpl*, int lineno = 0);
+ virtual JSObject *listenerObj() const;
+ protected:
+ virtual JSValue *eventParameterName() const;
+ private:
+ void parseCode() const;
+
+ mutable DOM::DOMString code;
+ mutable bool parsed;
+ int lineNumber;
+ DOM::NodeImpl* originalNode;
+ };
+
+ JSValue* getNodeEventListener(DOM::NodeImpl* n, const DOM::AtomicString& eventType);
+
+ // Constructor for Event - currently only used for some global vars
+ class EventConstructor : public DOMObject {
+ public:
+ EventConstructor(ExecState*) { }
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
+ // no put - all read-only
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ };
+
+ JSValue* getEventConstructor(ExecState*);
+
+ class DOMEvent : public DOMObject {
+ public:
+ DOMEvent(ExecState*, DOM::EventImpl*);
+ virtual ~DOMEvent();
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
+ virtual void put(ExecState*, const Identifier&, JSValue*, int attr = None);
+ void putValueProperty(ExecState*, int token, JSValue*, int);
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ enum { Type, Target, CurrentTarget, EventPhase, Bubbles,
+ Cancelable, TimeStamp, StopPropagation, PreventDefault, InitEvent,
+ // MS IE equivalents
+ SrcElement, ReturnValue, CancelBubble, ClipboardData, DataTransfer };
+ DOM::EventImpl *impl() const { return m_impl.get(); }
+ protected:
+ RefPtr<DOM::EventImpl> m_impl;
+ mutable Clipboard* clipboard;
+ };
+
+ JSValue* getDOMEvent(ExecState*, DOM::EventImpl*);
+
+ DOM::EventImpl* toEvent(JSValue*); // returns 0 if value is not a DOMEvent object
+
+ // Constructor object EventException
+ class EventExceptionConstructor : public DOMObject {
+ public:
+ EventExceptionConstructor(ExecState*) { }
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
+ // no put - all read-only
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ };
+
+ JSValue* getEventExceptionConstructor(ExecState*);
+
+ class DOMUIEvent : public DOMEvent {
+ public:
+ DOMUIEvent(ExecState*, DOM::UIEventImpl*);
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
+ // no put - all read-only
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ enum { View, Detail, KeyCode, CharCode, LayerX, LayerY, PageX, PageY, Which, InitUIEvent };
+ };
+
+ class DOMMouseEvent : public DOMUIEvent {
+ public:
+ DOMMouseEvent(ExecState*, DOM::MouseEventImpl *me);
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
+ virtual void mark();
+ // no put - all read-only
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ enum { ScreenX, ScreenY, ClientX, X, ClientY, Y, OffsetX, OffsetY,
+ CtrlKey, ShiftKey, AltKey,
+ MetaKey, Button, RelatedTarget, FromElement, ToElement,
+ InitMouseEvent };
+ };
+
+ class DOMKeyboardEvent : public DOMUIEvent {
+ public:
+ DOMKeyboardEvent(ExecState*, DOM::KeyboardEventImpl *ke);
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
+ // no put - all read-only
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ enum { KeyIdentifier, KeyLocation, CtrlKey, ShiftKey, AltKey, MetaKey, AltGraphKey, InitKeyboardEvent};
+ };
+
+ // Constructor object MutationEvent
+ class MutationEventConstructor : public DOMObject {
+ public:
+ MutationEventConstructor(ExecState*) { }
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
+ // no put - all read-only
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ };
+
+ JSValue* getMutationEventConstructor(ExecState*);
+
+ class DOMMutationEvent : public DOMEvent {
+ public:
+ DOMMutationEvent(ExecState*, DOM::MutationEventImpl *me);
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
+ // no put - all read-only
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ enum { AttrChange, RelatedNode, AttrName, PrevValue, NewValue,
+ InitMutationEvent };
+ };
class DOMWheelEvent : public DOMUIEvent {
public:
- DOMWheelEvent(ExecState *, DOM::WheelEventImpl *);
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *, int token) const;
+ DOMWheelEvent(ExecState*, DOM::WheelEventImpl*);
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
// no put - all read-only
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
enum { ScreenX, ScreenY, ClientX, X, ClientY, Y, OffsetX, OffsetY,
- CtrlKey, ShiftKey, AltKey, MetaKey, WheelDelta };
+ CtrlKey, ShiftKey, AltKey, MetaKey, WheelDelta };
};
- class Clipboard : public DOMObject {
- friend class ClipboardProtoFunc;
- public:
- Clipboard(ExecState *exec, DOM::ClipboardImpl *ds);
- ~Clipboard();
- virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
- JSValue *getValueProperty(ExecState *exec, int token) const;
- virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
- void putValueProperty(ExecState *exec, int token, JSValue *value, int /*attr*/);
- virtual bool toBoolean(ExecState *) const { return true; }
- virtual const ClassInfo* classInfo() const { return &info; }
- static const ClassInfo info;
- enum { ClearData, GetData, SetData, Types, SetDragImage, DropEffect, EffectAllowed };
- private:
- DOM::ClipboardImpl *clipboard;
- };
+ class Clipboard : public DOMObject {
+ friend class ClipboardProtoFunc;
+ public:
+ Clipboard(ExecState*, DOM::ClipboardImpl *ds);
+ virtual bool getOwnPropertySlot(ExecState*, const Identifier&, PropertySlot&);
+ JSValue* getValueProperty(ExecState*, int token) const;
+ virtual void put(ExecState*, const Identifier&, JSValue*, int attr = None);
+ void putValueProperty(ExecState*, int token, JSValue*, int attr);
+ virtual bool toBoolean(ExecState*) const { return true; }
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ enum { ClearData, GetData, SetData, Types, SetDragImage, DropEffect, EffectAllowed };
+ private:
+ RefPtr<DOM::ClipboardImpl> clipboard;
+ };
} // namespace
1.157 +1 -1 WebCore/khtml/ecma/kjs_html.cpp
Index: kjs_html.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_html.cpp,v
retrieving revision 1.156
retrieving revision 1.157
diff -u -r1.156 -r1.157
--- kjs_html.cpp 16 Dec 2005 06:39:57 -0000 1.156
+++ kjs_html.cpp 16 Dec 2005 08:08:12 -0000 1.157
@@ -3645,7 +3645,7 @@
case Complete:
return jsBoolean(!img || img->status() >= khtml::CachedObject::Persistent);
case OnLoad:
- if (onLoadListener && onLoadListener->listenerObjImp()) {
+ if (onLoadListener && onLoadListener->listenerObj()) {
return onLoadListener->listenerObj();
} else {
return jsNull();
1.31 +14 -33 WebCore/khtml/ecma/kjs_proxy.cpp
Index: kjs_proxy.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_proxy.cpp,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- kjs_proxy.cpp 15 Dec 2005 22:31:36 -0000 1.30
+++ kjs_proxy.cpp 16 Dec 2005 08:08:13 -0000 1.31
@@ -26,41 +26,23 @@
#include <khtml_part.h>
#include <kjs/collector.h>
+using namespace DOM;
using namespace KJS;
-using DOM::EventListener;
-
-#ifndef NDEBUG
-int KJSProxyImpl::s_count = 0;
-#endif
-
KJSProxyImpl::KJSProxyImpl(KHTMLPart *part)
{
- m_script = 0;
- m_part = part;
- m_handlerLineno = 0;
-#ifndef NDEBUG
- s_count++;
-#endif
+ m_script = 0;
+ m_part = part;
+ m_handlerLineno = 0;
}
KJSProxyImpl::~KJSProxyImpl()
{
- JSLock lock;
- delete m_script;
-
-#ifndef NDEBUG
- s_count--;
- // If it was the last interpreter, we should have nothing left
-#ifdef KJS_DEBUG_MEM
- if (s_count == 0)
- Interpreter::finalCheck();
-#endif
-#endif
+ JSLock lock;
+ delete m_script;
}
-QVariant KJSProxyImpl::evaluate(QString filename, int baseLine,
- const QString&str, DOM::NodeImpl *n)
+QVariant KJSProxyImpl::evaluate(const DOMString& filename, int baseLine, const DOMString& str, NodeImpl *n)
{
// evaluate code. Returns the JS return value or an invalid QVariant
// if there was none, an error occured or the type couldn't be converted.
@@ -76,9 +58,8 @@
JSLock lock;
- KJS::JSValue *thisNode = n ? Window::retrieve(m_part) : getDOMNode(m_script->globalExec(), n);
- UString code(str);
- Completion comp = m_script->evaluate(filename, baseLine, code, thisNode);
+ KJS::JSValue* thisNode = n ? Window::retrieve(m_part) : getDOMNode(m_script->globalExec(), n);
+ Completion comp = m_script->evaluate(filename, baseLine, reinterpret_cast<KJS::UChar *>(str.unicode()), str.length(), thisNode);
bool success = ( comp.complType() == Normal ) || ( comp.complType() == ReturnValue );
@@ -107,14 +88,14 @@
}
}
-DOM::EventListener *KJSProxyImpl::createHTMLEventHandler(QString code, DOM::NodeImpl *node)
+EventListener *KJSProxyImpl::createHTMLEventHandler(const DOMString& code, NodeImpl *node)
{
- initScript();
- JSLock lock;
- return KJS::Window::retrieveWindow(m_part)->getJSLazyEventListener(code, node, m_handlerLineno);
+ initScript();
+ JSLock lock;
+ return KJS::Window::retrieveWindow(m_part)->getJSLazyEventListener(code, node, m_handlerLineno);
}
-void KJSProxyImpl::finishedWithEvent(DOM::EventImpl *event)
+void KJSProxyImpl::finishedWithEvent(EventImpl *event)
{
// This is called when the DOM implementation has finished with a particular event. This
// is the case in sitations where an event has been created just for temporary usage,
1.6 +12 -17 WebCore/khtml/ecma/kjs_proxy.h
Index: kjs_proxy.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_proxy.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- kjs_proxy.h 14 Dec 2005 23:31:46 -0000 1.5
+++ kjs_proxy.h 16 Dec 2005 08:08:13 -0000 1.6
@@ -1,4 +1,3 @@
-// -*- c-basic-offset: 2 -*-
/*
* This file is part of the KDE libraries
* Copyright (C) 1999 Harri Porten (porten at kde.org)
@@ -19,33 +18,33 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef _KJS_PROXY_H_
-#define _KJS_PROXY_H_
+#ifndef KJS_PROXY_H
+#define KJS_PROXY_H
#include <qvariant.h>
-#include <qstring.h>
class KHTMLPart;
+class QString;
namespace DOM {
- class EventImpl;
- class EventListener;
- class NodeImpl;
+ class DOMString;
+ class EventImpl;
+ class EventListener;
+ class NodeImpl;
};
namespace KJS {
- class List;
- class ScriptInterpreter;
+ class ScriptInterpreter;
}
class KJSProxyImpl {
public:
- KJSProxyImpl(KHTMLPart *part);
+ KJSProxyImpl(KHTMLPart*);
~KJSProxyImpl();
- QVariant evaluate(QString filename, int baseLine, const QString& str, DOM::NodeImpl *n);
+ QVariant evaluate(const DOM::DOMString& filename, int baseLine, const DOM::DOMString& code, DOM::NodeImpl*);
void clear();
- DOM::EventListener *createHTMLEventHandler(QString code, DOM::NodeImpl *node);
- void finishedWithEvent(DOM::EventImpl *event);
+ DOM::EventListener* createHTMLEventHandler(const DOM::DOMString& code, DOM::NodeImpl*);
+ void finishedWithEvent(DOM::EventImpl*);
KJS::ScriptInterpreter *interpreter();
void setEventHandlerLineno(int lineno) { m_handlerLineno = lineno; }
@@ -55,10 +54,6 @@
KJS::ScriptInterpreter* m_script;
KHTMLPart *m_part;
int m_handlerLineno;
-#ifndef NDEBUG
- static int s_count;
-#endif
};
-
#endif
1.201 +2 -2 WebCore/khtml/ecma/kjs_window.cpp
Index: kjs_window.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_window.cpp,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -r1.200 -r1.201
--- kjs_window.cpp 15 Dec 2005 22:31:36 -0000 1.200
+++ kjs_window.cpp 16 Dec 2005 08:08:13 -0000 1.201
@@ -1362,7 +1362,7 @@
return jsUndefined();
DOM::EventListener *listener = doc->getHTMLWindowEventListener(eventType);
- if (listener && static_cast<JSEventListener*>(listener)->listenerObjImp())
+ if (listener && static_cast<JSEventListener*>(listener)->listenerObj())
return static_cast<JSEventListener*>(listener)->listenerObj();
else
return jsNull();
@@ -1397,7 +1397,7 @@
return new JSUnprotectedEventListener(listenerObject, this, html);
}
-JSLazyEventListener *Window::getJSLazyEventListener(const QString& code, DOM::NodeImpl *node, int lineNumber)
+JSLazyEventListener *Window::getJSLazyEventListener(const DOMString& code, DOM::NodeImpl *node, int lineNumber)
{
return new JSLazyEventListener(code, this, node, lineNumber);
}
1.63 +17 -17 WebCore/khtml/ecma/kjs_window.h
Index: kjs_window.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/kjs_window.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- kjs_window.h 14 Dec 2005 23:31:47 -0000 1.62
+++ kjs_window.h 16 Dec 2005 08:08:14 -0000 1.63
@@ -94,7 +94,7 @@
class Screen : public JSObject {
public:
- Screen(ExecState *exec);
+ Screen(ExecState*);
enum {
Height, Width, ColorDepth, PixelDepth, AvailLeft, AvailTop, AvailHeight,
AvailWidth
@@ -131,13 +131,13 @@
* returns a pointer to the Window object this javascript interpreting instance
* was called from.
*/
- static Window *retrieveActive(ExecState *exec);
+ static Window *retrieveActive(ExecState*);
QGuardedPtr<KHTMLPart> part() const { return m_part; }
virtual void mark();
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
JSValue *getValueProperty(ExecState *exec, int token) const;
virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
- virtual bool toBoolean(ExecState *exec) const;
+ virtual bool toBoolean(ExecState*) const;
int installTimeout(const UString& handler, int t, bool singleShot) { return winq->installTimeout(handler, t, singleShot); }
int installTimeout(JSValue* function, List& args, int t, bool singleShot) { return winq->installTimeout(function, args, t, singleShot); }
@@ -149,21 +149,21 @@
void scheduleClose();
- bool isSafeScript(ExecState *exec) const;
+ bool isSafeScript(ExecState*) const;
static bool isSafeScript(const ScriptInterpreter *origin, const ScriptInterpreter *target);
Location *location() const;
Selection *selection() const;
- BarInfo *locationbar(ExecState *exec) const;
- BarInfo *menubar(ExecState *exec) const;
- BarInfo *personalbar(ExecState *exec) const;
- BarInfo *scrollbars(ExecState *exec) const;
- BarInfo *statusbar(ExecState *exec) const;
- BarInfo *toolbar(ExecState *exec) const;
- JSEventListener *getJSEventListener(JSValue *val, bool html = false);
- JSUnprotectedEventListener *getJSUnprotectedEventListener(JSValue *val, bool html = false);
- JSLazyEventListener *getJSLazyEventListener(const QString &code, DOM::NodeImpl *node, int lineno = 0);
- void clear( ExecState *exec );
- virtual UString toString(ExecState *exec) const;
+ BarInfo *locationbar(ExecState*) const;
+ BarInfo *menubar(ExecState*) const;
+ BarInfo *personalbar(ExecState*) const;
+ BarInfo *scrollbars(ExecState*) const;
+ BarInfo *statusbar(ExecState*) const;
+ BarInfo *toolbar(ExecState*) const;
+ JSEventListener *getJSEventListener(JSValue*, bool html = false);
+ JSUnprotectedEventListener *getJSUnprotectedEventListener(JSValue*, bool html = false);
+ JSLazyEventListener *getJSLazyEventListener(const DOM::DOMString& code, DOM::NodeImpl*, int lineno = 0);
+ void clear(ExecState *);
+ virtual UString toString(ExecState *) const;
// Set the current "event" object
void setCurrentEvent(DOM::EventImpl *evt);
@@ -246,7 +246,7 @@
JSValue *getValueProperty(ExecState *exec, int token) const;
virtual void put(ExecState *exec, const Identifier &propertyName, JSValue *value, int attr = None);
virtual JSValue *toPrimitive(ExecState *exec, Type preferred) const;
- virtual UString toString(ExecState *exec) const;
+ virtual UString toString(ExecState*) const;
enum { Hash, Href, Hostname, Host, Pathname, Port, Protocol, Search, EqualEqual,
Replace, Reload, ToString, Assign };
KHTMLPart *part() const { return m_part; }
@@ -263,7 +263,7 @@
virtual bool getOwnPropertySlot(ExecState *, const Identifier&, PropertySlot&);
JSValue *getValueProperty(ExecState *exec, int token) const;
virtual JSValue *toPrimitive(ExecState *exec, Type preferred) const;
- virtual UString toString(ExecState *exec) const;
+ virtual UString toString(ExecState*) const;
enum { AnchorNode, AnchorOffset, FocusNode, FocusOffset, BaseNode, BaseOffset, ExtentNode, ExtentOffset,
IsCollapsed, _Type, EqualEqual, Collapse, CollapseToEnd, CollapseToStart, Empty, ToString,
SetBaseAndExtent, SetPosition, Modify };
1.52 +2 -2 WebCore/khtml/ecma/xmlhttprequest.cpp
Index: xmlhttprequest.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/ecma/xmlhttprequest.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- xmlhttprequest.cpp 11 Dec 2005 02:06:08 -0000 1.51
+++ xmlhttprequest.cpp 16 Dec 2005 08:08:14 -0000 1.52
@@ -174,13 +174,13 @@
case StatusText:
return getStatusText();
case Onreadystatechange:
- if (onReadyStateChangeListener && onReadyStateChangeListener->listenerObjImp()) {
+ if (onReadyStateChangeListener && onReadyStateChangeListener->listenerObj()) {
return onReadyStateChangeListener->listenerObj();
} else {
return jsNull();
}
case Onload:
- if (onLoadListener && onLoadListener->listenerObjImp()) {
+ if (onLoadListener && onLoadListener->listenerObj()) {
return onLoadListener->listenerObj();
} else {
return jsNull();
1.86 +13 -26 WebCore/khtml/html/html_baseimpl.cpp
Index: html_baseimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_baseimpl.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- html_baseimpl.cpp 4 Dec 2005 01:21:09 -0000 1.85
+++ html_baseimpl.cpp 16 Dec 2005 08:08:16 -0000 1.86
@@ -148,26 +148,19 @@
if (attached())
getDocument()->recalcStyle(Force);
} else if (attr->name() == onloadAttr) {
- getDocument()->setHTMLWindowEventListener(loadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), NULL));
+ getDocument()->setHTMLWindowEventListener(loadEvent, attr);
} else if (attr->name() == onbeforeunloadAttr) {
- getDocument()->setHTMLWindowEventListener(beforeunloadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), NULL));
+ getDocument()->setHTMLWindowEventListener(beforeunloadEvent, attr);
} else if (attr->name() == onunloadAttr) {
- getDocument()->setHTMLWindowEventListener(unloadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), NULL));
+ getDocument()->setHTMLWindowEventListener(unloadEvent, attr);
} else if (attr->name() == onblurAttr) {
- getDocument()->setHTMLWindowEventListener(blurEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), NULL));
+ getDocument()->setHTMLWindowEventListener(blurEvent, attr);
} else if (attr->name() == onfocusAttr) {
- getDocument()->setHTMLWindowEventListener(focusEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), NULL));
+ getDocument()->setHTMLWindowEventListener(focusEvent, attr);
} else if (attr->name() == onresizeAttr) {
- getDocument()->setHTMLWindowEventListener(resizeEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), NULL));
+ getDocument()->setHTMLWindowEventListener(resizeEvent, attr);
} else if (attr->name() == onscrollAttr) {
- getDocument()->setHTMLWindowEventListener(scrollEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), NULL));
+ getDocument()->setHTMLWindowEventListener(scrollEvent, attr);
} else
HTMLElementImpl::parseMappedAttribute(attr);
}
@@ -420,14 +413,11 @@
m_scrolling = QScrollView::AlwaysOff;
// FIXME: If we are already attached, this has no effect.
} else if (attr->name() == onloadAttr) {
- setHTMLEventListener(loadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(loadEvent, attr);
} else if (attr->name() == onbeforeunloadAttr) {
- setHTMLEventListener(beforeunloadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(beforeunloadEvent, attr);
} else if (attr->name() == onunloadAttr) {
- setHTMLEventListener(unloadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(unloadEvent, attr);
} else
HTMLElementImpl::parseMappedAttribute(attr);
}
@@ -707,14 +697,11 @@
if(!m_border)
frameborder = false;
} else if (attr->name() == onloadAttr) {
- setHTMLEventListener(loadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(loadEvent, attr);
} else if (attr->name() == onbeforeunloadAttr) {
- setHTMLEventListener(beforeunloadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(beforeunloadEvent, attr);
} else if (attr->name() == onunloadAttr) {
- setHTMLEventListener(unloadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(unloadEvent, attr);
} else
HTMLElementImpl::parseMappedAttribute(attr);
}
1.113 +34 -58 WebCore/khtml/html/html_elementimpl.cpp
Index: html_elementimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_elementimpl.cpp,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- html_elementimpl.cpp 1 Dec 2005 10:32:18 -0000 1.112
+++ html_elementimpl.cpp 16 Dec 2005 08:08:17 -0000 1.113
@@ -160,92 +160,63 @@
}
// standard events
else if (attr->name() == onclickAttr) {
- setHTMLEventListener(clickEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(clickEvent, attr);
} else if (attr->name() == oncontextmenuAttr) {
- setHTMLEventListener(contextmenuEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(contextmenuEvent, attr);
} else if (attr->name() == ondblclickAttr) {
- setHTMLEventListener(khtmlDblclickEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(khtmlDblclickEvent, attr);
} else if (attr->name() == onmousedownAttr) {
- setHTMLEventListener(mousedownEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(mousedownEvent, attr);
} else if (attr->name() == onmousemoveAttr) {
- setHTMLEventListener(mousemoveEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(mousemoveEvent, attr);
} else if (attr->name() == onmouseoutAttr) {
- setHTMLEventListener(mouseoutEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(mouseoutEvent, attr);
} else if (attr->name() == onmouseoverAttr) {
- setHTMLEventListener(mouseoverEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(mouseoverEvent, attr);
} else if (attr->name() == onmouseupAttr) {
- setHTMLEventListener(mouseupEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(mouseupEvent, attr);
} else if (attr->name() == onmousewheelAttr) {
- setHTMLEventListener(mousewheelEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(mousewheelEvent, attr);
} else if (attr->name() == onfocusAttr) {
- setHTMLEventListener(DOMFocusInEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(DOMFocusInEvent, attr);
} else if (attr->name() == onblurAttr) {
- setHTMLEventListener(DOMFocusOutEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(DOMFocusOutEvent, attr);
} else if (attr->name() == onkeydownAttr) {
- setHTMLEventListener(keydownEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(keydownEvent, attr);
} else if (attr->name() == onkeypressAttr) {
- setHTMLEventListener(keypressEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(keypressEvent, attr);
} else if (attr->name() == onkeyupAttr) {
- setHTMLEventListener(keyupEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(keyupEvent, attr);
} else if (attr->name() == onscrollAttr) {
- setHTMLEventListener(scrollEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(scrollEvent, attr);
} else if (attr->name() == onbeforecutAttr) {
- setHTMLEventListener(beforecutEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(beforecutEvent, attr);
} else if (attr->name() == oncutAttr) {
- setHTMLEventListener(cutEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(cutEvent, attr);
} else if (attr->name() == onbeforecopyAttr) {
- setHTMLEventListener(beforecopyEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(beforecopyEvent, attr);
} else if (attr->name() == oncopyAttr) {
- setHTMLEventListener(copyEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(copyEvent, attr);
} else if (attr->name() == onbeforepasteAttr) {
- setHTMLEventListener(beforepasteEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(beforepasteEvent, attr);
} else if (attr->name() == onpasteAttr) {
- setHTMLEventListener(pasteEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(pasteEvent, attr);
} else if (attr->name() == ondragenterAttr) {
- setHTMLEventListener(dragenterEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(dragenterEvent, attr);
} else if (attr->name() == ondragoverAttr) {
- setHTMLEventListener(dragoverEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(dragoverEvent, attr);
} else if (attr->name() == ondragleaveAttr) {
- setHTMLEventListener(dragleaveEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(dragleaveEvent, attr);
} else if (attr->name() == ondropAttr) {
- setHTMLEventListener(dropEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(dropEvent, attr);
} else if (attr->name() == ondragstartAttr) {
- setHTMLEventListener(dragstartEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(dragstartEvent, attr);
} else if (attr->name() == ondragAttr) {
- setHTMLEventListener(dragEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(dragEvent, attr);
} else if (attr->name() == ondragendAttr) {
- setHTMLEventListener(dragendEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(dragendEvent, attr);
} else if (attr->name() == onselectstartAttr) {
- setHTMLEventListener(selectstartEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(selectstartEvent, attr);
}
}
@@ -854,3 +825,8 @@
return true;
return inEitherTagList(newChild);
}
+
+void HTMLElementImpl::setHTMLEventListener(const AtomicString& eventType, AttributeImpl* attr)
+{
+ ElementImpl::setHTMLEventListener(eventType, getDocument()->createHTMLEventListener(attr->value(), this));
+}
1.41 +2 -0 WebCore/khtml/html/html_elementimpl.h
Index: html_elementimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_elementimpl.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- html_elementimpl.h 1 Dec 2005 10:32:18 -0000 1.40
+++ html_elementimpl.h 16 Dec 2005 08:08:17 -0000 1.41
@@ -97,6 +97,8 @@
static bool inBlockTagList(const NodeImpl* newChild);
static bool isRecognizedTagName(const QualifiedName& tagName);
+ void setHTMLEventListener(const AtomicString& eventType, AttributeImpl*);
+
protected:
// for IMG, OBJECT and APPLET
1.212 +19 -38 WebCore/khtml/html/html_formimpl.cpp
Index: html_formimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_formimpl.cpp,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -r1.211 -r1.212
--- html_formimpl.cpp 15 Dec 2005 23:40:37 -0000 1.211
+++ html_formimpl.cpp 16 Dec 2005 08:08:17 -0000 1.212
@@ -588,11 +588,9 @@
} else if (attr->name() == autocompleteAttr) {
m_autocomplete = strcasecmp( attr->value(), "off" );
} else if (attr->name() == onsubmitAttr) {
- setHTMLEventListener(submitEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(submitEvent, attr);
} else if (attr->name() == onresetAttr) {
- setHTMLEventListener(resetEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(resetEvent, attr);
} else if (attr->name() == nameAttr) {
DOMString newNameAttr = attr->value();
if (inDocument() && getDocument()->isHTMLDocument()) {
@@ -1084,11 +1082,9 @@
} else if (attr->name() == accesskeyAttr) {
// Do nothing.
} else if (attr->name() == onfocusAttr) {
- setHTMLEventListener(focusEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(focusEvent, attr);
} else if (attr->name() == onblurAttr) {
- setHTMLEventListener(blurEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(blurEvent, attr);
} else
HTMLGenericFormElementImpl::parseMappedAttribute(attr);
}
@@ -1664,26 +1660,20 @@
} else if (attr->name() == heightAttr) {
addCSSLength(attr, CSS_PROP_HEIGHT, attr->value());
} else if (attr->name() == onfocusAttr) {
- setHTMLEventListener(focusEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(focusEvent, attr);
} else if (attr->name() == onblurAttr) {
- setHTMLEventListener(blurEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(blurEvent, attr);
} else if (attr->name() == onselectAttr) {
- setHTMLEventListener(selectEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(selectEvent, attr);
} else if (attr->name() == onchangeAttr) {
- setHTMLEventListener(changeEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(changeEvent, attr);
} else if (attr->name() == oninputAttr) {
- setHTMLEventListener(inputEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(inputEvent, attr);
}
// Search field and slider attributes all just cause updateFromElement to be called through style
// recalcing.
else if (attr->name() == onsearchAttr) {
- setHTMLEventListener(searchEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(searchEvent, attr);
} else if (attr->name() == resultsAttr) {
m_maxResults = !attr->isNull() ? attr->value().toInt() : -1;
setChanged();
@@ -2385,11 +2375,9 @@
void HTMLLabelElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
{
if (attr->name() == onfocusAttr) {
- setHTMLEventListener(focusEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(focusEvent, attr);
} else if (attr->name() == onblurAttr) {
- setHTMLEventListener(blurEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(blurEvent, attr);
} else
HTMLElementImpl::parseMappedAttribute(attr);
}
@@ -2795,14 +2783,11 @@
} else if (attr->name() == accesskeyAttr) {
// FIXME: ignore for the moment
} else if (attr->name() == onfocusAttr) {
- setHTMLEventListener(focusEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(focusEvent, attr);
} else if (attr->name() == onblurAttr) {
- setHTMLEventListener(blurEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(blurEvent, attr);
} else if (attr->name() == onchangeAttr) {
- setHTMLEventListener(changeEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(changeEvent, attr);
} else
HTMLGenericFormElementImpl::parseMappedAttribute(attr);
}
@@ -3398,17 +3383,13 @@
} else if (attr->name() == accesskeyAttr) {
// ignore for the moment
} else if (attr->name() == onfocusAttr) {
- setHTMLEventListener(focusEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(focusEvent, attr);
} else if (attr->name() == onblurAttr) {
- setHTMLEventListener(blurEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(blurEvent, attr);
} else if (attr->name() == onselectAttr) {
- setHTMLEventListener(selectEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(selectEvent, attr);
} else if (attr->name() == onchangeAttr) {
- setHTMLEventListener(changeEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(changeEvent, attr);
} else
HTMLGenericFormElementImpl::parseMappedAttribute(attr);
}
1.63 +6 -5 WebCore/khtml/html/html_headimpl.cpp
Index: html_headimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_headimpl.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- html_headimpl.cpp 15 Dec 2005 20:20:01 -0000 1.62
+++ html_headimpl.cpp 16 Dec 2005 08:08:17 -0000 1.63
@@ -25,6 +25,7 @@
#include "config.h"
#include "html/html_headimpl.h"
+
#include "html/html_documentimpl.h"
#include "xml/dom_textimpl.h"
@@ -58,7 +59,7 @@
void HTMLBaseElementImpl::parseMappedAttribute(MappedAttributeImpl *attr)
{
if (attr->name() == hrefAttr) {
- m_href = khtml::parseURL(attr->value());
+ m_href = parseURL(attr->value());
process();
} else if (attr->name() == targetAttr) {
m_target = attr->value();
@@ -169,7 +170,7 @@
tokenizeRelAttribute(attr->value());
process();
} else if (attr->name() == hrefAttr) {
- m_url = getDocument()->completeURL( khtml::parseURL(attr->value()).qstring() );
+ m_url = getDocument()->completeURL(parseURL(attr->value()).qstring());
process();
} else if (attr->name() == typeAttr) {
m_type = attr->value();
@@ -580,13 +581,13 @@
assert(cs == m_cachedScript);
- evaluateScript(cs->url().qstring(), cs->script());
+ evaluateScript(cs->url(), cs->script());
cs->deref(this);
m_cachedScript = 0;
}
-void HTMLScriptElementImpl::evaluateScript(const QString &URL, const DOMString &script)
+void HTMLScriptElementImpl::evaluateScript(const DOMString& URL, const DOMString& script)
{
if (m_evaluated)
return;
@@ -596,7 +597,7 @@
KJSProxyImpl *proxy = part->jScript();
if (proxy) {
m_evaluated = true;
- proxy->evaluate(URL, 0, script.qstring(), 0);
+ proxy->evaluate(URL, 0, script, 0);
DocumentImpl::updateDocumentsRendering();
}
}
1.24 +1 -1 WebCore/khtml/html/html_headimpl.h
Index: html_headimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_headimpl.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- html_headimpl.h 30 Nov 2005 03:12:00 -0000 1.23
+++ html_headimpl.h 16 Dec 2005 08:08:17 -0000 1.24
@@ -206,7 +206,7 @@
void setCreatedByParser(bool createdByParser) { m_createdByParser = createdByParser; }
virtual void closeRenderer();
- void evaluateScript(const QString &, const DOMString &);
+ void evaluateScript(const DOMString &URL, const DOMString &script);
DOMString text() const;
void setText(const DOMString &);
1.61 +3 -3 WebCore/khtml/html/html_imageimpl.cpp
Index: html_imageimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_imageimpl.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- html_imageimpl.cpp 14 Dec 2005 23:31:51 -0000 1.60
+++ html_imageimpl.cpp 16 Dec 2005 08:08:18 -0000 1.61
@@ -209,11 +209,11 @@
} else if (attrName == ismapAttr) {
ismap = true;
} else if (attrName == onabortAttr) {
- setHTMLEventListener(abortEvent, getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(abortEvent, attr);
} else if (attrName == onerrorAttr) {
- setHTMLEventListener(errorEvent, getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(errorEvent, attr);
} else if (attrName == onloadAttr) {
- setHTMLEventListener(loadEvent, getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(loadEvent, attr);
} else if (attrName == compositeAttr) {
_compositeOperator = attr->value().qstring();
} else if (attrName == nameAttr) {
1.92 +2 -4 WebCore/khtml/html/html_objectimpl.cpp
Index: html_objectimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/html/html_objectimpl.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -r1.91 -r1.92
--- html_objectimpl.cpp 15 Dec 2005 22:31:39 -0000 1.91
+++ html_objectimpl.cpp 16 Dec 2005 08:08:18 -0000 1.92
@@ -632,11 +632,9 @@
if (m_render)
needWidgetUpdate = true;
} else if (attr->name() == onloadAttr) {
- setHTMLEventListener(loadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(loadEvent, attr);
} else if (attr->name() == onunloadAttr) {
- setHTMLEventListener(unloadEvent,
- getDocument()->createHTMLEventListener(attr->value().qstring(), this));
+ setHTMLEventListener(unloadEvent, attr);
} else if (attr->name() == nameAttr) {
DOMString newNameAttr = attr->value();
if (isDocNamedItem() && inDocument() && getDocument()->isHTMLDocument()) {
1.286 +6 -1 WebCore/khtml/xml/dom_docimpl.cpp
Index: dom_docimpl.cpp
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.cpp,v
retrieving revision 1.285
retrieving revision 1.286
diff -u -r1.285 -r1.286
--- dom_docimpl.cpp 15 Dec 2005 22:31:49 -0000 1.285
+++ dom_docimpl.cpp 16 Dec 2005 08:08:21 -0000 1.286
@@ -2521,7 +2521,7 @@
return false;
}
-EventListener *DocumentImpl::createHTMLEventListener(QString code, NodeImpl *node)
+EventListener *DocumentImpl::createHTMLEventListener(const DOMString& code, NodeImpl *node)
{
if (part()) {
return part()->createHTMLEventListener(code, node);
@@ -2530,6 +2530,11 @@
}
}
+void DocumentImpl::setHTMLWindowEventListener(const AtomicString& eventType, AttributeImpl* attr)
+{
+ setHTMLWindowEventListener(eventType, createHTMLEventListener(attr->value(), 0));
+}
+
void DocumentImpl::dispatchImageLoadEventSoon(HTMLImageLoader *image)
{
m_imageLoadEventDispatchSoonList.append(image);
1.144 +3 -1 WebCore/khtml/xml/dom_docimpl.h
Index: dom_docimpl.h
===================================================================
RCS file: /cvs/root/WebCore/khtml/xml/dom_docimpl.h,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -r1.143 -r1.144
--- dom_docimpl.h 1 Dec 2005 10:32:26 -0000 1.143
+++ dom_docimpl.h 16 Dec 2005 08:08:21 -0000 1.144
@@ -466,11 +466,13 @@
EventListener *getHTMLWindowEventListener(const AtomicString &eventType);
void removeHTMLWindowEventListener(const AtomicString &eventType);
+ void setHTMLWindowEventListener(const AtomicString& eventType, AttributeImpl*);
+
void addWindowEventListener(const AtomicString &eventType, EventListener *listener, bool useCapture);
void removeWindowEventListener(const AtomicString &eventType, EventListener *listener, bool useCapture);
bool hasWindowEventListener(const AtomicString &eventType);
- EventListener *createHTMLEventListener(QString code, NodeImpl *node);
+ EventListener *createHTMLEventListener(const DOMString& code, NodeImpl*);
/**
* Searches through the document, starting from fromNode, for the next selectable element that comes after fromNode.
1.8 +6 -5 WebCore/kwq/WebCoreScriptDebugger.mm
Index: WebCoreScriptDebugger.mm
===================================================================
RCS file: /cvs/root/WebCore/kwq/WebCoreScriptDebugger.mm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WebCoreScriptDebugger.mm 11 Dec 2005 02:06:17 -0000 1.7
+++ WebCoreScriptDebugger.mm 16 Dec 2005 08:08:22 -0000 1.8
@@ -27,14 +27,15 @@
*/
#include "config.h"
-#import <WebCore/WebCoreScriptDebugger.h>
+#import "WebCoreScriptDebugger.h"
+
#import <JavaScriptCore/WebScriptObjectPrivate.h>
#import <JavaScriptCore/debugger.h>
#import <JavaScriptCore/context.h>
-using namespace KJS;
-
+#import "KWQString.h"
+using namespace KJS;
@interface WebCoreScriptDebugger (WebCoreScriptDebuggerInternal)
@@ -311,7 +312,7 @@
- (id)evaluateWebScript:(NSString *)script
{
- UString code([script UTF8String]);
+ UString code(QString::fromNSString(script));
ExecState *state = _state;
Interpreter *interp = state->interpreter();
@@ -343,7 +344,7 @@
}
else {
// no "eval", or no context (i.e. global scope) - use global fallback
- result = interp->imp()->evaluate(code, globObj, UString(), 0).value();
+ result = interp->imp()->evaluate(code.data(), code.size(), globObj, UString(), 0).value();
}
if (state->hadException()) {
1.39 +2 -2 WebKitTools/Scripts/run-webkit-tests
Index: run-webkit-tests
===================================================================
RCS file: /cvs/root/WebKitTools/Scripts/run-webkit-tests,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- run-webkit-tests 16 Dec 2005 02:16:30 -0000 1.38
+++ run-webkit-tests 16 Dec 2005 08:08:23 -0000 1.39
@@ -206,7 +206,7 @@
my $result;
- my $startTime = time;
+ my $startTime = time if $report10Slowest;
print OUT "$testDirectory/$test\n";
@@ -216,7 +216,7 @@
$actual .= $_;
}
- $durations{$test} = time - $startTime;
+ $durations{$test} = time - $startTime if $report10Slowest;
my $expected;
if (open EXPECTED, "<", "$testDirectory/$base-expected.txt") {
More information about the webkit-changes
mailing list