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

mjs mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:42:27 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 65f51c306c71a3a096b3dafd10a2ae3ae30c37c5
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri May 16 01:09:29 2003 +0000

            Reviewed by Richard.
    
    	- fixed 3168588 - Can't click on links at Nike site (Image onload handler problem)
    
    	The fix was to implement the onload property for Image objects
    	(which are entirely different from <img> HTML elements).
    
            * khtml/ecma/kjs_html.cpp:
            (Image::getValueProperty): Implement access to onload attribte.
            (Image::tryPut): Use putValue cause we're gonna use the hashtable now.
            (Image::putValue): Moved guts of tryPut here. Implement setting of
    	onload attribute.
            (Image::notifyFinished): Fire onload event if there is a listener.
            (Image::Image): initialize onload listener to null.
            * khtml/ecma/kjs_html.h:
            * khtml/ecma/kjs_html.lut.h: Regenerated.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4386 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 9c176f7..9e1238e 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,22 @@
+2003-05-15  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Richard.
+
+	- fixed 3168588 - Can't click on links at Nike site (Image onload handler problem)
+
+	The fix was to implement the onload property for Image objects
+	(which are entirely different from <img> HTML elements).
+
+        * khtml/ecma/kjs_html.cpp:
+        (Image::getValueProperty): Implement access to onload attribte.
+        (Image::tryPut): Use putValue cause we're gonna use the hashtable now.
+        (Image::putValue): Moved guts of tryPut here. Implement setting of
+	onload attribute.
+        (Image::notifyFinished): Fire onload event if there is a listener.
+        (Image::Image): initialize onload listener to null.
+        * khtml/ecma/kjs_html.h:
+        * khtml/ecma/kjs_html.lut.h: Regenerated.
+
 === Safari-79 ===
 
 2003-05-14  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 9c176f7..9e1238e 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,22 @@
+2003-05-15  Maciej Stachowiak  <mjs at apple.com>
+
+        Reviewed by Richard.
+
+	- fixed 3168588 - Can't click on links at Nike site (Image onload handler problem)
+
+	The fix was to implement the onload property for Image objects
+	(which are entirely different from <img> HTML elements).
+
+        * khtml/ecma/kjs_html.cpp:
+        (Image::getValueProperty): Implement access to onload attribte.
+        (Image::tryPut): Use putValue cause we're gonna use the hashtable now.
+        (Image::putValue): Moved guts of tryPut here. Implement setting of
+	onload attribute.
+        (Image::notifyFinished): Fire onload event if there is a listener.
+        (Image::Image): initialize onload listener to null.
+        * khtml/ecma/kjs_html.h:
+        * khtml/ecma/kjs_html.lut.h: Regenerated.
+
 === Safari-79 ===
 
 2003-05-14  David Hyatt  <hyatt at apple.com>
diff --git a/WebCore/khtml/ecma/kjs_html.cpp b/WebCore/khtml/ecma/kjs_html.cpp
index 9935bab..d26cfd1 100644
--- a/WebCore/khtml/ecma/kjs_html.cpp
+++ b/WebCore/khtml/ecma/kjs_html.cpp
@@ -28,6 +28,7 @@
 #include "dom/html_table.h"
 #include "dom/html_object.h"
 #include "dom/dom_exception.h"
+#include "xml/dom2_eventsimpl.h"
 
 // ### HACK
 #include "html/html_baseimpl.h"
@@ -40,6 +41,7 @@
 #include "ecma/kjs_html.h"
 #include "ecma/kjs_window.h"
 #include "ecma/kjs_html.lut.h"
+#include "kjs_events.h"
 
 #include "misc/htmltags.h"
 
@@ -3118,6 +3120,7 @@ const ClassInfo KJS::Image::info = { "Image", 0, &ImageTable, 0 };
 @begin ImageTable 3
   src		Image::Src		DontDelete
   complete	Image::Complete		DontDelete|ReadOnly
+  onload        Image::OnLoad           DontDelete
 @end
 */
 
@@ -3133,6 +3136,12 @@ Value Image::getValueProperty(ExecState *, int token) const
     return String(src);
   case Complete:
     return Boolean(!img || img->status() >= khtml::CachedObject::Persistent);
