dom2_eventsimpl.cpp Source File (khtml Library)

| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# dom2_eventsimpl.cpp

    00001
    00023 #include "dom/dom2_views.h"
    00024
    00025 #include "xml/dom2_eventsimpl.h"
    00026 #include "xml/dom_stringimpl.h"
    00027 #include "xml/dom_nodeimpl.h"
    00028
    00029 #include <kdebug.h>
    00030
    00031 using namespace DOM;
    00032
    00033 EventImpl::EventImpl()
    00034 {
    00035     m_type = 0;
    00036     m_canBubble = false;
    00037     m_cancelable = false;
    00038
    00039     m_propagationStopped = false;
    00040     m_defaultPrevented = false;
    00041     m_id = UNKNOWN_EVENT;
    00042     m_currentTarget = 0;
    00043     m_eventPhase = 0;
    00044     m_target = 0;
    00045     m_createTime = QDateTime::currentDateTime();
    00046     m_defaultHandled = false;
    00047 }
    00048
    00049 EventImpl::EventImpl(EventId _id, bool canBubbleArg, bool cancelableArg)
    00050 {
    00051     DOMString t = EventImpl::idToType(_id);
    00052     m_type = t.implementation();
    00053     if (m_type)
    00054         m_type->ref();
    00055     m_canBubble = canBubbleArg;
    00056     m_cancelable = cancelableArg;
    00057
    00058     m_propagationStopped = false;
    00059     m_defaultPrevented = false;
    00060     m_id = _id;
    00061     m_currentTarget = 0;
    00062     m_eventPhase = 0;
    00063     m_target = 0;
    00064     m_createTime = QDateTime::currentDateTime();
    00065     m_defaultHandled = false;
    00066 }
    00067
    00068 EventImpl::~EventImpl()
    00069 {
    00070     if (m_type)
    00071         m_type->deref();
    00072     if (m_target)
    00073         m_target->deref();
    00074 }
    00075
    00076 void EventImpl::setTarget(NodeImpl *_target)
    00077 {
    00078     if (m_target)
    00079         m_target->deref();
    00080     m_target = _target;
    00081     if (m_target)
    00082         m_target->ref();
    00083 }
    00084
    00085 DOMTimeStamp EventImpl::timeStamp()
    00086 {
    00087     QDateTime epoch(QDate(1970,1,1),QTime(0,0));
    00088     // ### kjs does not yet support long long (?) so the value wraps around
    00089     return epoch.secsTo(m_createTime)*1000+m_createTime.time().msec();
    00090 }
    00091
    00092 void EventImpl::initEvent(const DOMString &eventTypeArg, bool canBubbleArg, bool cancelableArg)
    00093 {
    00094     // ### ensure this is not called after we have been dispatched (also for subclasses)
    00095
    00096     if (m_type)
    00097         m_type->deref();
    00098
    00099     m_type = eventTypeArg.implementation();
    00100     if (m_type)
    00101         m_type->ref();
    00102
    00103     m_id = typeToId(eventTypeArg);
    00104
    00105     m_canBubble = canBubbleArg;
    00106     m_cancelable = cancelableArg;
    00107 }
    00108
    00109 EventImpl::EventId EventImpl::typeToId(DOMString type)
    00110 {
    00111     if (type == "DOMFocusIn")
    00112         return DOMFOCUSIN_EVENT;
    00113     else if (type == "DOMFocusOut")
    00114         return DOMFOCUSOUT_EVENT;
    00115     else if (type == "DOMActivate")
    00116         return DOMACTIVATE_EVENT;
    00117     else if (type == "click")
    00118         return CLICK_EVENT;
    00119     else if (type == "mousedown")
    00120         return MOUSEDOWN_EVENT;
    00121     else if (type == "mouseup")
    00122         return MOUSEUP_EVENT;
    00123     else if (type == "mouseover")
    00124         return MOUSEOVER_EVENT;
    00125     else if (type == "mousemove")
    00126         return MOUSEMOVE_EVENT;
    00127     else if (type == "mouseout")
    00128         return MOUSEOUT_EVENT;
    00129     else if (type == "DOMSubtreeModified")
    00130         return DOMSUBTREEMODIFIED_EVENT;
    00131     else if (type == "DOMNodeInserted")
    00132         return DOMNODEINSERTED_EVENT;
    00133     else if (type == "DOMNodeRemoved")
    00134         return DOMNODEREMOVED_EVENT;
    00135     else if (type == "DOMNodeRemovedFromDocument")
    00136         return DOMNODEREMOVEDFROMDOCUMENT_EVENT;
    00137     else if (type == "DOMNodeInsertedIntoDocument")
    00138         return DOMNODEINSERTEDINTODOCUMENT_EVENT;
    00139     else if (type == "DOMAttrModified")
    00140         return DOMATTRMODIFIED_EVENT;
    00141     else if (type == "DOMCharacterDataModified")
    00142         return DOMCHARACTERDATAMODIFIED_EVENT;
    00143     else if (type == "load")
    00144         return LOAD_EVENT;
    00145     else if (type == "unload")
    00146         return UNLOAD_EVENT;
    00147     else if (type == "abort")
    00148         return ABORT_EVENT;
    00149     else if (type == "error")
    00150         return ERROR_EVENT;
    00151     else if (type == "select")
    00152         return SELECT_EVENT;
    00153     else if (type == "change")
    00154         return CHANGE_EVENT;
    00155     else if (type == "submit")
    00156         return SUBMIT_EVENT;
    00157     else if (type == "reset")
    00158         return RESET_EVENT;
    00159     else if (type == "focus")
    00160         return FOCUS_EVENT;
    00161     else if (type == "blur")
    00162         return BLUR_EVENT;
    00163     else if (type == "resize")
    00164         return RESIZE_EVENT;
    00165     else if (type == "scroll")
    00166         return SCROLL_EVENT;
    00167     // ignore: KHTML_DBLCLICK_EVENT
    00168     // ignore: KHTML_CLICK_EVENT
    00169     return UNKNOWN_EVENT;
    00170 }
    00171
    00172 DOMString EventImpl::idToType(EventImpl::EventId id)
    00173 {
    00174     switch (id) {
    00175         case DOMFOCUSIN_EVENT:
    00176             return "DOMFocusIn";
    00177         case DOMFOCUSOUT_EVENT:
    00178             return "DOMFocusOut";
    00179         case DOMACTIVATE_EVENT:
    00180             return "DOMActivate";
    00181         case CLICK_EVENT:
    00182             return "click";
    00183         case MOUSEDOWN_EVENT:
    00184             return "mousedown";
    00185         case MOUSEUP_EVENT:
    00186             return "mouseup";
    00187         case MOUSEOVER_EVENT:
    00188             return "mouseover";
    00189         case MOUSEMOVE_EVENT:
    00190             return "mousemove";
    00191         case MOUSEOUT_EVENT:
    00192             return "mouseout";
    00193         case DOMSUBTREEMODIFIED_EVENT:
    00194             return "DOMSubtreeModified";
    00195         case DOMNODEINSERTED_EVENT:
    00196             return "DOMNodeInserted";
    00197         case DOMNODEREMOVED_EVENT:
    00198             return "DOMNodeRemoved";
    00199         case DOMNODEREMOVEDFROMDOCUMENT_EVENT:
    00200             return "DOMNodeRemovedFromDocument";
    00201         case DOMNODEINSERTEDINTODOCUMENT_EVENT:
    00202             return "DOMNodeInsertedIntoDocument";
    00203         case DOMATTRMODIFIED_EVENT:
    00204             return "DOMAttrModified";
    00205         case DOMCHARACTERDATAMODIFIED_EVENT:
    00206             return "DOMCharacterDataModified";
    00207         case LOAD_EVENT:
    00208             return "load";
    00209         case UNLOAD_EVENT:
    00210             return "unload";
    00211         case ABORT_EVENT:
    00212             return "abort";
    00213         case ERROR_EVENT:
    00214             return "error";
    00215         case SELECT_EVENT:
    00216             return "select";
    00217         case CHANGE_EVENT:
    00218             return "change";
    00219         case SUBMIT_EVENT:
    00220             return "submit";
    00221         case RESET_EVENT:
    00222             return "reset";
    00223         case FOCUS_EVENT:
    00224             return "focus";
    00225         case BLUR_EVENT:
    00226             return "blur";
    00227         case RESIZE_EVENT:
    00228             return "resize";
    00229         case SCROLL_EVENT:
    00230             return "scroll";
    00231         // khtml extensions
    00232         case KHTML_ECMA_DBLCLICK_EVENT:
    00233             return "dblclick";
    00234         case KHTML_ECMA_CLICK_EVENT:
    00235             return "click";
    00236         case KHTML_DRAGDROP_EVENT:
    00237             return "khtml_dragdrop";
    00238         case KHTML_ERROR_EVENT:
    00239             return "khtml_error";
    00240         case KHTML_KEYDOWN_EVENT:
    00241             return "khtml_keydown";
    00242         case KHTML_KEYPRESS_EVENT:
    00243             return "khtml_keypress";
    00244         case KHTML_KEYUP_EVENT:
    00245             return "khtml_keyup";
    00246         case KHTML_MOVE_EVENT:
    00247             return "khtml_move";
    00248         case KHTML_ORIGCLICK_MOUSEUP_EVENT:
    00249             return "khtml_origclick_mouseup_event";
    00250         default:
    00251             return DOMString();
    00252             break;
    00253     }
    00254 }
    00255
    00256 // -----------------------------------------------------------------------------
    00257
    00258 UIEventImpl::UIEventImpl(EventId _id, bool canBubbleArg, bool cancelableArg,
    00259                 AbstractViewImpl *viewArg, long detailArg)
    00260                 : EventImpl(_id,canBubbleArg,cancelableArg)
    00261 {
    00262     m_view = viewArg;
    00263     if (m_view)
    00264         m_view->ref();
    00265     m_detail = detailArg;
    00266 }
    00267
    00268 UIEventImpl::~UIEventImpl()
    00269 {
    00270     if (m_view)
    00271         m_view->deref();
    00272 }
    00273
    00274 void UIEventImpl::initUIEvent(const DOMString &typeArg,
    00275                               bool canBubbleArg,
    00276                               bool cancelableArg,
    00277                               const AbstractView &viewArg,
    00278                               long detailArg)
    00279 {
    00280     EventImpl::initEvent(typeArg,canBubbleArg,cancelableArg);
    00281
    00282     if (m_view)
    00283         m_view->deref();
    00284
    00285     m_view = viewArg.handle();
    00286     if (m_view)
    00287         m_view->ref();
    00288     m_detail = detailArg;
    00289 }
    00290
    00291 // -----------------------------------------------------------------------------
    00292
    00293 MouseEventImpl::MouseEventImpl()
    00294 {
    00295     m_screenX = 0;
    00296     m_screenY = 0;
    00297     m_clientX = 0;
    00298     m_clientY = 0;
    00299     m_ctrlKey = false;
    00300     m_altKey = false;
    00301     m_shiftKey = false;
    00302     m_metaKey = false;
    00303     m_button = 0;
    00304     m_relatedTarget = 0;
    00305 }
    00306
    00307 MouseEventImpl::MouseEventImpl(EventId _id,
    00308                                bool canBubbleArg,
    00309                                bool cancelableArg,
    00310                                AbstractViewImpl *viewArg,
    00311                                long detailArg,
    00312                                long screenXArg,
    00313                                long screenYArg,
    00314                                long clientXArg,
    00315                                long clientYArg,
    00316                                bool ctrlKeyArg,
    00317                                bool altKeyArg,
    00318                                bool shiftKeyArg,
    00319                                bool metaKeyArg,
    00320                                unsigned short buttonArg,
    00321                                NodeImpl *relatedTargetArg)
    00322                    : UIEventImpl(_id,canBubbleArg,cancelableArg,viewArg,detailArg)
    00323 {
    00324     m_screenX = screenXArg;
    00325     m_screenY = screenYArg;
    00326     m_clientX = clientXArg;
    00327     m_clientY = clientYArg;
    00328     m_ctrlKey = ctrlKeyArg;
    00329     m_altKey = altKeyArg;
    00330     m_shiftKey = shiftKeyArg;
    00331     m_metaKey = metaKeyArg;
    00332     m_button = buttonArg;
    00333     m_relatedTarget = relatedTargetArg;
    00334     if (m_relatedTarget)
    00335         m_relatedTarget->ref();
    00336 }
    00337
    00338 MouseEventImpl::~MouseEventImpl()
    00339 {
    00340     if (m_relatedTarget)
    00341         m_relatedTarget->deref();
    00342 }
    00343
    00344 void MouseEventImpl::initMouseEvent(const DOMString &typeArg,
    00345                                     bool canBubbleArg,
    00346                                     bool cancelableArg,
    00347                                     const AbstractView &viewArg,
    00348                                     long detailArg,
    00349                                     long screenXArg,
    00350                                     long screenYArg,
    00351                                     long clientXArg,
    00352                                     long clientYArg,
    00353                                     bool ctrlKeyArg,
    00354                                     bool altKeyArg,
    00355                                     bool shiftKeyArg,
    00356                                     bool metaKeyArg,
    00357                                     unsigned short buttonArg,
    00358                                     const Node &relatedTargetArg)
    00359 {
    00360     UIEventImpl::initUIEvent(typeArg,canBubbleArg,cancelableArg,viewArg,detailArg);
    00361
    00362     if (m_relatedTarget)
    00363         m_relatedTarget->deref();
    00364
    00365     m_screenX = screenXArg;
    00366     m_screenY = screenYArg;
    00367     m_clientX = clientXArg;
    00368     m_clientY = clientYArg;
    00369     m_ctrlKey = ctrlKeyArg;
    00370     m_altKey = altKeyArg;
    00371     m_shiftKey = shiftKeyArg;
    00372     m_metaKey = metaKeyArg;
    00373     m_button = buttonArg;
    00374     m_relatedTarget = relatedTargetArg.handle();
    00375     if (m_relatedTarget)
    00376         m_relatedTarget->ref();
    00377 }
    00378
    00379 //---------------------------------------------------------------------------------------------
    00380
    00381 TextEventImpl::TextEventImpl()
    00382 {
    00383   qKeyEvent = 0;
    00384 }
    00385
    00386 TextEventImpl::TextEventImpl(QKeyEvent *key, AbstractViewImpl *view)
    00387   : UIEventImpl(KHTML_KEYDOWN_EVENT,true,true,view,0)
    00388 {
    00389   qKeyEvent = new QKeyEvent(key->type(), key->key(), key->ascii(), key->state(), key->text(), key->isAutoRepeat(), key->count() );
    00390   // Events are supposed to be accepted by default in Qt!
    00391   // This line made QLineEdit's keyevents be ignored, so they were sent to the khtmlview
    00392   // (and e.g. space would make it scroll down)
    00393   //qKeyEvent->ignore();
    00394
    00395   if (key->type() == QEvent::KeyRelease && !key->isAutoRepeat())
    00396       m_id = KHTML_KEYUP_EVENT;
    00397   else if (key->isAutoRepeat())
    00398       m_id = KHTML_KEYPRESS_EVENT;
    00399   else if (key->type() == QEvent::KeyPress)
    00400       m_id = KHTML_KEYDOWN_EVENT;
    00401
    00402   m_detail = key->count();
    00403
    00404   m_numPad = false;
    00405   m_keyVal = key->ascii();
    00406   m_virtKeyVal = DOM_VK_UNDEFINED;
    00407   m_inputGenerated = true;
    00408
    00409   switch(key->key())
    00410   {
    00411   case Qt::Key_Enter:
    00412       m_numPad = true;
    00413       /* fall through */
    00414   case Qt::Key_Return:
    00415       m_virtKeyVal = DOM_VK_ENTER;
    00416       break;
    00417   case Qt::Key_NumLock:
    00418       m_numPad = true;
    00419       m_virtKeyVal = DOM_VK_NUM_LOCK;
    00420       break;
    00421   case Qt::Key_Alt:
    00422       m_virtKeyVal = DOM_VK_RIGHT_ALT;
    00423       // ### DOM_VK_LEFT_ALT;
    00424       break;
    00425   case Qt::Key_Control:
    00426       m_virtKeyVal = DOM_VK_LEFT_CONTROL;
    00427       // ### DOM_VK_RIGHT_CONTROL
    00428       break;
    00429   case Qt::Key_Shift:
    00430       m_virtKeyVal = DOM_VK_LEFT_SHIFT;
    00431       // ### DOM_VK_RIGHT_SHIFT
    00432       break;
    00433   case Qt::Key_Meta:
    00434       m_virtKeyVal = DOM_VK_LEFT_META;
    00435       // ### DOM_VK_RIGHT_META
    00436       break;
    00437   case Qt::Key_CapsLock:
    00438       m_virtKeyVal = DOM_VK_CAPS_LOCK;
    00439       break;
    00440   case Qt::Key_Delete:
    00441       m_virtKeyVal = DOM_VK_DELETE;
    00442       break;
    00443   case Qt::Key_End:
    00444       m_virtKeyVal = DOM_VK_END;
    00445       break;
    00446   case Qt::Key_Escape:
    00447       m_virtKeyVal = DOM_VK_ESCAPE;
    00448       break;
    00449   case Qt::Key_Home:
    00450       m_virtKeyVal = DOM_VK_HOME;
    00451       break;
    00452   case Qt::Key_Insert:
    00453       m_virtKeyVal = DOM_VK_INSERT;
    00454       break;
    00455   case Qt::Key_Pause:
    00456       m_virtKeyVal = DOM_VK_PAUSE;
    00457       break;
    00458   case Qt::Key_Print:
    00459       m_virtKeyVal = DOM_VK_PRINTSCREEN;
    00460       break;
    00461   case Qt::Key_ScrollLock:
    00462       m_virtKeyVal = DOM_VK_SCROLL_LOCK;
    00463       break;
    00464   case Qt::Key_Left:
    00465       m_virtKeyVal = DOM_VK_LEFT;
    00466       break;
    00467   case Qt::Key_Right:
    00468       m_virtKeyVal = DOM_VK_RIGHT;
    00469       break;
    00470   case Qt::Key_Up:
    00471       m_virtKeyVal = DOM_VK_UP;
    00472       break;
    00473   case Qt::Key_Down:
    00474       m_virtKeyVal = DOM_VK_DOWN;
    00475       break;
    00476   case Qt::Key_Next:
    00477       m_virtKeyVal = DOM_VK_PAGE_DOWN;
    00478       break;
    00479   case Qt::Key_Prior:
    00480       m_virtKeyVal = DOM_VK_PAGE_UP;
    00481       break;
    00482   case Qt::Key_F1:
    00483       m_virtKeyVal = DOM_VK_F1;
    00484       break;
    00485   case Qt::Key_F2:
    00486       m_virtKeyVal = DOM_VK_F2;
    00487       break;
    00488   case Qt::Key_F3:
    00489       m_virtKeyVal = DOM_VK_F3;
    00490       break;
    00491   case Qt::Key_F4:
    00492       m_virtKeyVal = DOM_VK_F4;
    00493       break;
    00494   case Qt::Key_F5:
    00495       m_virtKeyVal = DOM_VK_F5;
    00496       break;
    00497   case Qt::Key_F6:
    00498       m_virtKeyVal = DOM_VK_F6;
    00499       break;
    00500   case Qt::Key_F7:
    00501       m_virtKeyVal = DOM_VK_F7;
    00502       break;
    00503   case Qt::Key_F8:
    00504       m_virtKeyVal = DOM_VK_F8;
    00505       break;
    00506   case Qt::Key_F9:
    00507       m_virtKeyVal = DOM_VK_F9;
    00508       break;
    00509   case Qt::Key_F10:
    00510       m_virtKeyVal = DOM_VK_F10;
    00511       break;
    00512   case Qt::Key_F11:
    00513       m_virtKeyVal = DOM_VK_F11;
    00514       break;
    00515   case Qt::Key_F12:
    00516       m_virtKeyVal = DOM_VK_F12;
    00517       break;
    00518   case Qt::Key_F13:
    00519       m_virtKeyVal = DOM_VK_F13;
    00520       break;
    00521   case Qt::Key_F14:
    00522       m_virtKeyVal = DOM_VK_F14;
    00523       break;
    00524   case Qt::Key_F15:
    00525       m_virtKeyVal = DOM_VK_F15;
    00526       break;
    00527   case Qt::Key_F16:
    00528       m_virtKeyVal = DOM_VK_F16;
    00529       break;
    00530   case Qt::Key_F17:
    00531       m_virtKeyVal = DOM_VK_F17;
    00532       break;
    00533   case Qt::Key_F18:
    00534       m_virtKeyVal = DOM_VK_F18;
    00535       break;
    00536   case Qt::Key_F19:
    00537       m_virtKeyVal = DOM_VK_F19;
    00538       break;
    00539   case Qt::Key_F20:
    00540       m_virtKeyVal = DOM_VK_F20;
    00541       break;
    00542   case Qt::Key_F21:
    00543       m_virtKeyVal = DOM_VK_F21;
    00544       break;
    00545   case Qt::Key_F22:
    00546       m_virtKeyVal = DOM_VK_F22;
    00547       break;
    00548   case Qt::Key_F23:
    00549       m_virtKeyVal = DOM_VK_F23;
    00550       break;
    00551   case Qt::Key_F24:
    00552       m_virtKeyVal = DOM_VK_F24;
    00553       break;
    00554   default:
    00555       m_virtKeyVal = DOM_VK_UNDEFINED;
    00556       break;
    00557   }
    00558
    00559   // m_keyVal should contain the unicode value
    00560   // of the pressed key if available.
    00561   if (m_virtKeyVal == DOM_VK_UNDEFINED && !key->text().isEmpty())
    00562       m_keyVal = key->text().unicode()[0];
    00563
    00564   //  m_numPad = ???
    00565
    00566   // key->state returns enum ButtonState, which is ShiftButton, ControlButton and AltButton or'ed together.
    00567   m_modifier = key->state();
    00568
    00569   // key->text() returns the unicode sequence as a QString
    00570   m_outputString = DOMString(key->text());
    00571 }
    00572
    00573 TextEventImpl::TextEventImpl(EventId _id,
    00574                            bool canBubbleArg,
    00575                            bool cancelableArg,
    00576                            AbstractViewImpl *viewArg,
    00577                            unsigned short detailArg,
    00578                            DOMString &outputStringArg,
    00579                            unsigned long keyValArg,
    00580                            unsigned long virtKeyValArg,
    00581                            bool inputGeneratedArg,
    00582                            bool numPadArg)
    00583   : UIEventImpl(_id,canBubbleArg,cancelableArg,viewArg,detailArg)
    00584 {
    00585   qKeyEvent = 0;
    00586   m_keyVal = keyValArg;
    00587   m_virtKeyVal = virtKeyValArg;
    00588   m_inputGenerated = inputGeneratedArg;
    00589   m_outputString = outputStringArg;
    00590   m_numPad = numPadArg;
    00591   m_modifier = 0;
    00592 }
    00593
    00594 TextEventImpl::~TextEventImpl()
    00595 {
    00596     delete qKeyEvent;
    00597 }
    00598
    00599 bool TextEventImpl::checkModifier(unsigned long modifierArg)
    00600 {
    00601   return ((m_modifier & modifierArg) == modifierArg);
    00602 }
    00603
    00604 void TextEventImpl::initTextEvent(const DOMString &typeArg,
    00605                                 bool canBubbleArg,
    00606                                 bool cancelableArg,
    00607                                 const AbstractView &viewArg,
    00608                                 long detailArg,
    00609                                 const DOMString &outputStringArg,
    00610                                 unsigned long keyValArg,
    00611                                 unsigned long virtKeyValArg,
    00612                                 bool inputGeneratedArg,
    00613                                 bool numPadArg)
    00614 {
    00615   UIEventImpl::initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
    00616
    00617   m_outputString = outputStringArg;
    00618   m_keyVal = keyValArg;
    00619   m_virtKeyVal = virtKeyValArg;
    00620   m_inputGenerated = inputGeneratedArg;
    00621   m_numPad = numPadArg;
    00622 }
    00623
    00624 void TextEventImpl::initModifier(unsigned long modifierArg,
    00625                                 bool valueArg)
    00626 {
    00627   if (valueArg)
    00628       m_modifier |= modifierArg;
    00629   else
    00630       m_modifier &= (modifierArg ^ 0xFFFFFFFF);
    00631 }
    00632
    00633 // -----------------------------------------------------------------------------
    00634
    00635 MutationEventImpl::MutationEventImpl()
    00636 {
    00637     m_relatedNode = 0;
    00638     m_prevValue = 0;
    00639     m_newValue = 0;
    00640     m_attrName = 0;
    00641     m_attrChange = 0;
    00642 }
    00643
    00644 MutationEventImpl::MutationEventImpl(EventId _id,
    00645                                      bool canBubbleArg,
    00646                                      bool cancelableArg,
    00647                                      const Node &relatedNodeArg,
    00648                                      const DOMString &prevValueArg,
    00649                                      const DOMString &newValueArg,
    00650                                      const DOMString &attrNameArg,
    00651                                      unsigned short attrChangeArg)
    00652                       : EventImpl(_id,canBubbleArg,cancelableArg)
    00653 {
    00654     m_relatedNode = relatedNodeArg.handle();
    00655     if (m_relatedNode)
    00656         m_relatedNode->ref();
    00657     m_prevValue = prevValueArg.implementation();
    00658     if (m_prevValue)
    00659         m_prevValue->ref();
    00660     m_newValue = newValueArg.implementation();
    00661     if (m_newValue)
    00662         m_newValue->ref();
    00663     m_attrName = attrNameArg.implementation();
    00664     if (m_newValue)
    00665         m_newValue->ref();
    00666     m_attrChange = attrChangeArg;
    00667 }
    00668
    00669 MutationEventImpl::~MutationEventImpl()
    00670 {
    00671     if (m_relatedNode)
    00672         m_relatedNode->deref();
    00673     if (m_prevValue)
    00674         m_prevValue->deref();
    00675     if (m_newValue)
    00676         m_newValue->deref();
    00677     if (m_attrName)
    00678         m_attrName->deref();
    00679 }
    00680
    00681 void MutationEventImpl::initMutationEvent(const DOMString &typeArg,
    00682                                           bool canBubbleArg,
    00683                                           bool cancelableArg,
    00684                                           const Node &relatedNodeArg,
    00685                                           const DOMString &prevValueArg,
    00686                                           const DOMString &newValueArg,
    00687                                           const DOMString &attrNameArg,
    00688                                           unsigned short attrChangeArg)
    00689 {
    00690     EventImpl::initEvent(typeArg,canBubbleArg,cancelableArg);
    00691
    00692     if (m_relatedNode)
    00693         m_relatedNode->deref();
    00694     if (m_prevValue)
    00695         m_prevValue->deref();
    00696     if (m_newValue)
    00697         m_newValue->deref();
    00698     if (m_attrName)
    00699         m_attrName->deref();
    00700
    00701     m_relatedNode = relatedNodeArg.handle();
    00702     if (m_relatedNode)
    00703         m_relatedNode->ref();
    00704     m_prevValue = prevValueArg.implementation();
    00705     if (m_prevValue)
    00706         m_prevValue->ref();
    00707     m_newValue = newValueArg.implementation();
    00708     if (m_newValue)
    00709         m_newValue->ref();
    00710     m_attrName = attrNameArg.implementation();
    00711     if (m_newValue)
    00712         m_newValue->ref();
    00713     m_attrChange = attrChangeArg;
    00714 }
    00715

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:33:36 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001