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

trey trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:43:19 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 6149bb583f71b93a398a95d659ea0ed5ec1c1d70
Author: trey <trey at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jun 2 21:12:07 2004 +0000

    WebCore:
    
    	First cut at the source side of DHTML dragging.  Following IE, new events are added:
    	ondragstart, ondrag, ondragend.  The recently added CSS property -khtml-user-drag can
    	be used to make an element draggable.  event.dataTransfer.setDragImage(ImageObject,x,y)
    	can be used from ondragstart to set a static image for the dragImage.  x,y is the location
    	of the mouse within the image from the upper right corner.  clipboard methods setdata
    	and cleardata are implemented.
    
            Reviewed by hyatt.
    
            * khtml/ecma/kjs_dom.cpp:
            (DOMNode::getValueProperty):  Boilerplate for new events
            (DOMNode::putValue):  Boilerplate for new events
            * khtml/ecma/kjs_dom.h:
            (KJS::DOMNode::):   Boilerplate for new events
            * khtml/ecma/kjs_dom.lut.h:
            * khtml/ecma/kjs_events.cpp:
            (DOMMouseEvent::getValueProperty):  Return undefined for clipboard when its not a drag event.
            (ClipboardProtoFunc::tryCall):  setDragImage glue to clipboard routine.
            * khtml/ecma/kjs_events.h:
            (KJS::Clipboard::):
            * khtml/ecma/kjs_events.lut.h:
            * khtml/html/html_elementimpl.cpp:
            (HTMLElementImpl::parseHTMLAttribute):  Boilerplate for new events
            * khtml/khtml_part.cpp:
            (KHTMLPart::shouldDragAutoNode):  Empty impl of new method, where UA determines
    	draggability for events with -khtml-user-drag=auto
            * khtml/khtml_part.h:
            * khtml/misc/htmlattrs.c:
            * khtml/misc/htmlattrs.h:
            * khtml/misc/htmlattrs.in:  Boilerplate for new events
            * khtml/rendering/render_object.cpp:
            (RenderObject::draggableNode):  Find the node or parent node which might be dragged.
            * khtml/rendering/render_object.h:
            * khtml/xml/dom2_eventsimpl.cpp:
            (EventImpl::typeToId):  Boilerplate for new events
            (EventImpl::idToType):  Boilerplate for new events
            * khtml/xml/dom2_eventsimpl.h:
            (DOM::EventImpl::):  Boilerplate for new events
            * kwq/KWQClipboard.h:
            * kwq/KWQClipboard.mm:
            (KWQClipboard::clearData):  Implemented to call NSPasteboard
            (KWQClipboard::clearAllData): ditto
            (KWQClipboard::getData):  fix corner case that came up testing
            (KWQClipboard::setData):  Implemented to call NSPasteboard
            (KWQClipboard::dragLocation):  Simple setter/getters
            (KWQClipboard::setDragLocation):
            (KWQClipboard::dragImage):
            (KWQClipboard::setDragImage):
            (KWQClipboard::dragNSImage):
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::KWQKHTMLPart): init new member var
            (KWQKHTMLPart::dragHysteresisExceeded):  Hysteresis moved here from WebKit
            (KWQKHTMLPart::dispatchDragSrcEvent):  Send a dragging event to the current dragSource
            (KWQKHTMLPart::khtmlMouseMoveEvent):  Initiate dragging, now including consulting DHTML,
    	hysteresis and sending ondragstart.
            (KWQKHTMLPart::dragSourceMovedTo):  simple passthrough
            (KWQKHTMLPart::dragSourceEndedAt):  simple passthrough
            (KWQKHTMLPart::mouseDown):  salt away _mouseDownX, _mouseDownY
            (KWQKHTMLPart::shouldDragAutoNode):  Called for -khtml-user-drag=auto.  We just call
    	out to WebKit.
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge dragSourceMovedTo:]):  New glue to drive new dragging events.
            (-[WebCoreBridge dragSourceEndedAt:operation:]):
    
    WebKit:
    
    	First cut at source side of DHTML dragging.  Most of the work is in WebCore.
    
            Reviewed by hyatt.
    
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge startDraggingImage:at:event:]):  Added image and loc args for
    	when WC tells WK to start a drag.
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView _startDraggingImage:at:event:]):  New image and loc args coming
    	from WebCore.  Hysteresis is moved to WC.
            (-[WebHTMLView mouseDragged:]):  Call new _startDragging method.
            (-[WebHTMLView draggedImage:movedTo:]):  Pass event to WC.
            (-[WebHTMLView draggedImage:endedAt:operation:]):  Pass event to WC.
            (-[WebHTMLView mouseUp:]):  Reset firstMouseDownEvent.  Fixes bug where
    	we would occasionally short-circuit WC event handling due to aliasing
    	problem with this event.
            * WebView.subproj/WebHTMLViewPrivate.h:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6746 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index abf90fb..781a3b1 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,71 @@
+2004-06-01  Trey Matteson  <trey at apple.com>
+
+	First cut at the source side of DHTML dragging.  Following IE, new events are added:
+	ondragstart, ondrag, ondragend.  The recently added CSS property -khtml-user-drag can
+	be used to make an element draggable.  event.dataTransfer.setDragImage(ImageObject,x,y)
+	can be used from ondragstart to set a static image for the dragImage.  x,y is the location
+	of the mouse within the image from the upper right corner.  clipboard methods setdata
+	and cleardata are implemented.
+
+        Reviewed by hyatt.
+
+        * khtml/ecma/kjs_dom.cpp:
+        (DOMNode::getValueProperty):  Boilerplate for new events
+        (DOMNode::putValue):  Boilerplate for new events
+        * khtml/ecma/kjs_dom.h:
+        (KJS::DOMNode::):   Boilerplate for new events
+        * khtml/ecma/kjs_dom.lut.h:
+        * khtml/ecma/kjs_events.cpp:
+        (DOMMouseEvent::getValueProperty):  Return undefined for clipboard when its not a drag event.
+        (ClipboardProtoFunc::tryCall):  setDragImage glue to clipboard routine.
+        * khtml/ecma/kjs_events.h:
+        (KJS::Clipboard::):
+        * khtml/ecma/kjs_events.lut.h:
+        * khtml/html/html_elementimpl.cpp:
+        (HTMLElementImpl::parseHTMLAttribute):  Boilerplate for new events
+        * khtml/khtml_part.cpp:
+        (KHTMLPart::shouldDragAutoNode):  Empty impl of new method, where UA determines
+	draggability for events with -khtml-user-drag=auto
+        * khtml/khtml_part.h:
+        * khtml/misc/htmlattrs.c:
+        * khtml/misc/htmlattrs.h:
+        * khtml/misc/htmlattrs.in:  Boilerplate for new events
+        * khtml/rendering/render_object.cpp:
+        (RenderObject::draggableNode):  Find the node or parent node which might be dragged.
+        * khtml/rendering/render_object.h:
+        * khtml/xml/dom2_eventsimpl.cpp:
+        (EventImpl::typeToId):  Boilerplate for new events
+        (EventImpl::idToType):  Boilerplate for new events
+        * khtml/xml/dom2_eventsimpl.h:
+        (DOM::EventImpl::):  Boilerplate for new events
+        * kwq/KWQClipboard.h:
+        * kwq/KWQClipboard.mm:
+        (KWQClipboard::clearData):  Implemented to call NSPasteboard
+        (KWQClipboard::clearAllData): ditto
+        (KWQClipboard::getData):  fix corner case that came up testing
+        (KWQClipboard::setData):  Implemented to call NSPasteboard
+        (KWQClipboard::dragLocation):  Simple setter/getters
+        (KWQClipboard::setDragLocation):
+        (KWQClipboard::dragImage):
+        (KWQClipboard::setDragImage):
+        (KWQClipboard::dragNSImage):
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::KWQKHTMLPart): init new member var
+        (KWQKHTMLPart::dragHysteresisExceeded):  Hysteresis moved here from WebKit
+        (KWQKHTMLPart::dispatchDragSrcEvent):  Send a dragging event to the current dragSource
+        (KWQKHTMLPart::khtmlMouseMoveEvent):  Initiate dragging, now including consulting DHTML,
+	hysteresis and sending ondragstart.
+        (KWQKHTMLPart::dragSourceMovedTo):  simple passthrough
+        (KWQKHTMLPart::dragSourceEndedAt):  simple passthrough
+        (KWQKHTMLPart::mouseDown):  salt away _mouseDownX, _mouseDownY
+        (KWQKHTMLPart::shouldDragAutoNode):  Called for -khtml-user-drag=auto.  We just call
+	out to WebKit.
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge dragSourceMovedTo:]):  New glue to drive new dragging events.
+        (-[WebCoreBridge dragSourceEndedAt:operation:]):
+
 2004-06-02  Ken Kocienda  <kocienda at apple.com>
 
         Reviewed by me
