TEST(AtomicHTMLTokenTest, EmptyAttributeValueFromCompactHTMLToken) { HTMLToken token; token.beginStartTag('a'); token.addNewAttribute(); token.beginAttributeName(3); token.appendToAttributeName('b'); token.endAttributeName(4); token.addNewAttribute(); token.beginAttributeName(5); token.appendToAttributeName('c'); token.endAttributeName(6); token.beginAttributeValue(8); token.endAttributeValue(8); AtomicHTMLToken atoken(CompactHTMLToken(&token, TextPosition())); const blink::Attribute* attributeB = atoken.getAttributeItem( QualifiedName(AtomicString(), "b", AtomicString())); ASSERT_TRUE(attributeB); EXPECT_FALSE(attributeB->value().isNull()); EXPECT_TRUE(attributeB->value().isEmpty()); const blink::Attribute* attributeC = atoken.getAttributeItem( QualifiedName(AtomicString(), "c", AtomicString())); ASSERT_TRUE(attributeC); EXPECT_FALSE(attributeC->value().isNull()); EXPECT_TRUE(attributeC->value().isEmpty()); const blink::Attribute* attributeD = atoken.getAttributeItem( QualifiedName(AtomicString(), "d", AtomicString())); EXPECT_FALSE(attributeD); }
std::vector<Variant> InternalSubscription::GetEventFields(const EventFilter& filter, const Event& event) { //Go through filter and add value og matches as in spec std::vector<Variant> fields; if(Debug) std::cout << "InternalSubscription | InternalGetEventField " << filter.SelectClauses.size() << std::endl; for (SimpleAttributeOperand sattr : filter.SelectClauses) { if(Debug) std::cout << "InternalSubscription | BrowsePath size " << sattr.BrowsePath.size() << std::endl; if ( sattr.BrowsePath.size() == 0 ) { fields.push_back(event.GetValue(sattr.Attribute)); } else { if(Debug) std::cout << "InternalSubscription | sending value for : " << sattr.BrowsePath[0] << std::endl; if ( sattr.BrowsePath[0] == QualifiedName("EventId", 0) ) { fields.push_back(event.EventId); } else if ( sattr.BrowsePath[0] == QualifiedName("EventType", 0) ) { fields.push_back(event.EventType); } else if ( sattr.BrowsePath[0] == QualifiedName("SourceNode", 0) ) { fields.push_back(event.SourceNode); } else if ( sattr.BrowsePath[0] == QualifiedName("SourceName", 0) ) { fields.push_back(event.SourceName); } else if ( sattr.BrowsePath[0] == QualifiedName("Message", 0) ) { if (Debug) std::cout << "msg is: " << event.Message << std::endl; fields.push_back(event.Message); } else if ( sattr.BrowsePath[0] == QualifiedName("Severity", 0) ) { fields.push_back(event.Severity); } else if ( sattr.BrowsePath[0] == QualifiedName("LocalTime", 0) ) { fields.push_back(event.LocalTime); } else if ( sattr.BrowsePath[0] == QualifiedName("ReceiveTime", 0) ) { fields.push_back(event.ReceiveTime); } else if ( sattr.BrowsePath[0] == QualifiedName("Time", 0) ) { fields.push_back(event.Time); } else { fields.push_back(event.GetValue(sattr.BrowsePath)); } } } return fields; }
PassRefPtrWillBeRawPtr<StyleRulePage> CSSParserImpl::consumePageRule(CSSParserTokenRange prelude, CSSParserTokenRange block) { // We only support a small subset of the css-page spec. prelude.consumeWhitespace(); AtomicString typeSelector; if (prelude.peek().type() == IdentToken) typeSelector = prelude.consume().value(); AtomicString pseudo; if (prelude.peek().type() == ColonToken) { prelude.consume(); if (prelude.peek().type() != IdentToken) return nullptr; // Parse error; expected ident token following colon in @page header pseudo = prelude.consume().value(); } prelude.consumeWhitespace(); if (!prelude.atEnd()) return nullptr; // Parse error; extra tokens in @page header OwnPtr<CSSParserSelector> selector; if (!typeSelector.isNull() && pseudo.isNull()) { selector = CSSParserSelector::create(QualifiedName(nullAtom, typeSelector, m_defaultNamespace)); } else { selector = CSSParserSelector::create(); if (!pseudo.isNull()) { selector->setMatch(CSSSelector::PagePseudoClass); selector->setValue(pseudo.lower()); if (selector->pseudoType() == CSSSelector::PseudoUnknown) return nullptr; // Parse error; unknown page pseudo-class } if (!typeSelector.isNull()) selector->prependTagSelector(QualifiedName(nullAtom, typeSelector, m_defaultNamespace)); } if (m_observerWrapper) { unsigned endOffset = m_observerWrapper->endOffset(prelude); m_observerWrapper->observer().startRuleHeader(StyleRule::Page, m_observerWrapper->startOffset(prelude)); m_observerWrapper->observer().endRuleHeader(endOffset); } selector->setForPage(); RefPtrWillBeRawPtr<StyleRulePage> pageRule = StyleRulePage::create(); Vector<OwnPtr<CSSParserSelector>> selectorVector; selectorVector.append(selector.release()); pageRule->parserAdoptSelectorVector(selectorVector); consumeDeclarationList(block, StyleRule::Style); pageRule->setProperties(createStylePropertySet(m_parsedProperties, m_context.mode())); m_parsedProperties.clear(); return pageRule.release(); }
TEST_F(CustomElementRegistryTest, attributeChangedCallback) { ScriptForbiddenScope doNotRelyOnScript; Element* element = CreateElement("a-a").inDocument(&document()); document().documentElement()->appendChild(element); LogUpgradeBuilder builder; NonThrowableExceptionState shouldNotThrow; { CEReactionsScope reactions; registry().define("a-a", builder, ElementDefinitionOptions(), shouldNotThrow); } LogUpgradeDefinition* definition = static_cast<LogUpgradeDefinition*>(registry().definitionForName("a-a")); definition->clear(); { CEReactionsScope reactions; element->setAttribute( QualifiedName(nullAtom, "attr2", HTMLNames::xhtmlNamespaceURI), "v2"); } EXPECT_EQ(LogUpgradeDefinition::AttributeChangedCallback, definition->m_logs[0]) << "Adding an attribute should invoke attributeChangedCallback"; EXPECT_EQ(1u, definition->m_attributeChanged.size()) << "Adding an attribute should invoke attributeChangedCallback"; EXPECT_EQ("attr2", definition->m_attributeChanged[0].name); EXPECT_EQ(nullAtom, definition->m_attributeChanged[0].oldValue); EXPECT_EQ("v2", definition->m_attributeChanged[0].newValue); EXPECT_EQ(1u, definition->m_logs.size()) << "upgrade should not invoke other callbacks"; }
void Element::setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode& ec) { if (!Document::isValidName(name)) { ec = INVALID_CHARACTER_ERR; return; } const AtomicString& localName = (shouldIgnoreAttributeCase(this) && !name.string().impl()->isLower()) ? AtomicString(name.string().lower()) : name; // allocate attributemap if necessary Attribute* old = attributes(false)->getAttributeItem(localName, false); document()->incDOMTreeVersion(); if (localName == idAttr.localName()) updateId(old ? old->value() : nullAtom, value); if (old && value.isNull()) namedAttrMap->removeAttribute(old->name()); else if (!old && !value.isNull()) namedAttrMap->addAttribute(createAttribute(QualifiedName(nullAtom, localName, nullAtom), value)); else if (old && !value.isNull()) { old->setValue(value); attributeChanged(old); } }
bool Element::hasAttributeNS(const String& namespaceURI, const String& localName) const { NamedAttrMap* attrs = attributes(true); if (!attrs) return false; return attrs->getAttributeItem(QualifiedName(nullAtom, localName, namespaceURI)); }
PassRefPtr<Attr> Element::getAttributeNodeNS(const String& namespaceURI, const String& localName) { NamedAttrMap* attrs = attributes(true); if (!attrs) return 0; return static_pointer_cast<Attr>(attrs->getNamedItem(QualifiedName(nullAtom, localName, namespaceURI))); }
static inline QualifiedName constructQualifiedName(const SVGElement* svgElement, const AtomicString& attributeName) { ASSERT(svgElement); if (attributeName.isEmpty()) return anyQName(); if (!attributeName.contains(':')) return QualifiedName(nullAtom, attributeName, nullAtom); AtomicString prefix; AtomicString localName; if (!Document::parseQualifiedName(attributeName, prefix, localName, IGNORE_EXCEPTION)) return anyQName(); const AtomicString& namespaceURI = svgElement->lookupNamespaceURI(prefix); if (namespaceURI.isEmpty()) return anyQName(); QualifiedName resolvedAttrName(nullAtom, localName, namespaceURI); // "Animation elements treat attributeName='xlink:href' as being an alias // for targetting the 'href' attribute." // https://svgwg.org/svg2-draft/types.html#__svg__SVGURIReference__href if (resolvedAttrName == XLinkNames::hrefAttr) return SVGNames::hrefAttr; return resolvedAttrName; }
AttributeState elementSupportsAutocorrect(const Element* element) { // First we check the input item itself. If the attribute is not defined, // we check its parent form. QualifiedName autocorrectAttr = QualifiedName(nullAtom, "autocorrect", nullAtom); if (element->fastHasAttribute(autocorrectAttr)) { AtomicString attributeString = element->fastGetAttribute(autocorrectAttr); if (equalIgnoringCase(attributeString, "off")) return Off; if (equalIgnoringCase(attributeString, "on")) return On; // If we haven't returned, it wasn't set properly. Check the form for an explicit setting // because the attribute was provided, but invalid. } if (element->isFormControlElement()) { const HTMLFormControlElement* formElement = static_cast<const HTMLFormControlElement*>(element); if (formElement->form() && formElement->form()->fastHasAttribute(autocorrectAttr)) { AtomicString attributeString = formElement->form()->fastGetAttribute(autocorrectAttr); if (equalIgnoringCase(attributeString, "off")) return Off; if (equalIgnoringCase(attributeString, "on")) return On; } } return Default; }
PassOwnPtr<CSSParserSelector> CSSSelectorParser::consumeCompoundSelector(CSSParserTokenRange& range) { OwnPtr<CSSParserSelector> selector; AtomicString namespacePrefix; AtomicString elementName; bool hasNamespace; if (!consumeName(range, elementName, namespacePrefix, hasNamespace)) { selector = consumeSimpleSelector(range); if (!selector) return nullptr; } if (m_context.isHTMLDocument()) elementName = elementName.lower(); while (OwnPtr<CSSParserSelector> nextSelector = consumeSimpleSelector(range)) { if (selector) selector = rewriteSpecifiers(selector.release(), nextSelector.release()); else selector = nextSelector.release(); } if (!selector) { if (hasNamespace) return CSSParserSelector::create(determineNameInNamespace(namespacePrefix, elementName)); return CSSParserSelector::create(QualifiedName(nullAtom, elementName, m_defaultNamespace)); } if (elementName.isNull()) rewriteSpecifiersWithNamespaceIfNeeded(selector.get()); else rewriteSpecifiersWithElementName(namespacePrefix, elementName, selector.get()); return selector.release(); }
void SetTransformsTask::init(const string &screen, QualifiedName m, const char *t, const char *ltow, const char *ltos, const char *ctow, const char *ctos, const char *stoc, const char *wtos, const char *wp, const char *wd) { this->screen = QualifiedName(screen + "."); this->m = m; this->t = t; this->ltow = ltow; this->ltos = ltos; this->ctow = ctow; this->ctos = ctos; this->stoc = stoc; this->wtos = wtos; this->wp = wp; this->wd = wd; this->time = NULL; this->localToWorld = NULL; this->localToScreen = NULL; this->cameraToWorld = NULL; this->cameraToScreen = NULL; this->screenToCamera = NULL; this->worldToScreen = NULL; this->worldPos = NULL; this->worldDir = NULL; }
bool V0CustomElementConstructorBuilder::validateOptions(const AtomicString& type, QualifiedName& tagName, ExceptionState& exceptionState) { ASSERT(m_prototype.IsEmpty()); v8::TryCatch tryCatch(m_scriptState->isolate()); if (!m_scriptState->perContextData()) { // FIXME: This should generate an InvalidContext exception at a later point. V0CustomElementException::throwException(V0CustomElementException::ContextDestroyedCheckingPrototype, type, exceptionState); tryCatch.ReThrow(); return false; } if (m_options.hasPrototype()) { ASSERT(m_options.prototype().isObject()); m_prototype = m_options.prototype().v8Value().As<v8::Object>(); } else { m_prototype = v8::Object::New(m_scriptState->isolate()); v8::Local<v8::Object> basePrototype = m_scriptState->perContextData()->prototypeForType(&V8HTMLElement::wrapperTypeInfo); if (!basePrototype.IsEmpty()) { if (!v8CallBoolean(m_prototype->SetPrototype(m_scriptState->context(), basePrototype))) return false; } } AtomicString namespaceURI = HTMLNames::xhtmlNamespaceURI; if (hasValidPrototypeChainFor(&V8SVGElement::wrapperTypeInfo)) namespaceURI = SVGNames::svgNamespaceURI; ASSERT(!tryCatch.HasCaught()); AtomicString localName; if (m_options.hasExtends()) { localName = AtomicString(m_options.extends().lower()); if (!Document::isValidName(localName)) { V0CustomElementException::throwException(V0CustomElementException::ExtendsIsInvalidName, type, exceptionState); tryCatch.ReThrow(); return false; } if (V0CustomElement::isValidName(localName)) { V0CustomElementException::throwException(V0CustomElementException::ExtendsIsCustomElementName, type, exceptionState); tryCatch.ReThrow(); return false; } } else { if (namespaceURI == SVGNames::svgNamespaceURI) { V0CustomElementException::throwException(V0CustomElementException::ExtendsIsInvalidName, type, exceptionState); tryCatch.ReThrow(); return false; } localName = type; } ASSERT(!tryCatch.HasCaught()); tagName = QualifiedName(nullAtom, localName, namespaceURI); return true; }
TEST_F(RuleFeatureSetTest, attribute) { updateInvalidationSets("[c] [d]"); InvalidationLists invalidationLists; collectInvalidationSetsForAttribute(invalidationLists, QualifiedName("", "c", "")); expectAttributeInvalidation("d", invalidationLists.descendants); }
UpdateTerrainTaskResource(ptr<ResourceManager> manager, const string &name, ptr<ResourceDescriptor> desc, const TiXmlElement *e = NULL) : ResourceTemplate<40, UpdateTerrainTask>(manager, name, desc) { e = e == NULL ? desc->descriptor : e; checkParameters(desc, e, "name,"); string n = getParameter(desc, e, "name"); init(QualifiedName(n)); }
std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeAttribute( CSSParserTokenRange& range) { ASSERT(range.peek().type() == LeftBracketToken); CSSParserTokenRange block = range.consumeBlock(); block.consumeWhitespace(); AtomicString namespacePrefix; AtomicString attributeName; if (!consumeName(block, attributeName, namespacePrefix)) return nullptr; block.consumeWhitespace(); if (m_context.isHTMLDocument()) attributeName = attributeName.lower(); AtomicString namespaceURI = determineNamespace(namespacePrefix); if (namespaceURI.isNull()) return nullptr; QualifiedName qualifiedName = namespacePrefix.isNull() ? QualifiedName(nullAtom, attributeName, nullAtom) : QualifiedName(namespacePrefix, attributeName, namespaceURI); std::unique_ptr<CSSParserSelector> selector = CSSParserSelector::create(); if (block.atEnd()) { selector->setAttribute(qualifiedName, CSSSelector::CaseSensitive); selector->setMatch(CSSSelector::AttributeSet); return selector; } selector->setMatch(consumeAttributeMatch(block)); const CSSParserToken& attributeValue = block.consumeIncludingWhitespace(); if (attributeValue.type() != IdentToken && attributeValue.type() != StringToken) return nullptr; selector->setValue(attributeValue.value().toAtomicString()); selector->setAttribute(qualifiedName, consumeAttributeFlags(block)); if (!block.atEnd()) return nullptr; return selector; }
void Element::setAttribute(const AtomicString& localName, const AtomicString& value, ExceptionState& exceptionState) { if (!Document::isValidName(localName)) { exceptionState.ThrowDOMException(InvalidCharacterError, "'" + localName + "' is not a valid attribute name."); return; } synchronizeAttribute(localName); if (!elementData()) { setAttributeInternal(kNotFound, QualifiedName(localName), value, NotInSynchronizationOfLazyAttribute); return; } AttributeCollection attributes = elementData()->attributes(); size_t index = attributes.findIndex(localName); const QualifiedName& qName = index != kNotFound ? attributes[index].name() : QualifiedName(localName); setAttributeInternal(index, qName, value, NotInSynchronizationOfLazyAttribute); }
static inline QualifiedName constructQualifiedName(const SVGElement* svgElement, const String& attributeName) { ASSERT(svgElement); if (attributeName.isEmpty()) return anyQName(); if (!attributeName.contains(':')) return QualifiedName(nullAtom, attributeName, nullAtom); String prefix; String localName; if (!Document::parseQualifiedName(attributeName, prefix, localName, ASSERT_NO_EXCEPTION)) return anyQName(); String namespaceURI = svgElement->lookupNamespaceURI(prefix); if (namespaceURI.isEmpty()) return anyQName(); return QualifiedName(nullAtom, localName, namespaceURI); }
std::unique_ptr<CSSParserSelector> CSSSelectorParser::consumeCompoundSelector( CSSParserTokenRange& range) { std::unique_ptr<CSSParserSelector> compoundSelector; AtomicString namespacePrefix; AtomicString elementName; CSSSelector::PseudoType compoundPseudoElement = CSSSelector::PseudoUnknown; if (!consumeName(range, elementName, namespacePrefix)) { compoundSelector = consumeSimpleSelector(range); if (!compoundSelector) return nullptr; if (compoundSelector->match() == CSSSelector::PseudoElement) compoundPseudoElement = compoundSelector->pseudoType(); } if (m_context.isHTMLDocument()) elementName = elementName.lower(); while (std::unique_ptr<CSSParserSelector> simpleSelector = consumeSimpleSelector(range)) { // TODO([email protected]): crbug.com/578131 // The UASheetMode check is a work-around to allow this selector in // mediaControls(New).css: // video::-webkit-media-text-track-region-container.scrolling if (m_context.mode() != UASheetMode && !isSimpleSelectorValidAfterPseudoElement(*simpleSelector.get(), compoundPseudoElement)) { m_failedParsing = true; return nullptr; } if (simpleSelector->match() == CSSSelector::PseudoElement) compoundPseudoElement = simpleSelector->pseudoType(); if (compoundSelector) compoundSelector = addSimpleSelectorToCompound( std::move(compoundSelector), std::move(simpleSelector)); else compoundSelector = std::move(simpleSelector); } if (!compoundSelector) { AtomicString namespaceURI = determineNamespace(namespacePrefix); if (namespaceURI.isNull()) { m_failedParsing = true; return nullptr; } if (namespaceURI == defaultNamespace()) namespacePrefix = nullAtom; return CSSParserSelector::create( QualifiedName(namespacePrefix, elementName, namespaceURI)); } prependTypeSelectorIfNeeded(namespacePrefix, elementName, compoundSelector.get()); return splitCompoundAtImplicitShadowCrossingCombinator( std::move(compoundSelector)); }
//---------------------------------------------------------------------------- // CLASS StmtDDLAlterTableAlterColumn //---------------------------------------------------------------------------- StmtDDLAlterTableAlterColumn::StmtDDLAlterTableAlterColumn( OperatorTypeEnum operatorType , const NAString &columnName , ElemDDLNode *pColDefault , CollHeap *heap) : StmtDDLAlterTable(operatorType, QualifiedName(PARSERHEAP()) /*no table name*/, pColDefault), columnName_(columnName, heap) { }
void XMLTreeBuilder::processEndTag(const AtomicXMLToken& token) { exitText(); RefPtr<ContainerNode> node = m_currentNodeStack.last().node(); if (!node->hasTagName(QualifiedName(token.prefix(), token.name(), m_currentNodeStack.last().namespaceForPrefix(token.prefix(), m_currentNodeStack.last().namespaceURI())))) m_parser->stopParsing(); closeElement(toElement(node.get())); }
PassRefPtr<Element> CustomElementRegistry::createElement(const QualifiedName& localName, const AtomicString& typeExtension) const { const QualifiedName& typeName = QualifiedName(nullAtom, typeExtension, localName.namespaceURI()); if (RefPtr<CustomElementConstructor> found = find(typeName, localName)) { RefPtr<Element> created = found->createElement(); if (!typeName.localName().isEmpty() && localName != typeName) return setTypeExtension(created, typeExtension); return created.release(); } return 0; }
/********************************************************************************************** * * ReadQualifiedName * * QualifiedName = Name ? ":" ? Name ; * * Name = NameStartCharacter ( NameCharacter )* ; * * NameStartCharacter = "_" | [A-Z] | [a-z] ; * * NameCharacter = NameStartCharacter | "-" | "." | [0-9] ; * *********************************************************************************************/ QualifiedName XMLParser::ReadQualifiedName () { static const int name_charachters [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 1, 0, 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, 0, 0, 0, 0, 0 }; bool first = true; bool valid = true; std::string specifier; std::string name; do { if (valid && current == ':') { if (specifier == "") { specifier = output.toString (); output.Reset (); } else { valid = false; } } else if (current == '\x20' || current == '\x9' || current == '\xD' || current == '\xA') { Position end = position; if (!valid) throw InvalidNameException (); if (first ) throw UnexpectedTokenException (); return QualifiedName (specifier, name); } else if ('\0' <= current && current < '\x7f' && name_characters [(int) current] == 1) { if ((first && '9' < current) || !first) { first = false; output.AppendIgnoreCase (current); } else { valid = false; } } else { valid = false; continue; } } while (ReadCharacter ()); return UnexpectedEndException (); }
DisassemblerCore( const CboValidator::Result &validationResult, Allocator &allocator, InputStream &cboStream, OutputStream &outputStream): mValue32Table(validationResult.mValue32Count, Value32(), Value32Table::allocator_type(&allocator)), mValue64Table(validationResult.mValue64Count, Value64(), Value64Table::allocator_type(&allocator)), mStringTable(validationResult.mStringCount, StringView(), StringTable::allocator_type(&allocator)), mStringBytes(validationResult.mStringByteCount + validationResult.mStringCount, char(), StringBytes::allocator_type(&allocator)), mQualifiedNameTable(validationResult.mQualifiedNameCount, QualifiedName(), QualifiedNameTable::allocator_type(&allocator)), mQualifiedNameElementTable(validationResult.mQualifiedNameElementCount + validationResult.mQualifiedNameCount, nullptr, QualifiedNameElementTable::allocator_type(&allocator)), mValidationResult(validationResult), mCboStream(cboStream), mOutStream(outputStream) {}
TEST_F(CustomElementRegistryTest, define_upgradesInDocumentElements) { ScriptForbiddenScope doNotRelyOnScript; Element* element = CreateElement("a-a").inDocument(&document()); element->setAttribute( QualifiedName(nullAtom, "attr1", HTMLNames::xhtmlNamespaceURI), "v1"); element->setBooleanAttribute(HTMLNames::contenteditableAttr, true); document().documentElement()->appendChild(element); LogUpgradeBuilder builder; NonThrowableExceptionState shouldNotThrow; { CEReactionsScope reactions; registry().define("a-a", builder, ElementDefinitionOptions(), shouldNotThrow); } LogUpgradeDefinition* definition = static_cast<LogUpgradeDefinition*>(registry().definitionForName("a-a")); EXPECT_EQ(LogUpgradeDefinition::Constructor, definition->m_logs[0]) << "defining the element should have 'upgraded' the existing element"; EXPECT_EQ(element, definition->m_element) << "the existing a-a element should have been upgraded"; EXPECT_EQ(LogUpgradeDefinition::AttributeChangedCallback, definition->m_logs[1]) << "Upgrade should invoke attributeChangedCallback for all attributes"; EXPECT_EQ("attr1", definition->m_attributeChanged[0].name); EXPECT_EQ(nullAtom, definition->m_attributeChanged[0].oldValue); EXPECT_EQ("v1", definition->m_attributeChanged[0].newValue); EXPECT_EQ(LogUpgradeDefinition::AttributeChangedCallback, definition->m_logs[2]) << "Upgrade should invoke attributeChangedCallback for all attributes"; EXPECT_EQ("contenteditable", definition->m_attributeChanged[1].name); EXPECT_EQ(nullAtom, definition->m_attributeChanged[1].oldValue); EXPECT_EQ(emptyAtom, definition->m_attributeChanged[1].newValue); EXPECT_EQ(2u, definition->m_attributeChanged.size()) << "Upgrade should invoke attributeChangedCallback for all attributes"; EXPECT_EQ(LogUpgradeDefinition::ConnectedCallback, definition->m_logs[3]) << "upgrade should invoke connectedCallback"; EXPECT_EQ(4u, definition->m_logs.size()) << "upgrade should not invoke other callbacks"; }
void DisassemblerCore::Disassemble() { // Skip some header information that is already included in the validation result. Skip((2 * sizeof(Value32)) + (7 * sizeof(Value16))); mOutStream.Print("Version %" BOND_PRIu32 ".%" BOND_PRIu32 "\n", mValidationResult.mMajorVersion, mValidationResult.mMinorVersion); mOutStream.Print("Pointer size: %d bits\n", (mValidationResult.mPointerSize == POINTER_64BIT) ? 64 : 32); for (size_t i = 0; i < mValidationResult.mValue32Count; ++i) { mValue32Table[i] = ReadValue32(); } for (size_t i = 0; i < mValidationResult.mValue64Count; ++i) { mValue64Table[i] = ReadValue64(); } char *stringBytes = mStringBytes.data(); for (size_t i = 0; i < mValidationResult.mStringCount; ++i) { const size_t length = ReadValue16().mUShort; mStringTable[i] = StringView(stringBytes, length); mCboStream.Read(stringBytes, length); stringBytes += length; *stringBytes++ = '\0'; } QualifiedName *name = mQualifiedNameTable.data(); const char **element = mQualifiedNameElementTable.data(); for (size_t i = 0; i < mValidationResult.mQualifiedNameCount; ++i) { *name++ = QualifiedName(element); const size_t numElements = ReadValue16().mUShort; for (size_t j = 0; j < numElements; ++j) { const size_t elementIndex = ReadValue16().mUShort; *element++ = mStringTable[elementIndex].GetString(); } *element++ = nullptr; } DisassembleBlob(); }
StatusCode AddressSpaceInMemory::AddReference(const AddReferencesItem& item) { NodesMap::iterator node_it = Nodes.find(item.SourceNodeId); if ( node_it == Nodes.end() ) { return StatusCode::BadSourceNodeIdInvalid; } NodesMap::iterator targetnode_it = Nodes.find(item.TargetNodeId); if ( targetnode_it == Nodes.end() ) { return StatusCode::BadTargetNodeIdInvalid; } ReferenceDescription desc; desc.ReferenceTypeId = item.ReferenceTypeId; desc.IsForward = item.IsForward; desc.TargetNodeId = item.TargetNodeId; desc.TargetNodeClass = item.TargetNodeClass; DataValue dv = GetValue(item.TargetNodeId, AttributeId::BrowseName); if (dv.Status == StatusCode::Good) { desc.BrowseName = dv.Value.As<QualifiedName>(); } else { desc.BrowseName = QualifiedName("NONAME", 0); } dv = GetValue(item.TargetNodeId, AttributeId::DisplayName); if (dv.Status == StatusCode::Good) { desc.DisplayName = dv.Value.As<LocalizedText>(); } else { desc.DisplayName = LocalizedText(desc.BrowseName.Name); } node_it->second.References.push_back(desc); return StatusCode::Good; }
// Convert a uaf::QualifiedName to a OpcUa_QualifiedName // ============================================================================================= Status NamespaceArray::fillOpcUaQualifiedName( const QualifiedName& qualifiedName, OpcUa_QualifiedName& opcUaQualifiedName) const { Status ret; // check if the browse name has a namespace URI for which we can find an index if (qualifiedName.hasNameSpaceUri()) { // we need to get a valid namespace index NameSpaceIndex nameSpaceIndex; if (findNamespaceIndex(qualifiedName.nameSpaceUri(), nameSpaceIndex)) { // copy the contents from the qualified name to the SDK object // (except the namespaceUri because that's not relevant for the SDK object anyway) QualifiedName(qualifiedName.name(), nameSpaceIndex).toSdk(&opcUaQualifiedName); ret = statuscodes::Good; } else { ret = UnknownNamespaceUriError(); } } else if (qualifiedName.hasNameSpaceIndex()) { // OK we don't have a namespace URI but we do have a namespace index qualifiedName.toSdk(&opcUaQualifiedName); ret = statuscodes::Good; } else { // we have no possible means to get the namespace index ret = NoNamespaceIndexOrUriGivenError(); } return ret; }
SetTransformsTaskResource(ptr<ResourceManager> manager, const string &name, ptr<ResourceDescriptor> desc, const TiXmlElement *e = NULL) : ResourceTemplate<40, SetTransformsTask>(manager, name, desc) { e = e == NULL ? desc->descriptor : e; checkParameters(desc, e, "screen,time,localToWorld,localToScreen,cameraToWorld,cameraToScreen,screenToCamera,module,worldToScreen,worldPos,worldDir,"); const char* s = e->Attribute("screen"); string screen = s == NULL ? "" : string(e->Attribute("screen")); s = e->Attribute("module"); QualifiedName module = QualifiedName(s == NULL ? "" : string(s)); const char *time = e->Attribute("time"); const char *localToWorld = e->Attribute("localToWorld"); const char *localToScreen = e->Attribute("localToScreen"); const char *cameraToWorld = e->Attribute("cameraToWorld"); const char *cameraToScreen = e->Attribute("cameraToScreen"); const char *screenToCamera = e->Attribute("screenToCamera"); const char *worldToScreen = e->Attribute("worldToScreen"); const char *worldPos = e->Attribute("worldPos"); const char *worldDir = e->Attribute("worldDir"); init(screen, module, time, localToWorld, localToScreen, cameraToWorld, cameraToScreen, screenToCamera, worldToScreen, worldPos, worldDir); }
void CSSSelectorParser::prependTypeSelectorIfNeeded( const AtomicString& namespacePrefix, const AtomicString& elementName, CSSParserSelector* compoundSelector) { if (elementName.isNull() && defaultNamespace() == starAtom && !compoundSelector->needsImplicitShadowCombinatorForMatching()) return; AtomicString determinedElementName = elementName.isNull() ? starAtom : elementName; AtomicString namespaceURI = determineNamespace(namespacePrefix); if (namespaceURI.isNull()) { m_failedParsing = true; return; } AtomicString determinedPrefix = namespacePrefix; if (namespaceURI == defaultNamespace()) determinedPrefix = nullAtom; QualifiedName tag = QualifiedName(determinedPrefix, determinedElementName, namespaceURI); // *:host/*:host-context never matches, so we can't discard the *, // otherwise we can't tell the difference between *:host and just :host. // // Also, selectors where we use a ShadowPseudo combinator between the // element and the pseudo element for matching (custom pseudo elements, // ::cue, ::shadow), we need a universal selector to set the combinator // (relation) on in the cases where there are no simple selectors preceding // the pseudo element. bool explicitForHost = compoundSelector->isHostPseudoSelector() && !elementName.isNull(); if (tag != anyQName() || explicitForHost || compoundSelector->needsImplicitShadowCombinatorForMatching()) compoundSelector->prependTagSelector( tag, determinedPrefix == nullAtom && determinedElementName == starAtom && !explicitForHost); }
spINode APICALL MetadataImpl::ReplaceNode( const spINode & node ) { if ( mSupportAliases ) { XMP_ExpandedXPath exPath; QualifiedName qName( node->GetNameSpace(), node->GetName() ); bool nodeIsAlias = IsNodeAlias( node->GetNameSpace()->c_str(), node->GetName()->c_str(), exPath ); if ( nodeIsAlias ) { spINode actualNodeToBeRemoved; sizet nodeIndex = 0; auto spSelf = MakeUncheckedSharedPointer( this, __FILE__, __LINE__, false ); if ( HandleConstAlias( spSelf, actualNodeToBeRemoved, exPath, nodeIndex ) ) { qName = QualifiedName( actualNodeToBeRemoved->GetNameSpace(), actualNodeToBeRemoved->GetName() ); } } if ( CheckSuitabilityToBeUsedAsChildNode( node ) && GetNode( qName.mNameSpace, qName.mName ) ) { auto retValue = RemoveNode( qName.mNameSpace, qName.mName ); spINode destNode = node; if ( nodeIsAlias ) { sizet destNodeIndex = 0; auto spSelf = MakeUncheckedSharedPointer( this, __FILE__, __LINE__, false ); if ( !HandleNonConstAlias( spSelf, exPath, true, 0, destNode, destNodeIndex, false, node ) ) { return destNode; } } InsertNode( destNode ); return retValue; } else { NOTIFY_ERROR( IError_v1::kEDDataModel, kDMECNoSuchNodeExists, "no such node exists with the specified qualified name", IError_v1::kESOperationFatal, true, node->GetNameSpace(), true, node->GetName() ); } return spINode(); } else { return StructureNodeImpl::ReplaceNode( node ); } }