| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
| 5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
| 8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 static bool checkNeedsStyleInvalidationForIdChange(const AtomicString& oldId, co
nst AtomicString& newId, StyleResolver* styleResolver) | 824 static bool checkNeedsStyleInvalidationForIdChange(const AtomicString& oldId, co
nst AtomicString& newId, StyleResolver* styleResolver) |
| 825 { | 825 { |
| 826 ASSERT(newId != oldId); | 826 ASSERT(newId != oldId); |
| 827 if (!oldId.isEmpty() && styleResolver->hasSelectorForId(oldId)) | 827 if (!oldId.isEmpty() && styleResolver->hasSelectorForId(oldId)) |
| 828 return true; | 828 return true; |
| 829 if (!newId.isEmpty() && styleResolver->hasSelectorForId(newId)) | 829 if (!newId.isEmpty() && styleResolver->hasSelectorForId(newId)) |
| 830 return true; | 830 return true; |
| 831 return false; | 831 return false; |
| 832 } | 832 } |
| 833 | 833 |
| 834 void Element::attributeChanged(const QualifiedName& name, const AtomicString& ne
wValue) | 834 void Element::attributeChanged(const QualifiedName& name, const AtomicString& ne
wValue, AttributeModificationReason) |
| 835 { | 835 { |
| 836 if (ElementShadow* parentElementShadow = shadowOfParentForDistribution(this)
) { | 836 if (ElementShadow* parentElementShadow = shadowOfParentForDistribution(this)
) { |
| 837 if (shouldInvalidateDistributionWhenAttributeChanged(parentElementShadow
, name, newValue)) | 837 if (shouldInvalidateDistributionWhenAttributeChanged(parentElementShadow
, name, newValue)) |
| 838 parentElementShadow->invalidateDistribution(); | 838 parentElementShadow->invalidateDistribution(); |
| 839 } | 839 } |
| 840 | 840 |
| 841 parseAttribute(name, newValue); | 841 parseAttribute(name, newValue); |
| 842 | 842 |
| 843 document()->incDOMTreeVersion(); | 843 document()->incDOMTreeVersion(); |
| 844 | 844 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 867 // If there is currently no StyleResolver, we can't be sure that this attrib
ute change won't affect style. | 867 // If there is currently no StyleResolver, we can't be sure that this attrib
ute change won't affect style. |
| 868 shouldInvalidateStyle |= !styleResolver; | 868 shouldInvalidateStyle |= !styleResolver; |
| 869 | 869 |
| 870 if (shouldInvalidateStyle) | 870 if (shouldInvalidateStyle) |
| 871 setNeedsStyleRecalc(); | 871 setNeedsStyleRecalc(); |
| 872 | 872 |
| 873 if (AXObjectCache* cache = document()->existingAXObjectCache()) | 873 if (AXObjectCache* cache = document()->existingAXObjectCache()) |
| 874 cache->handleAttributeChanged(name, this); | 874 cache->handleAttributeChanged(name, this); |
| 875 } | 875 } |
| 876 | 876 |
| 877 inline void Element::attributeChangedFromParserOrByCloning(const QualifiedName&
name, const AtomicString& newValue) | 877 inline void Element::attributeChangedFromParserOrByCloning(const QualifiedName&
name, const AtomicString& newValue, AttributeModificationReason reason) |
| 878 { | 878 { |
| 879 #if ENABLE(CUSTOM_ELEMENTS) | 879 #if ENABLE(CUSTOM_ELEMENTS) |
| 880 if (name == isAttr) { | 880 if (name == isAttr) { |
| 881 if (CustomElementRegistry* registry = document()->registry()) | 881 if (CustomElementRegistry* registry = document()->registry()) |
| 882 registry->didGiveTypeExtension(this); | 882 registry->didGiveTypeExtension(this); |
| 883 } | 883 } |
| 884 #endif | 884 #endif |
| 885 attributeChanged(name, newValue); | 885 attributeChanged(name, newValue, reason); |
| 886 } | 886 } |
| 887 | 887 |
| 888 template <typename CharacterType> | 888 template <typename CharacterType> |
| 889 static inline bool classStringHasClassName(const CharacterType* characters, unsi
gned length) | 889 static inline bool classStringHasClassName(const CharacterType* characters, unsi
gned length) |
| 890 { | 890 { |
| 891 ASSERT(length > 0); | 891 ASSERT(length > 0); |
| 892 | 892 |
| 893 unsigned i = 0; | 893 unsigned i = 0; |
| 894 do { | 894 do { |
| 895 if (isNotHTMLSpace(characters[i])) | 895 if (isNotHTMLSpace(characters[i])) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 if (attributeVector.isEmpty()) | 1053 if (attributeVector.isEmpty()) |
| 1054 return; | 1054 return; |
| 1055 | 1055 |
| 1056 if (document() && document()->sharedObjectPool()) | 1056 if (document() && document()->sharedObjectPool()) |
| 1057 m_elementData = document()->sharedObjectPool()->cachedShareableElementDa
taWithAttributes(attributeVector); | 1057 m_elementData = document()->sharedObjectPool()->cachedShareableElementDa
taWithAttributes(attributeVector); |
| 1058 else | 1058 else |
| 1059 m_elementData = ShareableElementData::createWithAttributes(attributeVect
or); | 1059 m_elementData = ShareableElementData::createWithAttributes(attributeVect
or); |
| 1060 | 1060 |
| 1061 // Use attributeVector instead of m_elementData because attributeChanged mig
ht modify m_elementData. | 1061 // Use attributeVector instead of m_elementData because attributeChanged mig
ht modify m_elementData. |
| 1062 for (unsigned i = 0; i < attributeVector.size(); ++i) | 1062 for (unsigned i = 0; i < attributeVector.size(); ++i) |
| 1063 attributeChangedFromParserOrByCloning(attributeVector[i].name(), attribu
teVector[i].value()); | 1063 attributeChangedFromParserOrByCloning(attributeVector[i].name(), attribu
teVector[i].value(), ModifiedDirectly); |
| 1064 } | 1064 } |
| 1065 | 1065 |
| 1066 bool Element::hasAttributes() const | 1066 bool Element::hasAttributes() const |
| 1067 { | 1067 { |
| 1068 synchronizeAllAttributes(); | 1068 synchronizeAllAttributes(); |
| 1069 return elementData() && elementData()->length(); | 1069 return elementData() && elementData()->length(); |
| 1070 } | 1070 } |
| 1071 | 1071 |
| 1072 bool Element::hasEquivalentAttributes(const Element* other) const | 1072 bool Element::hasEquivalentAttributes(const Element* other) const |
| 1073 { | 1073 { |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2852 && (!other.m_elementData->inlineStyle() || !other.m_elementData->inlineS
tyle()->hasCSSOMWrapper())) | 2852 && (!other.m_elementData->inlineStyle() || !other.m_elementData->inlineS
tyle()->hasCSSOMWrapper())) |
| 2853 const_cast<Element&>(other).m_elementData = static_cast<const UniqueElem
entData*>(other.m_elementData.get())->makeShareableCopy(); | 2853 const_cast<Element&>(other).m_elementData = static_cast<const UniqueElem
entData*>(other.m_elementData.get())->makeShareableCopy(); |
| 2854 | 2854 |
| 2855 if (!other.m_elementData->isUnique()) | 2855 if (!other.m_elementData->isUnique()) |
| 2856 m_elementData = other.m_elementData; | 2856 m_elementData = other.m_elementData; |
| 2857 else | 2857 else |
| 2858 m_elementData = other.m_elementData->makeUniqueCopy(); | 2858 m_elementData = other.m_elementData->makeUniqueCopy(); |
| 2859 | 2859 |
| 2860 for (unsigned i = 0; i < m_elementData->length(); ++i) { | 2860 for (unsigned i = 0; i < m_elementData->length(); ++i) { |
| 2861 const Attribute* attribute = const_cast<const ElementData*>(m_elementDat
a.get())->attributeItem(i); | 2861 const Attribute* attribute = const_cast<const ElementData*>(m_elementDat
a.get())->attributeItem(i); |
| 2862 attributeChangedFromParserOrByCloning(attribute->name(), attribute->valu
e()); | 2862 attributeChangedFromParserOrByCloning(attribute->name(), attribute->valu
e(), ModifiedByCloning); |
| 2863 } | 2863 } |
| 2864 } | 2864 } |
| 2865 | 2865 |
| 2866 void Element::cloneDataFromElement(const Element& other) | 2866 void Element::cloneDataFromElement(const Element& other) |
| 2867 { | 2867 { |
| 2868 cloneAttributesFromElement(other); | 2868 cloneAttributesFromElement(other); |
| 2869 copyNonAttributePropertiesFromElement(other); | 2869 copyNonAttributePropertiesFromElement(other); |
| 2870 } | 2870 } |
| 2871 | 2871 |
| 2872 void Element::createUniqueElementData() | 2872 void Element::createUniqueElementData() |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3112 return 0; | 3112 return 0; |
| 3113 } | 3113 } |
| 3114 | 3114 |
| 3115 Attribute* UniqueElementData::attributeItem(unsigned index) | 3115 Attribute* UniqueElementData::attributeItem(unsigned index) |
| 3116 { | 3116 { |
| 3117 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); | 3117 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); |
| 3118 return &m_attributeVector.at(index); | 3118 return &m_attributeVector.at(index); |
| 3119 } | 3119 } |
| 3120 | 3120 |
| 3121 } // namespace WebCore | 3121 } // namespace WebCore |
| OLD | NEW |