Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Side by Side Diff: Source/core/dom/Element.cpp

Issue 547823002: Track reasons for |Node::SetNeedsStyleRecalc| (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use AtomicString Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/dom/DocumentStyleSheetCollection.cpp ('k') | Source/core/dom/Fullscreen.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(LocalStyleChange, StyleChangeReasonForTracing::fromA ttribute(name));
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(SubtreeStyleChange, StyleChangeReasonForTracing::fro mAttribute(name));
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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 return; 1615 return;
1616 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimations ()) 1616 if (ActiveAnimations* activeAnimations = elementRareData()->activeAnimations ())
1617 activeAnimations->setAnimationStyleChange(animationStyleChange); 1617 activeAnimations->setAnimationStyleChange(animationStyleChange);
1618 } 1618 }
1619 1619
1620 void Element::setNeedsAnimationStyleRecalc() 1620 void Element::setNeedsAnimationStyleRecalc()
1621 { 1621 {
1622 if (styleChangeType() != NoStyleChange) 1622 if (styleChangeType() != NoStyleChange)
1623 return; 1623 return;
1624 1624
1625 setNeedsStyleRecalc(LocalStyleChange); 1625 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(St yleChangeReason::Animation));
1626 setAnimationStyleChange(true); 1626 setAnimationStyleChange(true);
1627 } 1627 }
1628 1628
1629 void Element::setNeedsCompositingUpdate() 1629 void Element::setNeedsCompositingUpdate()
1630 { 1630 {
1631 if (!document().isActive()) 1631 if (!document().isActive())
1632 return; 1632 return;
1633 RenderBoxModelObject* renderer = renderBoxModelObject(); 1633 RenderBoxModelObject* renderer = renderBoxModelObject();
1634 if (!renderer) 1634 if (!renderer)
1635 return; 1635 return;
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
2628 } 2628 }
2629 2629
2630 void Element::setFloatingPointAttribute(const QualifiedName& attributeName, doub le value) 2630 void Element::setFloatingPointAttribute(const QualifiedName& attributeName, doub le value)
2631 { 2631 {
2632 setAttribute(attributeName, AtomicString::number(value)); 2632 setAttribute(attributeName, AtomicString::number(value));
2633 } 2633 }
2634 2634
2635 void Element::setContainsFullScreenElement(bool flag) 2635 void Element::setContainsFullScreenElement(bool flag)
2636 { 2636 {
2637 setElementFlag(ContainsFullScreenElement, flag); 2637 setElementFlag(ContainsFullScreenElement, flag);
2638 setNeedsStyleRecalc(SubtreeStyleChange); 2638 setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create( StyleChangeReason::FullScreen));
2639 } 2639 }
2640 2640
2641 static Element* parentCrossingFrameBoundaries(Element* element) 2641 static Element* parentCrossingFrameBoundaries(Element* element)
2642 { 2642 {
2643 ASSERT(element); 2643 ASSERT(element);
2644 return element->parentElement() ? element->parentElement() : element->docume nt().ownerElement(); 2644 return element->parentElement() ? element->parentElement() : element->docume nt().ownerElement();
2645 } 2645 }
2646 2646
2647 void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo l flag) 2647 void Element::setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(boo l flag)
2648 { 2648 {
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
3093 startLineNumber = document().scriptableDocumentParser()->lineNumber(); 3093 startLineNumber = document().scriptableDocumentParser()->lineNumber();
3094 3094
3095 if (newStyleString.isNull()) { 3095 if (newStyleString.isNull()) {
3096 ensureUniqueElementData().m_inlineStyle.clear(); 3096 ensureUniqueElementData().m_inlineStyle.clear();
3097 } else if (modificationReason == ModifiedByCloning || document().contentSecu rityPolicy()->allowInlineStyle(document().url(), startLineNumber)) { 3097 } else if (modificationReason == ModifiedByCloning || document().contentSecu rityPolicy()->allowInlineStyle(document().url(), startLineNumber)) {
3098 setInlineStyleFromString(newStyleString); 3098 setInlineStyleFromString(newStyleString);
3099 } 3099 }
3100 3100
3101 elementData()->m_styleAttributeIsDirty = false; 3101 elementData()->m_styleAttributeIsDirty = false;
3102 3102
3103 setNeedsStyleRecalc(LocalStyleChange); 3103 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(St yleChangeReason::StyleSheetChange));
3104 InspectorInstrumentation::didInvalidateStyleAttr(this); 3104 InspectorInstrumentation::didInvalidateStyleAttr(this);
3105 } 3105 }
3106 3106
3107 void Element::inlineStyleChanged() 3107 void Element::inlineStyleChanged()
3108 { 3108 {
3109 ASSERT(isStyledElement()); 3109 ASSERT(isStyledElement());
3110 setNeedsStyleRecalc(LocalStyleChange); 3110 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create(St yleChangeReason::Inline));
3111 ASSERT(elementData()); 3111 ASSERT(elementData());
3112 elementData()->m_styleAttributeIsDirty = true; 3112 elementData()->m_styleAttributeIsDirty = true;
3113 InspectorInstrumentation::didInvalidateStyleAttr(this); 3113 InspectorInstrumentation::didInvalidateStyleAttr(this);
3114 } 3114 }
3115 3115
3116 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identi fier, bool important) 3116 bool Element::setInlineStyleProperty(CSSPropertyID propertyID, CSSValueID identi fier, bool important)
3117 { 3117 {
3118 ASSERT(isStyledElement()); 3118 ASSERT(isStyledElement());
3119 ensureMutableInlineStyle().setProperty(propertyID, cssValuePool().createIden tifierValue(identifier), important); 3119 ensureMutableInlineStyle().setProperty(propertyID, cssValuePool().createIden tifierValue(identifier), important);
3120 inlineStyleChanged(); 3120 inlineStyleChanged();
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
3261 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , wrapperType, toScriptWrappableBase(), isolate); 3261 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , wrapperType, toScriptWrappableBase(), isolate);
3262 if (wrapper.IsEmpty()) 3262 if (wrapper.IsEmpty())
3263 return v8::Handle<v8::Object>(); 3263 return v8::Handle<v8::Object>();
3264 3264
3265 wrapper->SetPrototype(binding->prototype()); 3265 wrapper->SetPrototype(binding->prototype());
3266 3266
3267 return V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType , wrapper, isolate); 3267 return V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType , wrapper, isolate);
3268 } 3268 }
3269 3269
3270 } // namespace blink 3270 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/DocumentStyleSheetCollection.cpp ('k') | Source/core/dom/Fullscreen.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698