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

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

Issue 17038004: Remove needsShadowTreeWalker flag (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 6 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
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/ElementRareData.h » ('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 2267 matching lines...) Expand 10 before | Expand all | Expand 10 after
2278 if (element && (needsStyleRecalc() || shouldRecalcStyle(change, element))) { 2278 if (element && (needsStyleRecalc() || shouldRecalcStyle(change, element))) {
2279 // PseudoElement styles hang off their parent element's style so if we n eeded 2279 // PseudoElement styles hang off their parent element's style so if we n eeded
2280 // a style recalc we should Force one on the pseudo. 2280 // a style recalc we should Force one on the pseudo.
2281 element->recalcStyle(needsStyleRecalc() ? Force : change); 2281 element->recalcStyle(needsStyleRecalc() ? Force : change);
2282 2282
2283 // Wait until our parent is not displayed or pseudoElementRendererIsNeed ed 2283 // Wait until our parent is not displayed or pseudoElementRendererIsNeed ed
2284 // is false, otherwise we could continously create and destroy PseudoEle ments 2284 // is false, otherwise we could continously create and destroy PseudoEle ments
2285 // when RenderObject::isChildAllowed on our parent returns false for the 2285 // when RenderObject::isChildAllowed on our parent returns false for the
2286 // PseudoElement's renderer for each style recalc. 2286 // PseudoElement's renderer for each style recalc.
2287 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedP seudoStyle(pseudoId))) 2287 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedP seudoStyle(pseudoId)))
2288 setPseudoElement(pseudoId, 0); 2288 elementRareData()->setPseudoElement(pseudoId, 0);
2289 } else if (change >= Inherit || needsStyleRecalc()) 2289 } else if (change >= Inherit || needsStyleRecalc())
2290 createPseudoElementIfNeeded(pseudoId); 2290 createPseudoElementIfNeeded(pseudoId);
2291 } 2291 }
2292 2292
2293 void Element::createPseudoElementIfNeeded(PseudoId pseudoId) 2293 void Element::createPseudoElementIfNeeded(PseudoId pseudoId)
2294 { 2294 {
2295 if (!document()->styleSheetCollection()->usesBeforeAfterRules()) 2295 if (!document()->styleSheetCollection()->usesBeforeAfterRules())
2296 return; 2296 return;
2297 2297
2298 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseud oStyle(pseudoId))) 2298 if (!renderer() || !pseudoElementRendererIsNeeded(renderer()->getCachedPseud oStyle(pseudoId)))
2299 return; 2299 return;
2300 2300
2301 if (!renderer()->canHaveGeneratedChildren()) 2301 if (!renderer()->canHaveGeneratedChildren())
2302 return; 2302 return;
2303 2303
2304 ASSERT(!isPseudoElement()); 2304 ASSERT(!isPseudoElement());
2305 RefPtr<PseudoElement> element = PseudoElement::create(this, pseudoId); 2305 RefPtr<PseudoElement> element = PseudoElement::create(this, pseudoId);
2306 element->attach(); 2306 element->attach();
2307 setPseudoElement(pseudoId, element.release()); 2307 ensureElementRareData()->setPseudoElement(pseudoId, element.release());
2308 }
2309
2310 bool Element::hasPseudoElements() const
2311 {
2312 return hasRareData() && elementRareData()->hasPseudoElements();
2313 } 2308 }
2314 2309
2315 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const 2310 PseudoElement* Element::pseudoElement(PseudoId pseudoId) const
2316 { 2311 {
2317 return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : 0; 2312 return hasRareData() ? elementRareData()->pseudoElement(pseudoId) : 0;
2318 } 2313 }
2319 2314
2320 void Element::setPseudoElement(PseudoId pseudoId, PassRefPtr<PseudoElement> elem ent)
2321 {
2322 ensureElementRareData()->setPseudoElement(pseudoId, element);
2323 resetNeedsShadowTreeWalker();
2324 }
2325
2326 RenderObject* Element::pseudoElementRenderer(PseudoId pseudoId) const 2315 RenderObject* Element::pseudoElementRenderer(PseudoId pseudoId) const
2327 { 2316 {
2328 if (PseudoElement* element = pseudoElement(pseudoId)) 2317 if (PseudoElement* element = pseudoElement(pseudoId))
2329 return element->renderer(); 2318 return element->renderer();
2330 return 0; 2319 return 0;
2331 } 2320 }
2332 2321
2333 bool Element::matchesReadOnlyPseudoClass() const 2322 bool Element::matchesReadOnlyPseudoClass() const
2334 { 2323 {
2335 return false; 2324 return false;
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
3121 return 0; 3110 return 0;
3122 } 3111 }
3123 3112
3124 Attribute* UniqueElementData::attributeItem(unsigned index) 3113 Attribute* UniqueElementData::attributeItem(unsigned index)
3125 { 3114 {
3126 ASSERT_WITH_SECURITY_IMPLICATION(index < length()); 3115 ASSERT_WITH_SECURITY_IMPLICATION(index < length());
3127 return &m_attributeVector.at(index); 3116 return &m_attributeVector.at(index);
3128 } 3117 }
3129 3118
3130 } // namespace WebCore 3119 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/ElementRareData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698