| 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 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 | 952 |
| 953 document().incDOMTreeVersion(); | 953 document().incDOMTreeVersion(); |
| 954 | 954 |
| 955 StyleResolver* styleResolver = document().styleResolver(); | 955 StyleResolver* styleResolver = document().styleResolver(); |
| 956 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl
eChangeType() < SubtreeStyleChange; | 956 bool testShouldInvalidateStyle = inActiveDocument() && styleResolver && styl
eChangeType() < SubtreeStyleChange; |
| 957 | 957 |
| 958 if (isStyledElement() && name == styleAttr) { | 958 if (isStyledElement() && name == styleAttr) { |
| 959 styleAttributeChanged(newValue, reason); | 959 styleAttributeChanged(newValue, reason); |
| 960 } else if (isStyledElement() && isPresentationAttribute(name)) { | 960 } else if (isStyledElement() && isPresentationAttribute(name)) { |
| 961 elementData()->m_presentationAttributeStyleIsDirty = true; | 961 elementData()->m_presentationAttributeStyleIsDirty = true; |
| 962 setNeedsStyleRecalc(LocalStyleChange); | 962 setNeedsStyleRecalc(StyleChangeReasonForTracing::fromAttribute(name), Lo
calStyleChange); |
| 963 } | 963 } |
| 964 | 964 |
| 965 if (isIdAttributeName(name)) { | 965 if (isIdAttributeName(name)) { |
| 966 AtomicString oldId = elementData()->idForStyleResolution(); | 966 AtomicString oldId = elementData()->idForStyleResolution(); |
| 967 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui
rksMode()); | 967 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui
rksMode()); |
| 968 if (newId != oldId) { | 968 if (newId != oldId) { |
| 969 elementData()->setIdForStyleResolution(newId); | 969 elementData()->setIdForStyleResolution(newId); |
| 970 if (testShouldInvalidateStyle) | 970 if (testShouldInvalidateStyle) |
| 971 styleResolver->ensureUpdatedRuleFeatureSet().scheduleStyleInvali
dationForIdChange(oldId, newId, *this); | 971 styleResolver->ensureUpdatedRuleFeatureSet().scheduleStyleInvali
dationForIdChange(oldId, newId, *this); |
| 972 } | 972 } |
| 973 } else if (name == classAttr) { | 973 } else if (name == classAttr) { |
| 974 classAttributeChanged(newValue); | 974 classAttributeChanged(newValue); |
| 975 } else if (name == HTMLNames::nameAttr) { | 975 } else if (name == HTMLNames::nameAttr) { |
| 976 setHasName(!newValue.isNull()); | 976 setHasName(!newValue.isNull()); |
| 977 } | 977 } |
| 978 | 978 |
| 979 invalidateNodeListCachesInAncestors(&name, this); | 979 invalidateNodeListCachesInAncestors(&name, this); |
| 980 | 980 |
| 981 // If there is currently no StyleResolver, we can't be sure that this attrib
ute change won't affect style. | 981 // If there is currently no StyleResolver, we can't be sure that this attrib
ute change won't affect style. |
| 982 if (!styleResolver) | 982 if (!styleResolver) |
| 983 setNeedsStyleRecalc(SubtreeStyleChange); | 983 setNeedsStyleRecalc(StyleChangeReasonForTracing::fromAttribute(name), Su
btreeStyleChange); |
| 984 | 984 |
| 985 if (AXObjectCache* cache = document().existingAXObjectCache()) | 985 if (AXObjectCache* cache = document().existingAXObjectCache()) |
| 986 cache->handleAttributeChanged(name, this); | 986 cache->handleAttributeChanged(name, this); |
| 987 } | 987 } |
| 988 | 988 |
| 989 bool Element::hasLegalLinkAttribute(const QualifiedName&) const | 989 bool Element::hasLegalLinkAttribute(const QualifiedName&) const |
| 990 { | 990 { |
| 991 return false; | 991 return false; |
| 992 } | 992 } |
| 993 | 993 |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 ElementShadow* Element::shadow() const | 1591 ElementShadow* Element::shadow() const |
| 1592 { | 1592 { |
| 1593 return hasRareData() ? elementRareData()->shadow() : 0; | 1593 return hasRareData() ? elementRareData()->shadow() : 0; |
| 1594 } | 1594 } |
| 1595 | 1595 |
| 1596 ElementShadow& Element::ensureShadow() | 1596 ElementShadow& Element::ensureShadow() |
| 1597 { | 1597 { |
| 1598 return ensureElementRareData().ensureShadow(); | 1598 return ensureElementRareData().ensureShadow(); |
| 1599 } | 1599 } |
| 1600 | 1600 |
| 1601 void Element::didAffectSelector(AffectedSelectorMask mask) | 1601 void Element::didAffectSelector(const StyleChangeReasonForTracing& reason, Affec
tedSelectorMask mask) |
| 1602 { | 1602 { |
| 1603 setNeedsStyleRecalc(SubtreeStyleChange); | 1603 setNeedsStyleRecalc(reason, SubtreeStyleChange); |
| 1604 if (ElementShadow* elementShadow = shadowWhereNodeCanBeDistributed(*this)) | 1604 if (ElementShadow* elementShadow = shadowWhereNodeCanBeDistributed(*this)) |
| 1605 elementShadow->didAffectSelector(mask); | 1605 elementShadow->didAffectSelector(mask); |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 void Element::setAnimationStyleChange(bool animationStyleChange) | 1608 void Element::setAnimationStyleChange(bool animationStyleChange) |
| 1609 { | 1609 { |
| 1610 if (animationStyleChange && document().inStyleRecalc()) | 1610 if (animationStyleChange && document().inStyleRecalc()) |
| 1611 return; | 1611 return; |
| 1612 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimations
()) | 1612 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimations
()) |
| 1613 activeAnimations->setAnimationStyleChange(animationStyleChange); | 1613 activeAnimations->setAnimationStyleChange(animationStyleChange); |
| 1614 } | 1614 } |
| 1615 | 1615 |
| 1616 void Element::setNeedsAnimationStyleRecalc() | 1616 void Element::setNeedsAnimationStyleRecalc() |
| 1617 { | 1617 { |
| 1618 if (styleChangeType() != NoStyleChange) | 1618 if (styleChangeType() != NoStyleChange) |
| 1619 return; | 1619 return; |
| 1620 | 1620 |
| 1621 setNeedsStyleRecalc(LocalStyleChange); | 1621 setNeedsStyleRecalc(StyleChangeReasonForTracing::create(StyleChangeReason::A
nimation), LocalStyleChange); |
| 1622 setAnimationStyleChange(true); | 1622 setAnimationStyleChange(true); |
| 1623 } | 1623 } |
| 1624 | 1624 |
| 1625 void Element::setNeedsCompositingUpdate() | 1625 void Element::setNeedsCompositingUpdate() |
| 1626 { | 1626 { |
| 1627 if (!document().isActive()) | 1627 if (!document().isActive()) |
| 1628 return; | 1628 return; |
| 1629 RenderBoxModelObject* renderer = renderBoxModelObject(); | 1629 RenderBoxModelObject* renderer = renderBoxModelObject(); |
| 1630 if (!renderer) | 1630 if (!renderer) |
| 1631 return; | 1631 return; |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2624 } | 2624 } |
| 2625 | 2625 |
| 2626 void Element::setFloatingPointAttribute(const QualifiedName& attributeName, doub
le value) | 2626 void Element::setFloatingPointAttribute(const QualifiedName& attributeName, doub
le value) |
| 2627 { | 2627 { |
| 2628 setAttribute(attributeName, AtomicString::number(value)); | 2628 setAttribute(attributeName, AtomicString::number(value)); |
| 2629 } | 2629 } |
| 2630 | 2630 |
| 2631 void Element::setContainsFullScreenElement(bool flag) | 2631 void Element::setContainsFullScreenElement(bool flag) |
| 2632 { | 2632 { |
| 2633 setElementFlag(ContainsFullScreenElement, flag); | 2633 setElementFlag(ContainsFullScreenElement, flag); |
| 2634 setNeedsStyleRecalc(SubtreeStyleChange); | 2634 setNeedsStyleRecalc(StyleChangeReasonForTracing::create(StyleChangeReason::F
ullScreen), SubtreeStyleChange); |
| 2635 } | 2635 } |
| 2636 | 2636 |
| 2637 static Element* parentCrossingFrameBoundaries(Element* element) | 2637 static Element* parentCrossingFrameBoundaries(Element* element) |
| 2638 { | 2638 { |
| 2639 ASSERT(element); | 2639 ASSERT(element); |
| 2640 return element->parentElement() ? element->parentElement() : element->docume
nt().ownerElement(); | 2640 return element->parentElement() ? element->parentElement() : element->docume
nt().ownerElement(); |
| 2641 } | 2641 } |
| 2642 | 2642 |
| 2643 void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo
l flag) | 2643 void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo
l flag) |
| 2644 { | 2644 { |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3089 startLineNumber = document().scriptableDocumentParser()->lineNumber(); | 3089 startLineNumber = document().scriptableDocumentParser()->lineNumber(); |
| 3090 | 3090 |
| 3091 if (newStyleString.isNull()) { | 3091 if (newStyleString.isNull()) { |
| 3092 ensureUniqueElementData().m_inlineStyle.clear(); | 3092 ensureUniqueElementData().m_inlineStyle.clear(); |
| 3093 } else if (modificationReason == ModifiedByCloning || document().contentSecu
rityPolicy()->allowInlineStyle(document().url(), startLineNumber)) { | 3093 } else if (modificationReason == ModifiedByCloning || document().contentSecu
rityPolicy()->allowInlineStyle(document().url(), startLineNumber)) { |
| 3094 setInlineStyleFromString(newStyleString); | 3094 setInlineStyleFromString(newStyleString); |
| 3095 } | 3095 } |
| 3096 | 3096 |
| 3097 elementData()->m_styleAttributeIsDirty = false; | 3097 elementData()->m_styleAttributeIsDirty = false; |
| 3098 | 3098 |
| 3099 setNeedsStyleRecalc(LocalStyleChange); | 3099 setNeedsStyleRecalc(StyleChangeReasonForTracing::create(StyleChangeReason::S
tyleSheetChange), LocalStyleChange); |
| 3100 InspectorInstrumentation::didInvalidateStyleAttr(this); | 3100 InspectorInstrumentation::didInvalidateStyleAttr(this); |
| 3101 } | 3101 } |
| 3102 | 3102 |
| 3103 void Element::inlineStyleChanged() | 3103 void Element::inlineStyleChanged() |
| 3104 { | 3104 { |
| 3105 ASSERT(isStyledElement()); | 3105 ASSERT(isStyledElement()); |
| 3106 setNeedsStyleRecalc(LocalStyleChange); | 3106 setNeedsStyleRecalc(StyleChangeReasonForTracing::create(StyleChangeReason::I
nline), LocalStyleChange); |
| 3107 ASSERT(elementData()); | 3107 ASSERT(elementData()); |
| 3108 elementData()->m_styleAttributeIsDirty = true; | 3108 elementData()->m_styleAttributeIsDirty = true; |
| 3109 InspectorInstrumentation::didInvalidateStyleAttr(this); | 3109 InspectorInstrumentation::didInvalidateStyleAttr(this); |
| 3110 } | 3110 } |
| 3111 | 3111 |
| 3112 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identi
fier, bool important) | 3112 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identi
fier, bool important) |
| 3113 { | 3113 { |
| 3114 ASSERT(isStyledElement()); | 3114 ASSERT(isStyledElement()); |
| 3115 ensureMutableInlineStyle().setProperty(propertyID, cssValuePool().createIden
tifierValue(identifier), important); | 3115 ensureMutableInlineStyle().setProperty(propertyID, cssValuePool().createIden
tifierValue(identifier), important); |
| 3116 inlineStyleChanged(); | 3116 inlineStyleChanged(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3259 return v8::Handle<v8::Object>(); | 3259 return v8::Handle<v8::Object>(); |
| 3260 | 3260 |
| 3261 wrapper->SetPrototype(binding->prototype()); | 3261 wrapper->SetPrototype(binding->prototype()); |
| 3262 | 3262 |
| 3263 wrapperType->refObject(toScriptWrappableBase()); | 3263 wrapperType->refObject(toScriptWrappableBase()); |
| 3264 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp
er, isolate); | 3264 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp
er, isolate); |
| 3265 return wrapper; | 3265 return wrapper; |
| 3266 } | 3266 } |
| 3267 | 3267 |
| 3268 } // namespace blink | 3268 } // namespace blink |
| OLD | NEW |