+2005-04-26 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - fixed <rdar://problem/3655817> please add support for mouse wheel events and the onmousewheel handler
+
+ Loose ends:
+
+ - need to test behavior of Windows IE with horizontal scroll wheeling; we currently send a distinct event
+ for that relatively obscure case, which means the event handlers won't fire at all; might be incorrect
+ - overflow scrolling is done after all DOM event handling, but ideally should be done in the overflowing
+ element's default event handler; not important in practice
+ - frame scrolling is done after all DOM event handling, but probably should be done in a default event handler;
+ not sure about this, but it's probably not important in practice and definitely not required
+
+ - JavaScript
+
+ * khtml/ecma/kjs_events.h: Added DOMWheelEvent.
+ * khtml/ecma/kjs_events.cpp:
+ (KJS::getDOMEvent): Added a case for wheel event. To be forward looking, I use the event's impl pointer
+ instead of a C++ DOM wrapper. Eventually it will all work this way.
+ (offsetFromTarget): Added. Factored out code to compute offsetX/Y for an event.
+ (DOMMouseEvent::getValueProperty): Changed to call offsetFromTarget for offsetX/Y.
+ (DOMWheelEvent::DOMWheelEvent): Added.
+ (DOMWheelEvent::tryGet): Added.
+ (DOMWheelEvent::getValueProperty): Added.
+ (DOMWheelEventProtoFunc::tryCall): Added. Nothing at the moment, but might get contents later.
+
+ * khtml/ecma/kjs_dom.h: Added OnMouseWheel to the enum with the list of properties.
+ * khtml/ecma/kjs_dom.cpp: Added onmousewheel as a property of DOM nodes.
+ (DOMNode::getValueProperty): Return the mouse wheel event handler.
+ (DOMNode::putValue): Set the mouse wheel event handler.
+
+ * khtml/ecma/kjs_window.cpp: Added onmousewheel as a property of the window.
+ (Window::get): Return the mouse wheel event handler.
+ (Window::put): Set the mouse wheel event handler.
+
+ * khtml/ecma/kjs_window.h: Added OnWindowMouseWheel to the enum with the list of properties.
+ (Other properties distinguish the window handler by lower-casing the initial letter, way too subtle,
+ so I did this one a good way.)
+
+ * khtml/dom/dom2_events.h: Made the constructors for Event and UIEvent public. There's no good reason
+ for them to be private, and I had to use the UIEvent one in the JavaScript implementation.
+
+ - DOM
+
+ * khtml/xml/dom2_eventsimpl.h: Added events for mouse wheel and horizontal mouse wheel.
+ Added isWheelEvent function to EventImpl.
+ (DOM::UIEventWithKeyStateImpl): Added. Base class shared by mouse, wheel, and keyboard events.
+ (DOM::MouseRelatedEventImpl): Added. Base class shared by mouse and wheel events.
+ (DOM::WheelEventImpl): Added.
+
+ * khtml/xml/dom2_eventsimpl.cpp: Added "mousewheel" to list of event names and a placeholder for
+ the horizontal mouse wheel.
+ (EventImpl::isWheelEvent): Added. Returns false.
+ (MouseRelatedEventImpl::MouseRelatedEventImpl): Added. Factored out what's shared between mouse
+ events and wheel events to avoid duplicated code.
+ (MouseRelatedEventImpl::computeLayerPos): Moved to MouseRelatedWheelEventImpl.
+ (MouseEventImpl::MouseEventImpl): Changed since MouseRelatedWheelEventImpl is now the base class
+ so we can share more code with wheel events.
+ (KeyboardEventImpl::KeyboardEventImpl): Changed since UIEventWithKeyStateImpl is now the base class
+ so we can share more code with mouse and wheel events.
+ (WheelEventImpl::WheelEventImpl): Added.
+ (WheelEventImpl::isWheelEvent): Added. Returns true.
+
+ * khtml/misc/htmlattrs.in: Added "onmousewheel" attribute name.
+ * khtml/html/html_elementimpl.cpp: (HTMLElementImpl::parseHTMLAttribute): Added parsing of the
+ "onmousewheel" atribute, consistent with other event handler attributes.
+
+ - event handling
+
+ * kwq/WebCoreBridge.h: Renamed scrollOverflowWithScrollWheelEvent to sendScrollWheelEvent.
+ * kwq/WebCoreBridge.mm: (-[WebCoreBridge sendScrollWheelEvent:]): Renamed.
+
+ * kwq/KWQEvent.h: Added Wheel as an event type value.
+ (QWheelEvent::QWheelEvent): Added.
+ * kwq/KWQEvent.mm:
+ (positionForEvent): Updated to know that wheel events have valid positions in them.
+ (orientationForEvent): Added.
+ (deltaForEvent): Added.
+ (QWheelEvent::QWheelEvent): Added.
+
+ * kwq/KWQKHTMLPart.h: Renamed scrollOverflowWithScrollWheelEvent to wheelEvent.
+ * kwq/KWQKHTMLPart.mm: (KWQKHTMLPart::wheelEvent): Renamed and added code to construct a QWheelEvent
+ and send it along to KHTMLView::viewportWheelEvent, consistent with how mouse events work.
+
+ * khtml/khtmlview.cpp: (KHTMLView::viewportWheelEvent): Do a hit test to figure out which node to
+ send the event to, and then call dispatchWheelEvent.
+
+ * khtml/xml/dom_nodeimpl.h: Added dispatchWheelEvent.
+ * khtml/xml/dom_nodeimpl.cpp: (NodeImpl::dispatchWheelEvent): Added.
+
+ - generated files
+
+ * khtml/ecma/kjs_dom.lut.h: Regenerated.
+ * khtml/ecma/kjs_events.lut.h: Regenerated.
+ * khtml/ecma/kjs_window.lut.h: Regenerated.
+ * khtml/misc/htmlattrs.c: Regenerated.
+ * khtml/misc/htmlattrs.h: Regenerated.
+
2005-04-26 David Harrison <harrison@apple.com>
Reviewed by Darin, Maciej.
bool getCancelBubble() const;
bool defaultPrevented() const;
-protected:
Event(EventImpl *i);
+
+protected:
EventImpl *impl;
};
bool cancelableArg,
const AbstractView &viewArg,
long detailArg);
-protected:
+
UIEvent(UIEventImpl *impl);
};
onmouseout DOMNode::OnMouseOut DontDelete
onmouseover DOMNode::OnMouseOver DontDelete
onmouseup DOMNode::OnMouseUp DontDelete
+ onmousewheel DOMNode::OnMouseWheel DontDelete
onmove DOMNode::OnMove DontDelete
onreset DOMNode::OnReset DontDelete
onresize DOMNode::OnResize DontDelete
return getListener(DOM::EventImpl::MOUSEOVER_EVENT);
case OnMouseUp:
return getListener(DOM::EventImpl::MOUSEUP_EVENT);
+ case OnMouseWheel:
+ return getListener(DOM::EventImpl::MOUSEWHEEL_EVENT);
case OnBeforeCut:
return getListener(DOM::EventImpl::BEFORECUT_EVENT);
case OnCut:
case OnMouseUp:
setListener(exec,DOM::EventImpl::MOUSEUP_EVENT,value);
break;
+ case OnMouseWheel:
+ setListener(exec,DOM::EventImpl::MOUSEWHEEL_EVENT,value);
+ break;
case OnBeforeCut:
setListener(exec,DOM::EventImpl::BEFORECUT_EVENT,value);
break;
OnDragEnter, OnDragOver, OnDragLeave, OnDrop, OnDragStart, OnDrag, OnDragEnd,
OnBeforeCut, OnCut, OnBeforeCopy, OnCopy, OnBeforePaste, OnPaste, OnSelectStart,
OnFocus, OnInput, OnKeyDown, OnKeyPress, OnKeyUp, OnLoad, OnMouseDown,
- OnMouseMove, OnMouseOut, OnMouseOver, OnMouseUp, OnMove, OnReset,
+ OnMouseMove, OnMouseOut, OnMouseOver, OnMouseUp, OnMouseWheel, OnMove, OnReset,
OnResize, OnScroll, OnSearch, OnSelect, OnSubmit, OnUnload,
OffsetLeft, OffsetTop, OffsetWidth, OffsetHeight, OffsetParent,
ClientWidth, ClientHeight, ScrollLeft, ScrollTop, ScrollWidth, ScrollHeight };
{ 0, 0, 0, 0, 0 },
{ "onsubmit", DOMNode::OnSubmit, DontDelete, 0, 0 },
{ 0, 0, 0, 0, 0 },
- { "onmouseover", DOMNode::OnMouseOver, DontDelete, 0, &DOMNodeTableEntries[81] },
+ { "onmouseover", DOMNode::OnMouseOver, DontDelete, 0, &DOMNodeTableEntries[82] },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
- { "childNodes", DOMNode::ChildNodes, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[84] },
+ { "childNodes", DOMNode::ChildNodes, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[85] },
{ "oncut", DOMNode::OnCut, DontDelete, 0, 0 },
{ "onbeforecopy", DOMNode::OnBeforeCopy, DontDelete, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "onpaste", DOMNode::OnPaste, DontDelete, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
- { "onfocus", DOMNode::OnFocus, DontDelete, 0, &DOMNodeTableEntries[90] },
+ { "onfocus", DOMNode::OnFocus, DontDelete, 0, &DOMNodeTableEntries[91] },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "firstChild", DOMNode::FirstChild, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[68] },
{ "ondrag", DOMNode::OnDrag, DontDelete, 0, 0 },
{ 0, 0, 0, 0, 0 },
- { "onload", DOMNode::OnLoad, DontDelete, 0, &DOMNodeTableEntries[88] },
+ { "onload", DOMNode::OnLoad, DontDelete, 0, &DOMNodeTableEntries[78] },
{ "parentNode", DOMNode::ParentNode, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[73] },
{ "nodeType", DOMNode::NodeType, DontDelete|ReadOnly, 0, 0 },
- { "localName", DOMNode::LocalName, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[83] },
+ { "localName", DOMNode::LocalName, DontDelete|ReadOnly, 0, &DOMNodeTableEntries[84] },
{ "ondragenter", DOMNode::OnDragEnter, DontDelete, 0, &DOMNodeTableEntries[72] },
{ 0, 0, 0, 0, 0 },
{ "ondblclick", DOMNode::OnDblClick, DontDelete, 0, 0 },
{ "ondragstart", DOMNode::OnDragStart, DontDelete, 0, 0 },
{ "onblur", DOMNode::OnBlur, DontDelete, 0, &DOMNodeTableEntries[71] },
{ 0, 0, 0, 0, 0 },
- { "onmove", DOMNode::OnMove, DontDelete, 0, &DOMNodeTableEntries[80] },
+ { "onmove", DOMNode::OnMove, DontDelete, 0, &DOMNodeTableEntries[81] },
{ 0, 0, 0, 0, 0 },
{ "offsetParent", DOMNode::OffsetParent, DontDelete|ReadOnly, 0, 0 },
- { "nodeValue", DOMNode::NodeValue, DontDelete, 0, &DOMNodeTableEntries[82] },
+ { "nodeValue", DOMNode::NodeValue, DontDelete, 0, &DOMNodeTableEntries[83] },
{ "oncopy", DOMNode::OnCopy, DontDelete, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0 },
{ "previousSibling", DOMNode::PreviousSibling, DontDelete|ReadOnly, 0, 0 },
{ "onmouseup", DOMNode::OnMouseUp, DontDelete, 0, 0 },
{ 0, 0, 0, 0, 0 },
- { "onabort", DOMNode::OnAbort, DontDelete, 0, &DOMNodeTableEntries[85] },
- { "onchange", DOMNode::OnChange, DontDelete, 0, &DOMNodeTableEntries[78] },
- { "oncontextmenu", DOMNode::OnContextMenu, DontDelete, 0, &DOMNodeTableEntries[89] },
+ { "onabort", DOMNode::OnAbort, DontDelete, 0, &DOMNodeTableEntries[86] },
+ { "onchange", DOMNode::OnChange, DontDelete, 0, &DOMNodeTableEntries[79] },
+ { "oncontextmenu", DOMNode::OnContextMenu, DontDelete, 0, &DOMNodeTableEntries[90] },
{ "onbeforepaste", DOMNode::OnBeforePaste, DontDelete, 0, 0 },
{ "ondrop", DOMNode::OnDrop, DontDelete, 0, 0 },
{ "onerror", DOMNode::OnError, DontDelete, 0, 0 },
{ "onkeypress", DOMNode::OnKeyPress, DontDelete, 0, 0 },
- { "onkeyup", DOMNode::OnKeyUp, DontDelete, 0, &DOMNodeTableEntries[86] },
- { "onmousedown", DOMNode::OnMouseDown, DontDelete, 0, &DOMNodeTableEntries[79] },
+ { "onkeyup", DOMNode::OnKeyUp, DontDelete, 0, &DOMNodeTableEntries[87] },
+ { "onmousedown", DOMNode::OnMouseDown, DontDelete, 0, &DOMNodeTableEntries[80] },
{ "onmousemove", DOMNode::OnMouseMove, DontDelete, 0, 0 },
{ "onmouseout", DOMNode::OnMouseOut, DontDelete, 0, 0 },
+ { "onmousewheel", DOMNode::OnMouseWheel, DontDelete, 0, &DOMNodeTableEntries[89] },
{ "onreset", DOMNode::OnReset, DontDelete, 0, 0 },
{ "onresize", DOMNode::OnResize, DontDelete, 0, 0 },
{ "onselect", DOMNode::OnSelect, DontDelete, 0, 0 },
- { "onselectstart", DOMNode::OnSelectStart, DontDelete, 0, &DOMNodeTableEntries[87] },
+ { "onselectstart", DOMNode::OnSelectStart, DontDelete, 0, &DOMNodeTableEntries[88] },
{ "onunload", DOMNode::OnUnload, DontDelete, 0, 0 },
{ "offsetLeft", DOMNode::OffsetLeft, DontDelete|ReadOnly, 0, 0 },
{ "offsetTop", DOMNode::OffsetTop, DontDelete|ReadOnly, 0, 0 },
{ "scrollWidth", DOMNode::ScrollWidth, DontDelete|ReadOnly, 0, 0 }
};
-const struct HashTable DOMNodeTable = { 2, 91, DOMNodeTableEntries, 67 };
+const struct HashTable DOMNodeTable = { 2, 92, DOMNodeTableEntries, 67 };
} // namespace
using namespace KJS;
-using DOM::KeyboardEvent;
+using DOM::DocumentImpl;
using DOM::EventImpl;
+using DOM::KeyboardEvent;
+using DOM::MouseRelatedEventImpl;
using DOM::NodeImpl;
+using khtml::RenderObject;
+
// -------------------------------------------------------------------------
JSAbstractEventListener::JSAbstractEventListener(bool _html)
timeStamp DOMEvent::TimeStamp DontDelete|ReadOnly
returnValue DOMEvent::ReturnValue DontDelete
cancelBubble DOMEvent::CancelBubble DontDelete
- dataTransfer DOMMouseEvent::DataTransfer DontDelete|ReadOnly
+ dataTransfer DOMEvent::DataTransfer DontDelete|ReadOnly
clipboardData DOMEvent::ClipboardData DontDelete|ReadOnly
@end
@begin DOMEventProtoTable 3
ret = new DOMKeyboardEvent(exec, e);
else if (ei->isMouseEvent())
ret = new DOMMouseEvent(exec, e);
+ else if (ei->isWheelEvent())
+ ret = new DOMWheelEvent(exec, static_cast<DOM::WheelEventImpl *>(ei));
else if (ei->isUIEvent())
ret = new DOMUIEvent(exec, e);
else if (ei->isMutationEvent())
return DOMObjectLookupGetValue<DOMMouseEvent,DOMUIEvent>(exec,p,&DOMMouseEventTable,this);
}
+static QPoint offsetFromTarget(const MouseRelatedEventImpl *e)
+{
+ int x = e->clientX();
+ int y = e->clientX();
+
+ NodeImpl *n = e->target();
+ if (n) {
+ DocumentImpl *doc = n->getDocument();
+ if (doc) {
+ doc->updateRendering();
+ RenderObject *r = n->renderer();
+ if (r) {
+ int rx, ry;
+ if (r->absolutePosition(rx, ry)) {
+ x -= rx;
+ x -= ry;
+ }
+ }
+ }
+ }
+ return QPoint(x, y);
+}
+
Value DOMMouseEvent::getValueProperty(ExecState *exec, int token) const
{
switch (token) {
case ClientY:
case Y:
return Number(static_cast<DOM::MouseEvent>(event).clientY());
- case OffsetX:
+ case OffsetX: // MSIE extension
+ return Number(offsetFromTarget(static_cast<MouseRelatedEventImpl *>(event.handle())).x());
case OffsetY: // MSIE extension
- {
- DOM::Node node = event.target();
- node.handle()->getDocument()->updateRendering();
- khtml::RenderObject *rend = node.handle() ? node.handle()->renderer() : 0L;
- int x = static_cast<DOM::MouseEvent>(event).clientX();
- int y = static_cast<DOM::MouseEvent>(event).clientY();
- if ( rend ) {
- int xPos, yPos;
- if ( rend->absolutePosition( xPos, yPos ) ) {
- kdDebug() << "DOMMouseEvent::getValueProperty rend=" << rend << " xPos=" << xPos << " yPos=" << yPos << endl;
- x -= xPos;
- y -= yPos;
- }
- }
- return Number( token == OffsetX ? x : y );
- }
+ return Number(offsetFromTarget(static_cast<MouseRelatedEventImpl *>(event.handle())).y());
case CtrlKey:
return Boolean(static_cast<DOM::MouseEvent>(event).ctrlKey());
case ShiftKey:
// -------------------------------------------------------------------------
+const ClassInfo DOMWheelEvent::info = { "WheelEvent", &DOMEvent::info, &DOMWheelEventTable, 0 };
+/*
+@begin DOMWheelEventTable 10
+ altKey DOMWheelEvent::AltKey DontDelete|ReadOnly
+ clientX DOMWheelEvent::ClientX DontDelete|ReadOnly
+ clientY DOMWheelEvent::ClientY DontDelete|ReadOnly
+ ctrlKey DOMWheelEvent::CtrlKey DontDelete|ReadOnly
+ metaKey DOMWheelEvent::MetaKey DontDelete|ReadOnly
+ offsetX DOMWheelEvent::OffsetX DontDelete|ReadOnly
+ offsetY DOMWheelEvent::OffsetY DontDelete|ReadOnly
+ screenX DOMWheelEvent::ScreenX DontDelete|ReadOnly
+ screenY DOMWheelEvent::ScreenY DontDelete|ReadOnly
+ shiftKey DOMWheelEvent::ShiftKey DontDelete|ReadOnly
+ wheelDelta DOMWheelEvent::WheelDelta DontDelete|ReadOnly
+ x DOMWheelEvent::X DontDelete|ReadOnly
+ y DOMWheelEvent::Y DontDelete|ReadOnly
+@end
+@begin DOMWheelEventProtoTable 1
+@end
+*/
+DEFINE_PROTOTYPE("DOMWheelEvent",DOMWheelEventProto)
+IMPLEMENT_PROTOFUNC(DOMWheelEventProtoFunc)
+IMPLEMENT_PROTOTYPE_WITH_PARENT(DOMWheelEventProto,DOMWheelEventProtoFunc,DOMEventProto)
+
+DOMWheelEvent::DOMWheelEvent(ExecState *exec, DOM::WheelEventImpl *e)
+ : DOMUIEvent(exec, DOM::UIEvent(e))
+{
+}
+
+Value DOMWheelEvent::tryGet(ExecState *exec, const Identifier &p) const
+{
+ return DOMObjectLookupGetValue<DOMWheelEvent,DOMEvent>(exec, p, &DOMWheelEventTable, this);
+}
+
+Value DOMWheelEvent::getValueProperty(ExecState *exec, int token) const
+{
+ DOM::WheelEventImpl *e = static_cast<DOM::WheelEventImpl *>(event.handle());
+ switch (token) {
+ case AltKey:
+ return Boolean(e->altKey());
+ case ClientX:
+ case X:
+ return Number(e->clientX());
+ case ClientY:
+ case Y:
+ return Number(e->clientY());
+ case CtrlKey:
+ return Number(e->ctrlKey());
+ case MetaKey:
+ return Number(e->metaKey());
+ case OffsetX:
+ return Number(offsetFromTarget(e).x());
+ case OffsetY:
+ return Number(offsetFromTarget(e).y());
+ case ScreenX:
+ return Number(e->screenX());
+ case ScreenY:
+ return Number(e->screenY());
+ case ShiftKey:
+ return Boolean(e->shiftKey());
+ case WheelDelta:
+ return Number(e->wheelDelta());
+ }
+ return Undefined();
+}
+
+Value DOMWheelEventProtoFunc::tryCall(ExecState *exec, Object &thisObj, const List &args)
+{
+ if (!thisObj.inherits(&DOMWheelEvent::info)) {
+ Object error = Error::create(exec,TypeError);
+ exec->setException(error);
+ return error;
+ }
+ return Undefined();
+}
+
+// -------------------------------------------------------------------------
+
const ClassInfo Clipboard::info = { "Clipboard", 0, &ClipboardTable, 0 };
/* Source for ClipboardTable. Use "make hashtables" to regenerate.
#include "ecma/kjs_dom.h"
#include "ecma/kjs_html.h"
#include "dom/dom2_events.h"
-#include "dom/dom_misc.h"
-namespace DOM { class ClipboardImpl; }
+namespace DOM {
+ class ClipboardImpl;
+ class WheelEventImpl;
+}
namespace KJS {
DOM::MutationEvent toMutationEvent() const { return static_cast<DOM::MutationEvent>(event); }
};
+ class DOMWheelEvent : public DOMUIEvent {
+ public:
+ DOMWheelEvent(ExecState *, DOM::WheelEventImpl *);
+ virtual Value tryGet(ExecState *, const Identifier &p) const;
+ Value getValueProperty(ExecState *, int token) const;
+ // no put - all read-only
+ virtual const ClassInfo* classInfo() const { return &info; }
+ static const ClassInfo info;
+ enum { ScreenX, ScreenY, ClientX, X, ClientY, Y, OffsetX, OffsetY,
+ CtrlKey, ShiftKey, AltKey, MetaKey, WheelDelta };
+ };
+
class Clipboard : public DOMObject {
friend class ClipboardProtoFunc;
public:
{ "currentTarget", DOMEvent::CurrentTarget, DontDelete|ReadOnly, 0, 0 },
{ "eventPhase", DOMEvent::EventPhase, DontDelete|ReadOnly, 0, &DOMEventTableEntries[15] },
{ "cancelable", DOMEvent::Cancelable, DontDelete|ReadOnly, 0, 0 },
- { "dataTransfer", DOMMouseEvent::DataTransfer, DontDelete|ReadOnly, 0, 0 },
+ { "dataTransfer", DOMEvent::DataTransfer, DontDelete|ReadOnly, 0, 0 },
{ "clipboardData", DOMEvent::ClipboardData, DontDelete|ReadOnly, 0, 0 }
};
namespace KJS {
+const struct HashEntry DOMWheelEventTableEntries[] = {
+ { "metaKey", DOMWheelEvent::MetaKey, DontDelete|ReadOnly, 0, &DOMWheelEventTableEntries[13] },
+ { "y", DOMWheelEvent::Y, DontDelete|ReadOnly, 0, 0 },
+ { 0, 0, 0, 0, 0 },
+ { "wheelDelta", DOMWheelEvent::WheelDelta, DontDelete|ReadOnly, 0, 0 },
+ { "ctrlKey", DOMWheelEvent::CtrlKey, DontDelete|ReadOnly, 0, 0 },
+ { "offsetX", DOMWheelEvent::OffsetX, DontDelete|ReadOnly, 0, 0 },
+ { "offsetY", DOMWheelEvent::OffsetY, DontDelete|ReadOnly, 0, 0 },
+ { "clientX", DOMWheelEvent::ClientX, DontDelete|ReadOnly, 0, 0 },
+ { "altKey", DOMWheelEvent::AltKey, DontDelete|ReadOnly, 0, &DOMWheelEventTableEntries[10] },
+ { "screenY", DOMWheelEvent::ScreenY, DontDelete|ReadOnly, 0, &DOMWheelEventTableEntries[12] },
+ { "clientY", DOMWheelEvent::ClientY, DontDelete|ReadOnly, 0, &DOMWheelEventTableEntries[11] },
+ { "screenX", DOMWheelEvent::ScreenX, DontDelete|ReadOnly, 0, 0 },
+ { "shiftKey", DOMWheelEvent::ShiftKey, DontDelete|ReadOnly, 0, 0 },
+ { "x", DOMWheelEvent::X, DontDelete|ReadOnly, 0, 0 }
+};
+
+const struct HashTable DOMWheelEventTable = { 2, 14, DOMWheelEventTableEntries, 10 };
+
+} // namespace
+
+namespace KJS {
+
+const struct HashEntry DOMWheelEventProtoTableEntries[] = {
+};
+
+const struct HashTable DOMWheelEventProtoTable = { 2, 1, DOMWheelEventProtoTableEntries, 1 };
+
+} // namespace
+
+namespace KJS {
+
const struct HashEntry ClipboardTableEntries[] = {
{ "dropEffect", Clipboard::DropEffect, DontDelete, 0, 0 },
{ "effectAllowed", Clipboard::EffectAllowed, DontDelete, 0, &ClipboardTableEntries[3] },
onmouseout Window::Onmouseout DontDelete
onmouseover Window::Onmouseover DontDelete
onmouseup Window::Onmouseup DontDelete
+ onmousewheel Window::OnWindowMouseWheel DontDelete
onmove Window::Onmove DontDelete
onreset Window::Onreset DontDelete
onresize Window::Onresize DontDelete
return getListener(exec,DOM::EventImpl::MOUSEUP_EVENT);
else
return Undefined();
+ case OnWindowMouseWheel:
+ if (isSafeScript(exec))
+ return getListener(exec, DOM::EventImpl::MOUSEWHEEL_EVENT);
+ else
+ return Undefined();
case Onmove:
if (isSafeScript(exec))
return getListener(exec,DOM::EventImpl::KHTML_MOVE_EVENT);
if (isSafeScript(exec))
setListener(exec,DOM::EventImpl::MOUSEUP_EVENT,value);
return;
+ case OnWindowMouseWheel:
+ if (isSafeScript(exec))
+ setListener(exec, DOM::EventImpl::MOUSEWHEEL_EVENT,value);
+ return;
case Onmove:
if (isSafeScript(exec))
setListener(exec,DOM::EventImpl::KHTML_MOVE_EVENT,value);
ReleaseEvents, AddEventListener, RemoveEventListener, XMLHttpRequest, XMLSerializer,
Onabort, Onblur, Onchange, Onclick, Ondblclick, Ondragdrop, Onerror,
Onfocus, Onkeydown, Onkeypress, Onkeyup, Onload, Onmousedown, Onmousemove,
- Onmouseout, Onmouseover, Onmouseup, Onmove, Onreset, Onresize, Onscroll, Onsearch,
+ Onmouseout, Onmouseover, Onmouseup, OnWindowMouseWheel, Onmove, Onreset, Onresize, Onscroll, Onsearch,
Onselect, Onsubmit, Onunload,
Statusbar, Toolbar, FrameElement };
protected:
{ "onmousemove", Window::Onmousemove, DontDelete, 0, 0 },
{ "scrollTo", Window::ScrollTo, DontDelete|Function, 2, &WindowTableEntries[121] },
{ "onsearch", Window::Onsearch, DontDelete, 0, 0 },
- { 0, 0, 0, 0, 0 },
+ { "onmousewheel", Window::OnWindowMouseWheel, DontDelete, 0, 0 },
{ "screenLeft", Window::ScreenLeft, DontDelete|ReadOnly, 0, &WindowTableEntries[100] },
{ "onmouseover", Window::Onmouseover, DontDelete, 0, 0 },
{ "crypto", Window::Crypto, DontDelete|ReadOnly, 0, 0 },
setHTMLEventListener(EventImpl::MOUSEUP_EVENT,
getDocument()->createHTMLEventListener(attr->value().string(), this));
break;
+ case ATTR_ONMOUSEWHEEL:
+ setHTMLEventListener(EventImpl::MOUSEWHEEL_EVENT,
+ getDocument()->createHTMLEventListener(attr->value().string(), this));
+ break;
case ATTR_ONFOCUS:
setHTMLEventListener(EventImpl::DOMFOCUSIN_EVENT,
getDocument()->createHTMLEventListener(attr->value().string(), this));
void KHTMLView::viewportWheelEvent(QWheelEvent* e)
{
+ DocumentImpl *doc = m_part->xmlDocImpl();
+ if (doc) {
+ RenderObject *docRenderer = doc->renderer();
+ if (docRenderer) {
+ int x, y;
+ viewportToContents(e->x(), e->y(), x, y);
+
+ RenderObject::NodeInfo hitTestResult(true, false);
+ doc->renderer()->layer()->hitTest(hitTestResult, x, y);
+ NodeImpl *node = hitTestResult.innerNode();
+
+ if (node) {
+ node->dispatchWheelEvent(e);
+ if (e->isAccepted())
+ return;
+ }
+ }
+ }
+
#if !APPLE_CHANGES
if ( d->ignoreWheelEvents && !verticalScrollBar()->isVisible() && m_part->parentPart() ) {
if ( m_part->parentPart()->view() )
}
#endif
}
+
#endif
#if !APPLE_CHANGES
{
enum
{
- TOTAL_KEYWORDS = 181,
+ TOTAL_KEYWORDS = 182,
MIN_WORD_LENGTH = 2,
MAX_WORD_LENGTH = 15,
MIN_HASH_VALUE = 3,
static const struct attrs wordlist_attr[] =
{
-#line 177 "htmlattrs.gperf"
+#line 178 "htmlattrs.gperf"
{"top", ATTR_TOP},
#line 118 "htmlattrs.gperf"
{"ondrop", ATTR_ONDROP},
-#line 167 "htmlattrs.gperf"
+#line 168 "htmlattrs.gperf"
{"src", ATTR_SRC},
-#line 159 "htmlattrs.gperf"
+#line 160 "htmlattrs.gperf"
{"scope", ATTR_SCOPE},
#line 52 "htmlattrs.gperf"
{"coords", ATTR_COORDS},
{"onerror", ATTR_ONERROR},
#line 42 "htmlattrs.gperf"
{"code", ATTR_CODE},
-#line 132 "htmlattrs.gperf"
+#line 133 "htmlattrs.gperf"
{"onreset", ATTR_ONRESET},
#line 84 "htmlattrs.gperf"
{"loop", ATTR_LOOP},
#line 109 "htmlattrs.gperf"
{"oncopy", ATTR_ONCOPY},
-#line 131 "htmlattrs.gperf"
+#line 132 "htmlattrs.gperf"
{"onpaste", ATTR_ONPASTE},
#line 46 "htmlattrs.gperf"
{"cols", ATTR_COLS},
{"color", ATTR_COLOR},
#line 14 "htmlattrs.gperf"
{"accept", ATTR_ACCEPT},
-#line 180 "htmlattrs.gperf"
+#line 181 "htmlattrs.gperf"
{"type", ATTR_TYPE},
#line 125 "htmlattrs.gperf"
{"onload", ATTR_ONLOAD},
{"border", ATTR_BORDER},
#line 73 "htmlattrs.gperf"
{"id", ATTR_ID},
-#line 136 "htmlattrs.gperf"
+#line 137 "htmlattrs.gperf"
{"onselect", ATTR_ONSELECT},
#line 53 "htmlattrs.gperf"
{"data", ATTR_DATA},
-#line 150 "htmlattrs.gperf"
+#line 151 "htmlattrs.gperf"
{"prompt", ATTR_PROMPT},
#line 101 "htmlattrs.gperf"
{"onabort", ATTR_ONABORT},
-#line 134 "htmlattrs.gperf"
+#line 135 "htmlattrs.gperf"
{"onscroll", ATTR_ONSCROLL},
#line 12 "htmlattrs.gperf"
{"abbr", ATTR_ABBR},
{"alt", ATTR_ALT},
#line 32 "htmlattrs.gperf"
{"char", ATTR_CHAR},
-#line 164 "htmlattrs.gperf"
+#line 165 "htmlattrs.gperf"
{"shape", ATTR_SHAPE},
-#line 137 "htmlattrs.gperf"
+#line 138 "htmlattrs.gperf"
{"onselectstart", ATTR_ONSELECTSTART},
#line 23 "htmlattrs.gperf"
{"axis", ATTR_AXIS},
{"compact", ATTR_COMPACT},
#line 62 "htmlattrs.gperf"
{"for", ATTR_FOR},
-#line 133 "htmlattrs.gperf"
+#line 134 "htmlattrs.gperf"
{"onresize", ATTR_ONRESIZE},
#line 117 "htmlattrs.gperf"
{"ondragstart", ATTR_ONDRAGSTART},
-#line 174 "htmlattrs.gperf"
+#line 175 "htmlattrs.gperf"
{"target", ATTR_TARGET},
-#line 152 "htmlattrs.gperf"
+#line 153 "htmlattrs.gperf"
{"rel", ATTR_REL},
#line 75 "htmlattrs.gperf"
{"ismap", ATTR_ISMAP},
-#line 161 "htmlattrs.gperf"
+#line 162 "htmlattrs.gperf"
{"scrolldelay", ATTR_SCROLLDELAY},
#line 49 "htmlattrs.gperf"
{"composite", ATTR_COMPOSITE},
-#line 142 "htmlattrs.gperf"
+#line 143 "htmlattrs.gperf"
{"pagey", ATTR_PAGEY},
#line 40 "htmlattrs.gperf"
{"classid", ATTR_CLASSID},
{"label", ATTR_LABEL},
#line 110 "htmlattrs.gperf"
{"oncut", ATTR_ONCUT},
-#line 163 "htmlattrs.gperf"
+#line 164 "htmlattrs.gperf"
{"selected", ATTR_SELECTED},
#line 61 "htmlattrs.gperf"
{"face", ATTR_FACE},
-#line 169 "htmlattrs.gperf"
+#line 170 "htmlattrs.gperf"
{"start", ATTR_START},
#line 55 "htmlattrs.gperf"
{"declare", ATTR_DECLARE},
-#line 166 "htmlattrs.gperf"
+#line 167 "htmlattrs.gperf"
{"span", ATTR_SPAN},
#line 54 "htmlattrs.gperf"
{"datetime", ATTR_DATETIME},
-#line 179 "htmlattrs.gperf"
+#line 180 "htmlattrs.gperf"
{"truespeed", ATTR_TRUESPEED},
-#line 173 "htmlattrs.gperf"
+#line 174 "htmlattrs.gperf"
{"tableborder", ATTR_TABLEBORDER},
#line 89 "htmlattrs.gperf"
{"mayscript", ATTR_MAYSCRIPT},
#line 63 "htmlattrs.gperf"
{"frame", ATTR_FRAME},
-#line 149 "htmlattrs.gperf"
+#line 150 "htmlattrs.gperf"
{"profile", ATTR_PROFILE},
-#line 170 "htmlattrs.gperf"
+#line 171 "htmlattrs.gperf"
{"style", ATTR_STYLE},
#line 102 "htmlattrs.gperf"
{"onbeforecopy", ATTR_ONBEFORECOPY},
{"onblur", ATTR_ONBLUR},
#line 87 "htmlattrs.gperf"
{"max", ATTR_MAX},
-#line 175 "htmlattrs.gperf"
+#line 176 "htmlattrs.gperf"
{"text", ATTR_TEXT},
#line 37 "htmlattrs.gperf"
{"cellborder", ATTR_CELLBORDER},
{"left", ATTR_LEFT},
#line 90 "htmlattrs.gperf"
{"media", ATTR_MEDIA},
-#line 182 "htmlattrs.gperf"
+#line 183 "htmlattrs.gperf"
{"usemap", ATTR_USEMAP},
-#line 141 "htmlattrs.gperf"
+#line 142 "htmlattrs.gperf"
{"pagex", ATTR_PAGEX},
#line 38 "htmlattrs.gperf"
{"cite", ATTR_CITE},
{"noresize", ATTR_NORESIZE},
#line 94 "htmlattrs.gperf"
{"name", ATTR_NAME},
-#line 176 "htmlattrs.gperf"
+#line 177 "htmlattrs.gperf"
{"title", ATTR_TITLE},
#line 114 "htmlattrs.gperf"
{"ondragenter", ATTR_ONDRAGENTER},
#line 83 "htmlattrs.gperf"
{"longdesc", ATTR_LONGDESC},
-#line 165 "htmlattrs.gperf"
+#line 166 "htmlattrs.gperf"
{"size", ATTR_SIZE},
#line 70 "htmlattrs.gperf"
{"hspace", ATTR_HSPACE},
-#line 153 "htmlattrs.gperf"
+#line 154 "htmlattrs.gperf"
{"results", ATTR_RESULTS},
-#line 135 "htmlattrs.gperf"
+#line 136 "htmlattrs.gperf"
{"onsearch", ATTR_ONSEARCH},
-#line 148 "htmlattrs.gperf"
+#line 149 "htmlattrs.gperf"
{"precision", ATTR_PRECISION},
-#line 144 "htmlattrs.gperf"
+#line 145 "htmlattrs.gperf"
{"plain", ATTR_PLAIN},
#line 34 "htmlattrs.gperf"
{"charoff", ATTR_CHAROFF},
#line 78 "htmlattrs.gperf"
{"lang", ATTR_LANG},
-#line 157 "htmlattrs.gperf"
+#line 158 "htmlattrs.gperf"
{"rules", ATTR_RULES},
-#line 189 "htmlattrs.gperf"
+#line 190 "htmlattrs.gperf"
{"vspace", ATTR_VSPACE},
-#line 138 "htmlattrs.gperf"
+#line 139 "htmlattrs.gperf"
{"onsubmit", ATTR_ONSUBMIT},
-#line 158 "htmlattrs.gperf"
+#line 159 "htmlattrs.gperf"
{"scheme", ATTR_SCHEME},
#line 26 "htmlattrs.gperf"
{"bgcolor", ATTR_BGCOLOR},
-#line 151 "htmlattrs.gperf"
+#line 152 "htmlattrs.gperf"
{"readonly", ATTR_READONLY},
#line 103 "htmlattrs.gperf"
{"onbeforecut", ATTR_ONBEFORECUT},
{"content", ATTR_CONTENT},
#line 59 "htmlattrs.gperf"
{"disabled", ATTR_DISABLED},
-#line 162 "htmlattrs.gperf"
+#line 163 "htmlattrs.gperf"
{"scrolling", ATTR_SCROLLING},
#line 13 "htmlattrs.gperf"
{"accept-charset", ATTR_ACCEPT_CHARSET},
#line 74 "htmlattrs.gperf"
{"incremental", ATTR_INCREMENTAL},
-#line 139 "htmlattrs.gperf"
+#line 140 "htmlattrs.gperf"
{"onunload", ATTR_ONUNLOAD},
#line 68 "htmlattrs.gperf"
{"href", ATTR_HREF},
{"align", ATTR_ALIGN},
#line 121 "htmlattrs.gperf"
{"oninput", ATTR_ONINPUT},
-#line 154 "htmlattrs.gperf"
+#line 155 "htmlattrs.gperf"
{"rev", ATTR_REV},
-#line 178 "htmlattrs.gperf"
+#line 179 "htmlattrs.gperf"
{"topmargin", ATTR_TOPMARGIN},
#line 116 "htmlattrs.gperf"
{"ondragover", ATTR_ONDRAGOVER},
{"headers", ATTR_HEADERS},
#line 33 "htmlattrs.gperf"
{"challenge", ATTR_CHALLENGE},
-#line 143 "htmlattrs.gperf"
+#line 144 "htmlattrs.gperf"
{"placeholder", ATTR_PLACEHOLDER},
-#line 168 "htmlattrs.gperf"
+#line 169 "htmlattrs.gperf"
{"standby", ATTR_STANDBY},
-#line 155 "htmlattrs.gperf"
+#line 156 "htmlattrs.gperf"
{"rows", ATTR_ROWS},
-#line 192 "htmlattrs.gperf"
+#line 193 "htmlattrs.gperf"
{"z-index", ATTR_Z_INDEX},
#line 21 "htmlattrs.gperf"
{"autocomplete", ATTR_AUTOCOMPLETE},
-#line 191 "htmlattrs.gperf"
+#line 192 "htmlattrs.gperf"
{"wrap", ATTR_WRAP},
#line 123 "htmlattrs.gperf"
{"onkeypress", ATTR_ONKEYPRESS},
#line 91 "htmlattrs.gperf"
{"method", ATTR_METHOD},
-#line 140 "htmlattrs.gperf"
+#line 141 "htmlattrs.gperf"
{"oversrc", ATTR_OVERSRC},
#line 115 "htmlattrs.gperf"
{"ondragleave", ATTR_ONDRAGLEAVE},
-#line 171 "htmlattrs.gperf"
+#line 172 "htmlattrs.gperf"
{"summary", ATTR_SUMMARY},
#line 98 "htmlattrs.gperf"
{"noshade", ATTR_NOSHADE},
-#line 172 "htmlattrs.gperf"
+#line 173 "htmlattrs.gperf"
{"tabindex", ATTR_TABINDEX},
#line 15 "htmlattrs.gperf"
{"accesskey", ATTR_ACCESSKEY},
{"multiple", ATTR_MULTIPLE},
#line 97 "htmlattrs.gperf"
{"nosave", ATTR_NOSAVE},
-#line 160 "htmlattrs.gperf"
+#line 161 "htmlattrs.gperf"
{"scrollamount", ATTR_SCROLLAMOUNT},
#line 92 "htmlattrs.gperf"
{"min", ATTR_MIN},
{"html", ATTR_HTML},
#line 31 "htmlattrs.gperf"
{"cellspacing", ATTR_CELLSPACING},
-#line 184 "htmlattrs.gperf"
+#line 185 "htmlattrs.gperf"
{"value", ATTR_VALUE},
#line 129 "htmlattrs.gperf"
{"onmouseover", ATTR_ONMOUSEOVER},
{"nohref", ATTR_NOHREF},
#line 76 "htmlattrs.gperf"
{"keytype", ATTR_KEYTYPE},
-#line 185 "htmlattrs.gperf"
+#line 186 "htmlattrs.gperf"
{"valuetype", ATTR_VALUETYPE},
#line 111 "htmlattrs.gperf"
{"ondblclick", ATTR_ONDBLCLICK},
{"onmousemove", ATTR_ONMOUSEMOVE},
#line 99 "htmlattrs.gperf"
{"nowrap", ATTR_NOWRAP},
-#line 156 "htmlattrs.gperf"
+#line 157 "htmlattrs.gperf"
{"rowspan", ATTR_ROWSPAN},
#line 22 "htmlattrs.gperf"
{"autosave", ATTR_AUTOSAVE},
-#line 186 "htmlattrs.gperf"
+#line 187 "htmlattrs.gperf"
{"version", ATTR_VERSION},
-#line 145 "htmlattrs.gperf"
- {"pluginpage", ATTR_PLUGINPAGE},
#line 146 "htmlattrs.gperf"
+ {"pluginpage", ATTR_PLUGINPAGE},
+#line 147 "htmlattrs.gperf"
{"pluginspage", ATTR_PLUGINSPAGE},
#line 20 "htmlattrs.gperf"
{"archive", ATTR_ARCHIVE},
#line 81 "htmlattrs.gperf"
{"leftmargin", ATTR_LEFTMARGIN},
-#line 183 "htmlattrs.gperf"
+#line 184 "htmlattrs.gperf"
{"valign", ATTR_VALIGN},
#line 69 "htmlattrs.gperf"
{"hreflang", ATTR_HREFLANG},
{"hidden", ATTR_HIDDEN},
#line 18 "htmlattrs.gperf"
{"alink", ATTR_ALINK},
-#line 147 "htmlattrs.gperf"
+#line 148 "htmlattrs.gperf"
{"pluginurl", ATTR_PLUGINURL},
#line 108 "htmlattrs.gperf"
{"oncontextmenu", ATTR_ONCONTEXTMENU},
{"behavior", ATTR_BEHAVIOR},
#line 88 "htmlattrs.gperf"
{"maxlength", ATTR_MAXLENGTH},
-#line 187 "htmlattrs.gperf"
+#line 188 "htmlattrs.gperf"
{"visibility", ATTR_VISIBILITY},
#line 126 "htmlattrs.gperf"
{"onmousedown", ATTR_ONMOUSEDOWN},
{"link", ATTR_LINK},
#line 24 "htmlattrs.gperf"
{"background", ATTR_BACKGROUND},
-#line 190 "htmlattrs.gperf"
+#line 191 "htmlattrs.gperf"
{"width", ATTR_WIDTH},
#line 72 "htmlattrs.gperf"
{"http-equiv", ATTR_HTTP_EQUIV},
-#line 188 "htmlattrs.gperf"
+#line 189 "htmlattrs.gperf"
{"vlink", ATTR_VLINK},
+#line 131 "htmlattrs.gperf"
+ {"onmousewheel", ATTR_ONMOUSEWHEEL},
#line 122 "htmlattrs.gperf"
{"onkeydown", ATTR_ONKEYDOWN},
#line 85 "htmlattrs.gperf"
{"marginheight", ATTR_MARGINHEIGHT},
#line 86 "htmlattrs.gperf"
{"marginwidth", ATTR_MARGINWIDTH},
-#line 181 "htmlattrs.gperf"
+#line 182 "htmlattrs.gperf"
{"unknown", ATTR_UNKNOWN}
};
173, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 174, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 175, -1, -1, -1, -1,
- 176, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 176, -1, -1, -1, -1, -1, -1, 177, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 177,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 178,
-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, 178, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 179, -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, 179, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 180, -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, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 180
+ -1, -1, -1, -1, -1, -1, -1, 181
};
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
}
return 0;
}
-#line 193 "htmlattrs.gperf"
+#line 194 "htmlattrs.gperf"
"ONMOUSEOUT",
"ONMOUSEOVER",
"ONMOUSEUP",
+ "ONMOUSEWHEEL",
"ONPASTE",
"ONRESET",
"ONRESIZE",
#define ATTR_ONMOUSEOUT 117
#define ATTR_ONMOUSEOVER 118
#define ATTR_ONMOUSEUP 119
-#define ATTR_ONPASTE 120
-#define ATTR_ONRESET 121
-#define ATTR_ONRESIZE 122
-#define ATTR_ONSCROLL 123
-#define ATTR_ONSEARCH 124
-#define ATTR_ONSELECT 125
-#define ATTR_ONSELECTSTART 126
-#define ATTR_ONSUBMIT 127
-#define ATTR_ONUNLOAD 128
-#define ATTR_OVERSRC 129
-#define ATTR_PAGEX 130
-#define ATTR_PAGEY 131
-#define ATTR_PLACEHOLDER 132
-#define ATTR_PLAIN 133
-#define ATTR_PLUGINPAGE 134
-#define ATTR_PLUGINSPAGE 135
-#define ATTR_PLUGINURL 136
-#define ATTR_PRECISION 137
-#define ATTR_PROFILE 138
-#define ATTR_PROMPT 139
-#define ATTR_READONLY 140
-#define ATTR_REL 141
-#define ATTR_RESULTS 142
-#define ATTR_REV 143
-#define ATTR_ROWS 144
-#define ATTR_ROWSPAN 145
-#define ATTR_RULES 146
-#define ATTR_SCHEME 147
-#define ATTR_SCOPE 148
-#define ATTR_SCROLLAMOUNT 149
-#define ATTR_SCROLLDELAY 150
-#define ATTR_SCROLLING 151
-#define ATTR_SELECTED 152
-#define ATTR_SHAPE 153
-#define ATTR_SIZE 154
-#define ATTR_SPAN 155
-#define ATTR_SRC 156
-#define ATTR_STANDBY 157
-#define ATTR_START 158
-#define ATTR_STYLE 159
-#define ATTR_SUMMARY 160
-#define ATTR_TABINDEX 161
-#define ATTR_TABLEBORDER 162
-#define ATTR_TARGET 163
-#define ATTR_TEXT 164
-#define ATTR_TITLE 165
-#define ATTR_TOP 166
-#define ATTR_TOPMARGIN 167
-#define ATTR_TRUESPEED 168
-#define ATTR_TYPE 169
-#define ATTR_UNKNOWN 170
-#define ATTR_USEMAP 171
-#define ATTR_VALIGN 172
-#define ATTR_VALUE 173
-#define ATTR_VALUETYPE 174
-#define ATTR_VERSION 175
-#define ATTR_VISIBILITY 176
-#define ATTR_VLINK 177
-#define ATTR_VSPACE 178
-#define ATTR_WIDTH 179
-#define ATTR_WRAP 180
-#define ATTR_Z_INDEX 181
-#define ATTR_LAST_ATTR 181
+#define ATTR_ONMOUSEWHEEL 120
+#define ATTR_ONPASTE 121
+#define ATTR_ONRESET 122
+#define ATTR_ONRESIZE 123
+#define ATTR_ONSCROLL 124
+#define ATTR_ONSEARCH 125
+#define ATTR_ONSELECT 126
+#define ATTR_ONSELECTSTART 127
+#define ATTR_ONSUBMIT 128
+#define ATTR_ONUNLOAD 129
+#define ATTR_OVERSRC 130
+#define ATTR_PAGEX 131
+#define ATTR_PAGEY 132
+#define ATTR_PLACEHOLDER 133
+#define ATTR_PLAIN 134
+#define ATTR_PLUGINPAGE 135
+#define ATTR_PLUGINSPAGE 136
+#define ATTR_PLUGINURL 137
+#define ATTR_PRECISION 138
+#define ATTR_PROFILE 139
+#define ATTR_PROMPT 140
+#define ATTR_READONLY 141
+#define ATTR_REL 142
+#define ATTR_RESULTS 143
+#define ATTR_REV 144
+#define ATTR_ROWS 145
+#define ATTR_ROWSPAN 146
+#define ATTR_RULES 147
+#define ATTR_SCHEME 148
+#define ATTR_SCOPE 149
+#define ATTR_SCROLLAMOUNT 150
+#define ATTR_SCROLLDELAY 151
+#define ATTR_SCROLLING 152
+#define ATTR_SELECTED 153
+#define ATTR_SHAPE 154
+#define ATTR_SIZE 155
+#define ATTR_SPAN 156
+#define ATTR_SRC 157
+#define ATTR_STANDBY 158
+#define ATTR_START 159
+#define ATTR_STYLE 160
+#define ATTR_SUMMARY 161
+#define ATTR_TABINDEX 162
+#define ATTR_TABLEBORDER 163
+#define ATTR_TARGET 164
+#define ATTR_TEXT 165
+#define ATTR_TITLE 166
+#define ATTR_TOP 167
+#define ATTR_TOPMARGIN 168
+#define ATTR_TRUESPEED 169
+#define ATTR_TYPE 170
+#define ATTR_UNKNOWN 171
+#define ATTR_USEMAP 172
+#define ATTR_VALIGN 173
+#define ATTR_VALUE 174
+#define ATTR_VALUETYPE 175
+#define ATTR_VERSION 176
+#define ATTR_VISIBILITY 177
+#define ATTR_VLINK 178
+#define ATTR_VSPACE 179
+#define ATTR_WIDTH 180
+#define ATTR_WRAP 181
+#define ATTR_Z_INDEX 182
+#define ATTR_LAST_ATTR 182
DOM::DOMString getAttrName(unsigned short id);
#endif
onmouseout
onmouseover
onmouseup
+onmousewheel
onpaste
onreset
onresize
0, // KHTML_MOVE_EVENT
0, // KHTML_ORIGCLICK_MOUSEUP_EVENT
"readystatechange",
+ "mousewheel",
+ 0, // horizontal mouse wheel
};
EventImpl::EventId EventImpl::typeToId(const DOMString &type)
return false;
}
+bool EventImpl::isWheelEvent() const
+{
+ return false;
+}
+
// -----------------------------------------------------------------------------
UIEventImpl::UIEventImpl()
// -----------------------------------------------------------------------------
-MouseEventImpl::MouseEventImpl()
+// -----------------------------------------------------------------------------
+
+MouseRelatedEventImpl::MouseRelatedEventImpl()
+ : m_screenX(0), m_screenY(0), m_clientX(0), m_clientY(0), m_layerX(0), m_layerY(0)
{
- m_screenX = 0;
- m_screenY = 0;
- m_clientX = 0;
- m_clientY = 0;
- m_ctrlKey = false;
- m_altKey = false;
- m_shiftKey = false;
- m_metaKey = false;
- m_button = 0;
- m_relatedTarget = 0;
- m_clipboard = 0;
}
-MouseEventImpl::MouseEventImpl(EventId _id,
+MouseRelatedEventImpl::MouseRelatedEventImpl(EventId _id,
bool canBubbleArg,
bool cancelableArg,
AbstractViewImpl *viewArg,
bool ctrlKeyArg,
bool altKeyArg,
bool shiftKeyArg,
- bool metaKeyArg,
- unsigned short buttonArg,
- NodeImpl *relatedTargetArg,
- ClipboardImpl *clipboardArg)
- : UIEventImpl(_id,canBubbleArg,cancelableArg,viewArg,detailArg)
+ bool metaKeyArg)
+ : UIEventWithKeyStateImpl(_id, canBubbleArg, cancelableArg, viewArg, detailArg,
+ ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg)
{
m_screenX = screenXArg;
m_screenY = screenYArg;
m_clientX = clientXArg;
m_clientY = clientYArg;
- m_ctrlKey = ctrlKeyArg;
- m_altKey = altKeyArg;
- m_shiftKey = shiftKeyArg;
- m_metaKey = metaKeyArg;
- m_button = buttonArg;
- m_relatedTarget = relatedTargetArg;
- if (m_relatedTarget)
- m_relatedTarget->ref();
- m_clipboard = clipboardArg;
- if (m_clipboard)
- m_clipboard->ref();
computeLayerPos();
}
-void MouseEventImpl::computeLayerPos()
+void MouseRelatedEventImpl::computeLayerPos()
{
m_layerX = m_clientX;
m_layerY = m_clientY;
}
}
+// -----------------------------------------------------------------------------
+
+MouseEventImpl::MouseEventImpl()
+{
+ m_button = 0;
+ m_relatedTarget = 0;
+ m_clipboard = 0;
+}
+
+MouseEventImpl::MouseEventImpl(EventId _id,
+ bool canBubbleArg,
+ bool cancelableArg,
+ AbstractViewImpl *viewArg,
+ long detailArg,
+ long screenXArg,
+ long screenYArg,
+ long clientXArg,
+ long clientYArg,
+ bool ctrlKeyArg,
+ bool altKeyArg,
+ bool shiftKeyArg,
+ bool metaKeyArg,
+ unsigned short buttonArg,
+ NodeImpl *relatedTargetArg,
+ ClipboardImpl *clipboardArg)
+ : MouseRelatedEventImpl(_id, canBubbleArg, cancelableArg, viewArg, detailArg,
+ screenXArg, screenYArg, clientXArg, clientYArg,
+ ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg)
+{
+ m_button = buttonArg;
+ m_relatedTarget = relatedTargetArg;
+ if (m_relatedTarget)
+ m_relatedTarget->ref();
+ m_clipboard = clipboardArg;
+ if (m_clipboard)
+ m_clipboard->ref();
+}
+
MouseEventImpl::~MouseEventImpl()
{
if (m_relatedTarget)
m_keyEvent = 0;
m_keyIdentifier = 0;
m_keyLocation = KeyboardEvent::DOM_KEY_LOCATION_STANDARD;
- m_ctrlKey = false;
- m_shiftKey = false;
- m_altKey = false;
- m_metaKey = false;
m_altGraphKey = false;
}
KeyboardEventImpl::KeyboardEventImpl(QKeyEvent *key, AbstractViewImpl *view)
- : UIEventImpl(key->type() == QEvent::KeyRelease ? KEYUP_EVENT : key->isAutoRepeat() ? KEYPRESS_EVENT : KEYDOWN_EVENT,
- true,true,view,0)
+ : UIEventWithKeyStateImpl(key->type() == QEvent::KeyRelease ? KEYUP_EVENT : key->isAutoRepeat() ? KEYPRESS_EVENT : KEYDOWN_EVENT,
+ true, true, view, 0,
+ key->state() & Qt::ControlButton,
+ key->state() & Qt::ShiftButton,
+ key->state() & Qt::AltButton,
+ key->state() & Qt::MetaButton)
{
#if APPLE_CHANGES
m_keyEvent = new QKeyEvent(*key);
int keyState = key->state();
- m_ctrlKey = keyState & Qt::ControlButton;
- m_shiftKey = keyState & Qt::ShiftButton;
- m_altKey = keyState & Qt::AltButton;
- m_metaKey = keyState & Qt::MetaButton;
m_altGraphKey = false; // altGraphKey is not supported by Qt.
// Note: we only support testing for num pad
bool altKeyArg,
bool metaKeyArg,
bool altGraphKeyArg)
- : UIEventImpl(_id,canBubbleArg,cancelableArg,viewArg,0)
+ : UIEventWithKeyStateImpl(_id, canBubbleArg, cancelableArg, viewArg, 0, ctrlKeyArg, shiftKeyArg, altKeyArg, metaKeyArg)
{
m_keyEvent = 0;
m_keyIdentifier = keyIdentifierArg.implementation();
if (m_keyIdentifier)
m_keyIdentifier->ref();
m_keyLocation = keyLocationArg;
- m_ctrlKey = ctrlKeyArg;
- m_shiftKey = shiftKeyArg;
- m_altKey = altKeyArg;
- m_metaKey = metaKeyArg;
m_altGraphKey = altGraphKeyArg;
}
// -----------------------------------------------------------------------------
+WheelEventImpl::WheelEventImpl() : m_horizontal(false), m_wheelDelta(0)
+{
+}
+
+WheelEventImpl::WheelEventImpl(bool h, long d, AbstractViewImpl *v,
+ long sx, long sy, long cx, long cy, bool ctrl, bool alt, bool shift, bool meta)
+ : MouseRelatedEventImpl(h ? HORIZONTALMOUSEWHEEL_EVENT : MOUSEWHEEL_EVENT,
+ true, true, v, 0, sx, sy, cx, cy, ctrl, alt, shift, meta)
+ , m_horizontal(h), m_wheelDelta(d)
+{
+}
+
+bool WheelEventImpl::isWheelEvent() const
+{
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+
RegisteredEventListener::RegisteredEventListener(EventImpl::EventId _id, EventListener *_listener, bool _useCapture)
{
id = _id;
// -----------------------------------------------------------------------------
-ClipboardImpl::ClipboardImpl()
-{
-}
-
ClipboardImpl::~ClipboardImpl()
{
}
KHTML_ORIGCLICK_MOUSEUP_EVENT,
// XMLHttpRequest events
KHTML_READYSTATECHANGE_EVENT,
+ // extensions
+ MOUSEWHEEL_EVENT,
+ HORIZONTALMOUSEWHEEL_EVENT,
numEventIds
};
virtual bool isKeyboardEvent() const;
virtual bool isDragEvent() const; // a subset of mouse events
virtual bool isClipboardEvent() const;
+ virtual bool isWheelEvent() const;
bool propagationStopped() const { return m_propagationStopped; }
bool defaultPrevented() const { return m_defaultPrevented; }
};
+class UIEventWithKeyStateImpl : public UIEventImpl {
+public:
+ UIEventWithKeyStateImpl() : m_ctrlKey(false), m_altKey(false), m_shiftKey(false), m_metaKey(false) { }
+ UIEventWithKeyStateImpl(EventId eventID, bool canBubbleArg, bool cancelableArg, AbstractViewImpl *viewArg,
+ long detailArg, bool ctrlKeyArg, bool altKeyArg, bool shiftKeyArg, bool metaKeyArg)
+ : UIEventImpl(eventID, canBubbleArg, cancelableArg, viewArg, detailArg)
+ , m_ctrlKey(ctrlKeyArg), m_altKey(altKeyArg), m_shiftKey(shiftKeyArg), m_metaKey(metaKeyArg) { }
+ bool ctrlKey() const { return m_ctrlKey; }
+ bool shiftKey() const { return m_shiftKey; }
+ bool altKey() const { return m_altKey; }
+ bool metaKey() const { return m_metaKey; }
+protected: // expose these so init functions can set them
+ bool m_ctrlKey : 1;
+ bool m_altKey : 1;
+ bool m_shiftKey : 1;
+ bool m_metaKey : 1;
+};
-// Introduced in DOM Level 2: - internal
-class MouseEventImpl : public UIEventImpl {
+// Internal only: Helper class for what's common between mouse and wheel events.
+class MouseRelatedEventImpl : public UIEventWithKeyStateImpl {
+public:
+ MouseRelatedEventImpl();
+ MouseRelatedEventImpl(EventId _id,
+ bool canBubbleArg,
+ bool cancelableArg,
+ AbstractViewImpl *viewArg,
+ long detailArg,
+ long screenXArg,
+ long screenYArg,
+ long clientXArg,
+ long clientYArg,
+ bool ctrlKeyArg,
+ bool altKeyArg,
+ bool shiftKeyArg,
+ bool metaKeyArg);
+ long screenX() const { return m_screenX; }
+ long screenY() const { return m_screenY; }
+ long clientX() const { return m_clientX; }
+ long clientY() const { return m_clientY; }
+ long layerX() const { return m_layerX; }
+ long layerY() const { return m_layerY; }
+protected: // expose these so MouseEventImpl::initMouseEvent can set them
+ long m_screenX;
+ long m_screenY;
+ long m_clientX;
+ long m_clientY;
+ void computeLayerPos();
+private:
+ long m_layerX;
+ long m_layerY;
+};
+
+// Introduced in DOM Level 2
+class MouseEventImpl : public MouseRelatedEventImpl {
public:
MouseEventImpl();
MouseEventImpl(EventId _id,
NodeImpl *relatedTargetArg,
ClipboardImpl *clipboardArg=0);
virtual ~MouseEventImpl();
- long screenX() const { return m_screenX; }
- long screenY() const { return m_screenY; }
- long clientX() const { return m_clientX; }
- long clientY() const { return m_clientY; }
- long layerX() const { return m_layerX; }
- long layerY() const { return m_layerY; }
- bool ctrlKey() const { return m_ctrlKey; }
- bool shiftKey() const { return m_shiftKey; }
- bool altKey() const { return m_altKey; }
- bool metaKey() const { return m_metaKey; }
unsigned short button() const { return m_button; }
NodeImpl *relatedTarget() const { return m_relatedTarget; }
ClipboardImpl *clipboard() const { return m_clipboard; }
const Node &relatedTargetArg);
virtual bool isMouseEvent() const;
virtual bool isDragEvent() const;
-protected:
- long m_screenX;
- long m_screenY;
- long m_clientX;
- long m_clientY;
- long m_layerX;
- long m_layerY;
- bool m_ctrlKey;
- bool m_altKey;
- bool m_shiftKey;
- bool m_metaKey;
+private:
unsigned short m_button;
NodeImpl *m_relatedTarget;
ClipboardImpl *m_clipboard;
- private:
- void computeLayerPos();
};
// Introduced in DOM Level 3
-class KeyboardEventImpl : public UIEventImpl {
+class KeyboardEventImpl : public UIEventWithKeyStateImpl {
public:
KeyboardEventImpl();
KeyboardEventImpl(QKeyEvent *key, AbstractViewImpl *view);
DOMString keyIdentifier() const { return m_keyIdentifier; }
unsigned long keyLocation() const { return m_keyLocation; }
- bool ctrlKey() const { return m_ctrlKey; }
- bool shiftKey() const { return m_shiftKey; }
- bool altKey() const { return m_altKey; }
- bool metaKey() const { return m_metaKey; }
bool altGraphKey() const { return m_altGraphKey; }
QKeyEvent *qKeyEvent() const { return m_keyEvent; }
QKeyEvent *m_keyEvent;
DOMStringImpl *m_keyIdentifier;
unsigned long m_keyLocation;
- bool m_ctrlKey : 1;
- bool m_shiftKey : 1;
- bool m_altKey : 1;
- bool m_metaKey : 1;
bool m_altGraphKey : 1;
};
ClipboardImpl *m_clipboard;
};
+// extension: mouse wheel event
+class WheelEventImpl : public MouseRelatedEventImpl
+{
+public:
+ WheelEventImpl();
+ WheelEventImpl(bool horizontal, long wheelDelta, AbstractViewImpl *,
+ long screenXArg, long screenYArg,
+ long clientXArg, long clientYArg,
+ bool ctrlKeyArg, bool altKeyArg, bool shiftKeyArg, bool metaKeyArg);
+ bool isHorizontal() const { return m_horizontal; }
+ long wheelDelta() const { return m_wheelDelta; }
+
+private:
+ virtual bool isWheelEvent() const;
+
+ bool m_horizontal;
+ long m_wheelDelta;
+};
+
class RegisteredEventListener {
public:
RegisteredEventListener(EventImpl::EventId _id, EventListener *_listener, bool _useCapture);
// State available during IE's events for drag and drop and copy/paste
class ClipboardImpl : public khtml::Shared<ClipboardImpl> {
public:
- ClipboardImpl();
+ ClipboardImpl() { }
virtual ~ClipboardImpl();
MAIN_THREAD_ALLOCATED;
virtual void setDragImageElement(const Node &, const QPoint &) = 0;
};
-}; //namespace
+} // namespace
+
#endif
return r;
}
+void NodeImpl::dispatchWheelEvent(QWheelEvent *e)
+{
+ if (e->delta() == 0)
+ return;
+
+ DocumentImpl *doc = getDocument();
+ if (!doc)
+ return;
+
+ KHTMLView *view = getDocument()->view();
+ if (!view)
+ return;
+
+ int x;
+ int y;
+ view->viewportToContents(e->x(), e->y(), x, y);
+
+ int state = e->state();
+
+ WheelEventImpl *we = new WheelEventImpl(e->orientation() == Qt::Horizontal, e->delta(),
+ getDocument()->defaultView(), e->globalX(), e->globalY(), x, y,
+ state & Qt::ControlButton, state & Qt::AltButton, state & Qt::ShiftButton, state & Qt::MetaButton);
+
+ int exceptionCode = 0;
+ if (!dispatchEvent(we, exceptionCode, true))
+ e->accept();
+}
+
void NodeImpl::handleLocalEvents(EventImpl *evt, bool useCapture)
{
if (!m_regdListeners)
class QKeyEvent;
class QTextStream;
class QStringList;
+class QWheelEvent;
namespace khtml {
class RenderObject;
bool dispatchUIEvent(int _id, int detail = 0);
bool dispatchSubtreeModifiedEvent(bool childrenChanged = true);
bool dispatchKeyEvent(QKeyEvent *key);
+ void dispatchWheelEvent(QWheelEvent *);
void handleLocalEvents(EventImpl *evt, bool useCapture);
KeyRelease,
Paint,
Resize,
+ Wheel,
KParts
};
static Reason reason() { return Other; }
};
+class QWheelEvent : public QEvent {
+public:
+ QWheelEvent(const QPoint &position, const QPoint &globalPosition, int delta, int state, Orientation orientation)
+ : QEvent(Wheel), _position(position), _globalPosition(globalPosition), _delta(delta), _state(state)
+ , _orientation(orientation), _isAccepted(false)
+ { }
+ QWheelEvent(NSEvent *);
+
+ const QPoint &pos() const { return _position; }
+ const QPoint &globalPos() const { return _globalPosition; }
+ int delta() const { return _delta; }
+ int state() const { return _state; }
+ Orientation orientation() const { return _orientation; }
+ bool isAccepted() const { return _isAccepted; }
+
+ int x() const { return _position.x(); }
+ int y() const { return _position.y(); }
+ int globalX() const { return _globalPosition.x(); }
+ int globalY() const { return _globalPosition.y(); }
+
+ void accept() { _isAccepted = true; }
+ void ignore() { _isAccepted = false; }
+
+private:
+ QPoint _position;
+ QPoint _globalPosition;
+ int _delta;
+ int _state;
+ Orientation _orientation;
+ bool _isAccepted;
+};
+
class QHideEvent;
class QShowEvent;
-class QWheelEvent;
class QContextMenuEvent;
class QResizeEvent : public QEvent {
case NSOtherMouseUp:
case NSOtherMouseDragged:
case NSMouseMoved:
+ case NSScrollWheel:
return QPoint([event locationInWindow]);
default:
return QPoint();
}
}
+static QPoint globalPositionForEvent(NSEvent *event)
+{
+ switch ([event type]) {
+ case NSLeftMouseDown:
+ case NSLeftMouseUp:
+ case NSLeftMouseDragged:
+ case NSRightMouseDown:
+ case NSRightMouseUp:
+ case NSRightMouseDragged:
+ case NSOtherMouseDown:
+ case NSOtherMouseUp:
+ case NSOtherMouseDragged:
+ case NSMouseMoved:
+ case NSScrollWheel:
+ return QPoint([[event window] convertBaseToScreen:[event locationInWindow]]);
+ default:
+ return QPoint();
+ }
+}
+
static int clickCountForEvent(NSEvent *event)
{
switch ([event type]) {
}
}
+static Qt::Orientation orientationForEvent(NSEvent *event)
+{
+ switch ([event type]) {
+ case NSScrollWheel:
+ return [event deltaX] != 0 ? Qt::Horizontal : Qt::Vertical;
+ default:
+ return Qt::Vertical;
+ }
+}
+
+static int deltaForEvent(NSEvent *event)
+{
+ switch ([event type]) {
+ case NSScrollWheel:
+ return lrint((orientationForEvent(event) == Qt::Horizontal ? [event deltaX] : [event deltaY]) * 120);
+ default:
+ return 0;
+ }
+}
+
// ========
QEvent::~QEvent()
_unmodifiedText = "\x8";
}
}
+
+// ========
+
+QWheelEvent::QWheelEvent(NSEvent *event)
+ : QEvent(Wheel)
+ , _position(positionForEvent(event))
+ , _globalPosition(globalPositionForEvent(event))
+ , _delta(deltaForEvent(event))
+ , _state(nonMouseButtonsForEvent(event))
+ , _orientation(orientationForEvent(event))
+ , _isAccepted(false)
+{
+}
void jumpToSelection();
QString advanceToNextMisspelling(bool startBeforeSelection = false);
bool scrollOverflow(KWQScrollDirection direction, KWQScrollGranularity granularity);
- bool scrollOverflowWithScrollWheelEvent(NSEvent *event);
void setEncoding(const QString &encoding, bool userChosen);
void addData(const char *bytes, int length);
void mouseDown(NSEvent *);
void mouseDragged(NSEvent *);
void mouseUp(NSEvent *);
- void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent);
void mouseMoved(NSEvent *);
bool keyEvent(NSEvent *);
+ bool wheelEvent(NSEvent *);
+
+ void sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent);
bool lastEventIsMouseUp() const;
void setActivationEventNumber(int num) { _activationEventNumber = num; }
return false;
}
-bool KWQKHTMLPart::scrollOverflowWithScrollWheelEvent(NSEvent *event)
+bool KWQKHTMLPart::wheelEvent(NSEvent *event)
{
- RenderObject *r = renderer();
- if (r == 0) {
- return false;
- }
-
- NSPoint point = [d->m_view->getDocumentView() convertPoint:[event locationInWindow] fromView:nil];
- RenderObject::NodeInfo nodeInfo(true, true);
- r->layer()->hitTest(nodeInfo, (int)point.x, (int)point.y);
-
- NodeImpl *node = nodeInfo.innerNode();
- if (node == 0) {
- return false;
- }
-
- r = node->renderer();
- if (r == 0) {
- return false;
+ KHTMLView *v = d->m_view;
+
+ if (v) {
+ QWheelEvent qEvent(event);
+ v->viewportWheelEvent(&qEvent);
+ if (qEvent.isAccepted())
+ return true;
}
-
+
+ // FIXME: The scrolling done here should be done in the default handlers
+ // of the elements rather than here in the part.
+
KWQScrollDirection direction;
float multiplier;
float deltaX = [event deltaX];
} else {
return false;
}
+
+ RenderObject *r = renderer();
+ if (r == 0) {
+ return false;
+ }
+
+ NSPoint point = [d->m_view->getDocumentView() convertPoint:[event locationInWindow] fromView:nil];
+ RenderObject::NodeInfo nodeInfo(true, true);
+ r->layer()->hitTest(nodeInfo, (int)point.x, (int)point.y);
+
+ NodeImpl *node = nodeInfo.innerNode();
+ if (node == 0) {
+ return false;
+ }
+
+ r = node->renderer();
+ if (r == 0) {
+ return false;
+ }
+
return r->scroll(direction, KWQScrollWheel, multiplier);
}
- (void)scrollToAnchorWithURL:(NSURL *)URL;
- (BOOL)scrollOverflowInDirection:(WebScrollDirection)direction granularity:(WebScrollGranularity)granularity;
-- (BOOL)scrollOverflowWithScrollWheelEvent:(NSEvent *)event;
- (void)createKHTMLViewWithNSView:(NSView *)view marginWidth:(int)mw marginHeight:(int)mh;
- (void)mouseMoved:(NSEvent *)event;
- (void)mouseDragged:(NSEvent *)event;
-- (BOOL)sendContextMenuEvent:(NSEvent *)event; // return YES if event is eaten by WebCore
+// these return YES if event is eaten by WebCore
+- (BOOL)sendScrollWheelEvent:(NSEvent *)event;
+- (BOOL)sendContextMenuEvent:(NSEvent *)event;
- (NSView *)nextKeyView;
- (NSView *)previousKeyView;
return _part->scrollOverflow((KWQScrollDirection)direction, (KWQScrollGranularity)granularity);
}
-- (BOOL)scrollOverflowWithScrollWheelEvent:(NSEvent *)event
+- (BOOL)sendScrollWheelEvent:(NSEvent *)event
{
- if (_part == NULL) {
- return NO;
- }
- return _part->scrollOverflowWithScrollWheelEvent(event);
+ return _part ? _part->wheelEvent(event) : NO;
}
- (BOOL)saveDocumentToPageCache
+2005-04-26 Darin Adler <darin@apple.com>
+
+ Reviewed by John.
+
+ - fixed <rdar://problem/3655817> please add support for mouse wheel events and the onmousewheel handler
+
+ * WebView.subproj/WebHTMLView.m: (-[WebHTMLView scrollWheel:]): Call sendScrollWheelEvent: method
+ instead of the old scrollOverflowWithScrollWheelEvent: (just a name change).
+
2005-04-18 Darin Adler <darin@apple.com>
Reviewed by Hyatt.
{
[self retain];
- if (![[self _bridge] scrollOverflowWithScrollWheelEvent:event]) {
+ if (![[self _bridge] sendScrollWheelEvent:event]) {
[[self nextResponder] scrollWheel:event];
}