diff --git a/WebCore/khtml/ecma/kjs_dom.cpp b/WebCore/khtml/ecma/kjs_dom.cpp
index 05ca4dd..065d6ff 100644
--- a/WebCore/khtml/ecma/kjs_dom.cpp
+++ b/WebCore/khtml/ecma/kjs_dom.cpp
@@ -94,7 +94,7 @@ bool DOMNode::toBoolean(ExecState *) const
 }
 
 /* Source for DOMNodeTable. Use "make hashtables" to regenerate.
- at begin DOMNodeTable 56
+ at begin DOMNodeTable 60
   nodeName	DOMNode::NodeName	DontDelete|ReadOnly
   nodeValue	DOMNode::NodeValue	DontDelete
   nodeType	DOMNode::NodeType	DontDelete|ReadOnly
@@ -118,10 +118,13 @@ bool DOMNode::toBoolean(ExecState *) const
   onclick	DOMNode::OnClick		DontDelete
   oncontextmenu	DOMNode::OnContextMenu		DontDelete
   ondblclick	DOMNode::OnDblClick		DontDelete
+  ondrag	DOMNode::OnDrag			DontDelete
   ondragdrop	DOMNode::OnDragDrop		DontDelete
+  ondragend	DOMNode::OnDragEnd		DontDelete
   ondragenter	DOMNode::OnDragEnter		DontDelete
   ondragleave	DOMNode::OnDragLeave		DontDelete
   ondragover	DOMNode::OnDragOver		DontDelete
+  ondragstart	DOMNode::OnDragStart		DontDelete
   ondrop	DOMNode::OnDrop                 DontDelete
   onerror	DOMNode::OnError		DontDelete
   onfocus	DOMNode::OnFocus       		DontDelete
@@ -244,6 +247,12 @@ Value DOMNode::getValueProperty(ExecState *exec, int token) const
     return getListener(DOM::EventImpl::DRAGLEAVE_EVENT);
   case OnDrop:
     return getListener(DOM::EventImpl::DROP_EVENT);
+  case OnDragStart:
+    return getListener(DOM::EventImpl::DRAGSTART_EVENT);
+  case OnDrag:
+    return getListener(DOM::EventImpl::DRAG_EVENT);
+  case OnDragEnd:
+    return getListener(DOM::EventImpl::DRAGEND_EVENT);
   case OnMove:
     return getListener(DOM::EventImpl::KHTML_MOVE_EVENT);
   case OnReset:
@@ -394,6 +403,15 @@ void DOMNode::putValue(ExecState *exec, int token, const Value& value, int /*att
   case OnDrop:
     setListener(exec,DOM::EventImpl::DROP_EVENT,value);
     break;
+  case OnDragStart:
+    setListener(exec,DOM::EventImpl::DRAGSTART_EVENT,value);
+    break;
+  case OnDrag:
+    setListener(exec,DOM::EventImpl::DRAG_EVENT,value);
+    break;
+  case OnDragEnd:
+    setListener(exec,DOM::EventImpl::DRAGEND_EVENT,value);
+    break;
   case OnMove:
     setListener(exec,DOM::EventImpl::KHTML_MOVE_EVENT,value);
     break;
diff --git a/WebCore/khtml/ecma/kjs_dom.h b/WebCore/khtml/ecma/kjs_dom.h
index a49d381..8eac4a3 100644
--- a/WebCore/khtml/ecma/kjs_dom.h
+++ b/WebCore/khtml/ecma/kjs_dom.h
@@ -60,7 +60,7 @@ namespace KJS {
            CloneNode, Normalize, IsSupported, AddEventListener, RemoveEventListener,
            DispatchEvent, Contains,
            OnAbort, OnBlur, OnChange, OnClick, OnContextMenu, OnDblClick, OnDragDrop, OnError,
-           OnDragEnter, OnDragOver, OnDragLeave, OnDrop,
+           OnDragEnter, OnDragOver, OnDragLeave, OnDrop, OnDragStart, OnDrag, OnDragEnd,
            OnFocus, OnInput, OnKeyDown, OnKeyPress, OnKeyUp, OnLoad, OnMouseDown,
            OnMouseMove, OnMouseOut, OnMouseOver, OnMouseUp, OnMove, OnReset,
            OnResize, OnScroll, OnSearch, OnSelect, OnSubmit, OnUnload,
diff --git a/WebCore/khtml/ecma/kjs_dom.lut.h b/WebCore/khtml/ecma/kjs_dom.lut.h
index 0297333..8d241ca 100644
--- a/WebCore/khtml/ecma/kjs_dom.lut.h
+++ b/WebCore/khtml/ecma/kjs_dom.lut.h
@@ -29,87 +29,88 @@ const struct HashTable DOMNodeProtoTable = { 2, 17, DOMNodeProtoTableEntries, 13
 namespace KJS {
 
 const struct HashEntry DOMNodeTableEntries[] = {
-   { "nodeType", DOMNode::NodeType, DontDelete|ReadOnly, 0, 0 },
-   { "ondragenter", DOMNode::OnDragEnter, DontDelete, 0, 0 },
-   { "offsetTop", DOMNode::OffsetTop, DontDelete|ReadOnly, 0, 0 },
-   { 0, 0, 0, 0, 0 },
-   { 0, 0, 0, 0, 0 },
-   { "namespaceURI", DOMNode::NamespaceURI, DontDelete|ReadOnly, 0, 0 },
-   { 0, 0, 0, 0, 0 },
-   { 0, 0, 0, 0, 0 },
-   { "ondragdrop", DOMNode::OnDragDrop, DontDelete, 0, &DOMNodeTableEntries[74] },
-   { 0, 0, 0, 0, 0 },
+   { "nodeType", DOMNode::NodeType, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[71] },
+   { "childNodes", DOMNode::ChildNodes, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[67] },
    { "scrollTop", DOMNode::ScrollTop, DontDelete, 0, 0 },
-   { "onclick", DOMNode::OnClick, DontDelete, 0, &DOMNodeTableEntries[69] },
-   { "localName", DOMNode::LocalName, DontDelete|ReadOnly, 0, 0 },
-   { "childNodes", DOMNode::ChildNodes, DontDelete|ReadOnly, 0, 0 },
-   { 0, 0, 0, 0, 0 },
-   { "ondragover", DOMNode::OnDragOver, DontDelete, 0, 0 },
-   { "offsetHeight", DOMNode::OffsetHeight, DontDelete|ReadOnly, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
+   { "offsetParent", DOMNode::OffsetParent, DontDelete|ReadOnly, 0, 0 },
+   { "ownerDocument", DOMNode::OwnerDocument, DontDelete|ReadOnly, 0, 0 },
    { 0, 0, 0, 0, 0 },
-   { "parentElement", DOMNode::ParentElement, DontDelete|ReadOnly, 0, 0 },
-   { "onload", DOMNode::OnLoad, DontDelete, 0, &DOMNodeTableEntries[70] },
-   { 0, 0, 0, 0, 0 },
-   { "nodeName", DOMNode::NodeName, DontDelete|ReadOnly, 0, 0 },
-   { "lastChild", DOMNode::LastChild, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[71] },
+   { "localName", DOMNode::LocalName, DontDelete|ReadOnly, 0, 0 },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
+   { "onsearch", DOMNode::OnSearch, DontDelete, 0, &DOMNodeTableEntries[76] },
    { 0, 0, 0, 0, 0 },
+   { "onmousemove", DOMNode::OnMouseMove, DontDelete, 0, 0 },
+   { "onmousedown", DOMNode::OnMouseDown, DontDelete, 0, 0 },
+   { "attributes", DOMNode::Attributes, DontDelete|ReadOnly, 0, 0 },
    { "firstChild", DOMNode::FirstChild, DontDelete|ReadOnly, 0, 0 },
-   { "onabort", DOMNode::OnAbort, DontDelete, 0, 0 },
    { 0, 0, 0, 0, 0 },
-   { "attributes", DOMNode::Attributes, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[57] },
-   { "parentNode", DOMNode::ParentNode, DontDelete|ReadOnly, 0, 0 },
-   { "offsetParent", DOMNode::OffsetParent, DontDelete|ReadOnly, 0, 0 },
+   { "onmouseover", DOMNode::OnMouseOver, DontDelete, 0, 0 },
+   { "nextSibling", DOMNode::NextSibling, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[61] },
+   { "parentNode", DOMNode::ParentNode, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[60] },
+   { "onselect", DOMNode::OnSelect, DontDelete, 0, 0 },
    { "offsetLeft", DOMNode::OffsetLeft, DontDelete|ReadOnly, 0, 0 },
-   { "nodeValue", DOMNode::NodeValue, DontDelete, 0, 0 },
-   { "onscroll", DOMNode::OnScroll, DontDelete, 0, 0 },
-   { "previousSibling", DOMNode::PreviousSibling, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[58] },
-   { "prefix", DOMNode::Prefix, DontDelete, 0, &DOMNodeTableEntries[61] },
-   { "nextSibling", DOMNode::NextSibling, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[68] },
-   { "ondragleave", DOMNode::OnDragLeave, DontDelete, 0, &DOMNodeTableEntries[67] },
-   { "onsubmit", DOMNode::OnSubmit, DontDelete, 0, 0 },
-   { "ownerDocument", DOMNode::OwnerDocument, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[56] },
-   { "onkeypress", DOMNode::OnKeyPress, DontDelete, 0, 0 },
-   { "onmove", DOMNode::OnMove, DontDelete, 0, 0 },
    { 0, 0, 0, 0, 0 },
+   { "onunload", DOMNode::OnUnload, DontDelete, 0, 0 },
+   { "ondblclick", DOMNode::OnDblClick, DontDelete, 0, 0 },
    { 0, 0, 0, 0, 0 },
-   { "onerror", DOMNode::OnError, DontDelete, 0, &DOMNodeTableEntries[76] },
+   { "nodeName", DOMNode::NodeName, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[68] },
    { 0, 0, 0, 0, 0 },
    { 0, 0, 0, 0, 0 },
+   { "onkeydown", DOMNode::OnKeyDown, DontDelete, 0, &DOMNodeTableEntries[77] },
+   { "nodeValue", DOMNode::NodeValue, DontDelete, 0, 0 },
    { 0, 0, 0, 0, 0 },
-   { "onchange", DOMNode::OnChange, DontDelete, 0, &DOMNodeTableEntries[62] },
    { 0, 0, 0, 0, 0 },
-   { "oninput", DOMNode::OnInput, DontDelete, 0, 0 },
+   { 0, 0, 0, 0, 0 },
+   { "ondrag", DOMNode::OnDrag, DontDelete, 0, 0 },
+   { "onscroll", DOMNode::OnScroll, DontDelete, 0, 0 },
+   { "onabort", DOMNode::OnAbort, DontDelete, 0, &DOMNodeTableEntries[62] },
    { "onmouseout", DOMNode::OnMouseOut, DontDelete, 0, 0 },
+   { "onresize", DOMNode::OnResize, DontDelete, 0, 0 },
+   { "clientHeight", DOMNode::ClientHeight, DontDelete|ReadOnly, 0, 0 },
+   { "namespaceURI", DOMNode::NamespaceURI, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[72] },
    { 0, 0, 0, 0, 0 },
-   { "onblur", DOMNode::OnBlur, DontDelete, 0, &DOMNodeTableEntries[59] },
-   { "oncontextmenu", DOMNode::OnContextMenu, DontDelete, 0, &DOMNodeTableEntries[73] },
-   { "ondblclick", DOMNode::OnDblClick, DontDelete, 0, &DOMNodeTableEntries[60] },
-   { "ondrop", DOMNode::OnDrop, DontDelete, 0, &DOMNodeTableEntries[65] },
-   { "onfocus", DOMNode::OnFocus, DontDelete, 0, &DOMNodeTableEntries[64] },
-   { "onkeydown", DOMNode::OnKeyDown, DontDelete, 0, &DOMNodeTableEntries[63] },
-   { "onkeyup", DOMNode::OnKeyUp, DontDelete, 0, &DOMNodeTableEntries[66] },
-   { "onmousedown", DOMNode::OnMouseDown, DontDelete, 0, 0 },
-   { "onmousemove", DOMNode::OnMouseMove, DontDelete, 0, 0 },
-   { "onmouseover", DOMNode::OnMouseOver, DontDelete, 0, &DOMNodeTableEntries[75] },
    { "onmouseup", DOMNode::OnMouseUp, DontDelete, 0, 0 },
-   { "onreset", DOMNode::OnReset, DontDelete, 0, 0 },
-   { "onresize", DOMNode::OnResize, DontDelete, 0, &DOMNodeTableEntries[72] },
-   { "onsearch", DOMNode::OnSearch, DontDelete, 0, 0 },
-   { "onselect", DOMNode::OnSelect, DontDelete, 0, 0 },
-   { "onunload", DOMNode::OnUnload, DontDelete, 0, &DOMNodeTableEntries[77] },
+   { "parentElement", DOMNode::ParentElement, DontDelete|ReadOnly, 0, 0 },
+   { "previousSibling", DOMNode::PreviousSibling, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[66] },
+   { "ondragend", DOMNode::OnDragEnd, DontDelete, 0, 0 },
+   { 0, 0, 0, 0, 0 },
+   { "onreset", DOMNode::OnReset, DontDelete, 0, &DOMNodeTableEntries[75] },
+   { 0, 0, 0, 0, 0 },
+   { 0, 0, 0, 0, 0 },
+   { "oncontextmenu", DOMNode::OnContextMenu, DontDelete, 0, 0 },
+   { "ondragdrop", DOMNode::OnDragDrop, DontDelete, 0, 0 },
+   { "ondragstart", DOMNode::OnDragStart, DontDelete, 0, 0 },
+   { "prefix", DOMNode::Prefix, DontDelete, 0, &DOMNodeTableEntries[73] },
+   { "onchange", DOMNode::OnChange, DontDelete, 0, &DOMNodeTableEntries[65] },
+   { "scrollHeight", DOMNode::ScrollHeight, DontDelete|ReadOnly, 0, 0 },
+   { 0, 0, 0, 0, 0 },
+   { "onblur", DOMNode::OnBlur, DontDelete, 0, &DOMNodeTableEntries[64] },
+   { "ondragover", DOMNode::OnDragOver, DontDelete, 0, &DOMNodeTableEntries[69] },
+   { "lastChild", DOMNode::LastChild, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[63] },
+   { "onclick", DOMNode::OnClick, DontDelete, 0, &DOMNodeTableEntries[74] },
+   { "ondragenter", DOMNode::OnDragEnter, DontDelete, 0, &DOMNodeTableEntries[70] },
+   { "ondragleave", DOMNode::OnDragLeave, DontDelete, 0, 0 },
+   { "ondrop", DOMNode::OnDrop, DontDelete, 0, 0 },
+   { "onerror", DOMNode::OnError, DontDelete, 0, 0 },
+   { "onfocus", DOMNode::OnFocus, DontDelete, 0, 0 },
+   { "oninput", DOMNode::OnInput, DontDelete, 0, 0 },
+   { "onkeypress", DOMNode::OnKeyPress, DontDelete, 0, &DOMNodeTableEntries[78] },
+   { "onkeyup", DOMNode::OnKeyUp, DontDelete, 0, 0 },
+   { "onload", DOMNode::OnLoad, DontDelete, 0, 0 },
+   { "onmove", DOMNode::OnMove, DontDelete, 0, 0 },
+   { "onsubmit", DOMNode::OnSubmit, DontDelete, 0, 0 },
+   { "offsetTop", DOMNode::OffsetTop, DontDelete|ReadOnly, 0, 0 },
    { "offsetWidth", DOMNode::OffsetWidth, DontDelete|ReadOnly, 0, 0 },
+   { "offsetHeight", DOMNode::OffsetHeight, DontDelete|ReadOnly, 0, 0 },
    { "clientWidth", DOMNode::ClientWidth, DontDelete|ReadOnly, 0, 0 },
-   { "clientHeight", DOMNode::ClientHeight, DontDelete|ReadOnly, 0, 0 },
    { "scrollLeft", DOMNode::ScrollLeft, DontDelete, 0, 0 },
-   { "scrollWidth", DOMNode::ScrollWidth, DontDelete|ReadOnly, 0, 0 },
-   { "scrollHeight", DOMNode::ScrollHeight, DontDelete|ReadOnly, 0, 0 }
+   { "scrollWidth", DOMNode::ScrollWidth, DontDelete|ReadOnly, 0, 0 }
 };
 
-const struct HashTable DOMNodeTable = { 2, 78, DOMNodeTableEntries, 56 };
+const struct HashTable DOMNodeTable = { 2, 79, DOMNodeTableEntries, 60 };
 
 } // namespace
 
diff --git a/WebCore/khtml/ecma/kjs_events.cpp b/WebCore/khtml/ecma/kjs_events.cpp
index 42d18d9..2e6c392 100644
--- a/WebCore/khtml/ecma/kjs_events.cpp
+++ b/WebCore/khtml/ecma/kjs_events.cpp
@@ -28,12 +28,14 @@
 #include "xml/dom_docimpl.h"
 #include "xml/dom2_eventsimpl.h"
 #include "rendering/render_object.h"
+#include "misc/loader.h"
 
 #include <kdebug.h>
 
 using namespace KJS;
 
 using DOM::KeyboardEvent;
+using DOM::EventImpl;
 
 // -------------------------------------------------------------------------
 
@@ -647,11 +649,21 @@ Value DOMMouseEvent::getValueProperty(ExecState *exec, int token) const
   case RelatedTarget:
     return getDOMNode(exec,static_cast<DOM::MouseEvent>(event).relatedTarget());
   case DataTransfer:
-    if (!clipboard) {
-      DOM::MouseEventImpl *impl = static_cast<DOM::MouseEventImpl *>(event.handle());
-      clipboard = new Clipboard(exec, impl->clipboard());
+  {
+    DOM::MouseEventImpl *impl = static_cast<DOM::MouseEventImpl *>(event.handle());
+    EventImpl::EventId eventId = impl->id();
+    if (eventId == EventImpl::DRAGENTER_EVENT || eventId == EventImpl::DRAGOVER_EVENT
+        || eventId == EventImpl::DRAGLEAVE_EVENT || eventId == EventImpl::DROP_EVENT 
+        || eventId == EventImpl::DRAGSTART_EVENT || eventId == EventImpl::DRAG_EVENT
+        || eventId == EventImpl::DRAGEND_EVENT) {
+      if (!clipboard) {
+        clipboard = new Clipboard(exec, impl->clipboard());
+      }
+      return Object(clipboard);
+    } else {
+      return Undefined();
     }
-    return Object(clipboard);
+  }
   default:
     kdWarning() << "Unhandled token in DOMMouseEvent::getValueProperty : " << token << endl;
     return Value();
@@ -881,10 +893,11 @@ const ClassInfo Clipboard::info = { "Clipboard", 0, &ClipboardTable, 0 };
   dropEffect	Clipboard::DropEffect	DontDelete
   dropAllowed	Clipboard::DropAllowed	DontDelete
 @end
- at begin ClipboardProtoTable 3
+ at begin ClipboardProtoTable 4
   clearData	Clipboard::ClearData	DontDelete|Function 0
   getData	Clipboard::GetData	DontDelete|Function 1
   setData	Clipboard::SetData	DontDelete|Function 2
+  setDragImage	Clipboard::SetDragImage	DontDelete|Function 3
 @end
 */
 
