2011-03-10  Emil A Eklund  <eae@chromium.org>

        Reviewed by Darin Adler.

        Collection cache not reset when moving base node between documents
        https://bugs.webkit.org/show_bug.cgi?id=55446

        Add tests for accessing elements moved across documents using namedItem.

        * fast/dom/HTMLFormElement/invalid-form-field-expected.txt: Added.
        * fast/dom/HTMLFormElement/invalid-form-field.html: Added.
        * fast/dom/HTMLFormElement/move-option-between-documents-expected.txt: Added.
        * fast/dom/HTMLFormElement/move-option-between-documents.html: Added.
        * fast/dom/collection-nameditem-move-between-documents-expected.txt: Added.
        * fast/dom/collection-nameditem-move-between-documents.html: Added.
2011-03-10  Emil A Eklund  <eae@chromium.org>

        Reviewed by Darin Adler.

        Collection cache not reset when moving base node between documents
        https://bugs.webkit.org/show_bug.cgi?id=55446

        Fix bug where HTMLCollection::resetCollectionInfo does not reset the
        cache when the base node is moved to a different document by making sure
        that the DOMVersion is updated and that it's unique across documents.

        Tests: fast/dom/HTMLFormElement/invalid-form-field.html
               fast/dom/HTMLFormElement/move-option-between-documents.html
               fast/dom/collection-nameditem-move-between-documents.html

        * dom/Document.cpp:
        (WebCore::Document::Document):
        * dom/Document.h:
        (WebCore::Document::incDOMTreeVersion):
        (WebCore::Document::domTreeVersion):
        * dom/Node.cpp:
        (WebCore::Node::setDocumentRecursively):
        * html/FormAssociatedElement.cpp:
        (WebCore::FormAssociatedElement::resetFormOwner):
        * html/HTMLCollection.cpp:
        (WebCore::HTMLCollection::resetCollectionInfo):
        * xml/XPathResult.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@80797 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/html/HTMLCollection.cpp b/Source/WebCore/html/HTMLCollection.cpp
index 6d64f5c..72ebf55 100644
--- a/Source/WebCore/html/HTMLCollection.cpp
+++ b/Source/WebCore/html/HTMLCollection.cpp
@@ -67,7 +67,7 @@
 
 void HTMLCollection::resetCollectionInfo() const
 {
-    unsigned docversion = static_cast<HTMLDocument*>(m_base->document())->domTreeVersion();
+    uint64_t docversion = static_cast<HTMLDocument*>(m_base->document())->domTreeVersion();
 
     if (!m_info) {
         m_info = new CollectionCache;