diff options
author | Ben Murdoch <benm@google.com> | 2011-01-06 21:36:31 +0000 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-01-07 10:36:05 +0000 |
commit | 4a156157940f51b91eadd76f6c86f862ec0a1da0 (patch) | |
tree | ee905fa007e14522848f571215c1054734db9269 /WebCore/dom | |
parent | 21d8d81a756ca7e60b5131e5f1006f52799179b0 (diff) | |
download | external_webkit-4a156157940f51b91eadd76f6c86f862ec0a1da0.zip external_webkit-4a156157940f51b91eadd76f6c86f862ec0a1da0.tar.gz external_webkit-4a156157940f51b91eadd76f6c86f862ec0a1da0.tar.bz2 |
Merge WebKit at Chromium 9.0.597.55: trivial merge by git
Change-Id: I2c6f2ebc4431d15ac82b5b1a9f08159e1731bc57
Diffstat (limited to 'WebCore/dom')
-rw-r--r-- | WebCore/dom/Document.cpp | 17 | ||||
-rw-r--r-- | WebCore/dom/Document.h | 1 | ||||
-rw-r--r-- | WebCore/dom/EventContext.cpp | 7 | ||||
-rw-r--r-- | WebCore/dom/EventContext.h | 1 | ||||
-rw-r--r-- | WebCore/dom/ExceptionCode.cpp | 41 | ||||
-rw-r--r-- | WebCore/dom/ExceptionCode.h | 3 | ||||
-rw-r--r-- | WebCore/dom/InputElement.cpp | 4 | ||||
-rw-r--r-- | WebCore/dom/Node.cpp | 17 | ||||
-rw-r--r-- | WebCore/dom/Node.h | 1 | ||||
-rw-r--r-- | WebCore/dom/SelectElement.cpp | 8 |
10 files changed, 86 insertions, 14 deletions
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp index 4bd3af3..400d917 100644 --- a/WebCore/dom/Document.cpp +++ b/WebCore/dom/Document.cpp @@ -1893,8 +1893,11 @@ void Document::clearAXObjectCache() #else // clear cache in top document if (m_axObjectCache) { - delete m_axObjectCache; + // Clear the cache member variable before calling delete because attempts + // are made to access it during destruction. + AXObjectCache* axObjectCache = m_axObjectCache; m_axObjectCache = 0; + delete axObjectCache; return; } @@ -3361,6 +3364,18 @@ void Document::detachNodeIterator(NodeIterator* ni) m_nodeIterators.remove(ni); } +void Document::moveNodeIteratorsToNewDocument(Node* node, Document* newDocument) +{ + HashSet<NodeIterator*> nodeIteratorsList = m_nodeIterators; + HashSet<NodeIterator*>::const_iterator nodeIteratorsEnd = nodeIteratorsList.end(); + for (HashSet<NodeIterator*>::const_iterator it = nodeIteratorsList.begin(); it != nodeIteratorsEnd; ++it) { + if ((*it)->root() == node) { + detachNodeIterator(*it); + newDocument->attachNodeIterator(*it); + } + } +} + void Document::nodeChildrenChanged(ContainerNode* container) { if (!disableRangeMutation(page())) { diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h index a7df9ff..0aba06c 100644 --- a/WebCore/dom/Document.h +++ b/WebCore/dom/Document.h @@ -683,6 +683,7 @@ public: void attachNodeIterator(NodeIterator*); void detachNodeIterator(NodeIterator*); + void moveNodeIteratorsToNewDocument(Node*, Document*); void attachRange(Range*); void detachRange(Range*); diff --git a/WebCore/dom/EventContext.cpp b/WebCore/dom/EventContext.cpp index e5fe0ee..2a5c521 100644 --- a/WebCore/dom/EventContext.cpp +++ b/WebCore/dom/EventContext.cpp @@ -41,13 +41,6 @@ EventContext::EventContext(PassRefPtr<Node> node, PassRefPtr<EventTarget> curren { } -void EventContext::defaultEventHandler(Event* event) const -{ - event->setTarget(m_target.get()); - event->setCurrentTarget(m_currentTarget.get()); - m_node->defaultEventHandler(event); -} - void EventContext::handleLocalEvents(Event* event) const { event->setTarget(m_target.get()); diff --git a/WebCore/dom/EventContext.h b/WebCore/dom/EventContext.h index 8331b4d..9bab9d4 100644 --- a/WebCore/dom/EventContext.h +++ b/WebCore/dom/EventContext.h @@ -42,7 +42,6 @@ public: Node* node() const; EventTarget* target() const; - void defaultEventHandler(Event*) const; void handleLocalEvents(Event*) const; private: diff --git a/WebCore/dom/ExceptionCode.cpp b/WebCore/dom/ExceptionCode.cpp index ad4fb6f..7e7e0c9 100644 --- a/WebCore/dom/ExceptionCode.cpp +++ b/WebCore/dom/ExceptionCode.cpp @@ -27,6 +27,7 @@ #include "ExceptionCode.h" #include "EventException.h" +#include "IDBDatabaseException.h" #include "RangeException.h" #include "XMLHttpRequestException.h" @@ -209,6 +210,36 @@ static const char* const fileExceptionDescriptions[] = { }; #endif +#if ENABLE(INDEXED_DATABASE) +static const char* const idbDatabaseExceptionNames[] = { + "UNKNOWN_ERR", + "NON_TRANSIENT_ERR", + "NOT_FOUND_ERR", + "CONSTRAINT_ERR", + "DATA_ERR", + "NOT_ALLOWED_ERR", + "SERIAL_ERR", + "RECOVERABLE_ERR", + "TRANSIENT_ERR", + "TIMEOUT_ERR", + "DEADLOCK_ERR" +}; + +static const char* const idbDatabaseExceptionDescriptions[] = { + "An unknown error occurred within Indexed Database.", + "NON_TRANSIENT_ERR", // FIXME: Write a better message if it's ever possible this is thrown. + "The name supplied does not match any existing item.", + "The request cannot be completed due to a failed constraint.", + "The data provided does not meet the requirements of the function.", + "This function is not allowed to be called in such a context.", + "The data supplied cannot be serialized according to the structured cloning algorithm.", + "RECOVERABLE_ERR", // FIXME: This isn't even used. + "TRANSIENT_ERR", // FIXME: This isn't even used. + "TIMEOUT_ERR", // This can't be thrown. + "DEADLOCK_ERR" // This can't be thrown. +}; +#endif + void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& description) { ASSERT(ec); @@ -287,6 +318,16 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des nameTableSize = WTF_ARRAY_LENGTH(fileExceptionNames); nameTableOffset = FileException::NOT_FOUND_ERR; #endif +#if ENABLE(INDEXED_DATABASE) + } else if (code >= IDBDatabaseException::IDBDatabaseExceptionOffset && code <= IDBDatabaseException::IDBDatabaseExceptionMax) { + type = IDBDatabaseExceptionType; + typeName = "DOM IDBDatabase"; + code -= IDBDatabaseException::IDBDatabaseExceptionOffset; + nameTable = idbDatabaseExceptionNames; + descriptionTable = idbDatabaseExceptionDescriptions; + nameTableSize = WTF_ARRAY_LENGTH(idbDatabaseExceptionNames); + nameTableOffset = IDBDatabaseException::UNKNOWN_ERR; +#endif } else { type = DOMExceptionType; typeName = "DOM"; diff --git a/WebCore/dom/ExceptionCode.h b/WebCore/dom/ExceptionCode.h index 6ea9f7d..dd976c7 100644 --- a/WebCore/dom/ExceptionCode.h +++ b/WebCore/dom/ExceptionCode.h @@ -84,6 +84,9 @@ namespace WebCore { #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM) , FileExceptionType #endif +#if ENABLE(INDEXED_DATABASE) + , IDBDatabaseExceptionType +#endif }; diff --git a/WebCore/dom/InputElement.cpp b/WebCore/dom/InputElement.cpp index 85f37e1..37211d8 100644 --- a/WebCore/dom/InputElement.cpp +++ b/WebCore/dom/InputElement.cpp @@ -138,7 +138,9 @@ void InputElement::setValueFromRenderer(InputElementData& data, InputElement* in element->setFormControlValueMatchesRenderer(true); - element->dispatchEvent(Event::create(eventNames().inputEvent, true, false)); + // Input event is fired by the Node::defaultEventHandler for editable controls. + if (!inputElement->isTextField()) + element->dispatchEvent(Event::create(eventNames().inputEvent, true, false)); notifyFormStateChanged(element); } diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index e76a37f..42a200b 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -450,8 +450,10 @@ void Node::setDocument(Document* document) document->addNodeListCache(); } - if (m_document) + if (m_document) { + m_document->moveNodeIteratorsToNewDocument(this, document); m_document->selfOnlyDeref(); + } m_document = document; @@ -1197,6 +1199,17 @@ bool Node::contains(const Node* node) const return this == node || node->isDescendantOf(this); } +bool Node::containsIncludingShadowDOM(Node* node) +{ + if (!node) + return false; + for (Node* n = node; n; n = n->parentOrHostNode()) { + if (n == this) + return true; + } + return false; +} + void Node::attach() { ASSERT(!attached()); @@ -2708,7 +2721,7 @@ doneDispatching: if (event->bubbles()) { size_t size = ancestors.size(); for (size_t i = 0; i < size; ++i) { - ancestors[i].defaultEventHandler(event.get()); + ancestors[i].node()->defaultEventHandler(event.get()); ASSERT(!event->defaultPrevented()); if (event->defaultHandled()) goto doneWithDefault; diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h index 17c1580..45a8488 100644 --- a/WebCore/dom/Node.h +++ b/WebCore/dom/Node.h @@ -385,6 +385,7 @@ public: void checkSetPrefix(const AtomicString& prefix, ExceptionCode&); bool isDescendantOf(const Node*) const; bool contains(const Node*) const; + bool containsIncludingShadowDOM(Node*); // This method is used to do strict error-checking when adding children via // the public DOM API (e.g., appendChild()). diff --git a/WebCore/dom/SelectElement.cpp b/WebCore/dom/SelectElement.cpp index 34a4961..d236c96 100644 --- a/WebCore/dom/SelectElement.cpp +++ b/WebCore/dom/SelectElement.cpp @@ -949,8 +949,12 @@ void SelectElement::accessKeySetSelectedIndex(SelectElementData& data, Element* else setSelectedIndex(data, element, index, false, true); } - - listBoxOnChange(data, element); + + if (data.usesMenuList()) + menuListOnChange(data, element); + else + listBoxOnChange(data, element); + scrollToSelection(data, element); } |