JSValue* JSMutationEvent::getValueProperty(ExecState* exec, int token) const { switch (token) { case RelatedNodeAttrNum: { MutationEvent* imp = static_cast<MutationEvent*>(impl()); return toJS(exec, WTF::getPtr(imp->relatedNode())); } case PrevValueAttrNum: { MutationEvent* imp = static_cast<MutationEvent*>(impl()); return jsString(exec, imp->prevValue()); } case NewValueAttrNum: { MutationEvent* imp = static_cast<MutationEvent*>(impl()); return jsString(exec, imp->newValue()); } case AttrNameAttrNum: { MutationEvent* imp = static_cast<MutationEvent*>(impl()); return jsString(exec, imp->attrName()); } case AttrChangeAttrNum: { MutationEvent* imp = static_cast<MutationEvent*>(impl()); return jsNumber(exec, imp->attrChange()); } case ConstructorAttrNum: return getConstructor(exec); } return 0; }
JSValue jsMutationEventAttrName(ExecState* exec, JSValue slotBase, const Identifier&) { JSMutationEvent* castedThis = static_cast<JSMutationEvent*>(asObject(slotBase)); UNUSED_PARAM(exec); MutationEvent* imp = static_cast<MutationEvent*>(castedThis->impl()); JSValue result = jsString(exec, imp->attrName()); return result; }
static v8::Handle<v8::Value> attrNameAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) { MutationEvent* imp = V8MutationEvent::toNative(info.Holder()); return v8String(imp->attrName(), info.GetIsolate()); }
void handleEvent(Event* evt) { XMLString type = evt->type(); XMLString phase; switch (evt->eventPhase()) { case Event::CAPTURING_PHASE: phase = "CAPTURING_PHASE"; break; case Event::AT_TARGET: phase = "AT_TARGET"; break; case Event::BUBBLING_PHASE: phase = "BUBBLING_PHASE"; break; } Node* pTarget = static_cast<Node*>(evt->target()); Node* pCurrentTarget = static_cast<Node*>(evt->currentTarget()); _log.append(_name); _log.append(":"); _log.append(type); _log.append(":"); _log.append(phase); _log.append(":"); _log.append(pTarget->nodeName()); _log.append(":"); _log.append(pCurrentTarget->nodeName()); _log.append(":"); _log.append(evt->bubbles() ? "B" : "-"); _log.append(":"); _log.append(evt->cancelable() ? "C" : "-"); MutationEvent* pME = dynamic_cast<MutationEvent*>(evt); if (pME) { XMLString attrChange; switch (pME->attrChange()) { case MutationEvent::MODIFICATION: attrChange = "MODIFICATION"; break; case MutationEvent::ADDITION: attrChange = "ADDITION"; break; case MutationEvent::REMOVAL: attrChange = "REMOVAL"; break; } XMLString relatedNode; Node* pRelatedNode = pME->relatedNode(); if (pRelatedNode) relatedNode = pRelatedNode->nodeName(); _log.append(":"); _log.append(attrChange); _log.append(":"); _log.append(relatedNode); _log.append(":"); _log.append(pME->attrName()); _log.append(":"); _log.append(pME->prevValue()); _log.append(":"); _log.append(pME->newValue()); } _log.append("\n"); if (_cancel) evt->stopPropagation(); if (_readd) pCurrentTarget->addEventListener(type, this, _capture); }