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

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

Issue 138343007: Use more consistent naming for caching methods in NodeListsNodeData class (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 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
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/NameNodeList.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 3196 matching lines...) Expand 10 before | Expand all | Expand 10 after
3207 3207
3208 if (!newId.isEmpty()) 3208 if (!newId.isEmpty())
3209 toHTMLDocument(document()).addExtraNamedItem(newId); 3209 toHTMLDocument(document()).addExtraNamedItem(newId);
3210 } 3210 }
3211 3211
3212 PassRefPtr<HTMLCollection> Element::ensureCachedHTMLCollection(CollectionType ty pe) 3212 PassRefPtr<HTMLCollection> Element::ensureCachedHTMLCollection(CollectionType ty pe)
3213 { 3213 {
3214 if (HTMLCollection* collection = cachedHTMLCollection(type)) 3214 if (HTMLCollection* collection = cachedHTMLCollection(type))
3215 return collection; 3215 return collection;
3216 3216
3217 RefPtr<HTMLCollection> collection;
3218 if (type == TableRows) { 3217 if (type == TableRows) {
3219 ASSERT(hasTagName(tableTag)); 3218 ASSERT(hasTagName(tableTag));
3220 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLTab leRowsCollection>(this, type); 3219 return ensureRareData().ensureNodeLists().addCache<HTMLTableRowsCollecti on>(this, type);
3221 } else if (type == SelectOptions) { 3220 } else if (type == SelectOptions) {
3222 ASSERT(hasTagName(selectTag)); 3221 ASSERT(hasTagName(selectTag));
3223 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLOpt ionsCollection>(this, type); 3222 return ensureRareData().ensureNodeLists().addCache<HTMLOptionsCollection >(this, type);
3224 } else if (type == FormControls) { 3223 } else if (type == FormControls) {
3225 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag)); 3224 ASSERT(hasTagName(formTag) || hasTagName(fieldsetTag));
3226 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLFor mControlsCollection>(this, type); 3225 return ensureRareData().ensureNodeLists().addCache<HTMLFormControlsColle ction>(this, type);
3227 } 3226 }
3228 return ensureRareData().ensureNodeLists().addCacheWithAtomicName<HTMLCollect ion>(this, type); 3227 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(this, typ e);
3229 } 3228 }
3230 3229
3231 static void scheduleLayerUpdateCallback(Node* node) 3230 static void scheduleLayerUpdateCallback(Node* node)
3232 { 3231 {
3233 // Notify the renderer even is the styles are identical since it may need to 3232 // Notify the renderer even is the styles are identical since it may need to
3234 // create or destroy a RenderLayer. 3233 // create or destroy a RenderLayer.
3235 node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer); 3234 node->setNeedsStyleRecalc(LocalStyleChange, StyleChangeFromRenderer);
3236 } 3235 }
3237 3236
3238 void Element::scheduleLayerUpdate() 3237 void Element::scheduleLayerUpdate()
3239 { 3238 {
3240 if (document().inStyleRecalc()) 3239 if (document().inStyleRecalc())
3241 PostAttachCallbacks::queueCallback(scheduleLayerUpdateCallback, this); 3240 PostAttachCallbacks::queueCallback(scheduleLayerUpdateCallback, this);
3242 else 3241 else
3243 scheduleLayerUpdateCallback(this); 3242 scheduleLayerUpdateCallback(this);
3244 } 3243 }
3245 3244
3246 HTMLCollection* Element::cachedHTMLCollection(CollectionType type) 3245 HTMLCollection* Element::cachedHTMLCollection(CollectionType type)
3247 { 3246 {
3248 return hasRareData() && rareData()->nodeLists() ? rareData()->nodeLists()->c acheWithAtomicName<HTMLCollection>(type) : 0; 3247 return hasRareData() && rareData()->nodeLists() ? rareData()->nodeLists()->c ached<HTMLCollection>(type) : 0;
3249 } 3248 }
3250 3249
3251 IntSize Element::savedLayerScrollOffset() const 3250 IntSize Element::savedLayerScrollOffset() const
3252 { 3251 {
3253 return hasRareData() ? elementRareData()->savedLayerScrollOffset() : IntSize (); 3252 return hasRareData() ? elementRareData()->savedLayerScrollOffset() : IntSize ();
3254 } 3253 }
3255 3254
3256 void Element::setSavedLayerScrollOffset(const IntSize& size) 3255 void Element::setSavedLayerScrollOffset(const IntSize& size)
3257 { 3256 {
3258 if (size.isZero() && !hasRareData()) 3257 if (size.isZero() && !hasRareData())
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
3626 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems 3625 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi stItems
3627 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405 3626 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg i?id=88405
3628 if (hasTagName(optionTag) || hasTagName(optgroupTag)) 3627 if (hasTagName(optionTag) || hasTagName(optgroupTag))
3629 return false; 3628 return false;
3630 if (FullscreenElementStack::isActiveFullScreenElement(this)) 3629 if (FullscreenElementStack::isActiveFullScreenElement(this))
3631 return false; 3630 return false;
3632 return true; 3631 return true;
3633 } 3632 }
3634 3633
3635 } // namespace WebCore 3634 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/dom/Document.cpp ('k') | Source/core/dom/NameNodeList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698