summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/dom
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-16 16:25:10 +0100
committerBen Murdoch <benm@google.com>2011-05-23 18:54:14 +0100
commitab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb (patch)
treedb769fadd053248f85db67434a5b275224defef7 /Source/WebCore/dom
parent52e2557aeb8477967e97fd24f20f8f407a10fa15 (diff)
downloadexternal_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.zip
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.gz
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.bz2
Merge WebKit at r76408: Initial merge by git.
Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53
Diffstat (limited to 'Source/WebCore/dom')
-rw-r--r--Source/WebCore/dom/AsyncScriptRunner.h3
-rw-r--r--Source/WebCore/dom/DOMStringMap.h3
-rw-r--r--Source/WebCore/dom/Document.cpp114
-rw-r--r--Source/WebCore/dom/Document.h24
-rw-r--r--Source/WebCore/dom/Document.idl4
-rw-r--r--Source/WebCore/dom/DocumentMarkerController.h4
-rw-r--r--Source/WebCore/dom/Element.cpp10
-rw-r--r--Source/WebCore/dom/Element.h2
-rw-r--r--Source/WebCore/dom/Element.idl4
-rw-r--r--Source/WebCore/dom/ElementRareData.h9
-rw-r--r--Source/WebCore/dom/ErrorEvent.cpp4
-rw-r--r--Source/WebCore/dom/ErrorEvent.h4
-rw-r--r--Source/WebCore/dom/Event.cpp4
-rw-r--r--Source/WebCore/dom/Event.h4
-rw-r--r--Source/WebCore/dom/EventNames.h5
-rw-r--r--Source/WebCore/dom/EventTarget.h4
-rw-r--r--Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h4
-rw-r--r--Source/WebCore/dom/InputElement.cpp2
-rw-r--r--Source/WebCore/dom/MessagePortChannel.h6
-rw-r--r--Source/WebCore/dom/NamedNodeMap.cpp2
-rw-r--r--Source/WebCore/dom/Node.cpp13
-rw-r--r--Source/WebCore/dom/Node.h2
-rw-r--r--Source/WebCore/dom/NodeRareData.h7
-rw-r--r--Source/WebCore/dom/Position.cpp21
-rw-r--r--Source/WebCore/dom/Position.h3
-rw-r--r--Source/WebCore/dom/QualifiedName.h3
-rw-r--r--Source/WebCore/dom/RequestAnimationFrameCallback.h53
-rw-r--r--Source/WebCore/dom/RequestAnimationFrameCallback.idl37
-rw-r--r--Source/WebCore/dom/ScriptElement.h1
-rw-r--r--Source/WebCore/dom/ScriptExecutionContext.cpp61
-rw-r--r--Source/WebCore/dom/ScriptExecutionContext.h21
-rw-r--r--Source/WebCore/dom/SpaceSplitString.h3
-rw-r--r--Source/WebCore/dom/TextEvent.cpp19
-rw-r--r--Source/WebCore/dom/TextEvent.h23
-rw-r--r--Source/WebCore/dom/TextEventInputType.h41
-rw-r--r--Source/WebCore/dom/TransformSource.h3
-rw-r--r--Source/WebCore/dom/UserGestureIndicator.h3
-rw-r--r--Source/WebCore/dom/UserTypingGestureIndicator.h3
-rw-r--r--Source/WebCore/dom/XMLDocumentParser.h1
-rw-r--r--Source/WebCore/dom/XMLDocumentParserLibxml2.cpp4
-rw-r--r--Source/WebCore/dom/XMLDocumentParserScope.h3
41 files changed, 454 insertions, 87 deletions
diff --git a/Source/WebCore/dom/AsyncScriptRunner.h b/Source/WebCore/dom/AsyncScriptRunner.h
index 2326f67..6a75323 100644
--- a/Source/WebCore/dom/AsyncScriptRunner.h
+++ b/Source/WebCore/dom/AsyncScriptRunner.h
@@ -39,7 +39,8 @@ class Document;
class PendingScript;
class ScriptElement;
-class AsyncScriptRunner : public Noncopyable {
+class AsyncScriptRunner {
+ WTF_MAKE_NONCOPYABLE(AsyncScriptRunner); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<AsyncScriptRunner> create(Document* document) { return new AsyncScriptRunner(document); }
~AsyncScriptRunner();
diff --git a/Source/WebCore/dom/DOMStringMap.h b/Source/WebCore/dom/DOMStringMap.h
index 86a22b0..772a700 100644
--- a/Source/WebCore/dom/DOMStringMap.h
+++ b/Source/WebCore/dom/DOMStringMap.h
@@ -35,7 +35,8 @@ namespace WebCore {
class Element;
typedef int ExceptionCode;
-class DOMStringMap : public Noncopyable {
+class DOMStringMap {
+ WTF_MAKE_NONCOPYABLE(DOMStringMap); WTF_MAKE_FAST_ALLOCATED;
public:
virtual ~DOMStringMap();
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index 1787b52..0bdd603 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -119,6 +119,7 @@
#include "RenderTextControl.h"
#include "RenderView.h"
#include "RenderWidget.h"
+#include "ScriptCallStack.h"
#include "ScriptController.h"
#include "ScriptElement.h"
#include "ScriptEventListener.h"
@@ -220,6 +221,10 @@
#include "RenderFullScreen.h"
#endif
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+#include "RequestAnimationFrameCallback.h"
+#endif
+
using namespace std;
using namespace WTF;
using namespace Unicode;
@@ -441,6 +446,9 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML, con
, m_loadEventDelayTimer(this, &Document::loadEventDelayTimerFired)
, m_directionSetOnDocumentElement(false)
, m_writingModeSetOnDocumentElement(false)
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ , m_nextRequestAnimationFrameCallbackId(0)
+#endif
{
m_document = this;
@@ -1330,7 +1338,7 @@ PassRefPtr<Range> Document::caretRangeFromPoint(int x, int y)
if (visiblePosition.isNull())
return 0;
- Position rangeCompliantPosition = rangeCompliantEquivalent(visiblePosition);
+ Position rangeCompliantPosition = visiblePosition.deepEquivalent().parentAnchoredEquivalent();
return Range::create(this, rangeCompliantPosition, rangeCompliantPosition);
}
@@ -2347,6 +2355,17 @@ KURL Document::virtualCompleteURL(const String& url) const
return completeURL(url);
}
+EventTarget* Document::errorEventTarget()
+{
+ return domWindow();
+}
+
+void Document::logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack)
+{
+ MessageType messageType = callStack ? UncaughtExceptionMessageType : LogMessageType;
+ addMessage(JSMessageSource, messageType, ErrorMessageLevel, errorMessage, lineNumber, sourceURL, callStack);
+}
+
void Document::setURL(const KURL& url)
{
const KURL& newURL = url.isEmpty() ? blankURL() : url;
@@ -4735,18 +4754,15 @@ void Document::parseDNSPrefetchControlHeader(const String& dnsPrefetchControl)
m_haveExplicitlyDisabledDNSPrefetch = true;
}
-void Document::reportException(const String& errorMessage, int lineNumber, const String& sourceURL)
-{
- addMessage(JSMessageSource, LogMessageType, ErrorMessageLevel, errorMessage, lineNumber, sourceURL);
-}
-
-void Document::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+void Document::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack)
{
if (DOMWindow* window = domWindow())
- window->console()->addMessage(source, type, level, message, lineNumber, sourceURL);
+ window->console()->addMessage(source, type, level, message, lineNumber, sourceURL, callStack);
}
-struct PerformTaskContext : Noncopyable {
+struct PerformTaskContext {
+ WTF_MAKE_NONCOPYABLE(PerformTaskContext); WTF_MAKE_FAST_ALLOCATED;
+public:
PerformTaskContext(PassRefPtr<DocumentWeakReference> documentReference, PassOwnPtr<ScriptExecutionContext::Task> task)
: documentReference(documentReference)
, task(task)
@@ -5004,6 +5020,86 @@ void Document::loadEventDelayTimerFired(Timer<Document>*)
frame()->loader()->checkCompleted();
}
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+int Document::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback, Element* e)
+{
+ if (!m_requestAnimationFrameCallbacks)
+ m_requestAnimationFrameCallbacks = new RequestAnimationFrameCallbackList;
+ int id = m_nextRequestAnimationFrameCallbackId++;
+ callback->m_firedOrCancelled = false;
+ callback->m_id = id;
+ callback->m_element = e;
+ m_requestAnimationFrameCallbacks->append(callback);
+ if (FrameView* v = view())
+ v->scheduleAnimation();
+ return id;
+}
+
+void Document::webkitCancelRequestAnimationFrame(int id)
+{
+ if (!m_requestAnimationFrameCallbacks)
+ return;
+ for (size_t i = 0; i < m_requestAnimationFrameCallbacks->size(); ++i) {
+ if (m_requestAnimationFrameCallbacks->at(i)->m_id == id) {
+ m_requestAnimationFrameCallbacks->at(i)->m_firedOrCancelled = true;
+ m_requestAnimationFrameCallbacks->remove(i);
+ return;
+ }
+ }
+}
+
+void Document::serviceScriptedAnimations()
+{
+ if (!m_requestAnimationFrameCallbacks)
+ return;
+ // We want to run the callback for all elements in the document that have registered
+ // for a callback and that are visible. Running the callbacks can cause new callbacks
+ // to be registered, existing callbacks to be cancelled, and elements to gain or lose
+ // visibility so this code has to iterate carefully.
+
+ // FIXME: Currently, this code doesn't do any visibility tests beyond checking display:
+
+ // First, generate a list of callbacks to consider. Callbacks registered from this point
+ // on are considered only for the "next" frame, not this one.
+ RequestAnimationFrameCallbackList callbacks(*m_requestAnimationFrameCallbacks);
+
+ // Firing the callback may cause the visibility of other elements to change. To avoid
+ // missing any callbacks, we keep iterating through the list of candiate callbacks and firing
+ // them until nothing new becomes visible.
+ bool firedCallback;
+ do {
+ firedCallback = false;
+ // A previous iteration may have invalidated style (or layout). Update styles for each iteration
+ // for now since all we check is the existence of a renderer.
+ updateStyleIfNeeded();
+ for (size_t i = 0; i < callbacks.size(); ++i) {
+ RequestAnimationFrameCallback* callback = callbacks[i].get();
+ if (!callback->m_firedOrCancelled && (!callback->m_element || callback->m_element->renderer())) {
+ callback->m_firedOrCancelled = true;
+ callback->handleEvent();
+ firedCallback = true;
+ callbacks.remove(i);
+ break;
+ }
+ }
+ } while (firedCallback);
+
+ // Remove any callbacks we fired from the list of pending callbacks.
+ for (size_t i = 0; i < m_requestAnimationFrameCallbacks->size();) {
+ if (m_requestAnimationFrameCallbacks->at(i)->m_firedOrCancelled)
+ m_requestAnimationFrameCallbacks->remove(i);
+ else
+ ++i;
+ }
+
+ // In most cases we expect this list to be empty, so no need to keep around the vector's inline buffer.
+ if (!m_requestAnimationFrameCallbacks->size())
+ m_requestAnimationFrameCallbacks.clear();
+ else if (FrameView* v = view())
+ v->scheduleAnimation();
+}
+#endif
+
#if ENABLE(TOUCH_EVENTS)
PassRefPtr<Touch> Document::createTouch(DOMWindow* window, EventTarget* target, int identifier, int pageX, int pageY, int screenX, int screenY, ExceptionCode&) const
{
diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h
index e70063a..c9c8d38 100644
--- a/Source/WebCore/dom/Document.h
+++ b/Source/WebCore/dom/Document.h
@@ -146,6 +146,10 @@ class Touch;
class TouchList;
#endif
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+class RequestAnimationFrameCallback;
+#endif
+
typedef int ExceptionCode;
class FormElementKey {
@@ -249,6 +253,8 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart);
DEFINE_ATTRIBUTE_EVENT_LISTENER(drag);
DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(formchange);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(forminput);
DEFINE_ATTRIBUTE_EVENT_LISTENER(input);
DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid);
DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown);
@@ -942,8 +948,7 @@ public:
bool isDNSPrefetchEnabled() const { return m_isDNSPrefetchEnabled; }
void parseDNSPrefetchControlHeader(const String&);
- virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL);
- virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+ virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>);
virtual void postTask(PassOwnPtr<Task>); // Executes the task on context's thread asynchronously.
#if USE(JSC)
@@ -1083,8 +1088,17 @@ public:
const DocumentTiming* timing() const { return &m_documentTiming; }
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>, Element*);
+ void webkitCancelRequestAnimationFrame(int id);
+ void serviceScriptedAnimations();
+#endif
+
bool mayCauseFlashOfUnstyledContent() const;
+ virtual EventTarget* errorEventTarget();
+ virtual void logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>);
+
void initDNSPrefetch();
protected:
@@ -1408,6 +1422,12 @@ private:
DocumentTiming m_documentTiming;
RefPtr<MediaQueryMatcher> m_mediaQueryMatcher;
+
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ typedef Vector<RefPtr<RequestAnimationFrameCallback> > RequestAnimationFrameCallbackList;
+ OwnPtr<RequestAnimationFrameCallbackList> m_requestAnimationFrameCallbacks;
+ int m_nextRequestAnimationFrameCallbackId;
+#endif
};
inline bool Document::DocumentOrderedMap::contains(AtomicStringImpl* id) const
diff --git a/Source/WebCore/dom/Document.idl b/Source/WebCore/dom/Document.idl
index 8d7a71b..c215df0 100644
--- a/Source/WebCore/dom/Document.idl
+++ b/Source/WebCore/dom/Document.idl
@@ -266,6 +266,8 @@ module core {
attribute [DontEnum] EventListener ondrop;
attribute [DontEnum] EventListener onerror;
attribute [DontEnum] EventListener onfocus;
+ attribute [DontEnum] EventListener onformchange;
+ attribute [DontEnum] EventListener onforminput;
attribute [DontEnum] EventListener oninput;
attribute [DontEnum] EventListener oninvalid;
attribute [DontEnum] EventListener onkeydown;
@@ -288,8 +290,6 @@ module core {
// attribute [DontEnum] EventListener ondurationchange;
// attribute [DontEnum] EventListener onemptied;
// attribute [DontEnum] EventListener onended;
- // attribute [DontEnum] EventListener onformchange;
- // attribute [DontEnum] EventListener onforminput;
// attribute [DontEnum] EventListener onloadeddata;
// attribute [DontEnum] EventListener onloadedmetadata;
// attribute [DontEnum] EventListener onloadstart;
diff --git a/Source/WebCore/dom/DocumentMarkerController.h b/Source/WebCore/dom/DocumentMarkerController.h
index 83177fc..2dc2b9e 100644
--- a/Source/WebCore/dom/DocumentMarkerController.h
+++ b/Source/WebCore/dom/DocumentMarkerController.h
@@ -38,8 +38,10 @@ class IntRect;
class Node;
class Range;
-class DocumentMarkerController : public Noncopyable {
+class DocumentMarkerController {
+ WTF_MAKE_NONCOPYABLE(DocumentMarkerController); WTF_MAKE_FAST_ALLOCATED;
public:
+ DocumentMarkerController() { }
~DocumentMarkerController() { detach(); }
void detach();
diff --git a/Source/WebCore/dom/Element.cpp b/Source/WebCore/dom/Element.cpp
index 5d91db7..276a409 100644
--- a/Source/WebCore/dom/Element.cpp
+++ b/Source/WebCore/dom/Element.cpp
@@ -75,6 +75,7 @@ PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* docu
Element::~Element()
{
+ removeShadowRoot();
if (m_attributeMap)
m_attributeMap->detachFromElement();
}
@@ -1100,7 +1101,7 @@ void Element::recalcStyle(StyleChange change)
Node* Element::shadowRoot()
{
- return hasRareData() ? rareData()->m_shadowRoot.get() : 0;
+ return hasRareData() ? rareData()->m_shadowRoot : 0;
}
void Element::setShadowRoot(PassRefPtr<Node> node)
@@ -1109,11 +1110,12 @@ void Element::setShadowRoot(PassRefPtr<Node> node)
// about compromising DOM tree integrity (eg. node being a parent of this). However,
// once we implement XBL2, we will have to add integrity checks here.
removeShadowRoot();
+
RefPtr<Node> newRoot = node;
if (!newRoot)
return;
- ensureRareData()->m_shadowRoot = newRoot;
+ ensureRareData()->m_shadowRoot = newRoot.get();
newRoot->setShadowHost(this);
}
@@ -1122,7 +1124,9 @@ void Element::removeShadowRoot()
if (!hasRareData())
return;
- if (RefPtr<Node> oldRoot = rareData()->m_shadowRoot.release()) {
+ ElementRareData* data = rareData();
+ if (RefPtr<Node> oldRoot = data->m_shadowRoot) {
+ data->m_shadowRoot = 0;
document()->removeFocusedNodeOfSubtree(oldRoot.get());
oldRoot->setShadowHost(0);
if (oldRoot->inDocument())
diff --git a/Source/WebCore/dom/Element.h b/Source/WebCore/dom/Element.h
index 5e6c047..4510478 100644
--- a/Source/WebCore/dom/Element.h
+++ b/Source/WebCore/dom/Element.h
@@ -63,6 +63,8 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(dragstart);
DEFINE_ATTRIBUTE_EVENT_LISTENER(drag);
DEFINE_ATTRIBUTE_EVENT_LISTENER(dragend);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(formchange);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(forminput);
DEFINE_ATTRIBUTE_EVENT_LISTENER(input);
DEFINE_ATTRIBUTE_EVENT_LISTENER(invalid);
DEFINE_ATTRIBUTE_EVENT_LISTENER(keydown);
diff --git a/Source/WebCore/dom/Element.idl b/Source/WebCore/dom/Element.idl
index 7cb63c2..652a75b 100644
--- a/Source/WebCore/dom/Element.idl
+++ b/Source/WebCore/dom/Element.idl
@@ -153,6 +153,8 @@ module core {
attribute [DontEnum] EventListener ondrop;
attribute [DontEnum] EventListener onerror;
attribute [DontEnum] EventListener onfocus;
+ attribute [DontEnum] EventListener onformchange;
+ attribute [DontEnum] EventListener onforminput;
attribute [DontEnum] EventListener oninput;
attribute [DontEnum] EventListener oninvalid;
attribute [DontEnum] EventListener onkeydown;
@@ -174,8 +176,6 @@ module core {
// attribute [DontEnum] EventListener ondurationchange;
// attribute [DontEnum] EventListener onemptied;
// attribute [DontEnum] EventListener onended;
- // attribute [DontEnum] EventListener onformchange;
- // attribute [DontEnum] EventListener onforminput;
// attribute [DontEnum] EventListener onloadeddata;
// attribute [DontEnum] EventListener onloadedmetadata;
// attribute [DontEnum] EventListener onloadstart;
diff --git a/Source/WebCore/dom/ElementRareData.h b/Source/WebCore/dom/ElementRareData.h
index f7f30bb..818a2c2 100644
--- a/Source/WebCore/dom/ElementRareData.h
+++ b/Source/WebCore/dom/ElementRareData.h
@@ -33,6 +33,7 @@ namespace WebCore {
class ElementRareData : public NodeRareData {
public:
ElementRareData();
+ virtual ~ElementRareData();
void resetComputedStyle();
@@ -41,7 +42,7 @@ public:
IntSize m_minimumSizeForResizing;
RefPtr<RenderStyle> m_computedStyle;
- RefPtr<Node> m_shadowRoot;
+ Node* m_shadowRoot;
OwnPtr<DatasetDOMStringMap> m_datasetDOMStringMap;
OwnPtr<ClassList> m_classList;
@@ -54,9 +55,15 @@ inline IntSize defaultMinimumSizeForResizing()
inline ElementRareData::ElementRareData()
: m_minimumSizeForResizing(defaultMinimumSizeForResizing())
+ , m_shadowRoot(0)
{
}
+inline ElementRareData::~ElementRareData()
+{
+ ASSERT(!m_shadowRoot);
+}
+
inline void ElementRareData::resetComputedStyle()
{
m_computedStyle.clear();
diff --git a/Source/WebCore/dom/ErrorEvent.cpp b/Source/WebCore/dom/ErrorEvent.cpp
index 2627d01..c598836 100644
--- a/Source/WebCore/dom/ErrorEvent.cpp
+++ b/Source/WebCore/dom/ErrorEvent.cpp
@@ -30,8 +30,6 @@
#include "config.h"
-#if ENABLE(WORKERS)
-
#include "ErrorEvent.h"
#include "EventNames.h"
@@ -72,5 +70,3 @@ bool ErrorEvent::isErrorEvent() const
}
} // namespace WebCore
-
-#endif // ENABLE(WORKERS)
diff --git a/Source/WebCore/dom/ErrorEvent.h b/Source/WebCore/dom/ErrorEvent.h
index f81530a..719ca2d 100644
--- a/Source/WebCore/dom/ErrorEvent.h
+++ b/Source/WebCore/dom/ErrorEvent.h
@@ -31,8 +31,6 @@
#ifndef ErrorEvent_h
#define ErrorEvent_h
-#if ENABLE(WORKERS)
-
#include "Event.h"
#include "PlatformString.h"
@@ -69,6 +67,4 @@ namespace WebCore {
} // namespace WebCore
-#endif // ENABLE(WORKERS)
-
#endif // ErrorEvent_h
diff --git a/Source/WebCore/dom/Event.cpp b/Source/WebCore/dom/Event.cpp
index 0a1538b..0e11c69 100644
--- a/Source/WebCore/dom/Event.cpp
+++ b/Source/WebCore/dom/Event.cpp
@@ -204,12 +204,10 @@ bool Event::isIDBSuccessEvent() const
}
#endif
-#if ENABLE(WORKERS)
bool Event::isErrorEvent() const
{
return false;
}
-#endif
#if ENABLE(TOUCH_EVENTS)
bool Event::isTouchEvent() const
@@ -265,7 +263,7 @@ bool Event::fromUserGesture()
// other accepted events
|| type == eventNames().selectEvent || type == eventNames().changeEvent
|| type == eventNames().focusEvent || type == eventNames().blurEvent
- || type == eventNames().submitEvent;
+ || type == eventNames().submitEvent || type == eventNames().formchangeEvent;
}
bool Event::storesResultAsString() const
diff --git a/Source/WebCore/dom/Event.h b/Source/WebCore/dom/Event.h
index 8562cad..45b879d 100644
--- a/Source/WebCore/dom/Event.h
+++ b/Source/WebCore/dom/Event.h
@@ -24,13 +24,13 @@
#ifndef Event_h
#define Event_h
+#include "Clipboard.h"
#include "DOMTimeStamp.h"
#include <wtf/RefCounted.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
- class Clipboard;
class EventTarget;
class Event : public RefCounted<Event> {
@@ -132,9 +132,7 @@ namespace WebCore {
#if ENABLE(WEB_AUDIO)
virtual bool isAudioProcessingEvent() const;
#endif
-#if ENABLE(WORKERS)
virtual bool isErrorEvent() const;
-#endif
#if ENABLE(TOUCH_EVENTS)
virtual bool isTouchEvent() const;
#endif
diff --git a/Source/WebCore/dom/EventNames.h b/Source/WebCore/dom/EventNames.h
index d19f043..3b52838 100644
--- a/Source/WebCore/dom/EventNames.h
+++ b/Source/WebCore/dom/EventNames.h
@@ -66,6 +66,8 @@ namespace WebCore {
macro(focus) \
macro(focusin) \
macro(focusout) \
+ macro(formchange) \
+ macro(forminput) \
macro(hashchange) \
macro(input) \
macro(invalid) \
@@ -182,7 +184,8 @@ namespace WebCore {
\
// end of DOM_EVENT_NAMES_FOR_EACH
- class EventNames : public Noncopyable {
+ class EventNames {
+ WTF_MAKE_NONCOPYABLE(EventNames); WTF_MAKE_FAST_ALLOCATED;
int dummy; // Needed to make initialization macro work.
// Private to prevent accidental call to EventNames() instead of eventNames()
EventNames();
diff --git a/Source/WebCore/dom/EventTarget.h b/Source/WebCore/dom/EventTarget.h
index ddcb663..81eeb7f 100644
--- a/Source/WebCore/dom/EventTarget.h
+++ b/Source/WebCore/dom/EventTarget.h
@@ -83,7 +83,9 @@ namespace WebCore {
typedef Vector<RegisteredEventListener, 1> EventListenerVector;
typedef HashMap<AtomicString, EventListenerVector*> EventListenerMap;
- struct EventTargetData : Noncopyable {
+ struct EventTargetData {
+ WTF_MAKE_NONCOPYABLE(EventTargetData); WTF_MAKE_FAST_ALLOCATED;
+ public:
EventTargetData();
~EventTargetData();
diff --git a/Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h b/Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h
index 9d1835a..26f7fd0 100644
--- a/Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h
+++ b/Source/WebCore/dom/IgnoreDestructiveWriteCountIncrementer.h
@@ -27,11 +27,11 @@
#define IgnoreDestructiveWriteCountIncrementer_h
#include "Document.h"
-#include <wtf/Noncopyable.h>
namespace WebCore {
-class IgnoreDestructiveWriteCountIncrementer : public Noncopyable {
+class IgnoreDestructiveWriteCountIncrementer {
+ WTF_MAKE_NONCOPYABLE(IgnoreDestructiveWriteCountIncrementer);
public:
explicit IgnoreDestructiveWriteCountIncrementer(Document* document)
: m_count(document ? &document->m_ignoreDestructiveWriteCount : 0)
diff --git a/Source/WebCore/dom/InputElement.cpp b/Source/WebCore/dom/InputElement.cpp
index 37211d8..db89c16 100644
--- a/Source/WebCore/dom/InputElement.cpp
+++ b/Source/WebCore/dom/InputElement.cpp
@@ -140,7 +140,7 @@ void InputElement::setValueFromRenderer(InputElementData& data, InputElement* in
// Input event is fired by the Node::defaultEventHandler for editable controls.
if (!inputElement->isTextField())
- element->dispatchEvent(Event::create(eventNames().inputEvent, true, false));
+ element->dispatchInputEvents();
notifyFormStateChanged(element);
}
diff --git a/Source/WebCore/dom/MessagePortChannel.h b/Source/WebCore/dom/MessagePortChannel.h
index f308a29..07668a4 100644
--- a/Source/WebCore/dom/MessagePortChannel.h
+++ b/Source/WebCore/dom/MessagePortChannel.h
@@ -55,7 +55,8 @@ namespace WebCore {
// MessagePortChannel is a platform-independent interface to the remote side of a message channel.
// It acts as a wrapper around the platform-dependent PlatformMessagePortChannel implementation which ensures that the platform-dependent close() method is invoked before destruction.
- class MessagePortChannel : public Noncopyable {
+ class MessagePortChannel {
+ WTF_MAKE_NONCOPYABLE(MessagePortChannel); WTF_MAKE_FAST_ALLOCATED;
public:
static void createChannel(PassRefPtr<MessagePort>, PassRefPtr<MessagePort>);
@@ -78,7 +79,8 @@ namespace WebCore {
// Returns true if the proxy currently contains messages for this port.
bool hasPendingActivity();
- class EventData : public Noncopyable {
+ class EventData {
+ WTF_MAKE_NONCOPYABLE(EventData); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<EventData> create(PassRefPtr<SerializedScriptValue>, PassOwnPtr<MessagePortChannelArray>);
diff --git a/Source/WebCore/dom/NamedNodeMap.cpp b/Source/WebCore/dom/NamedNodeMap.cpp
index bc56f7e..0e2861e 100644
--- a/Source/WebCore/dom/NamedNodeMap.cpp
+++ b/Source/WebCore/dom/NamedNodeMap.cpp
@@ -359,6 +359,8 @@ bool NamedNodeMap::mappedMapsEquivalent(const NamedNodeMap* otherMap) const
Attribute* otherAttr = otherMap->getAttributeItem(attr->name());
if (!otherAttr || attr->value() != otherAttr->value())
return false;
+ if (!attr->decl()->propertiesEqual(otherAttr->decl()))
+ return false;
}
}
return true;
diff --git a/Source/WebCore/dom/Node.cpp b/Source/WebCore/dom/Node.cpp
index 1998c8c..275e370 100644
--- a/Source/WebCore/dom/Node.cpp
+++ b/Source/WebCore/dom/Node.cpp
@@ -497,6 +497,7 @@ Element* Node::shadowHost() const
void Node::setShadowHost(Element* host)
{
+ ASSERT(!parentNode());
if (host)
setFlag(IsShadowRootFlag);
else
@@ -3037,6 +3038,16 @@ void Node::dispatchBlurEvent()
dispatchEvent(Event::create(eventNames().blurEvent, false, false));
}
+void Node::dispatchChangeEvents()
+{
+ dispatchEvent(Event::create(eventNames().changeEvent, true, false));
+}
+
+void Node::dispatchInputEvents()
+{
+ dispatchEvent(Event::create(eventNames().inputEvent, true, false));
+}
+
bool Node::disabled() const
{
return false;
@@ -3094,7 +3105,7 @@ void Node::defaultEventHandler(Event* event)
if (Frame* frame = document()->frame())
frame->eventHandler()->defaultWheelEventHandler(startNode, wheelEvent);
} else if (event->type() == eventNames().webkitEditableContentChangedEvent) {
- dispatchEvent(Event::create(eventNames().inputEvent, true, false));
+ dispatchInputEvents();
}
}
diff --git a/Source/WebCore/dom/Node.h b/Source/WebCore/dom/Node.h
index bc33e22..546b223 100644
--- a/Source/WebCore/dom/Node.h
+++ b/Source/WebCore/dom/Node.h
@@ -553,6 +553,8 @@ public:
virtual void dispatchFocusEvent();
virtual void dispatchBlurEvent();
+ virtual void dispatchChangeEvents();
+ virtual void dispatchInputEvents();
// Perform the default action for an event.
virtual void defaultEventHandler(Event*);
diff --git a/Source/WebCore/dom/NodeRareData.h b/Source/WebCore/dom/NodeRareData.h
index ab208d2..7350f80 100644
--- a/Source/WebCore/dom/NodeRareData.h
+++ b/Source/WebCore/dom/NodeRareData.h
@@ -34,7 +34,9 @@
namespace WebCore {
-struct NodeListsNodeData : Noncopyable {
+struct NodeListsNodeData {
+ WTF_MAKE_NONCOPYABLE(NodeListsNodeData); WTF_MAKE_FAST_ALLOCATED;
+public:
typedef HashSet<DynamicNodeList*> NodeListSet;
NodeListSet m_listsWithCaches;
@@ -67,7 +69,8 @@ private:
}
};
-class NodeRareData : public Noncopyable {
+class NodeRareData {
+ WTF_MAKE_NONCOPYABLE(NodeRareData); WTF_MAKE_FAST_ALLOCATED;
public:
NodeRareData()
: m_tabIndex(0)
diff --git a/Source/WebCore/dom/Position.cpp b/Source/WebCore/dom/Position.cpp
index be175aa..6749ca9 100644
--- a/Source/WebCore/dom/Position.cpp
+++ b/Source/WebCore/dom/Position.cpp
@@ -146,6 +146,27 @@ int Position::computeOffsetInContainerNode() const
return 0;
}
+// Neighbor-anchored positions are invalid DOM positions, so they need to be
+// fixed up before handing them off to the Range object.
+Position Position::parentAnchoredEquivalent() const
+{
+ if (!m_anchorNode)
+ return Position();
+
+ // FIXME: This should only be necessary for legacy positions, but is also needed for positions before and after Tables
+ if (m_offset <= 0) {
+ if (m_anchorNode->parentNode() && (editingIgnoresContent(m_anchorNode.get()) || isTableElement(m_anchorNode.get())))
+ return positionInParentBeforeNode(m_anchorNode.get());
+ return Position(m_anchorNode, 0, PositionIsOffsetInAnchor);
+ }
+ if (!m_anchorNode->offsetInCharacters() && static_cast<unsigned>(m_offset) == m_anchorNode->childNodeCount()
+ && (editingIgnoresContent(m_anchorNode.get()) || isTableElement(m_anchorNode.get()))) {
+ return positionInParentAfterNode(m_anchorNode.get());
+ }
+
+ return Position(containerNode(), computeOffsetInContainerNode(), PositionIsOffsetInAnchor);
+}
+
Node* Position::computeNodeBeforePosition() const
{
if (!m_anchorNode)
diff --git a/Source/WebCore/dom/Position.h b/Source/WebCore/dom/Position.h
index 4d3b5fe..8b41736 100644
--- a/Source/WebCore/dom/Position.h
+++ b/Source/WebCore/dom/Position.h
@@ -80,6 +80,7 @@ public:
// will return img->parentNode() and img->nodeIndex() from these functions.
Node* containerNode() const; // NULL for a before/after position anchored to a node with no parent
int computeOffsetInContainerNode() const; // O(n) for before/after-anchored positions, O(1) for parent-anchored positions
+ Position parentAnchoredEquivalent() const; // Convenience method for DOM positions that also fixes up some positions for editing
// Inline O(1) access for Positions which callers know to be parent-anchored
int offsetInContainerNode() const
@@ -179,7 +180,7 @@ private:
RefPtr<Node> m_anchorNode;
// m_offset can be the offset inside m_anchorNode, or if editingIgnoresContent(m_anchorNode)
// returns true, then other places in editing will treat m_offset == 0 as "before the anchor"
- // and m_offset > 0 as "after the anchor node". See rangeCompliantEquivalent for more info.
+ // and m_offset > 0 as "after the anchor node". See parentAnchoredEquivalent for more info.
int m_offset;
unsigned m_anchorType : 2;
bool m_isLegacyEditingPosition : 1;
diff --git a/Source/WebCore/dom/QualifiedName.h b/Source/WebCore/dom/QualifiedName.h
index 34fc069..cb95f20 100644
--- a/Source/WebCore/dom/QualifiedName.h
+++ b/Source/WebCore/dom/QualifiedName.h
@@ -32,7 +32,8 @@ struct QualifiedNameComponents {
StringImpl* m_namespace;
};
-class QualifiedName : public FastAllocBase {
+class QualifiedName {
+ WTF_MAKE_FAST_ALLOCATED;
public:
class QualifiedNameImpl : public RefCounted<QualifiedNameImpl> {
public:
diff --git a/Source/WebCore/dom/RequestAnimationFrameCallback.h b/Source/WebCore/dom/RequestAnimationFrameCallback.h
new file mode 100644
index 0000000..819e495
--- /dev/null
+++ b/Source/WebCore/dom/RequestAnimationFrameCallback.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef RequestAnimationFrameCallback_h
+#define RequestAnimationFrameCallback_h
+
+#include "Element.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class RequestAnimationFrameCallback : public RefCounted<RequestAnimationFrameCallback> {
+public:
+ virtual ~RequestAnimationFrameCallback() { }
+ virtual bool handleEvent() = 0;
+
+ RefPtr<Element> m_element;
+ int m_id;
+ bool m_firedOrCancelled;
+};
+
+}
+
+#endif // RequestAnimationFrameCallback_h
+
diff --git a/Source/WebCore/dom/RequestAnimationFrameCallback.idl b/Source/WebCore/dom/RequestAnimationFrameCallback.idl
new file mode 100644
index 0000000..8d232e5
--- /dev/null
+++ b/Source/WebCore/dom/RequestAnimationFrameCallback.idl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module core {
+ interface [
+ Callback=FunctionOnly,Conditional=REQUEST_ANIMATION_FRAME
+ ] RequestAnimationFrameCallback{
+ boolean handleEvent();
+ };
+}
diff --git a/Source/WebCore/dom/ScriptElement.h b/Source/WebCore/dom/ScriptElement.h
index 07c59db..5250f3e 100644
--- a/Source/WebCore/dom/ScriptElement.h
+++ b/Source/WebCore/dom/ScriptElement.h
@@ -32,6 +32,7 @@ class ScriptElement;
class ScriptSourceCode;
class ScriptElement : private CachedResourceClient {
+ WTF_MAKE_FAST_ALLOCATED;
public:
ScriptElement(Element*, bool createdByParser, bool isEvaluated);
virtual ~ScriptElement();
diff --git a/Source/WebCore/dom/ScriptExecutionContext.cpp b/Source/WebCore/dom/ScriptExecutionContext.cpp
index bfda17b..9fdf85e 100644
--- a/Source/WebCore/dom/ScriptExecutionContext.cpp
+++ b/Source/WebCore/dom/ScriptExecutionContext.cpp
@@ -33,14 +33,19 @@
#include "Database.h"
#include "DatabaseTask.h"
#include "DatabaseThread.h"
+#include "ErrorEvent.h"
+#include "EventListener.h"
+#include "EventTarget.h"
#include "FileThread.h"
#include "MessagePort.h"
+#include "ScriptCallStack.h"
#include "SecurityOrigin.h"
#include "ThreadableBlobRegistry.h"
#include "WorkerContext.h"
#include "WorkerThread.h"
#include <wtf/MainThread.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/Vector.h>
#if USE(JSC)
#include "JSDOMWindow.h"
@@ -61,9 +66,26 @@ public:
}
};
+class ScriptExecutionContext::PendingException {
+ WTF_MAKE_NONCOPYABLE(PendingException);
+public:
+ PendingException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack)
+ : m_errorMessage(errorMessage)
+ , m_lineNumber(lineNumber)
+ , m_sourceURL(sourceURL)
+ , m_callStack(callStack)
+ {
+ }
+ String m_errorMessage;
+ int m_lineNumber;
+ String m_sourceURL;
+ RefPtr<ScriptCallStack> m_callStack;
+};
+
ScriptExecutionContext::ScriptExecutionContext()
+ : m_inDispatchErrorEvent(false)
#if ENABLE(DATABASE)
- : m_hasOpenDatabases(false)
+ , m_hasOpenDatabases(false)
#endif
{
}
@@ -243,6 +265,43 @@ void ScriptExecutionContext::setSecurityOrigin(PassRefPtr<SecurityOrigin> securi
m_securityOrigin = securityOrigin;
}
+void ScriptExecutionContext::reportException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack> callStack)
+{
+ if (m_inDispatchErrorEvent) {
+ if (!m_pendingExceptions)
+ m_pendingExceptions = adoptPtr(new Vector<OwnPtr<PendingException> >());
+ m_pendingExceptions->append(adoptPtr(new PendingException(errorMessage, lineNumber, sourceURL, callStack)));
+ return;
+ }
+
+ // First report the original exception and only then all the nested ones.
+ if (!dispatchErrorEvent(errorMessage, lineNumber, sourceURL))
+ logExceptionToConsole(errorMessage, lineNumber, sourceURL, callStack);
+
+ if (!m_pendingExceptions)
+ return;
+
+ for (size_t i = 0; i < m_pendingExceptions->size(); i++) {
+ PendingException* e = m_pendingExceptions->at(i).get();
+ logExceptionToConsole(e->m_errorMessage, e->m_lineNumber, e->m_sourceURL, e->m_callStack);
+ }
+ m_pendingExceptions.clear();
+}
+
+bool ScriptExecutionContext::dispatchErrorEvent(const String& errorMessage, int lineNumber, const String& sourceURL)
+{
+ EventTarget* target = errorEventTarget();
+ if (!target)
+ return false;
+
+ ASSERT(!m_inDispatchErrorEvent);
+ m_inDispatchErrorEvent = true;
+ RefPtr<ErrorEvent> errorEvent = ErrorEvent::create(errorMessage, sourceURL, lineNumber);
+ target->dispatchEvent(errorEvent);
+ m_inDispatchErrorEvent = false;
+ return errorEvent->defaultPrevented();
+}
+
void ScriptExecutionContext::addTimeout(int timeoutId, DOMTimer* timer)
{
ASSERT(!m_timeouts.contains(timeoutId));
diff --git a/Source/WebCore/dom/ScriptExecutionContext.h b/Source/WebCore/dom/ScriptExecutionContext.h
index e473a4b..b57b75a 100644
--- a/Source/WebCore/dom/ScriptExecutionContext.h
+++ b/Source/WebCore/dom/ScriptExecutionContext.h
@@ -33,6 +33,8 @@
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
@@ -52,11 +54,14 @@ namespace WebCore {
class DatabaseThread;
#endif
class DOMTimer;
+ class EventListener;
+ class EventTarget;
#if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
class FileThread;
#endif
class MessagePort;
class SecurityOrigin;
+ class ScriptCallStack;
class ScriptExecutionContext {
public:
@@ -85,8 +90,8 @@ namespace WebCore {
SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); }
- virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
- virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL) = 0;
+ void reportException(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>);
+ virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>) = 0;
// Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.
bool canSuspendActiveDOMObjects();
@@ -110,8 +115,10 @@ namespace WebCore {
void ref() { refScriptExecutionContext(); }
void deref() { derefScriptExecutionContext(); }
- class Task : public Noncopyable {
+ class Task {
+ WTF_MAKE_NONCOPYABLE(Task); WTF_MAKE_FAST_ALLOCATED;
public:
+ Task() { }
virtual ~Task();
virtual void performTask(ScriptExecutionContext*) = 0;
// Certain tasks get marked specially so that they aren't discarded, and are executed, when the context is shutting down its message queue.
@@ -148,6 +155,10 @@ namespace WebCore {
virtual const KURL& virtualURL() const = 0;
virtual KURL virtualCompleteURL(const String&) const = 0;
+ virtual EventTarget* errorEventTarget() = 0;
+ virtual void logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>) = 0;
+ bool dispatchErrorEvent(const String& errorMessage, int lineNumber, const String& sourceURL);
+
void closeMessagePorts();
RefPtr<SecurityOrigin> m_securityOrigin;
@@ -165,6 +176,10 @@ namespace WebCore {
virtual void refScriptExecutionContext() = 0;
virtual void derefScriptExecutionContext() = 0;
+ bool m_inDispatchErrorEvent;
+ class PendingException;
+ OwnPtr<Vector<OwnPtr<PendingException> > > m_pendingExceptions;
+
#if ENABLE(DATABASE)
RefPtr<DatabaseThread> m_databaseThread;
bool m_hasOpenDatabases; // This never changes back to false, even after the database thread is closed.
diff --git a/Source/WebCore/dom/SpaceSplitString.h b/Source/WebCore/dom/SpaceSplitString.h
index 826e6bd..6eb893c 100644
--- a/Source/WebCore/dom/SpaceSplitString.h
+++ b/Source/WebCore/dom/SpaceSplitString.h
@@ -28,7 +28,8 @@
namespace WebCore {
- class SpaceSplitStringData : public Noncopyable {
+ class SpaceSplitStringData {
+ WTF_MAKE_NONCOPYABLE(SpaceSplitStringData); WTF_MAKE_FAST_ALLOCATED;
public:
SpaceSplitStringData(const String& string, bool shouldFoldCase)
: m_string(string), m_shouldFoldCase(shouldFoldCase), m_createdVector(false)
diff --git a/Source/WebCore/dom/TextEvent.cpp b/Source/WebCore/dom/TextEvent.cpp
index 68ed4b2..b7bd1c8 100644
--- a/Source/WebCore/dom/TextEvent.cpp
+++ b/Source/WebCore/dom/TextEvent.cpp
@@ -31,21 +31,12 @@
namespace WebCore {
-TextEvent::InputType TextEvent::selectInputType(bool isLineBreak, bool isBackTab)
-{
- if (isLineBreak)
- return TextEvent::InputTypeLineBreak;
- if (isBackTab)
- return TextEvent::InputTypeBackTab;
- return TextEvent::InputTypeKeyboard;
-}
-
PassRefPtr<TextEvent> TextEvent::create()
{
return adoptRef(new TextEvent);
}
-PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data, TextEvent::InputType inputType)
+PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType)
{
return adoptRef(new TextEvent(view, data, inputType));
}
@@ -62,17 +53,17 @@ PassRefPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtr<AbstractView>
PassRefPtr<TextEvent> TextEvent::createForDrop(PassRefPtr<AbstractView> view, const String& data)
{
- return adoptRef(new TextEvent(view, data, TextEvent::InputTypeDrop));
+ return adoptRef(new TextEvent(view, data, TextEventInputDrop));
}
TextEvent::TextEvent()
- : m_inputType(TextEvent::InputTypeKeyboard)
+ : m_inputType(TextEventInputKeyboard)
, m_shouldSmartReplace(false)
, m_shouldMatchStyle(false)
{
}
-TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, InputType inputType)
+TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, TextEventInputType inputType)
: UIEvent(eventNames().textInputEvent, true, true, view, 0)
, m_inputType(inputType)
, m_data(data)
@@ -85,7 +76,7 @@ TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, InputTyp
TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, PassRefPtr<DocumentFragment> pastingFragment,
bool shouldSmartReplace, bool shouldMatchStyle)
: UIEvent(eventNames().textInputEvent, true, true, view, 0)
- , m_inputType(TextEvent::InputTypePaste)
+ , m_inputType(TextEventInputPaste)
, m_data(data)
, m_pastingFragment(pastingFragment)
, m_shouldSmartReplace(shouldSmartReplace)
diff --git a/Source/WebCore/dom/TextEvent.h b/Source/WebCore/dom/TextEvent.h
index f1d24e9..d770d38 100644
--- a/Source/WebCore/dom/TextEvent.h
+++ b/Source/WebCore/dom/TextEvent.h
@@ -28,23 +28,16 @@
#define TextEvent_h
#include "DocumentFragment.h"
+#include "TextEventInputType.h"
#include "UIEvent.h"
namespace WebCore {
class TextEvent : public UIEvent {
public:
- enum InputType {
- InputTypeKeyboard, // any newline characters in the text are line breaks only, not paragraph separators.
- InputTypeLineBreak, // any tab characters in the text are backtabs.
- InputTypeBackTab,
- InputTypePaste,
- InputTypeDrop,
- };
- static InputType selectInputType(bool isLineBreak, bool isBackTab);
static PassRefPtr<TextEvent> create();
- static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView> view, const String& data, InputType = InputTypeKeyboard);
+ static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard);
static PassRefPtr<TextEvent> createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace);
static PassRefPtr<TextEvent> createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle);
static PassRefPtr<TextEvent> createForDrop(PassRefPtr<AbstractView> view, const String& data);
@@ -57,10 +50,10 @@ namespace WebCore {
virtual bool isTextEvent() const;
- bool isLineBreak() const { return m_inputType == InputTypeLineBreak; }
- bool isBackTab() const { return m_inputType == InputTypeBackTab; }
- bool isPaste() const { return m_inputType == InputTypePaste; }
- bool isDrop() const { return m_inputType == InputTypeDrop; }
+ bool isLineBreak() const { return m_inputType == TextEventInputLineBreak; }
+ bool isBackTab() const { return m_inputType == TextEventInputBackTab; }
+ bool isPaste() const { return m_inputType == TextEventInputPaste; }
+ bool isDrop() const { return m_inputType == TextEventInputDrop; }
bool shouldSmartReplace() const { return m_shouldSmartReplace; }
bool shouldMatchStyle() const { return m_shouldMatchStyle; }
@@ -69,11 +62,11 @@ namespace WebCore {
private:
TextEvent();
- TextEvent(PassRefPtr<AbstractView>, const String& data, InputType = InputTypeKeyboard);
+ TextEvent(PassRefPtr<AbstractView>, const String& data, TextEventInputType = TextEventInputKeyboard);
TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment>,
bool shouldSmartReplace, bool shouldMatchStyle);
- InputType m_inputType;
+ TextEventInputType m_inputType;
String m_data;
RefPtr<DocumentFragment> m_pastingFragment;
diff --git a/Source/WebCore/dom/TextEventInputType.h b/Source/WebCore/dom/TextEventInputType.h
new file mode 100644
index 0000000..2522ec4
--- /dev/null
+++ b/Source/WebCore/dom/TextEventInputType.h
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2010 Google, Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TextEventInputType_h
+#define TextEventInputType_h
+
+namespace WebCore {
+
+enum TextEventInputType {
+ TextEventInputKeyboard, // any newline characters in the text are line breaks only, not paragraph separators.
+ TextEventInputLineBreak, // any tab characters in the text are backtabs.
+ TextEventInputBackTab,
+ TextEventInputPaste,
+ TextEventInputDrop,
+};
+
+} // namespace WebCore
+
+#endif // TextEventInputType_h
diff --git a/Source/WebCore/dom/TransformSource.h b/Source/WebCore/dom/TransformSource.h
index f97afcf..63dc78a 100644
--- a/Source/WebCore/dom/TransformSource.h
+++ b/Source/WebCore/dom/TransformSource.h
@@ -33,7 +33,8 @@ namespace WebCore {
typedef void* PlatformTransformSource;
#endif
- class TransformSource : public Noncopyable {
+ class TransformSource {
+ WTF_MAKE_NONCOPYABLE(TransformSource); WTF_MAKE_FAST_ALLOCATED;
public:
TransformSource(const PlatformTransformSource& source);
~TransformSource();
diff --git a/Source/WebCore/dom/UserGestureIndicator.h b/Source/WebCore/dom/UserGestureIndicator.h
index 17ea319..b1ed96b 100644
--- a/Source/WebCore/dom/UserGestureIndicator.h
+++ b/Source/WebCore/dom/UserGestureIndicator.h
@@ -36,7 +36,8 @@ enum ProcessingUserGestureState {
DefinitelyNotProcessingUserGesture
};
-class UserGestureIndicator : public Noncopyable {
+class UserGestureIndicator {
+ WTF_MAKE_NONCOPYABLE(UserGestureIndicator);
public:
static bool processingUserGesture() { return s_processingUserGesture == DefinitelyProcessingUserGesture; }
static ProcessingUserGestureState getUserGestureState() { return s_processingUserGesture; }
diff --git a/Source/WebCore/dom/UserTypingGestureIndicator.h b/Source/WebCore/dom/UserTypingGestureIndicator.h
index 6c71079..21f4c7e 100644
--- a/Source/WebCore/dom/UserTypingGestureIndicator.h
+++ b/Source/WebCore/dom/UserTypingGestureIndicator.h
@@ -34,7 +34,8 @@ namespace WebCore {
class Frame;
class Node;
-class UserTypingGestureIndicator : public Noncopyable {
+class UserTypingGestureIndicator {
+ WTF_MAKE_NONCOPYABLE(UserTypingGestureIndicator);
public:
static bool processingUserTypingGesture();
static Node* focusedElementAtGestureStart();
diff --git a/Source/WebCore/dom/XMLDocumentParser.h b/Source/WebCore/dom/XMLDocumentParser.h
index 70628ed..2e305c8 100644
--- a/Source/WebCore/dom/XMLDocumentParser.h
+++ b/Source/WebCore/dom/XMLDocumentParser.h
@@ -180,6 +180,7 @@ namespace WebCore {
#endif
class XMLDocumentParser : public ScriptableDocumentParser, public CachedResourceClient {
+ WTF_MAKE_FAST_ALLOCATED;
public:
static PassRefPtr<XMLDocumentParser> create(Document* document, FrameView* view)
{
diff --git a/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp b/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp
index 0f6b4b4..10d6e0d 100644
--- a/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp
+++ b/Source/WebCore/dom/XMLDocumentParserLibxml2.cpp
@@ -75,8 +75,10 @@ using namespace std;
namespace WebCore {
-class PendingCallbacks : public Noncopyable {
+class PendingCallbacks {
+ WTF_MAKE_NONCOPYABLE(PendingCallbacks);
public:
+ PendingCallbacks() { }
~PendingCallbacks()
{
deleteAllValues(m_callbacks);
diff --git a/Source/WebCore/dom/XMLDocumentParserScope.h b/Source/WebCore/dom/XMLDocumentParserScope.h
index 58e8a6b..f60471b 100644
--- a/Source/WebCore/dom/XMLDocumentParserScope.h
+++ b/Source/WebCore/dom/XMLDocumentParserScope.h
@@ -36,7 +36,8 @@ namespace WebCore {
class CachedResourceLoader;
- class XMLDocumentParserScope : public Noncopyable {
+ class XMLDocumentParserScope {
+ WTF_MAKE_NONCOPYABLE(XMLDocumentParserScope);
public:
XMLDocumentParserScope(CachedResourceLoader* cachedResourceLoader);
~XMLDocumentParserScope();