Changeset 19302 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jan 31, 2007, 5:43:13 AM (18 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Mark with help from Lars.


  • added new ListHashSet class, which combines a hashtable and a linked list to provide a set that keeps elements in inserted order


This is to assist in fixing the following:
<rdar://problem/4751164> REGRESSION: Safari places text on incorrect button when returning to a page via back [10541]
http://bugs.webkit.org/show_bug.cgi?id=10541

  • JavaScriptCore.vcproj/WTF/WTF.vcproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • wtf/HashTable.h: (WTF::HashTable::find): (WTF::HashTable::contains): (WTF::::find): (WTF::::contains):
  • wtf/ListHashSet.h: Added. (WTF::ListHashSetNode::ListHashSetNode): (WTF::ListHashSetNodeHashFunctions::hash): (WTF::ListHashSetNodeHashFunctions::equal): (WTF::ListHashSetIterator::ListHashSetIterator): (WTF::ListHashSetIterator::get): (WTF::ListHashSetIterator::operator*): (WTF::ListHashSetIterator::operator->): (WTF::ListHashSetIterator::operator++): (WTF::ListHashSetIterator::operator--): (WTF::ListHashSetIterator::operator==): (WTF::ListHashSetIterator::operator!=): (WTF::ListHashSetIterator::operator const_iterator): (WTF::ListHashSetIterator::node): (WTF::ListHashSetConstIterator::ListHashSetConstIterator): (WTF::ListHashSetConstIterator::get): (WTF::ListHashSetConstIterator::operator*): (WTF::ListHashSetConstIterator::operator->): (WTF::ListHashSetConstIterator::operator++): (WTF::ListHashSetConstIterator::operator--): (WTF::ListHashSetConstIterator::operator==): (WTF::ListHashSetConstIterator::operator!=): (WTF::ListHashSetConstIterator::node): (WTF::ListHashSetTranslator::hash): (WTF::ListHashSetTranslator::equal): (WTF::ListHashSetTranslator::translate): (WTF::::ListHashSet): (WTF::::operator): (WTF::::~ListHashSet): (WTF::::size): (WTF::::capacity): (WTF::::isEmpty): (WTF::::begin): (WTF::::end): (WTF::::find): (WTF::::contains): (WTF::::add): (WTF::::remove): (WTF::::clear): (WTF::::unlinkAndDelete): (WTF::::appendNode): (WTF::::deleteAllNodes): (WTF::::makeIterator): (WTF::::makeConstIterator): (WTF::deleteAllValues):

WebCore:

Reviewed by Mark.

  • dom/Document.cpp: (WebCore::Document::formElementsState):
  • dom/Document.h:


I couldn't figure out the back/forward support in the tests enough
to make an automated test, but this maual test reproduces the
problem 100% without this patch:


  • manual-tests/back.html: Added.
  • manual-tests/form-control-madness.html: Added.
Location:
trunk/JavaScriptCore
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r19268 r19302  
     12007-01-31  Maciej Stachowiak  <[email protected]>
     2
     3        Reviewed by Mark with help from Lars.
     4       
     5        - added new ListHashSet class, which combines a hashtable and a linked list to provide a set
     6        that keeps elements in inserted order
     7       
     8        This is to assist in fixing the following:
     9        <rdar://problem/4751164> REGRESSION: Safari places text on incorrect button when returning to a page via back [10541]
     10        http://bugs.webkit.org/show_bug.cgi?id=10541
     11
     12        * JavaScriptCore.vcproj/WTF/WTF.vcproj:
     13        * JavaScriptCore.xcodeproj/project.pbxproj:
     14        * wtf/HashTable.h:
     15        (WTF::HashTable::find):
     16        (WTF::HashTable::contains):
     17        (WTF::::find):
     18        (WTF::::contains):
     19        * wtf/ListHashSet.h: Added.
     20        (WTF::ListHashSetNode::ListHashSetNode):
     21        (WTF::ListHashSetNodeHashFunctions::hash):
     22        (WTF::ListHashSetNodeHashFunctions::equal):
     23        (WTF::ListHashSetIterator::ListHashSetIterator):
     24        (WTF::ListHashSetIterator::get):
     25        (WTF::ListHashSetIterator::operator*):
     26        (WTF::ListHashSetIterator::operator->):
     27        (WTF::ListHashSetIterator::operator++):
     28        (WTF::ListHashSetIterator::operator--):
     29        (WTF::ListHashSetIterator::operator==):
     30        (WTF::ListHashSetIterator::operator!=):
     31        (WTF::ListHashSetIterator::operator const_iterator):
     32        (WTF::ListHashSetIterator::node):
     33        (WTF::ListHashSetConstIterator::ListHashSetConstIterator):
     34        (WTF::ListHashSetConstIterator::get):
     35        (WTF::ListHashSetConstIterator::operator*):
     36        (WTF::ListHashSetConstIterator::operator->):
     37        (WTF::ListHashSetConstIterator::operator++):
     38        (WTF::ListHashSetConstIterator::operator--):
     39        (WTF::ListHashSetConstIterator::operator==):
     40        (WTF::ListHashSetConstIterator::operator!=):
     41        (WTF::ListHashSetConstIterator::node):
     42        (WTF::ListHashSetTranslator::hash):
     43        (WTF::ListHashSetTranslator::equal):
     44        (WTF::ListHashSetTranslator::translate):
     45        (WTF::::ListHashSet):
     46        (WTF::::operator):
     47        (WTF::::~ListHashSet):
     48        (WTF::::size):
     49        (WTF::::capacity):
     50        (WTF::::isEmpty):
     51        (WTF::::begin):
     52        (WTF::::end):
     53        (WTF::::find):
     54        (WTF::::contains):
     55        (WTF::::add):
     56        (WTF::::remove):
     57        (WTF::::clear):
     58        (WTF::::unlinkAndDelete):
     59        (WTF::::appendNode):
     60        (WTF::::deleteAllNodes):
     61        (WTF::::makeIterator):
     62        (WTF::::makeConstIterator):
     63        (WTF::deleteAllValues):
     64
    1652007-01-30  Darin Adler  <[email protected]>
    266
  • trunk/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj

    r18108 r19302  
    225225                </File>
    226226                <File
     227                        RelativePath="..\..\wtf\ListHashSet.h"
     228                        >
     229                </File>
     230                <File
    227231                        RelativePath="..\..\wtf\ListRefPtr.h"
    228232                        >
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r19087 r19302  
    8989                65621E6D089E859700760F35 /* property_slot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65621E6B089E859700760F35 /* property_slot.cpp */; };
    9090                65621E6E089E859700760F35 /* property_slot.h in Headers */ = {isa = PBXBuildFile; fileRef = 65621E6C089E859700760F35 /* property_slot.h */; settings = {ATTRIBUTES = (Private, ); }; };
     91                657EB7460B708F540063461B /* ListHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 657EB7450B708F540063461B /* ListHashSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
    9192                657EEBC0094E445E008C9C7B /* HashCountedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 657EEBBF094E445E008C9C7B /* HashCountedSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
    9293                6580F796094070560082C219 /* PassRefPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 6580F795094070560082C219 /* PassRefPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    525526                65621E6B089E859700760F35 /* property_slot.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = property_slot.cpp; sourceTree = "<group>"; tabWidth = 8; };
    526527                65621E6C089E859700760F35 /* property_slot.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = property_slot.h; sourceTree = "<group>"; tabWidth = 8; };
     528                657EB7450B708F540063461B /* ListHashSet.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ListHashSet.h; sourceTree = "<group>"; };
    527529                657EEBBF094E445E008C9C7B /* HashCountedSet.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = HashCountedSet.h; sourceTree = "<group>"; tabWidth = 8; };
    528530                6580F795094070560082C219 /* PassRefPtr.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = PassRefPtr.h; sourceTree = "<group>"; tabWidth = 8; };
     
    888890                        isa = PBXGroup;
    889891                        children = (
     892                                657EB7450B708F540063461B /* ListHashSet.h */,
    890893                                E195678D09E7CF1200B89D13 /* unicode */,
    891894                                93AA4F770957251F0084B3A7 /* AlwaysInline.h */,
     
    12211224                                E11D51760B2E798D0056C188 /* StringExtras.h in Headers */,
    12221225                                146AAB2B0B66A84900E55F16 /* JSStringRefCF.h in Headers */,
     1226                                657EB7460B708F540063461B /* ListHashSet.h in Headers */,
    12231227                        );
    12241228                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/JavaScriptCore/wtf/HashTable.h

    r17127 r19302  
    292292        template<typename T, typename Extra, typename HashTranslator> pair<iterator, bool> add(const T& key, const Extra&);
    293293
    294         iterator find(const KeyType&);
    295         const_iterator find(const KeyType&) const;
    296         bool contains(const KeyType&) const;
     294        iterator find(const KeyType& key) { return find<KeyType, IdentityTranslatorType>(key); }
     295        const_iterator find(const KeyType& key) const { return find<KeyType, IdentityTranslatorType>(key); }
     296        bool contains(const KeyType& key) const { return contains<KeyType, IdentityTranslatorType>(key); }
     297
     298        template <typename T, typename HashTranslator> iterator find(const T&);
     299        template <typename T, typename HashTranslator> const_iterator find(const T&) const;
     300        template <typename T, typename HashTranslator> bool contains(const T&) const;
    297301
    298302        void remove(const KeyType&);
     
    468472
    469473    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
    470     typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::find(const Key& key)
     474    template <typename T, typename HashTranslator>
     475    typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::find(const T& key)
    471476    {
    472477        if (!m_table)
    473478            return end();
    474479
    475         LookupType result = lookup(key);
     480        LookupType result = lookup<T, HashTranslator>(key).first;
    476481        if (!result.second)
    477482            return end();
     
    480485
    481486    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
    482     typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::const_iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::find(const Key& key) const
     487    template <typename T, typename HashTranslator>
     488    typename HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::const_iterator HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::find(const T& key) const
    483489    {
    484490        if (!m_table)
    485491            return end();
    486492
    487         LookupType result = const_cast<HashTable *>(this)->lookup(key);
     493        LookupType result = const_cast<HashTable *>(this)->lookup<T, HashTranslator>(key).first;
    488494        if (!result.second)
    489495            return end();
     
    492498
    493499    template<typename Key, typename Value, typename Extractor, typename HashFunctions, typename Traits, typename KeyTraits>
    494     bool HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::contains(const KeyType& key) const
     500    template <typename T, typename HashTranslator>
     501    bool HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::contains(const T& key) const
    495502    {
    496503        if (!m_table)
    497504            return false;
    498505
    499         return const_cast<HashTable *>(this)->lookup(key).second;
     506        return const_cast<HashTable *>(this)->lookup<T, HashTranslator>(key).first.second;
    500507    }
    501508
Note: See TracChangeset for help on using the changeset viewer.