+  case OnLoad:
+    if (onLoadListener) {
+      return onLoadListener->listenerObj();
+    } else {
+      return Null();
+    }
   default:
     kdWarning() << "Image::getValueProperty unhandled token " << token << endl;
     return Value();
@@ -3141,20 +3150,40 @@ Value Image::getValueProperty(ExecState *, int token) const
 
 void Image::tryPut(ExecState *exec, const Identifier &propertyName, const Value& value, int attr)
 {
-  // Not worth using the hashtable
-  if (propertyName == "src") {
+  DOMObjectLookupPut<Image,DOMObject>(exec, propertyName, value, attr, &ImageTable, this );
+}
+
+void Image::putValue(ExecState *exec, int token, const Value& value, int /*attr*/)
+{
+  switch(token) {
+  case Src:
+  {
     String str = value.toString(exec);
     src = str.value();
     if ( img ) img->deref(this);
     img = doc ? doc->docLoader()->requestImage( src.string() ) : 0;
     if ( img ) img->ref(this);
-  } else {
-    DOMObject::tryPut(exec, propertyName, value, attr);
+    break;
+  }
+  case OnLoad:
+    onLoadListener = Window::retrieveActive(exec)->getJSEventListener(value, true);
+    break;
+  default:
+    kdWarning() << "HTMLDocument::putValue unhandled token " << token << endl;
+  }
+}
+
+void Image::notifyFinished(khtml::CachedObject *)
+{
+  if (onLoadListener) {
+    DOM::Event ev = doc->view()->part()->document().createEvent("HTMLEvents");
+    ev.initEvent("load", true, true);
+    onLoadListener->handleEvent(ev, true);
   }
 }
 
 Image::Image(const DOM::Document &d)
-    : doc(static_cast<DOM::DocumentImpl*>(d.handle())), img(0)
+  : doc(static_cast<DOM::DocumentImpl*>(d.handle())), img(0), onLoadListener(0)
 {
 }
 
diff --git a/WebCore/khtml/ecma/kjs_html.h b/WebCore/khtml/ecma/kjs_html.h
index f70b4a4..d1debc9 100644
--- a/WebCore/khtml/ecma/kjs_html.h
+++ b/WebCore/khtml/ecma/kjs_html.h
@@ -218,14 +218,17 @@ namespace KJS {
     virtual Value tryGet(ExecState *exec, const Identifier &propertyName) const;
     Value getValueProperty(ExecState *exec, int token) const;
     virtual void tryPut(ExecState *exec, const Identifier &propertyName, const Value& value, int attr = None);
+    void putValue(ExecState *exec, int token, const Value& value, int /*attr*/);
+    void notifyFinished(khtml::CachedObject *);
     virtual bool toBoolean(ExecState *) const { return true; }
     virtual const ClassInfo* classInfo() const { return &info; }
     static const ClassInfo info;
-    enum { Src, Complete };
+    enum { Src, Complete, OnLoad };
   private:
     UString src;
     QGuardedPtr<DOM::DocumentImpl> doc;
     khtml::CachedImage* img;
+    JSEventListener *onLoadListener;
   };
 
   Value getHTMLCollection(ExecState *exec, const DOM::HTMLCollection &c);
diff --git a/WebCore/khtml/ecma/kjs_html.lut.h b/WebCore/khtml/ecma/kjs_html.lut.h
index ee7b305..5243ac4 100644
--- a/WebCore/khtml/ecma/kjs_html.lut.h
+++ b/WebCore/khtml/ecma/kjs_html.lut.h
@@ -988,10 +988,11 @@ namespace KJS {
 
 const struct HashEntry ImageTableEntries[] = {
    { 0, 0, 0, 0, 0 },
-   { "src", Image::Src, DontDelete, 0, 0 },
-   { "complete", Image::Complete, DontDelete|ReadOnly, 0, 0 }
+   { "src", Image::Src, DontDelete, 0, &ImageTableEntries[3] },
+   { "complete", Image::Complete, DontDelete|ReadOnly, 0, 0 },
+   { "onload", Image::OnLoad, DontDelete, 0, 0 }
 };
 
-const struct HashTable ImageTable = { 2, 3, ImageTableEntries, 3 };
+const struct HashTable ImageTable = { 2, 4, ImageTableEntries, 3 };
 
 }; // namespace

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list