Skip to content
  • antti@apple.com's avatar
    Move array position caching out from HTMLCollection · a665845a
    antti@apple.com authored
    https://bugs.webkit.org/show_bug.cgi?id=123895
    
    Reviewed by Darin Adler.
    
    This caching complicates the logic but is used by a single subclass
    (HTMLFormControlsCollection) only. The subclass can do the caching itself.
    
    * html/HTMLAllCollection.cpp:
    (WebCore::HTMLAllCollection::HTMLAllCollection):
    * html/HTMLCollection.cpp:
    (WebCore::HTMLCollection::HTMLCollection):
    (WebCore::HTMLCollection::create):
    (WebCore::HTMLCollection::item):
    (WebCore::HTMLCollection::elementBeforeOrAfterCachedElement):
    (WebCore::HTMLCollection::firstElement):
            
        Renamed from traverseFirstElement.
    
    (WebCore::HTMLCollection::traverseForwardToOffset):
    (WebCore::HTMLCollection::invalidateCache):
            
        Make cache invalidation virtual so we can clear HTMLTableRowsCollection index cache.
    
    (WebCore::HTMLCollection::namedItem):
    (WebCore::HTMLCollection::updateNameCache):
            
        Use traverseForwardToOffset instead traverseNextElement. This allows removal of traverseNextElement.
    
    * html/HTMLCollection.h:
    (WebCore::HTMLCollection::usesCustomForwardOnlyTraversal):
            
        Renamed the enum and the accessor to be more informative.
    
    (WebCore::HTMLCollection::setCachedElement):
    (WebCore::HTMLCollection::customElementAfter):
            
        Renamed from virtualItemAfter.
    
    * html/HTMLFormControlsCollection.cpp:
    (WebCore::HTMLFormControlsCollection::HTMLFormControlsCollection):
    (WebCore::findFormAssociatedElement):
    (WebCore::HTMLFormControlsCollection::customElementAfter):
            
        Move the array position caching logic here.
    
    (WebCore::HTMLFormControlsCollection::invalidateCache):
    * html/HTMLFormControlsCollection.h:
    * html/HTMLNameCollection.cpp:
    (WebCore::HTMLNameCollection::HTMLNameCollection):
    * html/HTMLOptionsCollection.cpp:
    (WebCore::HTMLOptionsCollection::HTMLOptionsCollection):
    * html/HTMLTableRowsCollection.cpp:
    (WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection):
    (WebCore::HTMLTableRowsCollection::customElementAfter):
    * html/HTMLTableRowsCollection.h:
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158758 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    a665845a