@@ -990,6 +1003,29 @@ Value ClipboardProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &
                 exec->setException(err);
                 return err;
             }
+        case Clipboard::SetDragImage:
+        {
+            if (args.size() != 3) {
+                Object err = Error::create(exec,SyntaxError,"setData: Invalid number of arguments");
+                exec->setException(err);
+                return err;
+            }
+            
+            ObjectImp *o = static_cast<ObjectImp*>(args[0].imp());
+            if (!o->inherits(&Image::info)) {
+                Object err = Error::create(exec,TypeError);
+                exec->setException(err);
+                return err;
+            }
+
+            Image *JSImage = static_cast<Image*>(o);
+            int x = (int)args[1].toNumber(exec);
+            int y = (int)args[2].toNumber(exec);
+            cb->clipboard->setDragImage(JSImage->image()->pixmap());
+            cb->clipboard->setDragLocation(QPoint(x,y));
+
+            return Undefined();
+        }
     }
     return Undefined();
 }
diff --git a/WebCore/khtml/ecma/kjs_events.h b/WebCore/khtml/ecma/kjs_events.h
index 051c122..310d7fb 100644
--- a/WebCore/khtml/ecma/kjs_events.h
+++ b/WebCore/khtml/ecma/kjs_events.h
@@ -200,7 +200,7 @@ namespace KJS {
     virtual bool toBoolean(ExecState *) const { return true; }
     virtual const ClassInfo* classInfo() const { return &info; }
     static const ClassInfo info;
-    enum { ClearData, GetData, SetData, DropEffect, DropAllowed };
+    enum { ClearData, GetData, SetData, SetDragImage, DropEffect, DropAllowed };
   private:
     DOM::ClipboardImpl *clipboard;
   };
diff --git a/WebCore/khtml/ecma/kjs_events.lut.h b/WebCore/khtml/ecma/kjs_events.lut.h
index e6e7b58..9de2e2d 100644
--- a/WebCore/khtml/ecma/kjs_events.lut.h
+++ b/WebCore/khtml/ecma/kjs_events.lut.h
@@ -225,12 +225,14 @@ const struct HashTable ClipboardTable = { 2, 2, ClipboardTableEntries, 2 };
 namespace KJS {
 
 const struct HashEntry ClipboardProtoTableEntries[] = {
-   { "clearData", Clipboard::ClearData, DontDelete|Function, 0, 0 },
    { 0, 0, 0, 0, 0 },
-   { "getData", Clipboard::GetData, DontDelete|Function, 1, &ClipboardProtoTableEntries[3] },
-   { "setData", Clipboard::SetData, DontDelete|Function, 2, 0 }
+   { "clearData", Clipboard::ClearData, DontDelete|Function, 0, &ClipboardProtoTableEntries[5] },
+   { "getData", Clipboard::GetData, DontDelete|Function, 1, &ClipboardProtoTableEntries[4] },
+   { 0, 0, 0, 0, 0 },
+   { "setData", Clipboard::SetData, DontDelete|Function, 2, 0 },
+   { "setDragImage", Clipboard::SetDragImage, DontDelete|Function, 3, 0 }
 };
 
-const struct HashTable ClipboardProtoTable = { 2, 4, ClipboardProtoTableEntries, 3 };
+const struct HashTable ClipboardProtoTable = { 2, 6, ClipboardProtoTableEntries, 4 };
 
 } // namespace
diff --git a/WebCore/khtml/html/html_elementimpl.cpp b/WebCore/khtml/html/html_elementimpl.cpp
index 7e8fa8f..fe587cc 100644
--- a/WebCore/khtml/html/html_elementimpl.cpp
+++ b/WebCore/khtml/html/html_elementimpl.cpp
@@ -463,7 +463,19 @@ void HTMLElementImpl::parseHTMLAttribute(HTMLAttributeImpl *attr)
         setHTMLEventListener(EventImpl::DROP_EVENT,
                              getDocument()->createHTMLEventListener(attr->value().string()));
         break;
-    // other misc attributes
+    case ATTR_ONDRAGSTART:
+        setHTMLEventListener(EventImpl::DRAGSTART_EVENT,
+                             getDocument()->createHTMLEventListener(attr->value().string()));
+        break;
+    case ATTR_ONDRAG:
+        setHTMLEventListener(EventImpl::DRAG_EVENT,
+                             getDocument()->createHTMLEventListener(attr->value().string()));
+        break;
+    case ATTR_ONDRAGEND:
+        setHTMLEventListener(EventImpl::DRAGEND_EVENT,
+                             getDocument()->createHTMLEventListener(attr->value().string()));
+        break;
+        // other misc attributes
     default:
 #ifdef UNSUPPORTED_ATTR
 	kdDebug(6030) << "UATTR: <" << this->nodeName().string() << "> ["
diff --git a/WebCore/khtml/khtml_part.cpp b/WebCore/khtml/khtml_part.cpp
index f5107a5..630174c 100644
--- a/WebCore/khtml/khtml_part.cpp
+++ b/WebCore/khtml/khtml_part.cpp
@@ -4263,6 +4263,12 @@ bool KHTMLPart::dndEnabled() const
   return d->m_bDnd;
 }
 
