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 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 | 951 |
952 document().incDOMTreeVersion(); | 952 document().incDOMTreeVersion(); |
953 | 953 |
954 StyleResolver* styleResolver = document().styleResolver(); | 954 StyleResolver* styleResolver = document().styleResolver(); |
955 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl
eChangeType() < SubtreeStyleChange; | 955 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl
eChangeType() < SubtreeStyleChange; |
956 | 956 |
957 if (isStyledElement() && name == styleAttr) { | 957 if (isStyledElement() && name == styleAttr) { |
958 styleAttributeChanged(newValue, reason); | 958 styleAttributeChanged(newValue, reason); |
959 } else if (isStyledElement() && isPresentationAttribute(name)) { | 959 } else if (isStyledElement() && isPresentationAttribute(name)) { |
960 elementData()->m_presentationAttributeStyleIsDirty = true; | 960 elementData()->m_presentationAttributeStyleIsDirty = true; |
961 setNeedsStyleRecalc(LocalStyleChange); | 961 setNeedsStyleRecalc(StyleRecalcDueToAttribute, LocalStyleChange); |
962 } | 962 } |
963 | 963 |
964 if (isIdAttributeName(name)) { | 964 if (isIdAttributeName(name)) { |
965 AtomicString oldId = elementData()->idForStyleResolution(); | 965 AtomicString oldId = elementData()->idForStyleResolution(); |
966 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui
rksMode()); | 966 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui
rksMode()); |
967 if (newId != oldId) { | 967 if (newId != oldId) { |
968 elementData()->setIdForStyleResolution(newId); | 968 elementData()->setIdForStyleResolution(newId); |
969 if (testShouldInvalidateStyle) | 969 if (testShouldInvalidateStyle) |
970 styleResolver->ensureUpdatedRuleFeatureSet().scheduleStyleInvali
dationForIdChange(oldId, newId, *this); | 970 styleResolver->ensureUpdatedRuleFeatureSet().scheduleStyleInvali
dationForIdChange(oldId, newId, *this); |
971 } | 971 } |
972 } else if (name == classAttr) { | 972 } else if (name == classAttr) { |
973 classAttributeChanged(newValue); | 973 classAttributeChanged(newValue); |
974 } else if (name == HTMLNames::nameAttr) { | 974 } else if (name == HTMLNames::nameAttr) { |
975 setHasName(!newValue.isNull()); | 975 setHasName(!newValue.isNull()); |
976 } | 976 } |
977 | 977 |
978 invalidateNodeListCachesInAncestors(&name, this); | 978 invalidateNodeListCachesInAncestors(&name, this); |
979 | 979 |
980 // If there is currently no StyleResolver, we can't be sure that this attrib
ute change won't affect style. | 980 // If there is currently no StyleResolver, we can't be sure that this attrib
ute change won't affect style. |
981 if (!styleResolver) | 981 if (!styleResolver) |
982 setNeedsStyleRecalc(SubtreeStyleChange); | 982 setNeedsStyleRecalc(StyleRecalcDueToAttribute, SubtreeStyleChange); |
983 | 983 |
984 if (AXObjectCache* cache = document().existingAXObjectCache()) | 984 if (AXObjectCache* cache = document().existingAXObjectCache()) |
985 cache->handleAttributeChanged(name, this); | 985 cache->handleAttributeChanged(name, this); |
986 } | 986 } |
987 | 987 |
988 bool Element::hasLegalLinkAttribute(const QualifiedName&) const | 988 bool Element::hasLegalLinkAttribute(const QualifiedName&) const |
989 { | 989 { |
990 return false; | 990 return false; |
991 } | 991 } |
992 | 992 |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 return hasRareData() ? elementRareData()->shadow() : 0; | 1631 return hasRareData() ? elementRareData()->shadow() : 0; |
1632 } | 1632 } |
1633 | 1633 |
1634 ElementShadow& Element::ensureShadow() | 1634 ElementShadow& Element::ensureShadow() |
1635 { | 1635 { |
1636 return ensureElementRareData().ensureShadow(); | 1636 return ensureElementRareData().ensureShadow(); |
1637 } | 1637 } |
1638 | 1638 |
1639 void Element::didAffectSelector(AffectedSelectorMask mask) | 1639 void Element::didAffectSelector(AffectedSelectorMask mask) |
1640 { | 1640 { |
1641 setNeedsStyleRecalc(SubtreeStyleChange); | 1641 setNeedsStyleRecalc(StyleRecalcDueToSelector, SubtreeStyleChange); |
1642 if (ElementShadow* elementShadow = shadowWhereNodeCanBeDistributed(*this)) | 1642 if (ElementShadow* elementShadow = shadowWhereNodeCanBeDistributed(*this)) |
1643 elementShadow->didAffectSelector(mask); | 1643 elementShadow->didAffectSelector(mask); |
1644 } | 1644 } |
1645 | 1645 |
1646 void Element::setAnimationStyleChange(bool animationStyleChange) | 1646 void Element::setAnimationStyleChange(bool animationStyleChange) |
1647 { | 1647 { |
1648 if (animationStyleChange && document().inStyleRecalc()) | 1648 if (animationStyleChange && document().inStyleRecalc()) |
1649 return; | 1649 return; |
1650 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimations
()) | 1650 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimations
()) |
1651 activeAnimations->setAnimationStyleChange(animationStyleChange); | 1651 activeAnimations->setAnimationStyleChange(animationStyleChange); |
1652 } | 1652 } |
1653 | 1653 |
1654 void Element::setNeedsAnimationStyleRecalc() | 1654 void Element::setNeedsAnimationStyleRecalc() |
1655 { | 1655 { |
1656 if (styleChangeType() != NoStyleChange) | 1656 if (styleChangeType() != NoStyleChange) |
1657 return; | 1657 return; |
1658 | 1658 |
1659 setNeedsStyleRecalc(LocalStyleChange); | 1659 setNeedsStyleRecalc(StyleRecalcDueToAnimation, LocalStyleChange); |
1660 setAnimationStyleChange(true); | 1660 setAnimationStyleChange(true); |
1661 } | 1661 } |
1662 | 1662 |
1663 void Element::setNeedsCompositingUpdate() | 1663 void Element::setNeedsCompositingUpdate() |
1664 { | 1664 { |
1665 if (!document().isActive()) | 1665 if (!document().isActive()) |
1666 return; | 1666 return; |
1667 RenderBoxModelObject* renderer = renderBoxModelObject(); | 1667 RenderBoxModelObject* renderer = renderBoxModelObject(); |
1668 if (!renderer) | 1668 if (!renderer) |
1669 return; | 1669 return; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 } | 1751 } |
1752 | 1752 |
1753 void Element::checkForEmptyStyleChange() | 1753 void Element::checkForEmptyStyleChange() |
1754 { | 1754 { |
1755 RenderStyle* style = renderStyle(); | 1755 RenderStyle* style = renderStyle(); |
1756 | 1756 |
1757 if (!style && !styleAffectedByEmpty()) | 1757 if (!style && !styleAffectedByEmpty()) |
1758 return; | 1758 return; |
1759 | 1759 |
1760 if (!style || (styleAffectedByEmpty() && (!style->emptyState() || hasChildre
n()))) | 1760 if (!style || (styleAffectedByEmpty() && (!style->emptyState() || hasChildre
n()))) |
1761 setNeedsStyleRecalc(SubtreeStyleChange); | 1761 setNeedsStyleRecalc(StyleRecalcDueToEmptyPseudoClass, SubtreeStyleChange
); |
1762 } | 1762 } |
1763 | 1763 |
1764 void Element::childrenChanged(const ChildrenChange& change) | 1764 void Element::childrenChanged(const ChildrenChange& change) |
1765 { | 1765 { |
1766 ContainerNode::childrenChanged(change); | 1766 ContainerNode::childrenChanged(change); |
1767 | 1767 |
1768 checkForEmptyStyleChange(); | 1768 checkForEmptyStyleChange(); |
1769 if (!change.byParser && change.isChildElementChange()) | 1769 if (!change.byParser && change.isChildElementChange()) |
1770 checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingEleme
ntRemoved : SiblingElementInserted, change.siblingBeforeChange, change.siblingAf
terChange); | 1770 checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingEleme
ntRemoved : SiblingElementInserted, change.siblingBeforeChange, change.siblingAf
terChange); |
1771 | 1771 |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2669 } | 2669 } |
2670 | 2670 |
2671 void Element::setFloatingPointAttribute(const QualifiedName& attributeName, doub
le value) | 2671 void Element::setFloatingPointAttribute(const QualifiedName& attributeName, doub
le value) |
2672 { | 2672 { |
2673 setAttribute(attributeName, AtomicString::number(value)); | 2673 setAttribute(attributeName, AtomicString::number(value)); |
2674 } | 2674 } |
2675 | 2675 |
2676 void Element::setContainsFullScreenElement(bool flag) | 2676 void Element::setContainsFullScreenElement(bool flag) |
2677 { | 2677 { |
2678 setElementFlag(ContainsFullScreenElement, flag); | 2678 setElementFlag(ContainsFullScreenElement, flag); |
2679 setNeedsStyleRecalc(SubtreeStyleChange); | 2679 setNeedsStyleRecalc(StyleRecalcDueToFullScreen, SubtreeStyleChange); |
2680 } | 2680 } |
2681 | 2681 |
2682 static Element* parentCrossingFrameBoundaries(Element* element) | 2682 static Element* parentCrossingFrameBoundaries(Element* element) |
2683 { | 2683 { |
2684 ASSERT(element); | 2684 ASSERT(element); |
2685 return element->parentElement() ? element->parentElement() : element->docume
nt().ownerElement(); | 2685 return element->parentElement() ? element->parentElement() : element->docume
nt().ownerElement(); |
2686 } | 2686 } |
2687 | 2687 |
2688 void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo
l flag) | 2688 void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo
l flag) |
2689 { | 2689 { |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3134 startLineNumber = document().scriptableDocumentParser()->lineNumber(); | 3134 startLineNumber = document().scriptableDocumentParser()->lineNumber(); |
3135 | 3135 |
3136 if (newStyleString.isNull()) { | 3136 if (newStyleString.isNull()) { |
3137 ensureUniqueElementData().m_inlineStyle.clear(); | 3137 ensureUniqueElementData().m_inlineStyle.clear(); |
3138 } else if (modificationReason == ModifiedByCloning || document().contentSecu
rityPolicy()->allowInlineStyle(document().url(), startLineNumber)) { | 3138 } else if (modificationReason == ModifiedByCloning || document().contentSecu
rityPolicy()->allowInlineStyle(document().url(), startLineNumber)) { |
3139 setInlineStyleFromString(newStyleString); | 3139 setInlineStyleFromString(newStyleString); |
3140 } | 3140 } |
3141 | 3141 |
3142 elementData()->m_styleAttributeIsDirty = false; | 3142 elementData()->m_styleAttributeIsDirty = false; |
3143 | 3143 |
3144 setNeedsStyleRecalc(LocalStyleChange); | 3144 setNeedsStyleRecalc(StyleRecalcDueToStyleSheetChange, LocalStyleChange); |
3145 InspectorInstrumentation::didInvalidateStyleAttr(this); | 3145 InspectorInstrumentation::didInvalidateStyleAttr(this); |
3146 } | 3146 } |
3147 | 3147 |
3148 void Element::inlineStyleChanged() | 3148 void Element::inlineStyleChanged() |
3149 { | 3149 { |
3150 ASSERT(isStyledElement()); | 3150 ASSERT(isStyledElement()); |
3151 setNeedsStyleRecalc(LocalStyleChange); | 3151 setNeedsStyleRecalc(StyleRecalcDueToInline, LocalStyleChange); |
3152 ASSERT(elementData()); | 3152 ASSERT(elementData()); |
3153 elementData()->m_styleAttributeIsDirty = true; | 3153 elementData()->m_styleAttributeIsDirty = true; |
3154 InspectorInstrumentation::didInvalidateStyleAttr(this); | 3154 InspectorInstrumentation::didInvalidateStyleAttr(this); |
3155 } | 3155 } |
3156 | 3156 |
3157 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identi
fier, bool important) | 3157 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identi
fier, bool important) |
3158 { | 3158 { |
3159 ASSERT(isStyledElement()); | 3159 ASSERT(isStyledElement()); |
3160 ensureMutableInlineStyle().setProperty(propertyID, cssValuePool().createIden
tifierValue(identifier), important); | 3160 ensureMutableInlineStyle().setProperty(propertyID, cssValuePool().createIden
tifierValue(identifier), important); |
3161 inlineStyleChanged(); | 3161 inlineStyleChanged(); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3299 return v8::Handle<v8::Object>(); | 3299 return v8::Handle<v8::Object>(); |
3300 | 3300 |
3301 wrapper->SetPrototype(binding->prototype()); | 3301 wrapper->SetPrototype(binding->prototype()); |
3302 | 3302 |
3303 wrapperType->refObject(toScriptWrappableBase()); | 3303 wrapperType->refObject(toScriptWrappableBase()); |
3304 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp
er, isolate); | 3304 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp
er, isolate); |
3305 return wrapper; | 3305 return wrapper; |
3306 } | 3306 } |
3307 | 3307 |
3308 } // namespace blink | 3308 } // namespace blink |
OLD | NEW |