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

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

Issue 2701993002: DO NOT COMMIT: Results of running new (proposed) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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
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. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * (C) 2007 Eric Seidel (eric@webkit.org) 9 * (C) 2007 Eric Seidel (eric@webkit.org)
10 * 10 *
(...skipping 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 return true; 1446 return true;
1447 } 1447 }
1448 } 1448 }
1449 1449
1450 if (name == HTMLNames::classAttr) { 1450 if (name == HTMLNames::classAttr) {
1451 const AtomicString& newClassString = newValue; 1451 const AtomicString& newClassString = newValue;
1452 if (classStringHasClassName(newClassString) == 1452 if (classStringHasClassName(newClassString) ==
1453 ClassStringContent::HasClasses) { 1453 ClassStringContent::HasClasses) {
1454 const SpaceSplitString& oldClasses = elementData()->classNames(); 1454 const SpaceSplitString& oldClasses = elementData()->classNames();
1455 const SpaceSplitString newClasses( 1455 const SpaceSplitString newClasses(
1456 newClassString, document().inQuirksMode() 1456 newClassString,
1457 ? SpaceSplitString::ShouldFoldCase 1457 document().inQuirksMode() ? SpaceSplitString::ShouldFoldCase
1458 : SpaceSplitString::ShouldNotFoldCase); 1458 : SpaceSplitString::ShouldNotFoldCase);
1459 if (featureSet.checkSelectorsForClassChange(oldClasses, newClasses)) 1459 if (featureSet.checkSelectorsForClassChange(oldClasses, newClasses))
1460 return true; 1460 return true;
1461 } else { 1461 } else {
1462 const SpaceSplitString& oldClasses = elementData()->classNames(); 1462 const SpaceSplitString& oldClasses = elementData()->classNames();
1463 if (featureSet.checkSelectorsForClassChange(oldClasses)) 1463 if (featureSet.checkSelectorsForClassChange(oldClasses))
1464 return true; 1464 return true;
1465 } 1465 }
1466 } 1466 }
1467 1467
1468 return featureSet.hasSelectorForAttribute(name.localName()); 1468 return featureSet.hasSelectorForAttribute(name.localName());
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 return; 2122 return;
2123 if (ElementAnimations* elementAnimations = 2123 if (ElementAnimations* elementAnimations =
2124 elementRareData()->elementAnimations()) 2124 elementRareData()->elementAnimations())
2125 elementAnimations->setAnimationStyleChange(false); 2125 elementAnimations->setAnimationStyleChange(false);
2126 } 2126 }
2127 2127
2128 void Element::setNeedsAnimationStyleRecalc() { 2128 void Element::setNeedsAnimationStyleRecalc() {
2129 if (getStyleChangeType() != NoStyleChange) 2129 if (getStyleChangeType() != NoStyleChange)
2130 return; 2130 return;
2131 2131
2132 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create( 2132 setNeedsStyleRecalc(
2133 StyleChangeReason::Animation)); 2133 LocalStyleChange,
2134 StyleChangeReasonForTracing::create(StyleChangeReason::Animation));
2134 setAnimationStyleChange(true); 2135 setAnimationStyleChange(true);
2135 } 2136 }
2136 2137
2137 void Element::setNeedsCompositingUpdate() { 2138 void Element::setNeedsCompositingUpdate() {
2138 if (!document().isActive()) 2139 if (!document().isActive())
2139 return; 2140 return;
2140 LayoutBoxModelObject* layoutObject = layoutBoxModelObject(); 2141 LayoutBoxModelObject* layoutObject = layoutBoxModelObject();
2141 if (!layoutObject) 2142 if (!layoutObject)
2142 return; 2143 return;
2143 if (!layoutObject->hasLayer()) 2144 if (!layoutObject->hasLayer())
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
2908 if (equalIgnoringCase(where, "afterEnd")) { 2909 if (equalIgnoringCase(where, "afterEnd")) {
2909 if (ContainerNode* parent = this->parentNode()) { 2910 if (ContainerNode* parent = this->parentNode()) {
2910 parent->insertBefore(newChild, nextSibling(), exceptionState); 2911 parent->insertBefore(newChild, nextSibling(), exceptionState);
2911 if (!exceptionState.hadException()) 2912 if (!exceptionState.hadException())
2912 return newChild; 2913 return newChild;
2913 } 2914 }
2914 return nullptr; 2915 return nullptr;
2915 } 2916 }
2916 2917
2917 exceptionState.throwDOMException( 2918 exceptionState.throwDOMException(
2918 SyntaxError, "The value provided ('" + where + 2919 SyntaxError,
2919 "') is not one of 'beforeBegin', 'afterBegin', " 2920 "The value provided ('" + where +
2920 "'beforeEnd', or 'afterEnd'."); 2921 "') is not one of 'beforeBegin', 'afterBegin', "
2922 "'beforeEnd', or 'afterEnd'.");
2921 return nullptr; 2923 return nullptr;
2922 } 2924 }
2923 2925
2924 ElementIntersectionObserverData* Element::intersectionObserverData() const { 2926 ElementIntersectionObserverData* Element::intersectionObserverData() const {
2925 if (hasRareData()) 2927 if (hasRareData())
2926 return elementRareData()->intersectionObserverData(); 2928 return elementRareData()->intersectionObserverData();
2927 return nullptr; 2929 return nullptr;
2928 } 2930 }
2929 2931
2930 ElementIntersectionObserverData& Element::ensureIntersectionObserverData() { 2932 ElementIntersectionObserverData& Element::ensureIntersectionObserverData() {
(...skipping 30 matching lines...) Expand all
2961 exceptionState.throwDOMException(NoModificationAllowedError, 2963 exceptionState.throwDOMException(NoModificationAllowedError,
2962 "The element has no parent."); 2964 "The element has no parent.");
2963 return nullptr; 2965 return nullptr;
2964 } 2966 }
2965 return parent; 2967 return parent;
2966 } 2968 }
2967 if (equalIgnoringCase(where, "afterBegin") || 2969 if (equalIgnoringCase(where, "afterBegin") ||
2968 equalIgnoringCase(where, "beforeEnd")) 2970 equalIgnoringCase(where, "beforeEnd"))
2969 return element; 2971 return element;
2970 exceptionState.throwDOMException( 2972 exceptionState.throwDOMException(
2971 SyntaxError, "The value provided ('" + where + 2973 SyntaxError,
2972 "') is not one of 'beforeBegin', 'afterBegin', " 2974 "The value provided ('" + where +
2973 "'beforeEnd', or 'afterEnd'."); 2975 "') is not one of 'beforeBegin', 'afterBegin', "
2976 "'beforeEnd', or 'afterEnd'.");
2974 return nullptr; 2977 return nullptr;
2975 } 2978 }
2976 2979
2977 Element* Element::insertAdjacentElement(const String& where, 2980 Element* Element::insertAdjacentElement(const String& where,
2978 Element* newChild, 2981 Element* newChild,
2979 ExceptionState& exceptionState) { 2982 ExceptionState& exceptionState) {
2980 Node* returnValue = insertAdjacent(where, newChild, exceptionState); 2983 Node* returnValue = insertAdjacent(where, newChild, exceptionState);
2981 return toElement(returnValue); 2984 return toElement(returnValue);
2982 } 2985 }
2983 2986
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
3163 3166
3164 if (!pseudoElementSpecifier) 3167 if (!pseudoElementSpecifier)
3165 return elementStyle; 3168 return elementStyle;
3166 3169
3167 if (ComputedStyle* pseudoElementStyle = 3170 if (ComputedStyle* pseudoElementStyle =
3168 elementStyle->getCachedPseudoStyle(pseudoElementSpecifier)) 3171 elementStyle->getCachedPseudoStyle(pseudoElementSpecifier))
3169 return pseudoElementStyle; 3172 return pseudoElementStyle;
3170 3173
3171 RefPtr<ComputedStyle> result = 3174 RefPtr<ComputedStyle> result =
3172 document().ensureStyleResolver().pseudoStyleForElement( 3175 document().ensureStyleResolver().pseudoStyleForElement(
3173 this, PseudoStyleRequest(pseudoElementSpecifier, 3176 this,
3174 PseudoStyleRequest::ForComputedStyle), 3177 PseudoStyleRequest(pseudoElementSpecifier,
3178 PseudoStyleRequest::ForComputedStyle),
3175 elementStyle); 3179 elementStyle);
3176 DCHECK(result); 3180 DCHECK(result);
3177 return elementStyle->addCachedPseudoStyle(result.release()); 3181 return elementStyle->addCachedPseudoStyle(result.release());
3178 } 3182 }
3179 3183
3180 AtomicString Element::computeInheritedLanguage() const { 3184 AtomicString Element::computeInheritedLanguage() const {
3181 const Node* n = this; 3185 const Node* n = this;
3182 AtomicString value; 3186 AtomicString value;
3183 // The language property is inherited, so we iterate over the parents to find 3187 // The language property is inherited, so we iterate over the parents to find
3184 // the first language. 3188 // the first language.
(...skipping 25 matching lines...) Expand all
3210 3214
3211 void Element::cancelFocusAppearanceUpdate() { 3215 void Element::cancelFocusAppearanceUpdate() {
3212 if (document().focusedElement() == this) 3216 if (document().focusedElement() == this)
3213 document().cancelFocusAppearanceUpdate(); 3217 document().cancelFocusAppearanceUpdate();
3214 } 3218 }
3215 3219
3216 void Element::updatePseudoElement(PseudoId pseudoId, StyleRecalcChange change) { 3220 void Element::updatePseudoElement(PseudoId pseudoId, StyleRecalcChange change) {
3217 DCHECK(!needsStyleRecalc()); 3221 DCHECK(!needsStyleRecalc());
3218 PseudoElement* element = pseudoElement(pseudoId); 3222 PseudoElement* element = pseudoElement(pseudoId);
3219 3223
3220 if (element && (change == UpdatePseudoElements || 3224 if (element &&
3221 element->shouldCallRecalcStyle(change))) { 3225 (change == UpdatePseudoElements ||
3226 element->shouldCallRecalcStyle(change))) {
3222 if (pseudoId == PseudoIdFirstLetter && updateFirstLetter(element)) 3227 if (pseudoId == PseudoIdFirstLetter && updateFirstLetter(element))
3223 return; 3228 return;
3224 3229
3225 // Need to clear the cached style if the PseudoElement wants a recalc so it 3230 // Need to clear the cached style if the PseudoElement wants a recalc so it
3226 // computes a new style. 3231 // computes a new style.
3227 if (element->needsStyleRecalc()) 3232 if (element->needsStyleRecalc())
3228 layoutObject()->mutableStyle()->removeCachedPseudoStyle(pseudoId); 3233 layoutObject()->mutableStyle()->removeCachedPseudoStyle(pseudoId);
3229 3234
3230 // PseudoElement styles hang off their parent element's style so if we 3235 // PseudoElement styles hang off their parent element's style so if we
3231 // needed a style recalc we should Force one on the pseudo. FIXME: We 3236 // needed a style recalc we should Force one on the pseudo. FIXME: We
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
3902 elementData()->m_styleAttributeIsDirty = false; 3907 elementData()->m_styleAttributeIsDirty = false;
3903 3908
3904 setNeedsStyleRecalc( 3909 setNeedsStyleRecalc(
3905 LocalStyleChange, 3910 LocalStyleChange,
3906 StyleChangeReasonForTracing::create(StyleChangeReason::StyleSheetChange)); 3911 StyleChangeReasonForTracing::create(StyleChangeReason::StyleSheetChange));
3907 InspectorInstrumentation::didInvalidateStyleAttr(this); 3912 InspectorInstrumentation::didInvalidateStyleAttr(this);
3908 } 3913 }
3909 3914
3910 void Element::inlineStyleChanged() { 3915 void Element::inlineStyleChanged() {
3911 DCHECK(isStyledElement()); 3916 DCHECK(isStyledElement());
3912 setNeedsStyleRecalc(LocalStyleChange, StyleChangeReasonForTracing::create( 3917 setNeedsStyleRecalc(
3913 StyleChangeReason::Inline)); 3918 LocalStyleChange,
3919 StyleChangeReasonForTracing::create(StyleChangeReason::Inline));
3914 DCHECK(elementData()); 3920 DCHECK(elementData());
3915 elementData()->m_styleAttributeIsDirty = true; 3921 elementData()->m_styleAttributeIsDirty = true;
3916 InspectorInstrumentation::didInvalidateStyleAttr(this); 3922 InspectorInstrumentation::didInvalidateStyleAttr(this);
3917 3923
3918 if (MutationObserverInterestGroup* recipients = 3924 if (MutationObserverInterestGroup* recipients =
3919 MutationObserverInterestGroup::createForAttributesMutation( 3925 MutationObserverInterestGroup::createForAttributesMutation(
3920 *this, styleAttr)) { 3926 *this, styleAttr)) {
3921 // We don't use getAttribute() here to get a style attribute value 3927 // We don't use getAttribute() here to get a style attribute value
3922 // before the change. 3928 // before the change.
3923 AtomicString oldValue; 3929 AtomicString oldValue;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
4134 } 4140 }
4135 4141
4136 DEFINE_TRACE_WRAPPERS(Element) { 4142 DEFINE_TRACE_WRAPPERS(Element) {
4137 if (hasRareData()) { 4143 if (hasRareData()) {
4138 visitor->traceWrappers(elementRareData()); 4144 visitor->traceWrappers(elementRareData());
4139 } 4145 }
4140 ContainerNode::traceWrappers(visitor); 4146 ContainerNode::traceWrappers(visitor);
4141 } 4147 }
4142 4148
4143 } // namespace blink 4149 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698