Chromium Code Reviews| 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::Attribute, LocalStyleCh ange); |
|
esprehn
2014/09/19 04:53:09
Shouldn't we pass along the name of the attribute
kouhei (in TOK)
2014/09/22 09:03:54
Done.
| |
| 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::Attribute, SubtreeStyle Change); |
| 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1599 return hasRareData() ? elementRareData()->shadow() : 0; | 1599 return hasRareData() ? elementRareData()->shadow() : 0; |
| 1600 } | 1600 } |
| 1601 | 1601 |
| 1602 ElementShadow& Element::ensureShadow() | 1602 ElementShadow& Element::ensureShadow() |
| 1603 { | 1603 { |
| 1604 return ensureElementRareData().ensureShadow(); | 1604 return ensureElementRareData().ensureShadow(); |
| 1605 } | 1605 } |
| 1606 | 1606 |
| 1607 void Element::didAffectSelector(AffectedSelectorMask mask) | 1607 void Element::didAffectSelector(AffectedSelectorMask mask) |
| 1608 { | 1608 { |
| 1609 setNeedsStyleRecalc(SubtreeStyleChange); | 1609 setNeedsStyleRecalc(StyleChangeReasonForTracing::Selector, SubtreeStyleChang e); |
|
esprehn
2014/09/19 04:53:09
which selector?
kouhei (in TOK)
2014/09/22 09:03:54
Done.
| |
| 1610 if (ElementShadow* elementShadow = shadowWhereNodeCanBeDistributed(*this)) | 1610 if (ElementShadow* elementShadow = shadowWhereNodeCanBeDistributed(*this)) |
| 1611 elementShadow->didAffectSelector(mask); | 1611 elementShadow->didAffectSelector(mask); |
| 1612 } | 1612 } |
| 1613 | 1613 |
| 1614 void Element::setAnimationStyleChange(bool animationStyleChange) | 1614 void Element::setAnimationStyleChange(bool animationStyleChange) |
| 1615 { | 1615 { |
| 1616 if (animationStyleChange && document().inStyleRecalc()) | 1616 if (animationStyleChange && document().inStyleRecalc()) |
| 1617 return; | 1617 return; |
| 1618 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimations ()) | 1618 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimations ()) |
| 1619 activeAnimations->setAnimationStyleChange(animationStyleChange); | 1619 activeAnimations->setAnimationStyleChange(animationStyleChange); |
| 1620 } | 1620 } |
| 1621 | 1621 |
| 1622 void Element::setNeedsAnimationStyleRecalc() | 1622 void Element::setNeedsAnimationStyleRecalc() |
| 1623 { | 1623 { |
| 1624 if (styleChangeType() != NoStyleChange) | 1624 if (styleChangeType() != NoStyleChange) |
| 1625 return; | 1625 return; |
| 1626 | 1626 |
| 1627 setNeedsStyleRecalc(LocalStyleChange); | 1627 setNeedsStyleRecalc(StyleChangeReasonForTracing::Animation, LocalStyleChange ); |
| 1628 setAnimationStyleChange(true); | 1628 setAnimationStyleChange(true); |
| 1629 } | 1629 } |
| 1630 | 1630 |
| 1631 void Element::setNeedsCompositingUpdate() | 1631 void Element::setNeedsCompositingUpdate() |
| 1632 { | 1632 { |
| 1633 if (!document().isActive()) | 1633 if (!document().isActive()) |
| 1634 return; | 1634 return; |
| 1635 RenderBoxModelObject* renderer = renderBoxModelObject(); | 1635 RenderBoxModelObject* renderer = renderBoxModelObject(); |
| 1636 if (!renderer) | 1636 if (!renderer) |
| 1637 return; | 1637 return; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1719 } | 1719 } |
| 1720 | 1720 |
| 1721 void Element::checkForEmptyStyleChange() | 1721 void Element::checkForEmptyStyleChange() |
| 1722 { | 1722 { |
| 1723 RenderStyle* style = renderStyle(); | 1723 RenderStyle* style = renderStyle(); |
| 1724 | 1724 |
| 1725 if (!style && !styleAffectedByEmpty()) | 1725 if (!style && !styleAffectedByEmpty()) |
| 1726 return; | 1726 return; |
| 1727 | 1727 |
| 1728 if (!style || (styleAffectedByEmpty() && (!style->emptyState() || hasChildre n()))) | 1728 if (!style || (styleAffectedByEmpty() && (!style->emptyState() || hasChildre n()))) |
| 1729 setNeedsStyleRecalc(SubtreeStyleChange); | 1729 setNeedsStyleRecalc(StyleChangeReasonForTracing::EmptyPseudoClass, Subtr eeStyleChange); |
| 1730 } | 1730 } |
| 1731 | 1731 |
| 1732 void Element::childrenChanged(const ChildrenChange& change) | 1732 void Element::childrenChanged(const ChildrenChange& change) |
| 1733 { | 1733 { |
| 1734 ContainerNode::childrenChanged(change); | 1734 ContainerNode::childrenChanged(change); |
| 1735 | 1735 |
| 1736 checkForEmptyStyleChange(); | 1736 checkForEmptyStyleChange(); |
| 1737 if (!change.byParser && change.isChildElementChange()) | 1737 if (!change.byParser && change.isChildElementChange()) |
| 1738 checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingEleme ntRemoved : SiblingElementInserted, change.siblingBeforeChange, change.siblingAf terChange); | 1738 checkForSiblingStyleChanges(change.type == ElementRemoved ? SiblingEleme ntRemoved : SiblingElementInserted, change.siblingBeforeChange, change.siblingAf terChange); |
| 1739 | 1739 |
| (...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2637 } | 2637 } |
| 2638 | 2638 |
| 2639 void Element::setFloatingPointAttribute(const QualifiedName& attributeName, doub le value) | 2639 void Element::setFloatingPointAttribute(const QualifiedName& attributeName, doub le value) |
| 2640 { | 2640 { |
| 2641 setAttribute(attributeName, AtomicString::number(value)); | 2641 setAttribute(attributeName, AtomicString::number(value)); |
| 2642 } | 2642 } |
| 2643 | 2643 |
| 2644 void Element::setContainsFullScreenElement(bool flag) | 2644 void Element::setContainsFullScreenElement(bool flag) |
| 2645 { | 2645 { |
| 2646 setElementFlag(ContainsFullScreenElement, flag); | 2646 setElementFlag(ContainsFullScreenElement, flag); |
| 2647 setNeedsStyleRecalc(SubtreeStyleChange); | 2647 setNeedsStyleRecalc(StyleChangeReasonForTracing::FullScreen, SubtreeStyleCha nge); |
| 2648 } | 2648 } |
| 2649 | 2649 |
| 2650 static Element* parentCrossingFrameBoundaries(Element* element) | 2650 static Element* parentCrossingFrameBoundaries(Element* element) |
| 2651 { | 2651 { |
| 2652 ASSERT(element); | 2652 ASSERT(element); |
| 2653 return element->parentElement() ? element->parentElement() : element->docume nt().ownerElement(); | 2653 return element->parentElement() ? element->parentElement() : element->docume nt().ownerElement(); |
| 2654 } | 2654 } |
| 2655 | 2655 |
| 2656 void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo l flag) | 2656 void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo l flag) |
| 2657 { | 2657 { |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3102 startLineNumber = document().scriptableDocumentParser()->lineNumber(); | 3102 startLineNumber = document().scriptableDocumentParser()->lineNumber(); |
| 3103 | 3103 |
| 3104 if (newStyleString.isNull()) { | 3104 if (newStyleString.isNull()) { |
| 3105 ensureUniqueElementData().m_inlineStyle.clear(); | 3105 ensureUniqueElementData().m_inlineStyle.clear(); |
| 3106 } else if (modificationReason == ModifiedByCloning || document().contentSecu rityPolicy()->allowInlineStyle(document().url(), startLineNumber)) { | 3106 } else if (modificationReason == ModifiedByCloning || document().contentSecu rityPolicy()->allowInlineStyle(document().url(), startLineNumber)) { |
| 3107 setInlineStyleFromString(newStyleString); | 3107 setInlineStyleFromString(newStyleString); |
| 3108 } | 3108 } |
| 3109 | 3109 |
| 3110 elementData()->m_styleAttributeIsDirty = false; | 3110 elementData()->m_styleAttributeIsDirty = false; |
| 3111 | 3111 |
| 3112 setNeedsStyleRecalc(LocalStyleChange); | 3112 setNeedsStyleRecalc(StyleChangeReasonForTracing::StyleSheetChange, LocalStyl eChange); |
| 3113 InspectorInstrumentation::didInvalidateStyleAttr(this); | 3113 InspectorInstrumentation::didInvalidateStyleAttr(this); |
| 3114 } | 3114 } |
| 3115 | 3115 |
| 3116 void Element::inlineStyleChanged() | 3116 void Element::inlineStyleChanged() |
| 3117 { | 3117 { |
| 3118 ASSERT(isStyledElement()); | 3118 ASSERT(isStyledElement()); |
| 3119 setNeedsStyleRecalc(LocalStyleChange); | 3119 setNeedsStyleRecalc(StyleChangeReasonForTracing::Inline, LocalStyleChange); |
| 3120 ASSERT(elementData()); | 3120 ASSERT(elementData()); |
| 3121 elementData()->m_styleAttributeIsDirty = true; | 3121 elementData()->m_styleAttributeIsDirty = true; |
| 3122 InspectorInstrumentation::didInvalidateStyleAttr(this); | 3122 InspectorInstrumentation::didInvalidateStyleAttr(this); |
| 3123 } | 3123 } |
| 3124 | 3124 |
| 3125 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identi fier, bool important) | 3125 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identi fier, bool important) |
| 3126 { | 3126 { |
| 3127 ASSERT(isStyledElement()); | 3127 ASSERT(isStyledElement()); |
| 3128 ensureMutableInlineStyle().setProperty(propertyID, cssValuePool().createIden tifierValue(identifier), important); | 3128 ensureMutableInlineStyle().setProperty(propertyID, cssValuePool().createIden tifierValue(identifier), important); |
| 3129 inlineStyleChanged(); | 3129 inlineStyleChanged(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3267 return v8::Handle<v8::Object>(); | 3267 return v8::Handle<v8::Object>(); |
| 3268 | 3268 |
| 3269 wrapper->SetPrototype(binding->prototype()); | 3269 wrapper->SetPrototype(binding->prototype()); |
| 3270 | 3270 |
| 3271 wrapperType->refObject(toScriptWrappableBase()); | 3271 wrapperType->refObject(toScriptWrappableBase()); |
| 3272 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp er, isolate); | 3272 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp er, isolate); |
| 3273 return wrapper; | 3273 return wrapper; |
| 3274 } | 3274 } |
| 3275 | 3275 |
| 3276 } // namespace blink | 3276 } // namespace blink |
| OLD | NEW |