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

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

Issue 42543007: StyleResolver should update RuleSets lazily. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 } else if (isStyledElement() && isPresentationAttribute(name)) { 984 } else if (isStyledElement() && isPresentationAttribute(name)) {
985 elementData()->m_presentationAttributeStyleIsDirty = true; 985 elementData()->m_presentationAttributeStyleIsDirty = true;
986 setNeedsStyleRecalc(LocalStyleChange); 986 setNeedsStyleRecalc(LocalStyleChange);
987 } 987 }
988 988
989 if (isIdAttributeName(name)) { 989 if (isIdAttributeName(name)) {
990 AtomicString oldId = elementData()->idForStyleResolution(); 990 AtomicString oldId = elementData()->idForStyleResolution();
991 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui rksMode()); 991 AtomicString newId = makeIdForStyleResolution(newValue, document().inQui rksMode());
992 if (newId != oldId) { 992 if (newId != oldId) {
993 elementData()->setIdForStyleResolution(newId); 993 elementData()->setIdForStyleResolution(newId);
994 shouldInvalidateStyle = testShouldInvalidateStyle && checkNeedsStyle InvalidationForIdChange(oldId, newId, styleResolver->ruleFeatureSet()); 994 shouldInvalidateStyle = testShouldInvalidateStyle && checkNeedsStyle InvalidationForIdChange(oldId, newId, styleResolver->ensureRuleFeatureSet());
995 } 995 }
996 } else if (name == classAttr) { 996 } else if (name == classAttr) {
997 classAttributeChanged(newValue); 997 classAttributeChanged(newValue);
998 } else if (name == HTMLNames::nameAttr) { 998 } else if (name == HTMLNames::nameAttr) {
999 setHasName(!newValue.isNull()); 999 setHasName(!newValue.isNull());
1000 } else if (name == HTMLNames::pseudoAttr) { 1000 } else if (name == HTMLNames::pseudoAttr) {
1001 shouldInvalidateStyle |= testShouldInvalidateStyle && isInShadowTree(); 1001 shouldInvalidateStyle |= testShouldInvalidateStyle && isInShadowTree();
1002 } 1002 }
1003 1003
1004 invalidateNodeListCachesInAncestors(&name, this); 1004 invalidateNodeListCachesInAncestors(&name, this);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 { 1092 {
1093 StyleResolver* styleResolver = document().styleResolverIfExists(); 1093 StyleResolver* styleResolver = document().styleResolverIfExists();
1094 bool testShouldInvalidateStyle = confusingAndOftenMisusedAttached() && style Resolver && styleChangeType() < SubtreeStyleChange; 1094 bool testShouldInvalidateStyle = confusingAndOftenMisusedAttached() && style Resolver && styleChangeType() < SubtreeStyleChange;
1095 bool shouldInvalidateStyle = false; 1095 bool shouldInvalidateStyle = false;
1096 1096
1097 if (classStringHasClassName(newClassString)) { 1097 if (classStringHasClassName(newClassString)) {
1098 const bool shouldFoldCase = document().inQuirksMode(); 1098 const bool shouldFoldCase = document().inQuirksMode();
1099 const SpaceSplitString oldClasses = elementData()->classNames(); 1099 const SpaceSplitString oldClasses = elementData()->classNames();
1100 elementData()->setClass(newClassString, shouldFoldCase); 1100 elementData()->setClass(newClassString, shouldFoldCase);
1101 const SpaceSplitString& newClasses = elementData()->classNames(); 1101 const SpaceSplitString& newClasses = elementData()->classNames();
1102 shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForCla ssChange(oldClasses, newClasses, styleResolver->ruleFeatureSet()); 1102 shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForCla ssChange(oldClasses, newClasses, styleResolver->ensureRuleFeatureSet());
1103 } else { 1103 } else {
1104 const SpaceSplitString& oldClasses = elementData()->classNames(); 1104 const SpaceSplitString& oldClasses = elementData()->classNames();
1105 shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForCla ssChange(oldClasses, styleResolver->ruleFeatureSet()); 1105 shouldInvalidateStyle = testShouldInvalidateStyle && checkSelectorForCla ssChange(oldClasses, styleResolver->ensureRuleFeatureSet());
1106 elementData()->clearClass(); 1106 elementData()->clearClass();
1107 } 1107 }
1108 1108
1109 if (hasRareData()) 1109 if (hasRareData())
1110 elementRareData()->clearClassListValueForQuirksMode(); 1110 elementRareData()->clearClassListValueForQuirksMode();
1111 1111
1112 if (shouldInvalidateStyle) 1112 if (shouldInvalidateStyle)
1113 setNeedsStyleRecalc(); 1113 setNeedsStyleRecalc();
1114 } 1114 }
1115 1115
(...skipping 2311 matching lines...) Expand 10 before | Expand all | Expand 10 after
3427 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3427 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3428 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3428 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3429 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3429 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3430 return false; 3430 return false;
3431 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3431 if (FullscreenElementStack::isActiveFullScreenElement(this))
3432 return false; 3432 return false;
3433 return true; 3433 return true;
3434 } 3434 }
3435 3435
3436 } // namespace WebCore 3436 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698