+bool KHTMLPart::shouldDragAutoNode(DOM::NodeImpl *node) const
+{
+    // No KDE impl yet
+    return false;
+}
+
 void KHTMLPart::customEvent( QCustomEvent *event )
 {
   if ( khtml::MousePressEvent::test( event ) )
diff --git a/WebCore/khtml/khtml_part.h b/WebCore/khtml/khtml_part.h
index 5b57448..8b260f0 100644
--- a/WebCore/khtml/khtml_part.h
+++ b/WebCore/khtml/khtml_part.h
@@ -300,6 +300,11 @@ public:
   bool dndEnabled() const;
 
   /**
+   * Implementation of CSS property -khtml-user-drag == auto
+   */
+  virtual bool shouldDragAutoNode(DOM::NodeImpl*) const;
+  
+  /**
    * Enables/disables Java applet support. Note that calling this function
    * will permanently override the User settings about Java applet support.
    * Not calling this function is the only way to let the default settings
diff --git a/WebCore/khtml/misc/htmlattrs.c b/WebCore/khtml/misc/htmlattrs.c
index f05e4f9..7541038 100644
--- a/WebCore/khtml/misc/htmlattrs.c
+++ b/WebCore/khtml/misc/htmlattrs.c
@@ -8,7 +8,7 @@ struct attrs {
     const char *name;
     int id;
 };
-/* maximum key range = 939, duplicates = 1 */
+/* maximum key range = 894, duplicates = 1 */
 
 #ifdef __GNUC__
 __inline
@@ -22,32 +22,32 @@ hash_attr (register const char *str, register unsigned int len)
 {
   static const unsigned short asso_values[] =
     {
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948,  10, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948,  65, 115,  10,
-      185,   0, 110, 220, 105,   0,   0,  85,   0, 145,
-        0,   0,   5,   0,  10,  35,  65, 190,   5,  35,
-       50,   0,   0, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948, 948, 948, 948, 948,
-      948, 948, 948, 948, 948, 948
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917,  10, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 100, 120,  10,
+      150,   0,  40, 115, 165,   0,   5, 210,   0,  80,
+        0,   0, 125,   0,  20,  35,  60,  50, 110, 215,
+      100,  15,  15, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917, 917, 917, 917, 917,
+      917, 917, 917, 917, 917, 917
     };
   register int hval = len;
 
@@ -97,309 +97,308 @@ findAttr (register const char *str, register unsigned int len)
 {
   enum
     {
-      TOTAL_KEYWORDS = 171,
+      TOTAL_KEYWORDS = 174,
       MIN_WORD_LENGTH = 2,
       MAX_WORD_LENGTH = 15,
-      MIN_HASH_VALUE = 9,
-      MAX_HASH_VALUE = 947
+      MIN_HASH_VALUE = 23,
+      MAX_HASH_VALUE = 916
     };
 
   static const struct attrs wordlist_attr[] =
     {
-      {"loop", ATTR_LOOP},
       {"rel", ATTR_REL},
-      {"rev", ATTR_REV},
       {"color", ATTR_COLOR},
-      {"onerror", ATTR_ONERROR},
-      {"size", ATTR_SIZE},
       {"cols", ATTR_COLS},
-      {"noresize", ATTR_NORESIZE},
-      {"onresize", ATTR_ONRESIZE},
-      {"scope", ATTR_SCOPE},
-      {"version", ATTR_VERSION},
+      {"size", ATTR_SIZE},
+      {"for", ATTR_FOR},
+      {"onerror", ATTR_ONERROR},
       {"src", ATTR_SRC},
       {"onscroll", ATTR_ONSCROLL},
-      {"precision", ATTR_PRECISION},
-      {"top", ATTR_TOP},
-      {"type", ATTR_TYPE},
-      {"plain", ATTR_PLAIN},
-      {"oversrc", ATTR_OVERSRC},
       {"cite", ATTR_CITE},
-      {"rows", ATTR_ROWS},
-      {"enctype", ATTR_ENCTYPE},
-      {"link", ATTR_LINK},
-      {"clear", ATTR_CLEAR},
-      {"vlink", ATTR_VLINK},
+      {"noresize", ATTR_NORESIZE},
+      {"onresize", ATTR_ONRESIZE},
+      {"min", ATTR_MIN},
+      {"left", ATTR_LEFT},
+      {"rules", ATTR_RULES},
+      {"onselect", ATTR_ONSELECT},
       {"style", ATTR_STYLE},
-      {"span", ATTR_SPAN},
-      {"nosave", ATTR_NOSAVE},
-      {"onclick", ATTR_ONCLICK},
       {"onreset", ATTR_ONRESET},
-      {"onselect", ATTR_ONSELECT},
-      {"wrap", ATTR_WRAP},
-      {"nowrap", ATTR_NOWRAP},
-      {"colspan", ATTR_COLSPAN},
-      {"for", ATTR_FOR},
-      {"vspace", ATTR_VSPACE},
-      {"profile", ATTR_PROFILE},
-      {"alt", ATTR_ALT},
       {"title", ATTR_TITLE},
-      {"action", ATTR_ACTION},
+      {"loop", ATTR_LOOP},
+      {"rev", ATTR_REV},
+      {"clear", ATTR_CLEAR},
       {"content", ATTR_CONTENT},
-      {"min", ATTR_MIN},
-      {"class", ATTR_CLASS},
-      {"axis", ATTR_AXIS},
-      {"alink", ATTR_ALINK},
-      {"rowspan", ATTR_ROWSPAN},
-      {"accept", ATTR_ACCEPT},
-      {"keytype", ATTR_KEYTYPE},
-      {"left", ATTR_LEFT},
-      {"onkeypress", ATTR_ONKEYPRESS},
-      {"text", ATTR_TEXT},
-      {"label", ATTR_LABEL},
+      {"onfocus", ATTR_ONFOCUS},
       {"id", ATTR_ID},
       {"face", ATTR_FACE},
-      {"char", ATTR_CHAR},
-      {"object", ATTR_OBJECT},
-      {"dir", ATTR_DIR},
+      {"alt", ATTR_ALT},
       {"code", ATTR_CODE},
-      {"archive", ATTR_ARCHIVE},
-      {"ondrop", ATTR_ONDROP},
+      {"version", ATTR_VERSION},
+      {"dir", ATTR_DIR},
+      {"scope", ATTR_SCOPE},
+      {"action", ATTR_ACTION},
       {"name", ATTR_NAME},
-      {"shape", ATTR_SHAPE},
-      {"hspace", ATTR_HSPACE},
+      {"class", ATTR_CLASS},
+      {"top", ATTR_TOP},
+      {"scrolling", ATTR_SCROLLING},
+      {"profile", ATTR_PROFILE},
+      {"onblur", ATTR_ONBLUR},
+      {"precision", ATTR_PRECISION},
+      {"object", ATTR_OBJECT},
+      {"oversrc", ATTR_OVERSRC},
+      {"type", ATTR_TYPE},
+      {"results", ATTR_RESULTS},
+      {"link", ATTR_LINK},
+      {"defer", ATTR_DEFER},
+      {"enctype", ATTR_ENCTYPE},
+      {"lang", ATTR_LANG},
+      {"align", ATTR_ALIGN},
+      {"coords", ATTR_COORDS},
+      {"text", ATTR_TEXT},
+      {"label", ATTR_LABEL},
       {"href", ATTR_HREF},
-      {"visibility", ATTR_VISIBILITY},
+      {"plain", ATTR_PLAIN},
       {"nohref", ATTR_NOHREF},
-      {"onsearch", ATTR_ONSEARCH},
-      {"prompt", ATTR_PROMPT},
-      {"rules", ATTR_RULES},
+      {"onclick", ATTR_ONCLICK},
+      {"axis", ATTR_AXIS},
+      {"oninput", ATTR_ONINPUT},
+      {"frame", ATTR_FRAME},
+      {"direction", ATTR_DIRECTION},
+      {"nosave", ATTR_NOSAVE},
+      {"onload", ATTR_ONLOAD},
+      {"selected", ATTR_SELECTED},
+      {"span", ATTR_SPAN},
+      {"value", ATTR_VALUE},
+      {"bgcolor", ATTR_BGCOLOR},
+      {"rows", ATTR_ROWS},
+      {"colspan", ATTR_COLSPAN},
       {"start", ATTR_START},
-      {"coords", ATTR_COORDS},
-      {"accesskey", ATTR_ACCESSKEY},
+      {"incremental", ATTR_INCREMENTAL},
       {"z-index", ATTR_Z_INDEX},
-      {"ismap", ATTR_ISMAP},
-      {"onload", ATTR_ONLOAD},
-      {"onabort", ATTR_ONABORT},
       {"max", ATTR_MAX},
-      {"value", ATTR_VALUE},
-      {"oninput", ATTR_ONINPUT},
-      {"readonly", ATTR_READONLY},
-      {"composite", ATTR_COMPOSITE},
-      {"codetype", ATTR_CODETYPE},
+      {"onmouseout", ATTR_ONMOUSEOUT},
       {"declare", ATTR_DECLARE},
-      {"direction", ATTR_DIRECTION},
-      {"scrolling", ATTR_SCROLLING},
-      {"onkeyup", ATTR_ONKEYUP},
-      {"lang", ATTR_LANG},
-      {"align", ATTR_ALIGN},
-      {"pagey", ATTR_PAGEY},
-      {"valign", ATTR_VALIGN},
-      {"charset", ATTR_CHARSET},
+      {"readonly", ATTR_READONLY},
       {"scheme", ATTR_SCHEME},
-      {"selected", ATTR_SELECTED},
-      {"incremental", ATTR_INCREMENTAL},
-      {"compact", ATTR_COMPACT},
-      {"behavior", ATTR_BEHAVIOR},
-      {"abbr", ATTR_ABBR},
-      {"defer", ATTR_DEFER},
-      {"onkeydown", ATTR_ONKEYDOWN},
-      {"scrolldelay", ATTR_SCROLLDELAY},
-      {"unknown", ATTR_UNKNOWN},
+      {"char", ATTR_CHAR},
+      {"ondrop", ATTR_ONDROP},
+      {"onmouseover", ATTR_ONMOUSEOVER},
+      {"onabort", ATTR_ONABORT},
+      {"onunload", ATTR_ONUNLOAD},
       {"html", ATTR_HTML},
-      {"onblur", ATTR_ONBLUR},
+      {"accept", ATTR_ACCEPT},
+      {"alink", ATTR_ALINK},
       {"border", ATTR_BORDER},
-      {"frame", ATTR_FRAME},
-      {"classid", ATTR_CLASSID},
-      {"valuetype", ATTR_VALUETYPE},
+      {"longdesc", ATTR_LONGDESC},
+      {"composite", ATTR_COMPOSITE},
+      {"multiple", ATTR_MULTIPLE},
+      {"vlink", ATTR_VLINK},
       {"cellborder", ATTR_CELLBORDER},
-      {"results", ATTR_RESULTS},
-      {"mayscript", ATTR_MAYSCRIPT},
-      {"pagex", ATTR_PAGEX},
-      {"bordercolor", ATTR_BORDERCOLOR},
-      {"onfocus", ATTR_ONFOCUS},
-      {"cellspacing", ATTR_CELLSPACING},
-      {"bgcolor", ATTR_BGCOLOR},
-      {"data", ATTR_DATA},
-      {"placeholder", ATTR_PLACEHOLDER},
-      {"width", ATTR_WIDTH},
-      {"onmouseover", ATTR_ONMOUSEOVER},
-      {"noshade", ATTR_NOSHADE},
+      {"valign", ATTR_VALIGN},
       {"media", ATTR_MEDIA},
-      {"checked", ATTR_CHECKED},
-      {"headers", ATTR_HEADERS},
+      {"classid", ATTR_CLASSID},
+      {"onsearch", ATTR_ONSEARCH},
+      {"scrolldelay", ATTR_SCROLLDELAY},
+      {"ismap", ATTR_ISMAP},
+      {"onmouseup", ATTR_ONMOUSEUP},
+      {"visibility", ATTR_VISIBILITY},
+      {"bordercolor", ATTR_BORDERCOLOR},
+      {"onsubmit", ATTR_ONSUBMIT},
+      {"pagey", ATTR_PAGEY},
+      {"target", ATTR_TARGET},
+      {"abbr", ATTR_ABBR},
+      {"onmousemove", ATTR_ONMOUSEMOVE},
+      {"scrollamount", ATTR_SCROLLAMOUNT},
+      {"codetype", ATTR_CODETYPE},
+      {"pluginurl", ATTR_PLUGINURL},
+      {"oncontextmenu", ATTR_ONCONTEXTMENU},
+      {"charoff", ATTR_CHAROFF},
+      {"vspace", ATTR_VSPACE},
+      {"summary", ATTR_SUMMARY},
+      {"ondrag", ATTR_ONDRAG},
+      {"compact", ATTR_COMPACT},
+      {"usemap", ATTR_USEMAP},
+      {"charset", ATTR_CHARSET},
       {"onchange", ATTR_ONCHANGE},
       {"challenge", ATTR_CHALLENGE},
-      {"multiple", ATTR_MULTIPLE},
-      {"ondblclick", ATTR_ONDBLCLICK},
-      {"charoff", ATTR_CHAROFF},
+      {"cellspacing", ATTR_CELLSPACING},
+      {"onkeyup", ATTR_ONKEYUP},
+      {"archive", ATTR_ARCHIVE},
+      {"data", ATTR_DATA},
+      {"prompt", ATTR_PROMPT},
       {"codebase", ATTR_CODEBASE},
-      {"target", ATTR_TARGET},
+      {"accesskey", ATTR_ACCESSKEY},
+      {"leftmargin", ATTR_LEFTMARGIN},
+      {"shape", ATTR_SHAPE},
+      {"keytype", ATTR_KEYTYPE},
+      {"hspace", ATTR_HSPACE},
+      {"pagex", ATTR_PAGEX},
+      {"hreflang", ATTR_HREFLANG},
+      {"truespeed", ATTR_TRUESPEED},
+      {"onkeypress", ATTR_ONKEYPRESS},
+      {"mayscript", ATTR_MAYSCRIPT},
+      {"noshade", ATTR_NOSHADE},
+      {"datetime", ATTR_DATETIME},
+      {"method", ATTR_METHOD},
       {"autosave", ATTR_AUTOSAVE},
-      {"usemap", ATTR_USEMAP},
-      {"onunload", ATTR_ONUNLOAD},
-      {"http-equiv", ATTR_HTTP_EQUIV},
-      {"longdesc", ATTR_LONGDESC},
-      {"accept-charset", ATTR_ACCEPT_CHARSET},
-      {"standby", ATTR_STANDBY},
-      {"bgproperties", ATTR_BGPROPERTIES},
+      {"wrap", ATTR_WRAP},
+      {"nowrap", ATTR_NOWRAP},
+      {"valuetype", ATTR_VALUETYPE},
       {"hidden", ATTR_HIDDEN},
-      {"tabindex", ATTR_TABINDEX},
-      {"truespeed", ATTR_TRUESPEED},
+      {"ondragenter", ATTR_ONDRAGENTER},
+      {"headers", ATTR_HEADERS},
+      {"unknown", ATTR_UNKNOWN},
+      {"standby", ATTR_STANDBY},
+      {"language", ATTR_LANGUAGE},
+      {"autocomplete", ATTR_AUTOCOMPLETE},
+      {"rowspan", ATTR_ROWSPAN},
+      {"topmargin", ATTR_TOPMARGIN},
+      {"ondblclick", ATTR_ONDBLCLICK},
       {"height", ATTR_HEIGHT},
+      {"behavior", ATTR_BEHAVIOR},
       {"ondragover", ATTR_ONDRAGOVER},
-      {"method", ATTR_METHOD},
-      {"hreflang", ATTR_HREFLANG},
-      {"topmargin", ATTR_TOPMARGIN},
-      {"onmousemove", ATTR_ONMOUSEMOVE},
-      {"scrollamount", ATTR_SCROLLAMOUNT},
-      {"datetime", ATTR_DATETIME},
-      {"oncontextmenu", ATTR_ONCONTEXTMENU},
-      {"autocomplete", ATTR_AUTOCOMPLETE},
-      {"onsubmit", ATTR_ONSUBMIT},
-      {"ondragleave", ATTR_ONDRAGLEAVE},
-      {"ondragenter", ATTR_ONDRAGENTER},
-      {"onmouseup", ATTR_ONMOUSEUP},
-      {"tableborder", ATTR_TABLEBORDER},
-      {"contenteditable", ATTR_CONTENTEDITABLE},
-      {"disabled", ATTR_DISABLED},
-      {"summary", ATTR_SUMMARY},
+      {"tabindex", ATTR_TABINDEX},
       {"onmousedown", ATTR_ONMOUSEDOWN},
-      {"pluginurl", ATTR_PLUGINURL},
-      {"leftmargin", ATTR_LEFTMARGIN},
-      {"onmouseout", ATTR_ONMOUSEOUT},
-      {"maxlength", ATTR_MAXLENGTH},
+      {"ondragend", ATTR_ONDRAGEND},
+      {"checked", ATTR_CHECKED},
       {"frameborder", ATTR_FRAMEBORDER},
-      {"cellpadding", ATTR_CELLPADDING},
+      {"disabled", ATTR_DISABLED},
+      {"contenteditable", ATTR_CONTENTEDITABLE},
+      {"placeholder", ATTR_PLACEHOLDER},
+      {"http-equiv", ATTR_HTTP_EQUIV},
+      {"width", ATTR_WIDTH},
+      {"onkeydown", ATTR_ONKEYDOWN},
+      {"tableborder", ATTR_TABLEBORDER},
+      {"ondragleave", ATTR_ONDRAGLEAVE},
+      {"maxlength", ATTR_MAXLENGTH},
+      {"bgproperties", ATTR_BGPROPERTIES},
       {"pluginpage", ATTR_PLUGINPAGE},
+      {"cellpadding", ATTR_CELLPADDING},
+      {"ondragstart", ATTR_ONDRAGSTART},
       {"pluginspage", ATTR_PLUGINSPAGE},
-      {"language", ATTR_LANGUAGE},
-      {"marginwidth", ATTR_MARGINWIDTH},
+      {"accept-charset", ATTR_ACCEPT_CHARSET},
       {"background", ATTR_BACKGROUND},
-      {"marginheight", ATTR_MARGINHEIGHT}
+      {"marginheight", ATTR_MARGINHEIGHT},
+      {"marginwidth", ATTR_MARGINWIDTH}
     };
 
   static const short lookup[] =
     {
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,    0,   -1,   -1,   -1,    1,   -1,   -1,
-        -1,   -1,    2,   -1,   -1,   -1,   -1,   -1,
-        -1,    3,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,    4,   -1,    5,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,    6,   -1,   -1,   -1, -231,   -1,    9,
-        -1,   10,   11, -164,   -2,   -1,   -1,   12,
-        -1,   -1,   -1,   -1,   -1,   13,   -1,   -1,
-        -1,   14,   15,   16,   -1,   17,   -1,   18,
-        -1,   -1,   -1,   -1,   19,   -1,   -1,   20,
-        -1,   21,   22,   -1,   -1,   -1,   -1,   23,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   24,   -1,   -1,   -1,   25,   -1,   26,
-        27,   -1,   -1,   -1,   -1,   28,   29,   30,
-        -1,   31,   32,   33,   -1,   -1,   34,   -1,
-        -1,   -1,   -1,   -1,   35,   36,   -1,   37,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   38,   39,   40,   -1,   41,   -1,
-        -1,   -1,   42,   43,   -1,   44,   -1,   -1,
-        -1,   45,   46,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   47,   48,   -1,   -1,   -1,
-        49,   50,   -1,   51,   -1,   52,   -1,   -1,
-        -1,   -1,   53,   -1,   54,   -1,   55,   56,
-        -1,   -1,   57,   -1,   -1,   -1,   58,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   59,   60,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   61,   -1,   -1,   62,   63,   64,
-        -1,   65,   -1,   -1,   66,   -1,   -1,   -1,
-        67,   -1,   -1,   -1,   -1,   68,   69,   -1,
-        -1,   70,   -1,   -1,   71,   -1,   -1,   72,
-        73,   -1,   -1,   -1,   -1,   -1,   74,   75,
-        -1,   76,   -1,   77,   78,   79,   -1,   -1,
-        -1,   80,   -1,   -1,   -1,   81,   -1,   82,
-        -1,   -1,   -1,   -1,   83,   -1,   -1,   84,
-        -1,   85,   86,   -1,   -1,   -1,   -1,   87,
-        88,   89,   -1,   -1,   -1,   90,   -1,   91,
-        -1,   -1,   92,   93,   94,   95,   96,   -1,
-        -1,   -1,   97,   -1,   98,   99,   -1,  100,
-        -1,  101,   -1,   -1,   -1,   -1,  102,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,  103,
-        -1,  104,   -1,  105,  106,   -1,  107,   -1,
-       108,  109,   -1,   -1,   -1,   -1,   -1,  110,
-       111,   -1,   -1,   -1,  112,   -1,   -1,   -1,
-        -1,   -1,  113,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-       114,   -1,   -1,   -1,   -1,   -1,   -1,  115,
-        -1,   -1,   -1,  116,  117,  118,   -1,   -1,
-       119,   -1,  120,   -1,   -1,   -1,   -1,  121,
-       122,  123,   -1,   -1,   -1,  124,   -1,  125,
-        -1,  126,  127,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,  128,
-        -1,  129,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,  130,   -1,
-       131,   -1,   -1,   -1,   -1,   -1,   -1,  132,
-        -1,   -1,  133,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,  134,   -1,   -1,
-       135,   -1,   -1,   -1,   -1,  136,   -1,   -1,
-        -1,  137,   -1,   -1,   -1,   -1,   -1,   -1,
-       138,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,  139,   -1,  140,   -1,   -1,
-        -1,  141,  142,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,  143,  144,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,  145,  146,  147,   -1,   -1,
-        -1,   -1,  148,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,  149,  150,   -1,
-        -1,  151,   -1,   -1,   -1,   -1,  152,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,  153,   -1,
-       154,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,  155,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,  156,   -1,   -1,   -1,  157,   -1,   -1,
-        -1,  158,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-       159,  160,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,  161,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,  162,   -1,  163,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,    0,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,    1,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,    2,   -1,   -1,   -1,   -1,    3,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,    4,
+        -1,   -1,   -1,    5,    6,   -1,   -1,   -1,
+        -1,    7,    8,   -1,   -1,   -1, -254, -165,
+        -2,   -1,   -1,   11,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        12,   -1,   -1,   -1,   -1,   -1,   13,   -1,
+        -1,   14,   -1,   15,   -1,   -1,   -1,   -1,
+        -1,   -1,   16,   -1,   -1,   17,   -1,   -1,
+        -1,   18,   -1,   -1,   -1,   19,   -1,   20,
+        -1,   21,   -1,   -1,   -1,   -1,   22,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        23,   -1,   24,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,   25,   26,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,   27,   28,   -1,   29,
+        30,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        31,   32,   -1,   -1,   33,   34,   -1,   -1,
+        35,   -1,   -1,   -1,   36,   -1,   -1,   37,
+        -1,   38,   39,   -1,   40,   -1,   -1,   41,
+        -1,   -1,   -1,   -1,   -1,   -1,   42,   43,
+        -1,   44,   -1,   45,   46,   47,   -1,   -1,
+        48,   49,   -1,   -1,   -1,   50,   51,   52,
+        -1,   -1,   -1,   -1,   -1,   53,   -1,   54,
+        -1,   -1,   55,   -1,   -1,   56,   -1,   -1,
+        -1,   57,   -1,   58,   -1,   -1,   -1,   -1,
+        59,   -1,   -1,   -1,   -1,   -1,   -1,   60,
+        61,   62,   -1,   -1,   -1,   -1,   -1,   -1,
+        63,   -1,   64,   -1,   -1,   65,   -1,   -1,
+        66,   67,   68,   69,   -1,   70,   -1,   71,
+        -1,   -1,   -1,   -1,   -1,   72,   -1,   -1,
+        73,   -1,   -1,   74,   -1,   75,   -1,   -1,
+        -1,   -1,   76,   77,   78,   79,   -1,   80,
+        -1,   -1,   -1,   81,   82,   -1,   83,   84,
+        -1,   -1,   -1,   85,   -1,   86,   -1,   -1,
+        -1,   -1,   87,   88,   -1,   -1,   -1,   89,
+        -1,   90,   91,   -1,   -1,   92,   -1,   -1,
+        -1,   93,   -1,   -1,   -1,   94,   95,   96,
+        -1,   97,   -1,   -1,   -1,   -1,   -1,   -1,
+        98,   99,   -1,   -1,  100,   -1,  101,  102,
+       103,  104,   -1,   -1,   -1,  105,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,  106,   -1,
+        -1,   -1,  107,  108,   -1,   -1,   -1,  109,
+       110,   -1,   -1,   -1,  111,  112,  113,  114,
+        -1,   -1,   -1,   -1,   -1,   -1,  115,  116,
+        -1,   -1,   -1,   -1,  117,   -1,  118,   -1,
+       119,   -1,   -1,   -1,   -1,   -1,   -1,  120,
+       121,  122,   -1,   -1,   -1,   -1,  123,   -1,
+       124,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,  125,   -1,   -1,   -1,  126,   -1,   -1,
+       127,  128,  129,   -1,   -1,   -1,  130,   -1,
+        -1,  131,  132,   -1,   -1,  133,   -1,  134,
+       135,   -1,  136,   -1,   -1,  137,   -1,  138,
+        -1,   -1,   -1,   -1,  139,  140,   -1,   -1,
+        -1,   -1,  141,   -1,   -1,   -1,   -1,  142,
+       143,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,  144,   -1,   -1,   -1,   -1,  145,   -1,
+        -1,   -1,   -1,   -1,   -1,  146,  147,  148,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,  149,   -1,  150,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,  151,   -1,   -1,  152,   -1,   -1,
+       153,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+       154,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,  155,   -1,  156,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,  157,
+        -1,   -1,   -1,   -1,   -1,  158,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,  159,   -1,
+        -1,   -1,   -1,  160,   -1,   -1,   -1,  161,
+        -1,  162,   -1,   -1,   -1,   -1,  163,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,  164,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,  164,   -1,   -1,
+       165,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+       166,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,  167,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,  168,
+        -1,   -1,   -1,   -1,  169,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,  165,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,   -1,   -1,   -1,   -1,   -1,   -1,  170,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,   -1,   -1,   -1,   -1,  166,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-       167,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+        -1,  171,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,  168,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
+       172,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,  169,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
         -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
-        -1,   -1,   -1,  170
+        -1,   -1,   -1,   -1,  173
     };
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
@@ -534,9 +533,12 @@ static const char * const attrList[] = {
     "ONCLICK",
     "ONCONTEXTMENU",
     "ONDBLCLICK",
+    "ONDRAG",
+    "ONDRAGEND",
     "ONDRAGENTER",
     "ONDRAGLEAVE",
     "ONDRAGOVER",
+    "ONDRAGSTART",
     "ONDROP",
     "ONERROR",
     "ONFOCUS",
diff --git a/WebCore/khtml/misc/htmlattrs.h b/WebCore/khtml/misc/htmlattrs.h
index 2a007e3..be7ced3 100644
--- a/WebCore/khtml/misc/htmlattrs.h
+++ b/WebCore/khtml/misc/htmlattrs.h
@@ -102,83 +102,86 @@ htmlattrs.in by makeattrs, do not edit */
 #define ATTR_ONCLICK 93
 #define ATTR_ONCONTEXTMENU 94
 #define ATTR_ONDBLCLICK 95
-#define ATTR_ONDRAGENTER 96
-#define ATTR_ONDRAGLEAVE 97
-#define ATTR_ONDRAGOVER 98
-#define ATTR_ONDROP 99
-#define ATTR_ONERROR 100
-#define ATTR_ONFOCUS 101
-#define ATTR_ONINPUT 102
-#define ATTR_ONKEYDOWN 103
-#define ATTR_ONKEYPRESS 104
-#define ATTR_ONKEYUP 105
-#define ATTR_ONLOAD 106
-#define ATTR_ONMOUSEDOWN 107
-#define ATTR_ONMOUSEMOVE 108
-#define ATTR_ONMOUSEOUT 109
-#define ATTR_ONMOUSEOVER 110
-#define ATTR_ONMOUSEUP 111
-#define ATTR_ONRESET 112
-#define ATTR_ONRESIZE 113
-#define ATTR_ONSCROLL 114
-#define ATTR_ONSEARCH 115
-#define ATTR_ONSELECT 116
-#define ATTR_ONSUBMIT 117
-#define ATTR_ONUNLOAD 118
-#define ATTR_OVERSRC 119
-#define ATTR_PAGEX 120
-#define ATTR_PAGEY 121
-#define ATTR_PLACEHOLDER 122
-#define ATTR_PLAIN 123
-#define ATTR_PLUGINPAGE 124
-#define ATTR_PLUGINSPAGE 125
-#define ATTR_PLUGINURL 126
-#define ATTR_PRECISION 127
-#define ATTR_PROFILE 128
-#define ATTR_PROMPT 129
-#define ATTR_READONLY 130
-#define ATTR_REL 131
-#define ATTR_RESULTS 132
-#define ATTR_REV 133
-#define ATTR_ROWS 134
-#define ATTR_ROWSPAN 135
-#define ATTR_RULES 136
-#define ATTR_SCHEME 137
-#define ATTR_SCOPE 138
-#define ATTR_SCROLLAMOUNT 139
-#define ATTR_SCROLLDELAY 140
-#define ATTR_SCROLLING 141
-#define ATTR_SELECTED 142
-#define ATTR_SHAPE 143
-#define ATTR_SIZE 144
-#define ATTR_SPAN 145
-#define ATTR_SRC 146
-#define ATTR_STANDBY 147
-#define ATTR_START 148
-#define ATTR_STYLE 149
-#define ATTR_SUMMARY 150
-#define ATTR_TABINDEX 151
-#define ATTR_TABLEBORDER 152
-#define ATTR_TARGET 153
-#define ATTR_TEXT 154
-#define ATTR_TITLE 155
-#define ATTR_TOP 156
-#define ATTR_TOPMARGIN 157
-#define ATTR_TRUESPEED 158
-#define ATTR_TYPE 159
-#define ATTR_UNKNOWN 160
-#define ATTR_USEMAP 161
-#define ATTR_VALIGN 162
-#define ATTR_VALUE 163
-#define ATTR_VALUETYPE 164
-#define ATTR_VERSION 165
-#define ATTR_VISIBILITY 166
-#define ATTR_VLINK 167
-#define ATTR_VSPACE 168
-#define ATTR_WIDTH 169
-#define ATTR_WRAP 170
-#define ATTR_Z_INDEX 171
-#define ATTR_LAST_ATTR 171
+#define ATTR_ONDRAG 96
+#define ATTR_ONDRAGEND 97
+#define ATTR_ONDRAGENTER 98
+#define ATTR_ONDRAGLEAVE 99
+#define ATTR_ONDRAGOVER 100
+#define ATTR_ONDRAGSTART 101
+#define ATTR_ONDROP 102
+#define ATTR_ONERROR 103
+#define ATTR_ONFOCUS 104
+#define ATTR_ONINPUT 105
+#define ATTR_ONKEYDOWN 106
+#define ATTR_ONKEYPRESS 107
+#define ATTR_ONKEYUP 108
+#define ATTR_ONLOAD 109
+#define ATTR_ONMOUSEDOWN 110
+#define ATTR_ONMOUSEMOVE 111
+#define ATTR_ONMOUSEOUT 112
+#define ATTR_ONMOUSEOVER 113
+#define ATTR_ONMOUSEUP 114
+#define ATTR_ONRESET 115
+#define ATTR_ONRESIZE 116
+#define ATTR_ONSCROLL 117
+#define ATTR_ONSEARCH 118
+#define ATTR_ONSELECT 119
+#define ATTR_ONSUBMIT 120
+#define ATTR_ONUNLOAD 121
+#define ATTR_OVERSRC 122
+#define ATTR_PAGEX 123
+#define ATTR_PAGEY 124
+#define ATTR_PLACEHOLDER 125
+#define ATTR_PLAIN 126
+#define ATTR_PLUGINPAGE 127
+#define ATTR_PLUGINSPAGE 128
+#define ATTR_PLUGINURL 129
+#define ATTR_PRECISION 130
+#define ATTR_PROFILE 131
+#define ATTR_PROMPT 132
+#define ATTR_READONLY 133
+#define ATTR_REL 134
+#define ATTR_RESULTS 135
+#define ATTR_REV 136
+#define ATTR_ROWS 137
+#define ATTR_ROWSPAN 138
+#define ATTR_RULES 139
+#define ATTR_SCHEME 140
+#define ATTR_SCOPE 141
+#define ATTR_SCROLLAMOUNT 142
+#define ATTR_SCROLLDELAY 143
+#define ATTR_SCROLLING 144
+#define ATTR_SELECTED 145
+#define ATTR_SHAPE 146
+#define ATTR_SIZE 147
+#define ATTR_SPAN 148
+#define ATTR_SRC 149
+#define ATTR_STANDBY 150
+#define ATTR_START 151
+#define ATTR_STYLE 152
+#define ATTR_SUMMARY 153
+#define ATTR_TABINDEX 154
+#define ATTR_TABLEBORDER 155
+#define ATTR_TARGET 156
+#define ATTR_TEXT 157
+#define ATTR_TITLE 158
+#define ATTR_TOP 159
+#define ATTR_TOPMARGIN 160
+#define ATTR_TRUESPEED 161
+#define ATTR_TYPE 162
+#define ATTR_UNKNOWN 163
+#define ATTR_USEMAP 164
+#define ATTR_VALIGN 165
+#define ATTR_VALUE 166
+#define ATTR_VALUETYPE 167
+#define ATTR_VERSION 168
+#define ATTR_VISIBILITY 169
+#define ATTR_VLINK 170
+#define ATTR_VSPACE 171
+#define ATTR_WIDTH 172
+#define ATTR_WRAP 173
+#define ATTR_Z_INDEX 174
+#define ATTR_LAST_ATTR 174
 DOM::DOMString getAttrName(unsigned short id);
 
 #endif
diff --git a/WebCore/khtml/misc/htmlattrs.in b/WebCore/khtml/misc/htmlattrs.in
index 63677db..b76c8ae 100644
--- a/WebCore/khtml/misc/htmlattrs.in
+++ b/WebCore/khtml/misc/htmlattrs.in
@@ -93,9 +93,12 @@ onchange
 onclick
 oncontextmenu
 ondblclick
+ondrag
+ondragend
 ondragenter
 ondragleave
 ondragover
+ondragstart
 ondrop
 onerror
 onfocus
diff --git a/WebCore/khtml/rendering/render_object.cpp b/WebCore/khtml/rendering/render_object.cpp
index 76baed1..88d1b35 100644
--- a/WebCore/khtml/rendering/render_object.cpp
+++ b/WebCore/khtml/rendering/render_object.cpp
@@ -37,6 +37,7 @@
 #include <kdebug.h>
 #include <qpainter.h>
 #include "khtmlview.h"
+#include "khtml_part.h"
 #include "render_arena.h"
 #include "render_inline.h"
 #include "render_block.h"
@@ -1333,6 +1334,32 @@ bool RenderObject::shouldSelect() const
     return true;
 }
 
+DOM::NodeImpl* RenderObject::draggableNode() const
+{
+    const RenderObject* curr = this;
+    while (curr) {
+        if (curr->element()->nodeType() == Node::TEXT_NODE) {
+            // Since there's no way for the author to address the -khtml-user-drag style for a text node,
+            // we use our own judgement.
+            if (canvas()->view()->part()->shouldDragAutoNode(curr->node()))
+                return curr->node();
+            else if (curr->shouldSelect())
+                // In this case we have a click in the unselected portion of text.  If this text is
+                // selectable, we want to start the selection process instead of looking for a parent
+                // to try to drag.
+                return 0;
+        } else {
+            EUserDrag dragMode = curr->style()->userDrag();
+            if (dragMode == DRAG_ELEMENT)
+                return curr->node();
+            else if (dragMode == DRAG_AUTO && canvas()->view()->part()->shouldDragAutoNode(curr->node()))
+                return curr->node();
+        }
+        curr = curr->parent();
+    }
+    return 0;
+}
+
 void RenderObject::selectionStartEnd(int& spos, int& epos)
 {
     if (parent())
diff --git a/WebCore/khtml/rendering/render_object.h b/WebCore/khtml/rendering/render_object.h
index 29a8fac..da8afef 100644
--- a/WebCore/khtml/rendering/render_object.h
+++ b/WebCore/khtml/rendering/render_object.h
@@ -688,6 +688,8 @@ public:
     virtual void setSelectionState(SelectionState) {}
     bool shouldSelect() const;
 
+    DOM::NodeImpl* draggableNode() const;
+
     /**
      * Returns the content coordinates of the caret within this render object.
      * @param offset zero-based offset determining position within the render object.
diff --git a/WebCore/khtml/xml/dom2_eventsimpl.cpp b/WebCore/khtml/xml/dom2_eventsimpl.cpp
index 4b678f4..e9d14e2 100644
--- a/WebCore/khtml/xml/dom2_eventsimpl.cpp
+++ b/WebCore/khtml/xml/dom2_eventsimpl.cpp
@@ -191,6 +191,12 @@ EventImpl::EventId EventImpl::typeToId(DOMString type)
 	return DRAGLEAVE_EVENT;
     else if (type == "drop")
 	return DROP_EVENT;
+    else if (type == "dragstart")
+	return DRAGSTART_EVENT;
+    else if (type == "drag")
+	return DRAG_EVENT;
+    else if (type == "dragend")
+	return DRAGEND_EVENT;
     else if (type == "DOMSubtreeModified")
 	return DOMSUBTREEMODIFIED_EVENT;
     else if (type == "DOMNodeInserted")
@@ -279,6 +285,12 @@ DOMString EventImpl::idToType(EventImpl::EventId id)
             return "dragleave";
 	case DROP_EVENT:
 	    return "drop";
+	case DRAGSTART_EVENT:
+	    return "dragstart";
+	case DRAG_EVENT:
+	    return "drag";
+	case DRAGEND_EVENT:
+	    return "dragend";
 	case DOMSUBTREEMODIFIED_EVENT:
 	    return "DOMSubtreeModified";
 	case DOMNODEINSERTED_EVENT:
diff --git a/WebCore/khtml/xml/dom2_eventsimpl.h b/WebCore/khtml/xml/dom2_eventsimpl.h
index 684bdb5..b2a95c3 100644
--- a/WebCore/khtml/xml/dom2_eventsimpl.h
+++ b/WebCore/khtml/xml/dom2_eventsimpl.h
@@ -32,6 +32,8 @@
 #include <qevent.h>
 
 class KHTMLPart;
+class QPoint;
+class QStringList;
 
 namespace DOM {
 
@@ -63,6 +65,9 @@ public:
         DRAGOVER_EVENT,
         DRAGLEAVE_EVENT,
         DROP_EVENT,
+        DRAGSTART_EVENT,
+        DRAG_EVENT,
+        DRAGEND_EVENT,
         // Mutation events
         DOMSUBTREEMODIFIED_EVENT,
         DOMNODEINSERTED_EVENT,
@@ -386,6 +391,14 @@ public:
     virtual void clearAllData() = 0;
     virtual DOMString getData(const DOMString &type, bool &success) const = 0;
     virtual bool setData(const DOMString &type, const DOMString &data) = 0;
+    
+    // extensions beyond IE's API
+    virtual QStringList types() const = 0;
+    
+    virtual QPoint dragLocation() const = 0;
+    virtual void setDragLocation(const QPoint &) = 0;
+    virtual QPixmap dragImage() const = 0;
+    virtual void setDragImage(const QPixmap &) = 0;
 };
 
 }; //namespace
diff --git a/WebCore/kwq/KWQClipboard.h b/WebCore/kwq/KWQClipboard.h
index 626246e..3454206 100644
--- a/WebCore/kwq/KWQClipboard.h
+++ b/WebCore/kwq/KWQClipboard.h
@@ -48,11 +48,25 @@ public:
     void clearAllData();
     DOM::DOMString getData(const DOM::DOMString &type, bool &success) const;
     bool setData(const DOM::DOMString &type, const DOM::DOMString &data);
+    
+    //FIXME: need invalidate method for security
+    
+    // extensions beyond IE's API
+    virtual QStringList types() const;
+
+    QPoint dragLocation() const;
+    void setDragLocation(const QPoint &);
+    QPixmap dragImage() const;
+    void setDragImage(const QPixmap &);
+    NSImage *dragNSImage();
+
 private:
     NSPasteboard *m_pasteboard;
     bool m_forDragging;
     DOM::DOMString m_dropEffect;
     DOM::DOMString m_dropAllowed;
+    QPoint m_dragLoc;
+    QPixmap m_dragImage;
 };
 
 
diff --git a/WebCore/kwq/KWQClipboard.mm b/WebCore/kwq/KWQClipboard.mm
index c13c65e..1d8b0e7 100644
--- a/WebCore/kwq/KWQClipboard.mm
+++ b/WebCore/kwq/KWQClipboard.mm
@@ -24,6 +24,7 @@
  */
 
 #import "KWQClipboard.h"
+#import "KWQStringList.h"
 
 using DOM::DOMString;
 
@@ -94,12 +95,23 @@ static NSString *cocoaTypeFromMIMEType(const DOMString &type) {
     }
 }
 
+/*
+static QString MIMETypeFromCocoaType(NSString type) {
+    return QString("");
+}
+*/
+
 void KWQClipboard::clearData(const DOMString &type)
-{    
+{
+    NSString *cocoaType = cocoaTypeFromMIMEType(type);
+    if (cocoaType) {
+        [m_pasteboard setString:@"" forType:cocoaType];
+    }
 }
 
 void KWQClipboard::clearAllData()
 {
+    [m_pasteboard declareTypes:[NSArray array] owner:nil];
 }
 
 DOMString KWQClipboard::getData(const DOMString &type, bool &success) const
@@ -145,7 +157,7 @@ DOMString KWQClipboard::getData(const DOMString &type, bool &success) const
         } else {
             cocoaValue = nil;
         }
-    } else if (!cocoaValue) {        
+    } else if (cocoaType && !cocoaValue) {        
         cocoaValue = [m_pasteboard stringForType:cocoaType];
     }
 
@@ -159,5 +171,67 @@ DOMString KWQClipboard::getData(const DOMString &type, bool &success) const
 
 bool KWQClipboard::setData(const DOMString &type, const DOMString &data)
 {
-    return true;
+    NSString *cocoaType = cocoaTypeFromMIMEType(type);
+    NSString *cocoaData = data.string().getNSString();
+    if (cocoaType == NSURLPboardType) {
+        [m_pasteboard addTypes:[NSArray arrayWithObject:NSURLPboardType] owner:nil];
+        NSURL *url = [[NSURL alloc] initWithString:cocoaData];
+        [url writeToPasteboard:m_pasteboard];
+        
+        if ([url isFileURL]) {
+            [m_pasteboard addTypes:[NSArray arrayWithObject:NSFilenamesPboardType] owner:nil];
+            NSArray *fileList = [NSArray arrayWithObject:[url path]];
+            [m_pasteboard setPropertyList:fileList forType:NSFilenamesPboardType];
+        }
+
+        [url release];
+        return true;
+    } else if (cocoaType) {
+        // everything else we know of goes on the pboard as a string
+        [m_pasteboard addTypes:[NSArray arrayWithObject:cocoaType] owner:nil];
+        return [m_pasteboard setString:cocoaData forType:cocoaType];
+    } else {
+        return false;
+    }
+}
+
+QStringList KWQClipboard::types() const
+{
+#if 0
+    NSArray *types = [m_pasteboard types];
+    QStringList result;
+    if (types) {
+        unsigned count = [types count];
+        unsigned i;
+        for (i = 0; i < count; i++) {
+            NSString *nsstr = [types objectAtIndex:i];
+        }
+    }
+#endif
+    return QStringList();
+}
+
+QPoint KWQClipboard::dragLocation() const
+{
+    return m_dragLoc;
+}
+
+void KWQClipboard::setDragLocation(const QPoint &p)
+{
+    m_dragLoc = p;
+}
+
+QPixmap KWQClipboard::dragImage() const
+{
+    return m_dragImage;
+}
+
+void KWQClipboard::setDragImage(const QPixmap &pm)
+{
+    m_dragImage = pm;
+}
+
+NSImage *KWQClipboard::dragNSImage()
+{
+    return m_dragImage.image();
 }
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 9fb3766..41c3473 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -68,6 +68,7 @@ typedef DOMElement ObjCDOMElement;
 @class NSEvent;
 @class NSFileWrapper;
 @class NSFont;
+ at class NSImage;
 @class NSMutableDictionary;
 @class NSResponder;
 @class NSString;
@@ -87,6 +88,7 @@ class NSColor;
 class NSEvent;
 class NSFileWrapper;
 class NSFont;
+class NSImage;
 class NSMutableDictionary;
 class NSResponder;
 class NSString;
@@ -224,6 +226,9 @@ public:
     bool keyEvent(NSEvent *);
     bool lastEventIsMouseUp();
 
+    void dragSourceMovedTo(const QPoint &loc);
+    void dragSourceEndedAt(const QPoint &loc);
+
     bool sendContextMenuEvent(NSEvent *);
 
     void clearTimers();
@@ -297,6 +302,9 @@ public:
     
     void partClearedInBegin();
     
+    // Implementation of CSS property -khtml-user-drag == auto
+    bool shouldDragAutoNode(DOM::NodeImpl*) const;
+
 private:
     virtual void khtmlMousePressEvent(khtml::MousePressEvent *);
     virtual void khtmlMouseDoubleClickEvent(khtml::MouseDoubleClickEvent *);
@@ -318,6 +326,9 @@ private:
     static KWQKHTMLPart *partForNode(DOM::NodeImpl *);
     static NSView *documentViewForNode(DOM::NodeImpl *);
     
+    bool dragHysteresisExceeded(float dragLocationX, float dragLocationY) const;
+    bool dispatchDragSrcEvent(int eventId, const QPoint &loc, bool declareTypes, NSImage **dragImage, NSPoint *dragLoc) const;
+
     WebCoreBridge *_bridge;
     
     KWQSignal _started;
@@ -329,6 +340,8 @@ private:
     bool _sendingEventToSubview;
     bool _mouseDownMayStartDrag;
     bool _mouseDownMayStartSelect;
+    // in our view's coords
+    int _mouseDownX, _mouseDownY;
     
     static NSEvent *_currentEvent;
     static NSResponder *_firstResponderAtMouseDownTime;
@@ -353,6 +366,11 @@ private:
                                             // bound outside the context of a plugin.
     QPtrList<KJS::Bindings::RootObject> rootObjects;
     WebScriptObject *_windowScriptObject;
+    
+    DOM::Node _dragSrc;     // element that may be a drag source, for the current mouse gesture
+    bool _dragSrcIsLink;
+    bool _dragSrcIsImage;
+    bool _dragSrcInSelection;
 };
 
 inline KWQKHTMLPart *KWQ(KHTMLPart *part) { return static_cast<KWQKHTMLPart *>(part); }
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index 7adb67c..ecf2874 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -26,6 +26,7 @@
 #import "KWQKHTMLPart.h"
 
 #import "DOMInternal.h"
+#import "KWQClipboard.h"
 #import "KWQDOMNode.h"
 #import "KWQDummyView.h"
 #import "KWQEditCommand.h"
@@ -182,6 +183,7 @@ KWQKHTMLPart::KWQKHTMLPart()
     , _showsFirstResponder(true)
     , _bindingRoot(0)
     , _windowScriptObject(0)
+    , _dragSrc(0)
 {
     // Must init the cache before connecting to any signals
     Cache::init();
@@ -1875,6 +1877,63 @@ NSView *KWQKHTMLPart::mouseDownViewIfStillGood()
     return mouseDownView;
 }
 
+// The link drag hysteresis is much larger than the others because there
+// needs to be enough space to cancel the link press without starting a link drag,
+// and because dragging links is rare.
+#define LinkDragHysteresis              40.0
+#define ImageDragHysteresis              5.0
+#define TextDragHysteresis               3.0
+#define GeneralDragHysterisis            3.0
+
+bool KWQKHTMLPart::dragHysteresisExceeded(float dragLocationX, float dragLocationY) const
+{
+    int dragX, dragY;
+    d->m_view->viewportToContents((int)dragLocationX, (int)dragLocationY, dragX, dragY);
+    float deltaX = QABS(dragX - _mouseDownX);
+    float deltaY = QABS(dragY - _mouseDownY);
+
+    float threshold = GeneralDragHysterisis;
+    if (_dragSrcIsImage) {
+        threshold = ImageDragHysteresis;
+    } else if (_dragSrcIsLink) {
+        threshold = LinkDragHysteresis;
+    } else if (_dragSrcInSelection) {
+        threshold = TextDragHysteresis;
+    }
+    return deltaX >= threshold || deltaY >= threshold;
+}
+
+// returns if we should continue "default processing", i.e., whether eventhandler canceled
+bool KWQKHTMLPart::dispatchDragSrcEvent(int eventId, const QPoint &loc, bool declareTypes, NSImage **dragImage, NSPoint *dragLoc) const
+{
+    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
+    if (declareTypes) {
+        // Must be done before ondragstart adds types and data to the pboard,
+        // also done for security, as it erases data from the last drag
+        [pasteboard declareTypes:[NSArray array] owner:nil];
+    }
+    KWQClipboard *clipboard = new KWQClipboard(true, pasteboard);
+    clipboard->ref();
+    bool DHTMLBailed = d->m_view->dispatchDragEvent(eventId, _dragSrc.handle(), loc, clipboard);
+    // FIXME - invalidate clipboard here for security
+
+    if (dragImage) {
+        *dragImage = clipboard->dragNSImage();
+        if (*dragImage) {
+            [[*dragImage retain] autorelease];   // just in case clipboard takes the image with it
+            // should be set in clipboard iff dragImage is set
+            if (dragLoc) {
+                *dragLoc = NSPoint(clipboard->dragLocation());
+                // Web way is upper left, AppKit way is lower left
+                dragLoc->y = [*dragImage size].height - dragLoc->y;
+            }
+        }
+    }
+
+    clipboard->deref();
+    return !DHTMLBailed;
+}
+
 void KWQKHTMLPart::khtmlMouseMoveEvent(MouseMoveEvent *event)
 {
     KWQ_BLOCK_EXCEPTIONS;
@@ -1889,15 +1948,47 @@ void KWQKHTMLPart::khtmlMouseMoveEvent(MouseMoveEvent *event)
             return;
         }
 
-	if (_mouseDownMayStartDrag && [_bridge mayStartDragWithMouseDragged:_currentEvent]) {
+	if (_mouseDownMayStartDrag && _dragSrc.isNull()) {
+            // try to find an element that wants to be dragged
+            RenderObject::NodeInfo nodeInfo(true, false);
+            renderer()->layer()->nodeAtPoint(nodeInfo, _mouseDownX, _mouseDownY);
+            _dragSrc = nodeInfo.innerNode()->renderer()->draggableNode();
+            if (_dragSrc.isNull()) {
+                _mouseDownMayStartDrag = false;     // no element is draggable
+            } else {
+                // remember some facts about this source, while we have a NodeInfo handy
+                NodeImpl *node = nodeInfo.URLElement();
+                _dragSrcIsLink = node ? node->hasAnchor() : false;
+
+                node = nodeInfo.innerNonSharedNode();
+                _dragSrcIsImage = (node && node->renderer() && node->renderer()->isImage());
 
+                _dragSrcInSelection = isPointInsideSelection(_mouseDownX, _mouseDownY);
+            }                
+        }
+
+        if (_mouseDownMayStartDrag) {
             // We are starting a text/image/url drag, so the cursor should be an arrow
             d->m_view->resetCursor();
-
-            if ([_bridge handleMouseDragged:_currentEvent]) {
-                // Prevent click handling from taking place once we start dragging.
-                d->m_view->invalidateClick();
+            
+            NSPoint dragLocation = [_currentEvent locationInWindow];
+            if (dragHysteresisExceeded(dragLocation.x, dragLocation.y)) {
+                NSImage *dragImage = nil;
+                NSPoint dragLoc = NSZeroPoint;
+                if (dispatchDragSrcEvent(EventImpl::DRAGSTART_EVENT, QPoint(dragLocation), true, &dragImage, &dragLoc)) {
+                    if ([_bridge startDraggingImage:dragImage at:dragLoc event:_currentEvent]) {
+                        // Prevent click handling from taking place once we start dragging.
+                        d->m_view->invalidateClick();
+                    } else {
+                        // WebKit canned the drag at the last minute - we owe _dragSrc a DRAGEND event
+                        dispatchDragSrcEvent(EventImpl::DRAGEND_EVENT, QPoint(dragLocation), false, NULL, NULL);
+                    }
+                } else {
+                    _mouseDownMayStartDrag = false;
+                }
             }
+
+            // No more default handling (like selection), whether we're past the hysteresis bounds or not
             return;
 	}
         if (!_mouseDownMayStartSelect) {
@@ -1923,6 +2014,18 @@ void KWQKHTMLPart::khtmlMouseMoveEvent(MouseMoveEvent *event)
     KWQ_UNBLOCK_EXCEPTIONS;
 }
 
+void KWQKHTMLPart::dragSourceMovedTo(const QPoint &loc)
+{
+    // for now we don't care if event handler cancels default behavior, since there is none
+    dispatchDragSrcEvent(EventImpl::DRAG_EVENT, loc, false, NULL, NULL);
+}
+
+void KWQKHTMLPart::dragSourceEndedAt(const QPoint &loc)
+{
+    // for now we don't care if event handler cancels default behavior, since there is none
+    dispatchDragSrcEvent(EventImpl::DRAGEND_EVENT, loc, false, NULL, NULL);
+}
+
 void KWQKHTMLPart::khtmlMouseReleaseEvent(MouseReleaseEvent *event)
 {
     NSView *view = mouseDownViewIfStillGood();
@@ -2021,10 +2124,13 @@ void KWQKHTMLPart::mouseDown(NSEvent *event)
     KWQ_BLOCK_EXCEPTIONS;
 
     _mouseDownView = nil;
-
+    _dragSrc = 0;
+    
     NSEvent *oldCurrentEvent = _currentEvent;
     _currentEvent = [event retain];
-    
+    NSPoint loc = [event locationInWindow];
+    d->m_view->viewportToContents((int)loc.x, (int)loc.y, _mouseDownX, _mouseDownY);
+
     NSResponder *oldFirstResponderAtMouseDownTime = _firstResponderAtMouseDownTime;
     // Unlike other places in WebCore where we get the first
     // responder, in this case we must be talking about the real first
@@ -2207,6 +2313,20 @@ void KWQKHTMLPart::mouseMoved(NSEvent *event)
     KWQ_UNBLOCK_EXCEPTIONS;
 }
 
+// Called as we walk up the element chain for nodes with CSS property -khtml-user-drag == auto
+bool KWQKHTMLPart::shouldDragAutoNode(DOM::NodeImpl* node) const
+{
+    // We assume that WebKit only cares about dragging things that can be leaf nodes (text, images, urls).
+    // This saves a bunch of expensive calls (creating WC and WK element dicts) as we walk farther up
+    // the node hierarchy, and we also don't have to cook up a way to ask WK about non-leaf nodes
+    // (since right now WK just hit-tests using a cached lastMouseDown).
+    if (!node->hasChildNodes()) {
+        return [_bridge mayStartDragWithMouseDragged:_currentEvent];
+    } else {
+        return NO;
+    }
+}
+
 bool KWQKHTMLPart::sendContextMenuEvent(NSEvent *event)
 {
     DocumentImpl *doc = d->m_doc;
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index cbbc553..725bd67 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -320,6 +320,8 @@ typedef enum {
 - (NSDragOperation)dragOperationForDraggingInfo:(id <NSDraggingInfo>)info;
 - (void)dragExitedWithDraggingInfo:(id <NSDraggingInfo>)info;
 - (BOOL)concludeDragForDraggingInfo:(id <NSDraggingInfo>)info;
+- (void)dragSourceMovedTo:(NSPoint)windowLoc;
+- (void)dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation;
 
 @end
 
@@ -426,7 +428,7 @@ typedef enum {
 
 - (NSString *)MIMETypeForPath:(NSString *)path;
 
-- (BOOL)handleMouseDragged:(NSEvent *)event;
+- (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc event:(NSEvent *)event;
 - (void)handleAutoscrollForMouseDragged:(NSEvent *)event;
 - (BOOL)mayStartDragWithMouseDragged:(NSEvent *)event;
 
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 31c614f..ef577cc 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -1618,7 +1618,8 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     }
 }
 
-- (BOOL)concludeDragForDraggingInfo:(id <NSDraggingInfo>)info {
+- (BOOL)concludeDragForDraggingInfo:(id <NSDraggingInfo>)info
+{
     if (_part) {
         KHTMLView *v = _part->view();
         if (v) {
@@ -1639,4 +1640,19 @@ static HTMLFormElementImpl *formElementFromDOMElement(DOMElement *element)
     return NO;
 }
 
+- (void)dragSourceMovedTo:(NSPoint)windowLoc
+{
+    if (_part) {
+        _part->dragSourceMovedTo(QPoint(windowLoc));
+    }
+}
+
+- (void)dragSourceEndedAt:(NSPoint)windowLoc operation:(NSDragOperation)operation
+{
+    if (_part) {
+        // FIXME must handle operation
+        _part->dragSourceEndedAt(QPoint(windowLoc));
+    }
+}
+
 @end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 53d5ba0..e041b70 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,23 @@
+2004-06-01  Trey Matteson  <trey at apple.com>
+
+	First cut at source side of DHTML dragging.  Most of the work is in WebCore.
+
+        Reviewed by hyatt.
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge startDraggingImage:at:event:]):  Added image and loc args for
+	when WC tells WK to start a drag.
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _startDraggingImage:at:event:]):  New image and loc args coming
+	from WebCore.  Hysteresis is moved to WC.
+        (-[WebHTMLView mouseDragged:]):  Call new _startDragging method.
+        (-[WebHTMLView draggedImage:movedTo:]):  Pass event to WC.
+        (-[WebHTMLView draggedImage:endedAt:operation:]):  Pass event to WC.
+        (-[WebHTMLView mouseUp:]):  Reset firstMouseDownEvent.  Fixes bug where
+	we would occasionally short-circuit WC event handling due to aliasing
+	problem with this event.
+        * WebView.subproj/WebHTMLViewPrivate.h:
+
 2004-06-02  Darin Adler  <darin at apple.com>
 
         Reviewed by John.
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 7f3608a..372dabc 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -987,11 +987,11 @@ static BOOL loggedObjectCacheSize = NO;
     return [type length] == 0 ? @"application/octet-stream" : type;
 }
 
-- (BOOL)handleMouseDragged:(NSEvent *)event
+- (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc event:(NSEvent *)event
 {
     WebHTMLView *docView = (WebHTMLView *)[[_frame frameView] documentView];
     ASSERT([docView isKindOfClass:[WebHTMLView class]]);
-    return [docView _handleMouseDragged:event];
+    return [docView _startDraggingImage:dragImage at:dragLoc event:event];
 }
 
 - (void)handleAutoscrollForMouseDragged:(NSEvent *)event;
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 3498a23..e41ab62 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -49,13 +49,7 @@
 
 #import <CoreGraphics/CGContextGState.h>
 
-// The link drag hysteresis is much larger than the others because there
-// needs to be enough space to cancel the link press without starting a link drag,
-// and because dragging links is rare.
-#define LinkDragHysteresis              40.0
-#define ImageDragHysteresis             5.0
-#define TextDragHysteresis              3.0
-#define TextDragDelay                   0.15
+#define TextDragDelay                    0.15
 
 // By imaging to a width a little wider than the available pixels,
 // thin pages will be scaled down a little, matching the way they
@@ -724,8 +718,11 @@ static WebHTMLView *lastHitView = nil;
     return dragImage;
 }
 
-- (BOOL)_handleMouseDragged:(NSEvent *)mouseDraggedEvent
+- (BOOL)_startDraggingImage:(NSImage *)wcDragImage at:(NSPoint)wcDragLoc event:(NSEvent *)mouseDraggedEvent
 {
+    // Once we start a drag session we may not get a mouseup, so clear this out here as well as mouseUp:
+    _private->firstMouseDownEvent = nil;
+
     NSPoint mouseDownPoint = [self convertPoint:[_private->mouseDownEvent locationInWindow] fromView:nil];
     NSDictionary *element = [self elementAtPoint:mouseDownPoint];
 
@@ -736,21 +733,7 @@ static WebHTMLView *lastHitView = nil;
     [_private->draggingImageURL release];
     _private->draggingImageURL = nil;
 
-    // We must have started over something draggable:
-    ASSERT((imageURL && [[WebPreferences standardPreferences] loadsImagesAutomatically]) ||
-           (!imageURL && linkURL) || isSelected); 
-
     NSPoint mouseDraggedPoint = [self convertPoint:[mouseDraggedEvent locationInWindow] fromView:nil];
-    float deltaX = ABS(mouseDraggedPoint.x - mouseDownPoint.x);
-    float deltaY = ABS(mouseDraggedPoint.y - mouseDownPoint.y);
-    
-    // Drag hysteresis hasn't been met yet but we don't want to do other drag actions like selection.
-    if ((imageURL && deltaX < ImageDragHysteresis && deltaY < ImageDragHysteresis) ||
-        (linkURL && deltaX < LinkDragHysteresis && deltaY < LinkDragHysteresis) ||
-        (isSelected && deltaX < TextDragHysteresis && deltaY < TextDragHysteresis)) {
-        return NO;
-    }
-    
     NSImage *dragImage = nil;
     
     if (imageURL) {
@@ -762,7 +745,13 @@ static WebHTMLView *lastHitView = nil;
         dragImage = [[self _bridge] selectionImage];
         [dragImage _web_dissolveToFraction:WebDragImageAlpha];
     } else {
-        ASSERT_NOT_REACHED();
+        //FIXME - for which of these types should WC control the image?
+        if (wcDragImage) {
+            dragImage = wcDragImage;
+        } else {
+            NSString *imagePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"missing_image" ofType:@"tiff"];
+            dragImage = [[[NSImage alloc] initWithContentsOfFile:imagePath] autorelease];
+        }
     }
     
     ASSERT(dragImage != nil);
@@ -776,6 +765,7 @@ static WebHTMLView *lastHitView = nil;
         return YES;   
     }
     
+    // note per kwebster, the offset arg below is always ignored in positioning the image
     if (imageURL) {
         _private->draggingImageURL = [imageURL retain];
         WebImageRenderer *image = [element objectForKey:WebElementImageKey];
@@ -813,7 +803,24 @@ static WebHTMLView *lastHitView = nil;
                  source:self
               slideBack:YES];
     } else {
-        ASSERT_NOT_REACHED();
+        // FIXME - need slideback control for WC
+        // FIXME - is offset totally ignored by the CG-based system? seems like it to me
+        NSPoint dragLoc;
+        if (wcDragImage) {
+            // wcDragLoc is the cursor position relative to the lower-left corner of the image.
+            // We add in the Y dimension because we are a flipped view, so adding moves the image down.
+            dragLoc = NSMakePoint(mouseDownPoint.x - wcDragLoc.x, mouseDownPoint.y + wcDragLoc.y);
+        } else {
+            NSSize imageSize = [dragImage size];
+            dragLoc = NSMakePoint(mouseDownPoint.x - imageSize.width/2, mouseDownPoint.y + imageSize.height/2);
+        }
+        [self dragImage:dragImage
+                     at:dragLoc
+                 offset:NSMakeSize(mouseDraggedPoint.x - mouseDownPoint.x, mouseDraggedPoint.y - mouseDownPoint.y)
+                  event:_private->mouseDownEvent
+             pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]
+                 source:self
+              slideBack:YES];
     }
     return YES;
 }
