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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 | 1201 |
1202 document().incDOMTreeVersion(); | 1202 document().incDOMTreeVersion(); |
1203 | 1203 |
1204 StyleResolver* styleResolver = document().styleResolver(); | 1204 StyleResolver* styleResolver = document().styleResolver(); |
1205 | 1205 |
1206 if (name == HTMLNames::idAttr) { | 1206 if (name == HTMLNames::idAttr) { |
1207 AtomicString oldId = elementData()->idForStyleResolution(); | 1207 AtomicString oldId = elementData()->idForStyleResolution(); |
1208 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui
rksMode()); | 1208 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui
rksMode()); |
1209 if (newId != oldId) { | 1209 if (newId != oldId) { |
1210 elementData()->setIdForStyleResolution(newId); | 1210 elementData()->setIdForStyleResolution(newId); |
1211 if (inActiveDocument() && styleResolver && styleChangeType() < Subtr
eeStyleChange) | 1211 if (inActiveDocument() && styleResolver) |
1212 document().styleEngine().idChangedForElement(oldId, newId, *this
); | 1212 document().styleEngine().idChangedForElement(oldId, newId, *this
); |
1213 } | 1213 } |
1214 } else if (name == classAttr) { | 1214 } else if (name == classAttr) { |
1215 classAttributeChanged(newValue); | 1215 classAttributeChanged(newValue); |
1216 } else if (name == HTMLNames::nameAttr) { | 1216 } else if (name == HTMLNames::nameAttr) { |
1217 setHasName(!newValue.isNull()); | 1217 setHasName(!newValue.isNull()); |
1218 } else if (isStyledElement()) { | 1218 } else if (isStyledElement()) { |
1219 if (name == styleAttr) { | 1219 if (name == styleAttr) { |
1220 styleAttributeChanged(newValue, reason); | 1220 styleAttributeChanged(newValue, reason); |
1221 } else if (isPresentationAttribute(name)) { | 1221 } else if (isPresentationAttribute(name)) { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 return ClassStringContent::Empty; | 1281 return ClassStringContent::Empty; |
1282 | 1282 |
1283 if (newClassString.is8Bit()) | 1283 if (newClassString.is8Bit()) |
1284 return classStringHasClassName(newClassString.characters8(), length); | 1284 return classStringHasClassName(newClassString.characters8(), length); |
1285 return classStringHasClassName(newClassString.characters16(), length); | 1285 return classStringHasClassName(newClassString.characters16(), length); |
1286 } | 1286 } |
1287 | 1287 |
1288 void Element::classAttributeChanged(const AtomicString& newClassString) | 1288 void Element::classAttributeChanged(const AtomicString& newClassString) |
1289 { | 1289 { |
1290 StyleResolver* styleResolver = document().styleResolver(); | 1290 StyleResolver* styleResolver = document().styleResolver(); |
1291 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl
eChangeType() < SubtreeStyleChange; | 1291 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver; |
1292 | 1292 |
1293 ASSERT(elementData()); | 1293 ASSERT(elementData()); |
1294 ClassStringContent classStringContentType = classStringHasClassName(newClass
String); | 1294 ClassStringContent classStringContentType = classStringHasClassName(newClass
String); |
1295 const bool shouldFoldCase = document().inQuirksMode(); | 1295 const bool shouldFoldCase = document().inQuirksMode(); |
1296 if (classStringContentType == ClassStringContent::HasClasses) { | 1296 if (classStringContentType == ClassStringContent::HasClasses) { |
1297 const SpaceSplitString oldClasses = elementData()->classNames(); | 1297 const SpaceSplitString oldClasses = elementData()->classNames(); |
1298 elementData()->setClass(newClassString, shouldFoldCase); | 1298 elementData()->setClass(newClassString, shouldFoldCase); |
1299 const SpaceSplitString& newClasses = elementData()->classNames(); | 1299 const SpaceSplitString& newClasses = elementData()->classNames(); |
1300 if (testShouldInvalidateStyle) | 1300 if (testShouldInvalidateStyle) |
1301 document().styleEngine().classChangedForElement(oldClasses, newClass
es, *this); | 1301 document().styleEngine().classChangedForElement(oldClasses, newClass
es, *this); |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 | 1870 |
1871 void Element::pseudoStateChanged(CSSSelector::PseudoType pseudo) | 1871 void Element::pseudoStateChanged(CSSSelector::PseudoType pseudo) |
1872 { | 1872 { |
1873 // We can't schedule invaliation sets from inside style recalc otherwise | 1873 // We can't schedule invaliation sets from inside style recalc otherwise |
1874 // we'd never process them. | 1874 // we'd never process them. |
1875 // TODO(esprehn): Make this an ASSERT and fix places that call into this | 1875 // TODO(esprehn): Make this an ASSERT and fix places that call into this |
1876 // like HTMLSelectElement. | 1876 // like HTMLSelectElement. |
1877 if (document().inStyleRecalc()) | 1877 if (document().inStyleRecalc()) |
1878 return; | 1878 return; |
1879 StyleResolver* styleResolver = document().styleResolver(); | 1879 StyleResolver* styleResolver = document().styleResolver(); |
1880 if (inActiveDocument() && styleResolver && styleChangeType() < SubtreeStyleC
hange) | 1880 if (inActiveDocument() && styleResolver) |
1881 document().styleEngine().pseudoStateChangedForElement(pseudo, *this); | 1881 document().styleEngine().pseudoStateChangedForElement(pseudo, *this); |
1882 } | 1882 } |
1883 | 1883 |
1884 void Element::setAnimationStyleChange(bool animationStyleChange) | 1884 void Element::setAnimationStyleChange(bool animationStyleChange) |
1885 { | 1885 { |
1886 if (animationStyleChange && document().inStyleRecalc()) | 1886 if (animationStyleChange && document().inStyleRecalc()) |
1887 return; | 1887 return; |
1888 if (!hasRareData()) | 1888 if (!hasRareData()) |
1889 return; | 1889 return; |
1890 if (ElementAnimations* elementAnimations = elementRareData()->elementAnimati
ons()) | 1890 if (ElementAnimations* elementAnimations = elementRareData()->elementAnimati
ons()) |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2067 } | 2067 } |
2068 return false; | 2068 return false; |
2069 } | 2069 } |
2070 | 2070 |
2071 void Element::checkForEmptyStyleChange() | 2071 void Element::checkForEmptyStyleChange() |
2072 { | 2072 { |
2073 const ComputedStyle* style = computedStyle(); | 2073 const ComputedStyle* style = computedStyle(); |
2074 | 2074 |
2075 if (!style && !styleAffectedByEmpty()) | 2075 if (!style && !styleAffectedByEmpty()) |
2076 return; | 2076 return; |
2077 if (styleChangeType() >= SubtreeStyleChange) | |
2078 return; | |
2079 if (!inActiveDocument()) | 2077 if (!inActiveDocument()) |
2080 return; | 2078 return; |
2081 if (!document().styleResolver()) | 2079 if (!document().styleResolver()) |
2082 return; | 2080 return; |
2083 | 2081 |
2084 if (!style || (styleAffectedByEmpty() && (!style->emptyState() || hasChildre
n()))) | 2082 if (!style || (styleAffectedByEmpty() && (!style->emptyState() || hasChildre
n()))) |
2085 pseudoStateChanged(CSSSelector::PseudoEmpty); | 2083 pseudoStateChanged(CSSSelector::PseudoEmpty); |
2086 } | 2084 } |
2087 | 2085 |
2088 void Element::childrenChanged(const ChildrenChange& change) | 2086 void Element::childrenChanged(const ChildrenChange& change) |
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3126 updateExtraNamedItemRegistration(oldId, newId); | 3124 updateExtraNamedItemRegistration(oldId, newId); |
3127 } | 3125 } |
3128 | 3126 |
3129 void Element::willModifyAttribute(const QualifiedName& name, const AtomicString&
oldValue, const AtomicString& newValue) | 3127 void Element::willModifyAttribute(const QualifiedName& name, const AtomicString&
oldValue, const AtomicString& newValue) |
3130 { | 3128 { |
3131 if (name == HTMLNames::nameAttr) { | 3129 if (name == HTMLNames::nameAttr) { |
3132 updateName(oldValue, newValue); | 3130 updateName(oldValue, newValue); |
3133 } | 3131 } |
3134 | 3132 |
3135 if (oldValue != newValue) { | 3133 if (oldValue != newValue) { |
3136 if (inActiveDocument() && document().styleResolver() && styleChangeType(
) < SubtreeStyleChange) | 3134 if (inActiveDocument() && document().styleResolver()) |
3137 document().styleEngine().attributeChangedForElement(name, *this); | 3135 document().styleEngine().attributeChangedForElement(name, *this); |
3138 | 3136 |
3139 if (isUpgradedCustomElement()) | 3137 if (isUpgradedCustomElement()) |
3140 CustomElement::attributeDidChange(this, name.localName(), oldValue,
newValue); | 3138 CustomElement::attributeDidChange(this, name.localName(), oldValue,
newValue); |
3141 } | 3139 } |
3142 | 3140 |
3143 if (OwnPtrWillBeRawPtr<MutationObserverInterestGroup> recipients = MutationO
bserverInterestGroup::createForAttributesMutation(*this, name)) | 3141 if (OwnPtrWillBeRawPtr<MutationObserverInterestGroup> recipients = MutationO
bserverInterestGroup::createForAttributesMutation(*this, name)) |
3144 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this,
name, oldValue)); | 3142 recipients->enqueueMutationRecord(MutationRecord::createAttributes(this,
name, oldValue)); |
3145 | 3143 |
3146 InspectorInstrumentation::willModifyDOMAttr(this, oldValue, newValue); | 3144 InspectorInstrumentation::willModifyDOMAttr(this, oldValue, newValue); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3646 { | 3644 { |
3647 #if ENABLE(OILPAN) | 3645 #if ENABLE(OILPAN) |
3648 if (hasRareData()) | 3646 if (hasRareData()) |
3649 visitor->trace(elementRareData()); | 3647 visitor->trace(elementRareData()); |
3650 visitor->trace(m_elementData); | 3648 visitor->trace(m_elementData); |
3651 #endif | 3649 #endif |
3652 ContainerNode::trace(visitor); | 3650 ContainerNode::trace(visitor); |
3653 } | 3651 } |
3654 | 3652 |
3655 } // namespace blink | 3653 } // namespace blink |
OLD | NEW |