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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 didModifyAttribute(existingAttributeName, newValue); | 964 didModifyAttribute(existingAttributeName, newValue); |
965 } | 965 } |
966 | 966 |
967 static inline AtomicString makeIdForStyleResolution(const AtomicString& value, b
ool inQuirksMode) | 967 static inline AtomicString makeIdForStyleResolution(const AtomicString& value, b
ool inQuirksMode) |
968 { | 968 { |
969 if (inQuirksMode) | 969 if (inQuirksMode) |
970 return value.lower(); | 970 return value.lower(); |
971 return value; | 971 return value; |
972 } | 972 } |
973 | 973 |
974 static bool checkNeedsStyleInvalidationForIdChange(const AtomicString& oldId, co
nst AtomicString& newId, const RuleFeatureSet& features) | |
975 { | |
976 ASSERT(newId != oldId); | |
977 if (!oldId.isEmpty() && features.hasSelectorForId(oldId)) | |
978 return true; | |
979 if (!newId.isEmpty() && features.hasSelectorForId(newId)) | |
980 return true; | |
981 return false; | |
982 } | |
983 | |
984 void Element::attributeChanged(const QualifiedName& name, const AtomicString& ne
wValue, AttributeModificationReason reason) | 974 void Element::attributeChanged(const QualifiedName& name, const AtomicString& ne
wValue, AttributeModificationReason reason) |
985 { | 975 { |
986 if (ElementShadow* parentElementShadow = shadowWhereNodeCanBeDistributed(*th
is)) { | 976 if (ElementShadow* parentElementShadow = shadowWhereNodeCanBeDistributed(*th
is)) { |
987 if (shouldInvalidateDistributionWhenAttributeChanged(parentElementShadow
, name, newValue)) | 977 if (shouldInvalidateDistributionWhenAttributeChanged(parentElementShadow
, name, newValue)) |
988 parentElementShadow->setNeedsDistributionRecalc(); | 978 parentElementShadow->setNeedsDistributionRecalc(); |
989 } | 979 } |
990 | 980 |
991 parseAttribute(name, newValue); | 981 parseAttribute(name, newValue); |
992 | 982 |
993 document().incDOMTreeVersion(); | 983 document().incDOMTreeVersion(); |
994 | 984 |
995 StyleResolver* styleResolver = document().styleResolver(); | 985 StyleResolver* styleResolver = document().styleResolver(); |
996 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl
eChangeType() < SubtreeStyleChange; | 986 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl
eChangeType() < SubtreeStyleChange; |
997 bool shouldInvalidateStyle = false; | |
998 | 987 |
999 if (isStyledElement() && name == styleAttr) { | 988 if (isStyledElement() && name == styleAttr) { |
1000 styleAttributeChanged(newValue, reason); | 989 styleAttributeChanged(newValue, reason); |
1001 } else if (isStyledElement() && isPresentationAttribute(name)) { | 990 } else if (isStyledElement() && isPresentationAttribute(name)) { |
1002 elementData()->m_presentationAttributeStyleIsDirty = true; | 991 elementData()->m_presentationAttributeStyleIsDirty = true; |
1003 setNeedsStyleRecalc(LocalStyleChange); | 992 setNeedsStyleRecalc(LocalStyleChange); |
1004 } | 993 } |
1005 | 994 |
1006 if (isIdAttributeName(name)) { | 995 if (isIdAttributeName(name)) { |
1007 AtomicString oldId = elementData()->idForStyleResolution(); | 996 AtomicString oldId = elementData()->idForStyleResolution(); |
1008 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui
rksMode()); | 997 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui
rksMode()); |
1009 if (newId != oldId) { | 998 if (newId != oldId) { |
1010 elementData()->setIdForStyleResolution(newId); | 999 elementData()->setIdForStyleResolution(newId); |
1011 shouldInvalidateStyle = testShouldInvalidateStyle && checkNeedsStyle
InvalidationForIdChange(oldId, newId, styleResolver->ensureUpdatedRuleFeatureSet
()); | 1000 if (testShouldInvalidateStyle) |
| 1001 styleResolver->ensureUpdatedRuleFeatureSet().scheduleStyleInvali
dationForIdChange(oldId, newId, *this); |
1012 } | 1002 } |
1013 } else if (name == classAttr) { | 1003 } else if (name == classAttr) { |
1014 classAttributeChanged(newValue); | 1004 classAttributeChanged(newValue); |
1015 } else if (name == HTMLNames::nameAttr) { | 1005 } else if (name == HTMLNames::nameAttr) { |
1016 setHasName(!newValue.isNull()); | 1006 setHasName(!newValue.isNull()); |
1017 } | 1007 } |
1018 | 1008 |
1019 invalidateNodeListCachesInAncestors(&name, this); | 1009 invalidateNodeListCachesInAncestors(&name, this); |
1020 | 1010 |
1021 // If there is currently no StyleResolver, we can't be sure that this attrib
ute change won't affect style. | 1011 // If there is currently no StyleResolver, we can't be sure that this attrib
ute change won't affect style. |
1022 shouldInvalidateStyle |= !styleResolver; | 1012 if (!styleResolver) |
1023 | |
1024 if (shouldInvalidateStyle) | |
1025 setNeedsStyleRecalc(SubtreeStyleChange); | 1013 setNeedsStyleRecalc(SubtreeStyleChange); |
1026 | 1014 |
1027 if (AXObjectCache* cache = document().existingAXObjectCache()) | 1015 if (AXObjectCache* cache = document().existingAXObjectCache()) |
1028 cache->handleAttributeChanged(name, this); | 1016 cache->handleAttributeChanged(name, this); |
1029 } | 1017 } |
1030 | 1018 |
1031 bool Element::hasLegalLinkAttribute(const QualifiedName&) const | 1019 bool Element::hasLegalLinkAttribute(const QualifiedName&) const |
1032 { | 1020 { |
1033 return false; | 1021 return false; |
1034 } | 1022 } |
(...skipping 2329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3364 || isHTMLObjectElement(*this) | 3352 || isHTMLObjectElement(*this) |
3365 || isHTMLAppletElement(*this) | 3353 || isHTMLAppletElement(*this) |
3366 || isHTMLCanvasElement(*this)) | 3354 || isHTMLCanvasElement(*this)) |
3367 return false; | 3355 return false; |
3368 if (FullscreenElementStack::isActiveFullScreenElement(this)) | 3356 if (FullscreenElementStack::isActiveFullScreenElement(this)) |
3369 return false; | 3357 return false; |
3370 return true; | 3358 return true; |
3371 } | 3359 } |
3372 | 3360 |
3373 } // namespace WebCore | 3361 } // namespace WebCore |
OLD | NEW |