@@ -1664,8 +1671,9 @@ static WebHTMLView *lastHitView = nil;
     // If this drag started from a mouse down in an inactive window, we only allow it to drag out an existing selection, so don't tell WebCore about it.
     if (_private->mouseDownEvent == _private->firstMouseDownEvent) {
         // Handle the drag directly instead of getting callbacks from WebCore.
+        // FIXME - how does this play with DHTML dragging?
         if ([self _mayStartDragWithMouseDragged:event]) {
-            [self _handleMouseDragged:event];
+            [self _startDraggingImage:nil at:NSZeroPoint event:event];
         }
     } else if (!_private->ignoringMouseDraggedEvents) {
         [[self _bridge] mouseDragged:event];
@@ -1677,8 +1685,17 @@ static WebHTMLView *lastHitView = nil;
     return (NSDragOperationGeneric | NSDragOperationCopy);
 }
 
+- (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenLoc
+{
+    NSPoint windowLoc = [[self window] convertScreenToBase:screenLoc];
+    [[self _bridge] dragSourceMovedTo:windowLoc];
+}
+
 - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
 {
+    NSPoint windowLoc = [[self window] convertScreenToBase:aPoint];
+    [[self _bridge] dragSourceEndedAt:windowLoc operation:operation];
+
     _private->initiatedDrag = NO;
     [[self _webView] _setInitiatedDrag:NO];
     
@@ -1688,7 +1705,7 @@ static WebHTMLView *lastHitView = nil;
     // Once the dragging machinery kicks in, we no longer get mouse drags or the up event.
     // khtml expects to get balanced down/up's, so we must fake up a mouseup.
     NSEvent *fakeEvent = [NSEvent mouseEventWithType:NSLeftMouseUp
-                                            location:[[self window] convertScreenToBase:aPoint]
+                                            location:windowLoc
                                        modifierFlags:[[NSApp currentEvent] modifierFlags]
                                            timestamp:[NSDate timeIntervalSinceReferenceDate]
                                         windowNumber:[[self window] windowNumber]
@@ -1812,6 +1829,7 @@ static WebHTMLView *lastHitView = nil;
 
 - (void)mouseUp:(NSEvent *)event
 {
+    _private->firstMouseDownEvent = nil;
     [self _stopAutoscrollTimer];
     [[self _bridge] mouseUp:event];
     [self _updateMouseoverWithFakeEvent];
diff --git a/WebKit/WebView.subproj/WebHTMLViewPrivate.h b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
index a5a6fcc..bb38c6f 100644
--- a/WebKit/WebView.subproj/WebHTMLViewPrivate.h
+++ b/WebKit/WebView.subproj/WebHTMLViewPrivate.h
@@ -45,7 +45,7 @@
 - (void)_frameOrBoundsChanged;
 
 - (NSImage *)_dragImageForLinkElement:(NSDictionary *)element;
-- (BOOL)_handleMouseDragged:(NSEvent *)event;
+- (BOOL)_startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc event:(NSEvent *)event;
 - (void)_handleAutoscrollForMouseDragged:(NSEvent *)event;
 - (BOOL)_mayStartDragWithMouseDragged:(NSEvent *)event;
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list