Refactoring spelling-insert-html.html to use asynchronous spellchecking
https://bugs.webkit.org/show_bug.cgi?id=129422

Reviewed by Ryosuke Niwa.

Use asynchronous text checking in spelling-insert-html.html.
Add more logs to the test expectation so that it becomes
more descriptive.

Additionally, the word "foo" was changed to "moo" due to
only Mac had recognized this word as spelled correctly.

* editing/spelling/spelling-insert-html-expected.txt:
* editing/spelling/spelling-insert-html.html:

* platform/efl/TestExpectations:
Remove failing expectation for EFL.

* platform/gtk-wk2/TestExpectations:
* platform/gtk/TestExpectations:
Skip the tests for GTK+ because of missing asynchronous spellchecking.

* platform/mac-wk2/TestExpectations:
Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165101 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Remove unsupported spelling tests.
https://bugs.webkit.org/show_bug.cgi?id=129482

Reviewed by Ryosuke Niwa.

Remove two spelling tests that require spellchecking of multiple words.
Currently, neither WebKit port is supporting this feature.
Those tests were added by Chromium at r141354.

* editing/spelling/spelling-exactly-selected-multiple-words-expected.txt: Removed.
* editing/spelling/spelling-exactly-selected-multiple-words.html: Removed.
* editing/spelling/spelling-should-select-multiple-words-expected.txt: Removed.
* editing/spelling/spelling-should-select-multiple-words.html: Removed.

* platform/efl-wk2/TestExpectations:
* platform/gtk/TestExpectations:
* platform/mac-wk2/TestExpectations:
* platform/mac/TestExpectations:
* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:
Clear TestExpectations.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165102 268f45cc-cd09-0410-ab3c-d52691b4dbfc
appendChild shouldn't invalidate LiveNodeLists and HTMLCollections if they don't have valid caches
https://bugs.webkit.org/show_bug.cgi?id=129727

Reviewed by Andreas Kling.

Before this patch, invalidateNodeListAndCollectionCachesInAncestors invalidated node lists and HTML
collections on ancestors of a node whenever we're inserting or removing a child node. This patch
makes HTMLCollections and LiveNodeLists register themselves with Document only when they have valid
caches.

Each user of CollectionIndexCache now implements willValidateIndexCache member function that gets
called when CollectionIndexCache caches any state and necessitates the registration with document.

* dom/ChildNodeList.h: Added an empty willValidateIndexCache since child node lists are never
registered with document.

* dom/CollectionIndexCache.h:
(WebCore::CollectionIndexCache::hasValidCache): Added.
(WebCore::CollectionIndexCache::nodeCount): Calls willValidateIndexCache when caching node count.
(WebCore::CollectionIndexCache::nodeAfterCached): Ditto. Also assert that hasValidCache() true in
the cases where we're simply updating our caches or adding more caches.
(WebCore::CollectionIndexCache::nodeAt): Ditto. Also added a code to set the length cache when
we've reached the end of the list. This should be a slight speed up on some cases.

* dom/Document.cpp:
(WebCore::Document::Document): Initializes a variable used by assertions.
(WebCore::Document::unregisterNodeList): Added an early exit for when m_listsInvalidatedAtDocument
is empty since invalidateNodeListAndCollectionCaches swaps out the list.
(WebCore::Document::registerCollection): Removed the boolean hasIdNameMap since we now explicitly
call collectionCachedIdNameMap in HTMLCollection.
(WebCore::Document::unregisterCollection): Ditto. Exit early if m_collectionsInvalidatedAtDocument
is empty since invalidateNodeListAndCollectionCaches swaps out the list.
* dom/Document.h:

* dom/LiveNodeList.cpp:
(WebCore::LiveNodeList::invalidateCache): Unregister the node list with document if we had caches.
* dom/LiveNodeList.h:
(WebCore::LiveNodeList::LiveNodeList):
(WebCore::LiveNodeList::~LiveNodeList): Ditto.
(WebCore::LiveNodeList::invalidateCache): Pass around document. This is necessary since document()
had already moved to the new document inside NodeListsNodeData::invalidateCaches.
(WebCore::LiveNodeList::willValidateIndexCache): Added. Registers itself with document.

* dom/Node.cpp:
(WebCore::Document::invalidateNodeListAndCollectionCaches): Swap the lists since invalidateCache
tries to unregister node lists and HTML collections with document. Since this is the only case in
which node lists and HTML collections being removed may not be in the lists in unregisterNodeList
and unregisterCollection, assert this condition via m_inInvalidateNodeListAndCollectionCaches.
(WebCore::NodeListsNodeData::invalidateCaches):

* dom/NodeRareData.h:
(WebCore::NodeListsNodeData::adoptDocument): Unregister node lists and HTML collections from old
document via invalidateCache. We need to explicitly pass in oldDocument here since owner node's
document had already been changed to newDocument at this point. Since we're invalidating caches,
there is no need to register node lists and HTML collections with newDocument.

* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::HTMLCollection):
(WebCore::HTMLCollection::~HTMLCollection): Unregister the node list with document if we had caches.
(WebCore::HTMLCollection::invalidateCache): Ditto.
(WebCore::HTMLCollection::invalidateNamedElementCache):
* html/HTMLCollection.h:
(WebCore::HTMLCollection::invalidateCache): Pass around document as done in LiveNodeList.
(WebCore::HTMLCollection::willValidateIndexCache): Ditto.

* html/HTMLFormControlsCollection.cpp:
(WebCore::HTMLFormControlsCollection::invalidateCache): Ditto.
* html/HTMLFormControlsCollection.h:

* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::invalidateSelectedItems): Ditto.
(WebCore::HTMLSelectElement::setRecalcListItems): Ditto.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@165103 268f45cc-cd09-0410-ab3c-d52691b4dbfc