当前位置: 首页>>代码示例>>C++>>正文


C++ MutationEvent类代码示例

本文整理汇总了C++中MutationEvent的典型用法代码示例。如果您正苦于以下问题:C++ MutationEvent类的具体用法?C++ MutationEvent怎么用?C++ MutationEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MutationEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例2: switch

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;
}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:28,代码来源:JSMutationEvent.cpp

示例3: jsMutationEventRelatedNode

JSValue jsMutationEventRelatedNode(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 = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->relatedNode()));
    return result;
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:8,代码来源:JSMutationEvent.cpp

示例4: jsMutationEventNewValue

JSValue jsMutationEventNewValue(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->newValue());
    return result;
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:8,代码来源:JSMutationEvent.cpp

示例5: jsMutationEventAttrChange

JSValue jsMutationEventAttrChange(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 = jsNumber(imp->attrChange());
    return result;
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:8,代码来源:JSMutationEvent.cpp

示例6: set_data

void CharacterData::set_data(System::StringW* data)
{
	m_data = data;

	MutationEvent* evt = new MutationEvent;
	evt->InitEvent(WSTR("TextChanged"), true, false);
	dispatchEvent(evt);
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例7: 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();
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:14,代码来源:V8MutationEvent.cpp

示例8: 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();
}
开发者ID:Gin-Rye,项目名称:duibrowser,代码行数:18,代码来源:JSMutationEvent.cpp

示例9: ASSERT

void CharacterData::deleteData(long offset, long count)
{
// TODO, improve this

	ASSERT(0);
#if 0

	System::StringW* data = sysstring(m_data.c_str(), offset);
	data += m_data.c_str()+offset+count;
	m_data = data;

	MutationEvent* evt = new MutationEvent;
	evt->m_offset = offset;
	evt->m_len = count;
	evt->initEvent(WSTR("TextDeleted"), true, false);
	dispatchEvent(evt);
#endif
}
开发者ID:,项目名称:,代码行数:18,代码来源:

示例10: 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());
}
开发者ID:mulriple,项目名称:Webkit-Projects,代码行数:36,代码来源:JSMutationEvent.cpp

示例11: 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);
}
开发者ID:,项目名称:,代码行数:24,代码来源:

示例12: newElement


//.........这里部分代码省略.........
			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;
}
开发者ID:,项目名称:,代码行数:101,代码来源:

示例13: attrChangeAttrGetter

static v8::Handle<v8::Value> attrChangeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    MutationEvent* imp = V8MutationEvent::toNative(info.Holder());
    return v8Integer(imp->attrChange(), info.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:5,代码来源:V8MutationEvent.cpp

示例14: relatedNodeAttrGetter

static v8::Handle<v8::Value> relatedNodeAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    MutationEvent* imp = V8MutationEvent::toNative(info.Holder());
    return toV8Fast(imp->relatedNode(), info, imp);
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:5,代码来源:V8MutationEvent.cpp

示例15: handleEvent

    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);
    }
开发者ID:JerkWisdom,项目名称:zpublic,代码行数:70,代码来源:EventTest.cpp


注:本文中的MutationEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。