void CSSSelector::setAttribute(const QualifiedName& value, bool isCaseInsensitive) { createRareData(); m_data.m_rareData->m_attribute = value; m_data.m_rareData->m_attributeCanonicalLocalName = isCaseInsensitive ? value.localName().convertToASCIILowercase() : value.localName(); }
bool SVGElement::isAnimatableAttribute(const QualifiedName& name) const { if (SVGElement::animatableAttributeForName(name.localName()) == name) return !filterOutAnimatableAttribute(name); return false; }
static bool threadSafeMatch(const String& localName, const QualifiedName& qName) { return threadSafeEqual(localName.impl(), qName.localName().impl()); }
bool threadSafeMatch(const HTMLIdentifier& localName, const QualifiedName& qName) { return threadSafeEqual(localName.asStringImpl(), qName.localName().impl()); }
bool HTMLElementStack::inSelectScope(const QualifiedName& tagName) const { return inSelectScope(tagName.localName()); }
static void addLocalNameToSet(HashSet<AtomicStringImpl*>* set, const QualifiedName& qName) { set->add(qName.localName().impl()); }
static void addTag(const QualifiedName& tag, ConstructorFunction func) { gFunctionMap->set(tag.localName().impl(), func); }
void RuleFeatureSet::collectInvalidationSetsForAttribute(InvalidationSetVector& invalidationSets, Element& element, const QualifiedName& attributeName) const { if (RefPtrWillBeRawPtr<InvalidationSet> invalidationSet = m_attributeInvalidationSets.get(attributeName.localName())) { TRACE_SCHEDULE_STYLE_INVALIDATION(element, *invalidationSet, attributeChange, attributeName); invalidationSets.append(invalidationSet); } }
static bool anyAttributeMatches(Element* element, const CSSSelector* selector, const QualifiedName& selectorAttr, bool caseSensitive) { ASSERT(element->hasAttributesWithoutUpdate()); for (size_t i = 0, count = element->attributeCount(); i < count; ++i) { const Attribute& attribute = element->attributeAt(i); if (!attribute.matches(selectorAttr.prefix(), element->isHTMLElement() ? selector->attributeCanonicalLocalName() : selectorAttr.localName(), selectorAttr.namespaceURI())) continue; if (attributeValueMatches(attribute, static_cast<CSSSelector::Match>(selector->m_match), selector->value(), caseSensitive)) return true; } return false; }
bool Element::hasAttribute(const QualifiedName& name) const { return hasAttributeNS(name.namespaceURI(), name.localName()); }
static bool match(const AtomicString& name, const QualifiedName& qName) { ASSERT(isMainThread()); return qName.localName() == name; }
static SVGPropertyInfo createSVGTestPropertyInfo(const QualifiedName& attributeName, SVGPropertyInfo::SynchronizeProperty synchronizeFunction) { return { AnimatedUnknown, PropertyIsReadWrite, attributeName, attributeName.localName(), synchronizeFunction, nullptr }; }
void RuleFeatureSet::scheduleStyleInvalidationForAttributeChange(const QualifiedName& attributeName, Element& element) { if (RefPtrWillBeRawPtr<DescendantInvalidationSet> invalidationSet = m_attributeInvalidationSets.get(attributeName.localName())) m_styleInvalidator.scheduleInvalidation(invalidationSet, element); }
static inline void getPropertyValue(SVGElement* svgParent, const QualifiedName& attributeName, String& value) { ASSERT(svgParent->isStyled()); value = computedStyle(svgParent)->getPropertyValue(cssPropertyID(attributeName.localName())); }
void Element::willModifyAttribute(const QualifiedName& name, const AtomicString& oldValue, const AtomicString& newValue) { if (name == HTMLNames::idAttr) updateId(oldValue, newValue); if (inActiveDocument() && styleChangeType() < SubtreeStyleChange && affectedByAttributeSelector(name.localName())) setNeedsStyleRecalc(LocalStyleChange); if (OwnPtr<MutationObserverInterestGroup> recipients = MutationObserverInterestGroup::createForAttributesMutation(*this, name)) recipients->enqueueMutationRecord(MutationRecord::createAttributes(this, name, oldValue)); }
int SVGStyledElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attrName) { if (!attrName.namespaceURI().isNull()) return 0; static HashMap<AtomicStringImpl*, int>* propertyNameToIdMap = 0; if (!propertyNameToIdMap) { propertyNameToIdMap = new HashMap<AtomicStringImpl*, int>; // This is a list of all base CSS and SVG CSS properties which are exposed as SVG XML attributes mapAttributeToCSSProperty(propertyNameToIdMap, alignment_baselineAttr); mapAttributeToCSSProperty(propertyNameToIdMap, baseline_shiftAttr); mapAttributeToCSSProperty(propertyNameToIdMap, clipAttr); mapAttributeToCSSProperty(propertyNameToIdMap, clip_pathAttr); mapAttributeToCSSProperty(propertyNameToIdMap, clip_ruleAttr); mapAttributeToCSSProperty(propertyNameToIdMap, SVGNames::colorAttr); mapAttributeToCSSProperty(propertyNameToIdMap, color_interpolationAttr); mapAttributeToCSSProperty(propertyNameToIdMap, color_interpolation_filtersAttr); mapAttributeToCSSProperty(propertyNameToIdMap, color_profileAttr); mapAttributeToCSSProperty(propertyNameToIdMap, color_renderingAttr); mapAttributeToCSSProperty(propertyNameToIdMap, cursorAttr); mapAttributeToCSSProperty(propertyNameToIdMap, SVGNames::directionAttr); mapAttributeToCSSProperty(propertyNameToIdMap, displayAttr); mapAttributeToCSSProperty(propertyNameToIdMap, dominant_baselineAttr); mapAttributeToCSSProperty(propertyNameToIdMap, enable_backgroundAttr); mapAttributeToCSSProperty(propertyNameToIdMap, fillAttr); mapAttributeToCSSProperty(propertyNameToIdMap, fill_opacityAttr); mapAttributeToCSSProperty(propertyNameToIdMap, fill_ruleAttr); mapAttributeToCSSProperty(propertyNameToIdMap, filterAttr); mapAttributeToCSSProperty(propertyNameToIdMap, flood_colorAttr); mapAttributeToCSSProperty(propertyNameToIdMap, flood_opacityAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_familyAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_sizeAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_stretchAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_styleAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_variantAttr); mapAttributeToCSSProperty(propertyNameToIdMap, font_weightAttr); mapAttributeToCSSProperty(propertyNameToIdMap, glyph_orientation_horizontalAttr); mapAttributeToCSSProperty(propertyNameToIdMap, glyph_orientation_verticalAttr); mapAttributeToCSSProperty(propertyNameToIdMap, image_renderingAttr); mapAttributeToCSSProperty(propertyNameToIdMap, kerningAttr); mapAttributeToCSSProperty(propertyNameToIdMap, letter_spacingAttr); mapAttributeToCSSProperty(propertyNameToIdMap, lighting_colorAttr); mapAttributeToCSSProperty(propertyNameToIdMap, marker_endAttr); mapAttributeToCSSProperty(propertyNameToIdMap, marker_midAttr); mapAttributeToCSSProperty(propertyNameToIdMap, marker_startAttr); mapAttributeToCSSProperty(propertyNameToIdMap, maskAttr); mapAttributeToCSSProperty(propertyNameToIdMap, opacityAttr); mapAttributeToCSSProperty(propertyNameToIdMap, overflowAttr); mapAttributeToCSSProperty(propertyNameToIdMap, pointer_eventsAttr); mapAttributeToCSSProperty(propertyNameToIdMap, shape_renderingAttr); mapAttributeToCSSProperty(propertyNameToIdMap, stop_colorAttr); mapAttributeToCSSProperty(propertyNameToIdMap, stop_opacityAttr); mapAttributeToCSSProperty(propertyNameToIdMap, strokeAttr); mapAttributeToCSSProperty(propertyNameToIdMap, stroke_dasharrayAttr); mapAttributeToCSSProperty(propertyNameToIdMap, stroke_dashoffsetAttr); mapAttributeToCSSProperty(propertyNameToIdMap, stroke_linecapAttr); mapAttributeToCSSProperty(propertyNameToIdMap, stroke_linejoinAttr); mapAttributeToCSSProperty(propertyNameToIdMap, stroke_miterlimitAttr); mapAttributeToCSSProperty(propertyNameToIdMap, stroke_opacityAttr); mapAttributeToCSSProperty(propertyNameToIdMap, stroke_widthAttr); mapAttributeToCSSProperty(propertyNameToIdMap, text_anchorAttr); mapAttributeToCSSProperty(propertyNameToIdMap, text_decorationAttr); mapAttributeToCSSProperty(propertyNameToIdMap, text_renderingAttr); mapAttributeToCSSProperty(propertyNameToIdMap, unicode_bidiAttr); mapAttributeToCSSProperty(propertyNameToIdMap, vector_effectAttr); mapAttributeToCSSProperty(propertyNameToIdMap, visibilityAttr); mapAttributeToCSSProperty(propertyNameToIdMap, word_spacingAttr); mapAttributeToCSSProperty(propertyNameToIdMap, writing_modeAttr); } return propertyNameToIdMap->get(attrName.localName().impl()); }
void Element::setAttribute(const QualifiedName& name, const AtomicString& value) { synchronizeAttribute(name.localName()); size_t index = elementData() ? elementData()->attributes().findIndex(name) : kNotFound; setAttributeInternal(index, name, value, NotInSynchronizationOfLazyAttribute); }
void mapAttributeToCSSProperty(HashMap<AtomicStringImpl*, int>* propertyNameToIdMap, const QualifiedName& attrName) { int propertyId = cssPropertyID(attrName.localName()); ASSERT(propertyId > 0); propertyNameToIdMap->set(attrName.localName().impl(), propertyId); }
bool HTMLDocument::isCaseSensitiveAttribute(const QualifiedName& attributeName) { static HashSet<AtomicStringImpl*>* htmlCaseInsensitiveAttributesSet = createHtmlCaseInsensitiveAttributesSet(); bool isPossibleHTMLAttr = !attributeName.hasPrefix() && (attributeName.namespaceURI() == nullAtom); return !isPossibleHTMLAttr || !htmlCaseInsensitiveAttributesSet->contains(attributeName.localName().impl()); }
AtomicString HTMLElement::eventNameForAttributeName(const QualifiedName& attrName) const { if (!attrName.namespaceURI().isNull()) return AtomicString(); typedef HashMap<AtomicString, AtomicString> StringToStringMap; DEFINE_STATIC_LOCAL(StringToStringMap, attributeNameToEventNameMap, ()); if (!attributeNameToEventNameMap.size()) { attributeNameToEventNameMap.set(onclickAttr.localName(), eventNames().clickEvent); attributeNameToEventNameMap.set(oncontextmenuAttr.localName(), eventNames().contextmenuEvent); attributeNameToEventNameMap.set(ondblclickAttr.localName(), eventNames().dblclickEvent); attributeNameToEventNameMap.set(onmousedownAttr.localName(), eventNames().mousedownEvent); attributeNameToEventNameMap.set(onmouseenterAttr.localName(), eventNames().mouseenterEvent); attributeNameToEventNameMap.set(onmouseleaveAttr.localName(), eventNames().mouseleaveEvent); attributeNameToEventNameMap.set(onmousemoveAttr.localName(), eventNames().mousemoveEvent); attributeNameToEventNameMap.set(onmouseoutAttr.localName(), eventNames().mouseoutEvent); attributeNameToEventNameMap.set(onmouseoverAttr.localName(), eventNames().mouseoverEvent); attributeNameToEventNameMap.set(onmouseupAttr.localName(), eventNames().mouseupEvent); attributeNameToEventNameMap.set(onmousewheelAttr.localName(), eventNames().mousewheelEvent); attributeNameToEventNameMap.set(onwheelAttr.localName(), eventNames().wheelEvent); attributeNameToEventNameMap.set(onfocusAttr.localName(), eventNames().focusEvent); attributeNameToEventNameMap.set(onfocusinAttr.localName(), eventNames().focusinEvent); attributeNameToEventNameMap.set(onfocusoutAttr.localName(), eventNames().focusoutEvent); attributeNameToEventNameMap.set(onblurAttr.localName(), eventNames().blurEvent); attributeNameToEventNameMap.set(onkeydownAttr.localName(), eventNames().keydownEvent); attributeNameToEventNameMap.set(onkeypressAttr.localName(), eventNames().keypressEvent); attributeNameToEventNameMap.set(onkeyupAttr.localName(), eventNames().keyupEvent); attributeNameToEventNameMap.set(onscrollAttr.localName(), eventNames().scrollEvent); attributeNameToEventNameMap.set(onbeforecutAttr.localName(), eventNames().beforecutEvent); attributeNameToEventNameMap.set(oncutAttr.localName(), eventNames().cutEvent); attributeNameToEventNameMap.set(onbeforecopyAttr.localName(), eventNames().beforecopyEvent); attributeNameToEventNameMap.set(oncopyAttr.localName(), eventNames().copyEvent); attributeNameToEventNameMap.set(onbeforepasteAttr.localName(), eventNames().beforepasteEvent); attributeNameToEventNameMap.set(onpasteAttr.localName(), eventNames().pasteEvent); attributeNameToEventNameMap.set(ondragenterAttr.localName(), eventNames().dragenterEvent); attributeNameToEventNameMap.set(ondragoverAttr.localName(), eventNames().dragoverEvent); attributeNameToEventNameMap.set(ondragleaveAttr.localName(), eventNames().dragleaveEvent); attributeNameToEventNameMap.set(ondropAttr.localName(), eventNames().dropEvent); attributeNameToEventNameMap.set(ondragstartAttr.localName(), eventNames().dragstartEvent); attributeNameToEventNameMap.set(ondragAttr.localName(), eventNames().dragEvent); attributeNameToEventNameMap.set(ondragendAttr.localName(), eventNames().dragendEvent); attributeNameToEventNameMap.set(onselectstartAttr.localName(), eventNames().selectstartEvent); attributeNameToEventNameMap.set(onsubmitAttr.localName(), eventNames().submitEvent); attributeNameToEventNameMap.set(onerrorAttr.localName(), eventNames().errorEvent); attributeNameToEventNameMap.set(onwebkitanimationstartAttr.localName(), eventNames().webkitAnimationStartEvent); attributeNameToEventNameMap.set(onwebkitanimationiterationAttr.localName(), eventNames().webkitAnimationIterationEvent); attributeNameToEventNameMap.set(onwebkitanimationendAttr.localName(), eventNames().webkitAnimationEndEvent); attributeNameToEventNameMap.set(onwebkittransitionendAttr.localName(), eventNames().webkitTransitionEndEvent); attributeNameToEventNameMap.set(ontransitionendAttr.localName(), eventNames().webkitTransitionEndEvent); attributeNameToEventNameMap.set(oninputAttr.localName(), eventNames().inputEvent); attributeNameToEventNameMap.set(oninvalidAttr.localName(), eventNames().invalidEvent); attributeNameToEventNameMap.set(ontouchstartAttr.localName(), eventNames().touchstartEvent); attributeNameToEventNameMap.set(ontouchmoveAttr.localName(), eventNames().touchmoveEvent); attributeNameToEventNameMap.set(ontouchendAttr.localName(), eventNames().touchendEvent); attributeNameToEventNameMap.set(ontouchcancelAttr.localName(), eventNames().touchcancelEvent); #if ENABLE(FULLSCREEN_API) attributeNameToEventNameMap.set(onwebkitfullscreenchangeAttr.localName(), eventNames().webkitfullscreenchangeEvent); attributeNameToEventNameMap.set(onwebkitfullscreenerrorAttr.localName(), eventNames().webkitfullscreenerrorEvent); #endif attributeNameToEventNameMap.set(onabortAttr.localName(), eventNames().abortEvent); attributeNameToEventNameMap.set(oncanplayAttr.localName(), eventNames().canplayEvent); attributeNameToEventNameMap.set(oncanplaythroughAttr.localName(), eventNames().canplaythroughEvent); attributeNameToEventNameMap.set(onchangeAttr.localName(), eventNames().changeEvent); attributeNameToEventNameMap.set(ondurationchangeAttr.localName(), eventNames().durationchangeEvent); attributeNameToEventNameMap.set(onemptiedAttr.localName(), eventNames().emptiedEvent); attributeNameToEventNameMap.set(onendedAttr.localName(), eventNames().endedEvent); attributeNameToEventNameMap.set(onloadeddataAttr.localName(), eventNames().loadeddataEvent); attributeNameToEventNameMap.set(onloadedmetadataAttr.localName(), eventNames().loadedmetadataEvent); attributeNameToEventNameMap.set(onloadstartAttr.localName(), eventNames().loadstartEvent); attributeNameToEventNameMap.set(onpauseAttr.localName(), eventNames().pauseEvent); attributeNameToEventNameMap.set(onplayAttr.localName(), eventNames().playEvent); attributeNameToEventNameMap.set(onplayingAttr.localName(), eventNames().playingEvent); attributeNameToEventNameMap.set(onprogressAttr.localName(), eventNames().progressEvent); attributeNameToEventNameMap.set(onratechangeAttr.localName(), eventNames().ratechangeEvent); attributeNameToEventNameMap.set(onresetAttr.localName(), eventNames().resetEvent); attributeNameToEventNameMap.set(onseekedAttr.localName(), eventNames().seekedEvent); attributeNameToEventNameMap.set(onseekingAttr.localName(), eventNames().seekingEvent); attributeNameToEventNameMap.set(onselectAttr.localName(), eventNames().selectEvent); attributeNameToEventNameMap.set(onstalledAttr.localName(), eventNames().stalledEvent); attributeNameToEventNameMap.set(onsuspendAttr.localName(), eventNames().suspendEvent); attributeNameToEventNameMap.set(ontimeupdateAttr.localName(), eventNames().timeupdateEvent); attributeNameToEventNameMap.set(onvolumechangeAttr.localName(), eventNames().volumechangeEvent); attributeNameToEventNameMap.set(onwaitingAttr.localName(), eventNames().waitingEvent); attributeNameToEventNameMap.set(onloadAttr.localName(), eventNames().loadEvent); } return attributeNameToEventNameMap.get(attrName.localName()); }
static bool hasName(const HTMLToken& token, const QualifiedName& name) { return equalIgnoringNullity(token.name(), static_cast<const String&>(name.localName())); }
CSSPropertyID SVGElement::cssPropertyIdForSVGAttributeName(const QualifiedName& attrName) { if (!attrName.namespaceURI().isNull()) return CSSPropertyInvalid; static HashMap<StringImpl*, CSSPropertyID>* propertyNameToIdMap = 0; if (!propertyNameToIdMap) { propertyNameToIdMap = new HashMap<StringImpl*, CSSPropertyID>; // This is a list of all base CSS and SVG CSS properties which are exposed as SVG XML attributes const QualifiedName* const attrNames[] = { &alignment_baselineAttr, &baseline_shiftAttr, &buffered_renderingAttr, &clipAttr, &clip_pathAttr, &clip_ruleAttr, &SVGNames::colorAttr, &color_interpolationAttr, &color_interpolation_filtersAttr, &color_renderingAttr, &cursorAttr, &SVGNames::directionAttr, &displayAttr, &dominant_baselineAttr, &fillAttr, &fill_opacityAttr, &fill_ruleAttr, &filterAttr, &flood_colorAttr, &flood_opacityAttr, &font_familyAttr, &font_sizeAttr, &font_stretchAttr, &font_styleAttr, &font_variantAttr, &font_weightAttr, &glyph_orientation_horizontalAttr, &glyph_orientation_verticalAttr, &image_renderingAttr, &letter_spacingAttr, &lighting_colorAttr, &marker_endAttr, &marker_midAttr, &marker_startAttr, &maskAttr, &mask_typeAttr, &opacityAttr, &overflowAttr, &paint_orderAttr, &pointer_eventsAttr, &shape_renderingAttr, &stop_colorAttr, &stop_opacityAttr, &strokeAttr, &stroke_dasharrayAttr, &stroke_dashoffsetAttr, &stroke_linecapAttr, &stroke_linejoinAttr, &stroke_miterlimitAttr, &stroke_opacityAttr, &stroke_widthAttr, &text_anchorAttr, &text_decorationAttr, &text_renderingAttr, &transform_originAttr, &unicode_bidiAttr, &vector_effectAttr, &visibilityAttr, &word_spacingAttr, &writing_modeAttr, }; for (size_t i = 0; i < WTF_ARRAY_LENGTH(attrNames); i++) { CSSPropertyID propertyId = cssPropertyID(attrNames[i]->localName()); ASSERT(propertyId > 0); propertyNameToIdMap->set(attrNames[i]->localName().impl(), propertyId); } } return propertyNameToIdMap->get(attrName.localName().impl()); }
bool HTMLElementStack::inSelectScope(const QualifiedName& tagName) const { // FIXME: Is localName() right for non-html elements? return inSelectScope(tagName.localName()); }
bool threadSafeMatch(const Vector<UChar, inlineCapacity>& vector, const QualifiedName& qname) { return equalIgnoringNullity(vector, qname.localName().impl()); }
static void addQualifiedName(HashMap<AtomicString, QualifiedName>& map, const QualifiedName& name) { HashMap<AtomicString, QualifiedName>::AddResult addResult = map.add(name.localName(), name); ASSERT_UNUSED(addResult, addResult.isNewEntry); }
static bool findAttributeWithName(const HTMLToken& token, const QualifiedName& name, size_t& indexOfMatchingAttribute) { // Notice that we're careful not to ref the StringImpl here because we might be on a background thread. const String& attrName = name.namespaceURI() == XLinkNames::xlinkNamespaceURI ? "xlink:" + name.localName().string() : name.localName().string(); for (size_t i = 0; i < token.attributes().size(); ++i) { if (equalIgnoringNullity(token.attributes().at(i).name, attrName)) { indexOfMatchingAttribute = i; return true; } } return false; }
bool threadSafeMatch(const QualifiedName& a, const QualifiedName& b) { return threadSafeEqual(a.localName().impl(), b.localName().impl()); }
void RuleFeatureSet::collectInvalidationSetsForAttribute(InvalidationLists& invalidationLists, Element& element, const QualifiedName& attributeName) const { if (RefPtrWillBeRawPtr<InvalidationData> invalidationData = m_attributeInvalidationSets.get(attributeName.localName())) { if (invalidationData->descendants()) { TRACE_SCHEDULE_STYLE_INVALIDATION(element, *invalidationData->descendants(), attributeChange, attributeName); invalidationLists.descendants.append(invalidationData->descendants()); } if (invalidationData->siblings()) { if (element.parentElement()) TRACE_SCHEDULE_STYLE_INVALIDATION(*element.parentElement(), *invalidationData->siblings(), attributeChange, attributeName); invalidationLists.siblings.append(invalidationData->siblings()); } } }