本文整理汇总了C++中MutationEvent::initMutationEvent方法的典型用法代码示例。如果您正苦于以下问题:C++ MutationEvent::initMutationEvent方法的具体用法?C++ MutationEvent::initMutationEvent怎么用?C++ MutationEvent::initMutationEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MutationEvent
的用法示例。
在下文中一共展示了MutationEvent::initMutationEvent方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NodeRemovedFromDocument
void NodeRemovedFromDocument(Node* node)
{
NodeList* childNodes = node->get_childNodes();
unsigned int length = childNodes->get_length();
for (unsigned int i = 0; i < length; ++i)
{
Node* child = childNodes->item(i);
NodeRemovedFromDocument(child);
}
Document* ownerDocument = node->get_ownerDocument();
DocumentEvent* ownerDocumentEvent = dynamic_cast<DocumentEvent*>(ownerDocument);
ASSERT(ownerDocumentEvent != nullptr);
MutationEvent* event = dynamic_cast<MutationEvent*>(ownerDocumentEvent->createEvent(S("MutationEvent")));
event->initMutationEvent(S("DOMNodeRemovedFromDocument"), false, false, NULL/*relatedNode*/, nullptr, nullptr, nullptr, CHANGE_UNKNOWN);
EventTarget* target = dynamic_cast<EventTarget*>(node);
target->dispatchEvent(event);
}
示例2: initMutationEventCallback
static v8::Handle<v8::Value> initMutationEventCallback(const v8::Arguments& args)
{
MutationEvent* imp = V8MutationEvent::toNative(args.Holder());
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, type, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
V8TRYCATCH(bool, canBubble, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)->BooleanValue());
V8TRYCATCH(bool, cancelable, MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)->BooleanValue());
V8TRYCATCH(Node*, relatedNode, V8Node::HasInstance(MAYBE_MISSING_PARAMETER(args, 3, DefaultIsUndefined)) ? V8Node::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 3, DefaultIsUndefined))) : 0);
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, prevValue, MAYBE_MISSING_PARAMETER(args, 4, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, newValue, MAYBE_MISSING_PARAMETER(args, 5, DefaultIsUndefined));
V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, attrName, MAYBE_MISSING_PARAMETER(args, 6, DefaultIsUndefined));
V8TRYCATCH(int, attrChange, toUInt32(MAYBE_MISSING_PARAMETER(args, 7, DefaultIsUndefined)));
imp->initMutationEvent(type, canBubble, cancelable, relatedNode, prevValue, newValue, attrName, attrChange);
return v8Undefined();
}
示例3: jsMutationEventPrototypeFunctionInitMutationEvent
JSValue* jsMutationEventPrototypeFunctionInitMutationEvent(ExecState* exec, JSObject*, JSValue* thisValue, const ArgList& args)
{
if (!thisValue->isObject(&JSMutationEvent::s_info))
return throwError(exec, TypeError);
JSMutationEvent* castedThisObj = static_cast<JSMutationEvent*>(thisValue);
MutationEvent* imp = static_cast<MutationEvent*>(castedThisObj->impl());
const UString& type = args[0]->toString(exec);
bool canBubble = args[1]->toBoolean(exec);
bool cancelable = args[2]->toBoolean(exec);
Node* relatedNode = toNode(args[3]);
const UString& prevValue = args[4]->toString(exec);
const UString& newValue = args[5]->toString(exec);
const UString& attrName = args[6]->toString(exec);
unsigned short attrChange = args[7]->toInt32(exec);
imp->initMutationEvent(type, canBubble, cancelable, relatedNode, prevValue, newValue, attrName, attrChange);
return jsUndefined();
}
示例4: jsMutationEventPrototypeFunctionInitMutationEvent
EncodedJSValue JSC_HOST_CALL jsMutationEventPrototypeFunctionInitMutationEvent(ExecState* exec)
{
JSValue thisValue = exec->hostThisValue();
if (!thisValue.inherits(&JSMutationEvent::s_info))
return throwVMTypeError(exec);
JSMutationEvent* castedThis = static_cast<JSMutationEvent*>(asObject(thisValue));
ASSERT_GC_OBJECT_INHERITS(castedThis, &JSMutationEvent::s_info);
MutationEvent* imp = static_cast<MutationEvent*>(castedThis->impl());
const String& type(ustringToString(exec->argument(0).toString(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
bool canBubble(exec->argument(1).toBoolean(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
bool cancelable(exec->argument(2).toBoolean(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
Node* relatedNode(toNode(exec->argument(3)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
const String& prevValue(ustringToString(exec->argument(4).toString(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
const String& newValue(ustringToString(exec->argument(5).toString(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
const String& attrName(ustringToString(exec->argument(6).toString(exec)));
if (exec->hadException())
return JSValue::encode(jsUndefined());
unsigned short attrChange(exec->argument(7).toUInt32(exec));
if (exec->hadException())
return JSValue::encode(jsUndefined());
imp->initMutationEvent(type, canBubble, cancelable, relatedNode, prevValue, newValue, attrName, attrChange);
return JSValue::encode(jsUndefined());
}
示例5: NodeInsertedIntoDocument
void NodeInsertedIntoDocument(Node* node)
{
NodeList* childNodes = node->get_childNodes();
long length = childNodes->get_length();
for (int i = 0; i < length; ++i)
{
Node* child = childNodes->item(i);
NodeInsertedIntoDocument(child);
}
Document* ownerDocument = node->get_ownerDocument();
DocumentEvent* ownerDocumentEvent = dynamic_cast<DocumentEvent*>(ownerDocument);
ASSERT(ownerDocumentEvent != nullptr);
MutationEvent* pEvent = dynamic_cast<MutationEvent*>(ownerDocumentEvent->createEvent(S("MutationEvent")));
pEvent->initMutationEvent(S("DOMNodeInsertedIntoDocument"), false, false, nullptr/*relatedNode*/, nullptr, nullptr, nullptr, CHANGE_UNKNOWN);
EventTarget* target = dynamic_cast<EventTarget*>(node);
target->dispatchEvent(pEvent);
}
示例6: set_value
void Attr::set_value(StringIn newVal)
{
String prevValue = nullptr;
if (false)
{
prevValue = get_value();
}
m_valueIsValid = true;
// Optimize if there is one single textnode already there
Text* textNode;
#if 0
CComQIPtr<ILDOMText, &IID_ILDOMText> textNode;
if ((m_childNodes->m_items.GetSize() == 1) && (textNode = m_childNodes->m_items[0]))
{
textNode->set_data(newVal);
}
else
#endif
{
for (int i = m_childNodes->m_items.GetSize()-1; i >= 0; i--)
{
removeChild(m_childNodes->m_items[i]);
}
textNode = m_ownerDocument->createTextNode(newVal);
appendChild(textNode);
}
#if 0
ASSERT(m_callbacks);
(m_ownerElement->*m_callbacks->SetBaseValString)();
#endif
if (m_owner)
{
m_owner->UpdateBaseValString();
}
// m_callbacks->SetBaseValString(m_ownerElement);
// m_notify->OnSetBaseValString();
/*
if (m_pListener)
{
m_pListener->OnAttrValueChanged(m_nodeName, this);
}
*/
if (false)
{
EventTarget* eventTarget = dynamic_cast<EventTarget*>(m_ownerElement);
if (eventTarget)
{
DocumentEvent* ownerDocumentEvent = dynamic_cast<DocumentEvent*>(m_ownerDocument);
if (ownerDocumentEvent)
{
MutationEvent* evt;
evt = dynamic_cast<MutationEvent*>(ownerDocumentEvent->createEvent(WSTR("MutationEvent")));
if (evt)
{
// Create an attr modification event
evt->initMutationEvent(WSTR("DOMAttrModified"), true, false, this, prevValue, newVal, m_nodeName, CHANGE_MODIFICATION);
eventTarget->dispatchEvent(evt);
}
}
}
}
}
示例7: removeChild
Node* Node::removeChild(Node *oldChild)
{
//ASSERT(0);
#if 0
// Do this first?
{
CComQIPtr<INotifySend> cp = thisNode;
if (cp)
{
cp->FireOnChanged(NOTIFY_REMOVE, oldChild, DISPID_UNKNOWN);
}
}
#endif
Document* ownerDocument = oldChild->get_ownerDocument();
if (ownerDocument)
{
ASSERT(ownerDocument != NULL);
DocumentEvent* ownerDocumentEvent = dynamic_cast<DocumentEvent*>(ownerDocument);
ASSERT(ownerDocumentEvent != NULL);
MutationEvent* evt = dynamic_cast<MutationEvent*>(ownerDocumentEvent->createEvent(S("MutationEvent")));
// Create a DOMNodeRemoved event
evt->initMutationEvent(S("DOMNodeRemoved"), true, false, this, nullptr, nullptr, nullptr, CHANGE_UNKNOWN);
EventTarget* target = dynamic_cast<EventTarget*>(oldChild);
target->dispatchEvent(evt);
NodeRemovedFromDocument(oldChild);
}
// Do the work
ChildNode* previous = oldChild->get_previousSibling();
ChildNode* next = oldChild->get_nextSibling();
if (previous != NULL)
previous->set_nextSibling(next);
else
m_firstChild = next;
if (next != NULL)
next->set_previousSibling(previous);
else
m_lastChild = previous;
oldChild->set_previousSibling(nullptr);
oldChild->set_nextSibling(nullptr);
for (int i = 0; i < m_childNodes->m_items.GetSize(); ++i)
{
if (m_childNodes->m_items[i] == oldChild)
{
#if 0
ASSERT(0);
/////////
CComQIPtr<INotifySend, &IID_INotifySend> cp = (IUnknown*)oldChild;
if (cp)
{
CComQIPtr<INotifyGet, &IID_INotifyGet> get = (IUnknown*)thisNode;
if (get)
{
cp->Unadvise(get);
}
}
#endif
/////////
// m_childNodes->m_items.erase(&m_childNodes->m_items[i]);
m_childNodes->m_items.RemoveAt(i);
break;
}
}
oldChild->set_parentNode(NULL);
return oldChild;
}
示例8: insertNode
//.........这里部分代码省略.........
elementTimeImpl->get_parentTimeContainer(&parentTimeContainer);
CComQIPtr<CLElementTimeContainerImplImpl> parentTimeContainerImpl((IUnknown*)parentTimeContainer);
if (parentTimeContainerImpl)
{
parentTimeContainerImpl->RecalculateTime();
}
elementTimeImpl->CalculateTimeAfterParent();
}
}
CComQIPtr<ILAnimationElement, &IID_ILAnimationElement> animation = (IUnknown*)newChild;
if (animation)
{
CComQIPtr<CLAnimationElementImplImpl> pAnimation((IUnknown*)animation);
pAnimation->SetValuesFromAttributes();
}
#endif
{
#if 0 // TODO
for (int i = 0; i < m_pNodes.GetSize(); i++)
{
ASSERT(0);
m_pNodes[i]->OnInsertedChild(newChild);
}
#endif
#if 0
if (TRUE) // TODO, probably remove this (use above loop only)
{
CComQIPtr<INotifySend, &IID_INotifySend> cp = newChild;
if (cp)
{
CComQIPtr<INotifyGet, &IID_INotifyGet> get = (IUnknown*)thisNode;
if (get)
{
DWORD cookie;
cp->Advise(get, &cookie);
}
cp->FireOnChanged(NOTIFY_ADD, newChild, DISPID_UNKNOWN);
}
}
#endif
}
// CComPtr<ILDOMDocument> ownerDocument;
// newChild->get_ownerDocument(&ownerDocument);
// if (ownerDocument)
{
////////////////////////////////
// create an event notification
DocumentEvent* ownerDocumentEvent = dynamic_cast<DocumentEvent*>(m_ownerDocument);
if (ownerDocumentEvent == NULL)
ownerDocumentEvent = dynamic_cast<DocumentEvent*>(this);
if (ownerDocumentEvent)
{
MutationEvent* event = dynamic_cast<MutationEvent*>(ownerDocumentEvent->createEvent(S("MutationEvent")));
EventTarget* eventTarget = dynamic_cast<EventTarget*>(newChild);
//
event->initMutationEvent(S("DOMNodeInserted"), true, false, this, nullptr, nullptr, nullptr, CHANGE_UNKNOWN);
bool doDefault = eventTarget->dispatchEvent(event);
if (IsDocumentOrPartOfDocument(this))
{
// Send "DOMNodeInsertedIntoDocument" to the node and it's children
NodeInsertedIntoDocument(newChild);
}
}
{
Node* p = this;
while (p)
{
if (p->m_pNode)
{
p->m_pNode->m_bArrangeValid = false;
}
p = p->get_parentNode();
}
}
#if 0
//
event->initMutationEvent(OLESTR("DOMSubtreeModified"), VARIANT_TRUE, VARIANT_FALSE, thisNode, NULL, NULL, NULL, CHANGE_UNKNOWN);
eventTarget->dispatchEvent(event, &doDefault);
#endif
}
return newChild;
}