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

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

Issue 342283005: Make collection caching code more consistent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix nits Created 6 years, 4 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/NodeListsNodeData.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 2900 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 if (!document().isHTMLDocument()) 2911 if (!document().isHTMLDocument())
2912 return; 2912 return;
2913 2913
2914 if (!oldId.isEmpty()) 2914 if (!oldId.isEmpty())
2915 toHTMLDocument(document()).removeExtraNamedItem(oldId); 2915 toHTMLDocument(document()).removeExtraNamedItem(oldId);
2916 2916
2917 if (!newId.isEmpty()) 2917 if (!newId.isEmpty())
2918 toHTMLDocument(document()).addExtraNamedItem(newId); 2918 toHTMLDocument(document()).addExtraNamedItem(newId);
2919 } 2919 }
2920 2920
2921 PassRefPtrWillBeRawPtr<HTMLCollection> Element::ensureCachedHTMLCollection(Colle ctionType type)
2922 {
2923 if (HTMLCollection* collection = cachedHTMLCollection(type))
2924 return collection;
2925
2926 if (type == TableRows) {
2927 ASSERT(isHTMLTableElement(this));
2928 return ensureRareData().ensureNodeLists().addCache<HTMLTableRowsCollecti on>(*this, type);
2929 } else if (type == SelectOptions) {
2930 ASSERT(isHTMLSelectElement(this));
2931 return ensureRareData().ensureNodeLists().addCache<HTMLOptionsCollection >(*this, type);
2932 } else if (type == FormControls) {
2933 ASSERT(isHTMLFormElement(this) || isHTMLFieldSetElement(this));
2934 return ensureRareData().ensureNodeLists().addCache<HTMLFormControlsColle ction>(*this, type);
2935 }
2936 return ensureRareData().ensureNodeLists().addCache<HTMLCollection>(*this, ty pe);
2937 }
2938
2939 void Element::scheduleSVGFilterLayerUpdateHack() 2921 void Element::scheduleSVGFilterLayerUpdateHack()
2940 { 2922 {
2941 document().scheduleSVGFilterLayerUpdateHack(*this); 2923 document().scheduleSVGFilterLayerUpdateHack(*this);
2942 } 2924 }
2943 2925
2944 HTMLCollection* Element::cachedHTMLCollection(CollectionType type)
2945 {
2946 return hasRareData() && rareData()->nodeLists() ? rareData()->nodeLists()->c ached<HTMLCollection>(type) : 0;
2947 }
2948
2949 IntSize Element::savedLayerScrollOffset() const 2926 IntSize Element::savedLayerScrollOffset() const
2950 { 2927 {
2951 return hasRareData() ? elementRareData()->savedLayerScrollOffset() : IntSize (); 2928 return hasRareData() ? elementRareData()->savedLayerScrollOffset() : IntSize ();
2952 } 2929 }
2953 2930
2954 void Element::setSavedLayerScrollOffset(const IntSize& size) 2931 void Element::setSavedLayerScrollOffset(const IntSize& size)
2955 { 2932 {
2956 if (size.isZero() && !hasRareData()) 2933 if (size.isZero() && !hasRareData())
2957 return; 2934 return;
2958 ensureElementRareData().setSavedLayerScrollOffset(size); 2935 ensureElementRareData().setSavedLayerScrollOffset(size);
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
3306 { 3283 {
3307 #if ENABLE(OILPAN) 3284 #if ENABLE(OILPAN)
3308 if (hasRareData()) 3285 if (hasRareData())
3309 visitor->trace(elementRareData()); 3286 visitor->trace(elementRareData());
3310 visitor->trace(m_elementData); 3287 visitor->trace(m_elementData);
3311 #endif 3288 #endif
3312 ContainerNode::trace(visitor); 3289 ContainerNode::trace(visitor);
3313 } 3290 }
3314 3291
3315 } // namespace blink 3292 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/NodeListsNodeData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698