summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/dom
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/dom')
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Clipboard.h7
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Clipboard.idl1
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp4
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DOMImplementation.cpp10
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DOMStringList.cpp35
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DOMStringList.h46
-rw-r--r--src/3rdparty/webkit/WebCore/dom/DOMStringList.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Document.cpp28
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Document.h1
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Document.idl72
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Element.cpp11
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Element.h3
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Element.idl71
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp7
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePort.cpp254
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePort.h68
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePort.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp (renamed from src/3rdparty/webkit/WebCore/dom/MessagePortProxy.h)44
-rw-r--r--src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h103
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Node.cpp186
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Node.h69
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Node.idl41
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Position.cpp14
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Range.cpp6
-rw-r--r--src/3rdparty/webkit/WebCore/dom/RangeBoundaryPoint.h9
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp3
-rw-r--r--src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp2
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SelectElement.cpp14
-rw-r--r--src/3rdparty/webkit/WebCore/dom/SelectElement.h9
-rw-r--r--src/3rdparty/webkit/WebCore/dom/StaticStringList.cpp67
-rw-r--r--src/3rdparty/webkit/WebCore/dom/StaticStringList.h61
-rw-r--r--src/3rdparty/webkit/WebCore/dom/Tokenizer.h8
-rw-r--r--src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.cpp222
-rw-r--r--src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.h129
35 files changed, 938 insertions, 714 deletions
diff --git a/src/3rdparty/webkit/WebCore/dom/Clipboard.h b/src/3rdparty/webkit/WebCore/dom/Clipboard.h
index 59ae026..0fea604 100644
--- a/src/3rdparty/webkit/WebCore/dom/Clipboard.h
+++ b/src/3rdparty/webkit/WebCore/dom/Clipboard.h
@@ -33,6 +33,8 @@
namespace WebCore {
+ class FileList;
+
// State available during IE's events for drag and drop and copy/paste
class Clipboard : public RefCounted<Clipboard> {
public:
@@ -53,11 +55,12 @@ namespace WebCore {
// extensions beyond IE's API
virtual HashSet<String> types() const = 0;
-
+ virtual PassRefPtr<FileList> files() const = 0;
+
IntPoint dragLocation() const { return m_dragLoc; }
CachedImage* dragImage() const { return m_dragImage.get(); }
virtual void setDragImage(CachedImage*, const IntPoint&) = 0;
- Node* dragImageElement() { return m_dragImageElement.get(); }
+ Node* dragImageElement() const { return m_dragImageElement.get(); }
virtual void setDragImageElement(Node*, const IntPoint&) = 0;
virtual DragImageRef createDragImage(IntPoint& dragLocation) const = 0;
diff --git a/src/3rdparty/webkit/WebCore/dom/Clipboard.idl b/src/3rdparty/webkit/WebCore/dom/Clipboard.idl
index 6fe83f7..dc8677e 100644
--- a/src/3rdparty/webkit/WebCore/dom/Clipboard.idl
+++ b/src/3rdparty/webkit/WebCore/dom/Clipboard.idl
@@ -34,6 +34,7 @@ module core {
attribute [ConvertNullStringTo=Undefined] DOMString dropEffect;
attribute [ConvertNullStringTo=Undefined] DOMString effectAllowed;
readonly attribute [CustomGetter] Array types;
+ readonly attribute FileList files;
[Custom] void clearData(in [Optional] DOMString type)
raises(DOMException);
diff --git a/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp b/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp
index 2573908..20cc7a3 100644
--- a/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/ContainerNode.cpp
@@ -798,7 +798,7 @@ void ContainerNode::setActive(bool down, bool pause)
if (reactsToPress)
setNeedsStyleRecalc();
if (renderer() && renderer()->style()->hasAppearance()) {
- if (theme()->stateChanged(renderer(), PressedState))
+ if (renderer()->theme()->stateChanged(renderer(), PressedState))
reactsToPress = true;
}
if (reactsToPress && pause) {
@@ -840,7 +840,7 @@ void ContainerNode::setHovered(bool over)
if (renderer()->style()->affectedByHoverRules())
setNeedsStyleRecalc();
if (renderer() && renderer()->style()->hasAppearance())
- theme()->stateChanged(renderer(), HoverState);
+ renderer()->theme()->stateChanged(renderer(), HoverState);
}
}
diff --git a/src/3rdparty/webkit/WebCore/dom/DOMImplementation.cpp b/src/3rdparty/webkit/WebCore/dom/DOMImplementation.cpp
index 783c629..065f708 100644
--- a/src/3rdparty/webkit/WebCore/dom/DOMImplementation.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/DOMImplementation.cpp
@@ -314,14 +314,8 @@ PassRefPtr<HTMLDocument> DOMImplementation::createHTMLDocument(const String& tit
PassRefPtr<Document> DOMImplementation::createDocument(const String& type, Frame* frame, bool inViewSourceMode)
{
- if (inViewSourceMode) {
- if (type == "text/html" || type == "application/xhtml+xml" || type == "image/svg+xml" || isTextMIMEType(type) || isXMLMIMEType(type)
-#if ENABLE(XHTMLMP)
- || type == "application/vnd.wap.xhtml+xml"
-#endif
- )
- return HTMLViewSourceDocument::create(frame, type);
- }
+ if (inViewSourceMode)
+ return HTMLViewSourceDocument::create(frame, type);
// Plugins cannot take HTML and XHTML from us, and we don't even need to initialize the plugin database for those.
if (type == "text/html")
diff --git a/src/3rdparty/webkit/WebCore/dom/DOMStringList.cpp b/src/3rdparty/webkit/WebCore/dom/DOMStringList.cpp
deleted file mode 100644
index f89702b..0000000
--- a/src/3rdparty/webkit/WebCore/dom/DOMStringList.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2009 Apple 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 COMPUTER, 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 COMPUTER, 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.
- *
- */
-#include "config.h"
-#include "DOMStringList.h"
-
-namespace WebCore {
-
-DOMStringList::~DOMStringList()
-{
-}
-
-} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/dom/DOMStringList.h b/src/3rdparty/webkit/WebCore/dom/DOMStringList.h
deleted file mode 100644
index 630e33e..0000000
--- a/src/3rdparty/webkit/WebCore/dom/DOMStringList.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2009 Apple 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 COMPUTER, 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 COMPUTER, 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 DOMStringList_h
-#define DOMStringList_h
-
-#include "PlatformString.h"
-#include <wtf/RefCounted.h>
-
-namespace WebCore {
-
- class DOMStringList : public RefCounted<DOMStringList> {
- public:
- virtual ~DOMStringList();
-
- virtual unsigned length() const = 0;
- virtual String item(unsigned) const = 0;
- virtual bool contains(const String&) const = 0;
- };
-
-} // namespace WebCore
-
-#endif // DOMStringList_h
diff --git a/src/3rdparty/webkit/WebCore/dom/DOMStringList.idl b/src/3rdparty/webkit/WebCore/dom/DOMStringList.idl
deleted file mode 100644
index 16d4e12..0000000
--- a/src/3rdparty/webkit/WebCore/dom/DOMStringList.idl
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2009 Apple 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 COMPUTER, 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 COMPUTER, 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.
- *
- */
-
-module core {
-
- interface [
- GenerateConstructor,
- HasCustomIndexGetter
- ] DOMStringList {
-
- // Unlike the index getter, item() never raises exceptions, and returns null for out of bounds indices.
- [Custom] DOMString item(in unsigned long index);
-
- readonly attribute unsigned long length;
- boolean contains(in DOMString str);
- };
-
-}
diff --git a/src/3rdparty/webkit/WebCore/dom/Document.cpp b/src/3rdparty/webkit/WebCore/dom/Document.cpp
index 75c0ba0..3d01c80 100644
--- a/src/3rdparty/webkit/WebCore/dom/Document.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/Document.cpp
@@ -5,7 +5,7 @@
* (C) 2006 Alexey Proskuryakov (ap@webkit.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- * Copyright (C) 2008 David Levin (levin@chromium.org)
+ * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -1338,6 +1338,12 @@ void Document::detach()
// in order to stop media elements
documentWillBecomeInactive();
+ if (m_frame) {
+ FrameView* view = m_frame->view();
+ if (view)
+ view->detachCustomScrollbars();
+ }
+
// indicate destruction mode, i.e. attached() but renderer == 0
setRenderer(0);
@@ -1477,7 +1483,7 @@ void Document::open(Document* ownerDocument)
if (m_frame->loader()->state() == FrameStateProvisional)
m_frame->loader()->stopAllLoaders();
}
-
+
implicitOpen();
if (m_frame)
@@ -1505,6 +1511,9 @@ void Document::implicitOpen()
m_tokenizer = createTokenizer();
setParsing(true);
+ if (m_frame)
+ m_tokenizer->setXSSAuditor(m_frame->script()->xssAuditor());
+
// If we reload, the animation controller sticks around and has
// a stale animation time. We need to update it here.
if (m_frame && m_frame->animation())
@@ -2531,7 +2540,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode)
focusChangeBlocked = true;
newFocusedNode = 0;
}
- oldFocusedNode->dispatchUIEvent(eventNames().DOMFocusOutEvent);
+ oldFocusedNode->dispatchUIEvent(eventNames().DOMFocusOutEvent, 0, 0);
if (m_focusedNode) {
// handler shifted focus
focusChangeBlocked = true;
@@ -2561,7 +2570,7 @@ bool Document::setFocusedNode(PassRefPtr<Node> newFocusedNode)
focusChangeBlocked = true;
goto SetFocusedNodeDone;
}
- m_focusedNode->dispatchUIEvent(eventNames().DOMFocusInEvent);
+ m_focusedNode->dispatchUIEvent(eventNames().DOMFocusInEvent, 0, 0);
if (m_focusedNode != newFocusedNode) {
// handler shifted focus
focusChangeBlocked = true;
@@ -2739,6 +2748,14 @@ void Document::setWindowAttributeEventListener(const AtomicString& eventType, Pa
domWindow->setAttributeEventListener(eventType, listener);
}
+EventListener* Document::getWindowAttributeEventListener(const AtomicString& eventType)
+{
+ DOMWindow* domWindow = this->domWindow();
+ if (!domWindow)
+ return 0;
+ return domWindow->getAttributeEventListener(eventType);
+}
+
void Document::dispatchWindowEvent(PassRefPtr<Event> event)
{
ASSERT(!eventDispatchForbidden());
@@ -4287,7 +4304,8 @@ void Document::attachRange(Range* range)
void Document::detachRange(Range* range)
{
- ASSERT(m_ranges.contains(range));
+ // We don't ASSERT m_ranges.contains(range) to allow us to call this
+ // unconditionally to fix: https://bugs.webkit.org/show_bug.cgi?id=26044
m_ranges.remove(range);
}
diff --git a/src/3rdparty/webkit/WebCore/dom/Document.h b/src/3rdparty/webkit/WebCore/dom/Document.h
index 2747d09..92865f4 100644
--- a/src/3rdparty/webkit/WebCore/dom/Document.h
+++ b/src/3rdparty/webkit/WebCore/dom/Document.h
@@ -566,6 +566,7 @@ public:
// Helper functions for forwarding DOMWindow event related tasks to the DOMWindow if it exists.
void setWindowAttributeEventListener(const AtomicString& eventType, PassRefPtr<EventListener>);
+ EventListener* getWindowAttributeEventListener(const AtomicString& eventType);
void dispatchWindowEvent(PassRefPtr<Event>);
void dispatchWindowEvent(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg);
void dispatchLoadEvent();
diff --git a/src/3rdparty/webkit/WebCore/dom/Document.idl b/src/3rdparty/webkit/WebCore/dom/Document.idl
index 232ceb4..ac6dd0e 100644
--- a/src/3rdparty/webkit/WebCore/dom/Document.idl
+++ b/src/3rdparty/webkit/WebCore/dom/Document.idl
@@ -244,6 +244,78 @@ module core {
void resetWMLPageState();
void initializeWMLPageState();
#endif
+
+#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
+#if !defined(LANGUAGE_COM) || !LANGUAGE_COM
+ // Event handler DOM attributes
+ attribute [DontEnum] EventListener onabort;
+ attribute [DontEnum] EventListener onblur;
+ attribute [DontEnum] EventListener onchange;
+ attribute [DontEnum] EventListener onclick;
+ attribute [DontEnum] EventListener oncontextmenu;
+ attribute [DontEnum] EventListener ondblclick;
+ attribute [DontEnum] EventListener ondrag;
+ attribute [DontEnum] EventListener ondragend;
+ attribute [DontEnum] EventListener ondragenter;
+ attribute [DontEnum] EventListener ondragleave;
+ attribute [DontEnum] EventListener ondragover;
+ attribute [DontEnum] EventListener ondragstart;
+ attribute [DontEnum] EventListener ondrop;
+ attribute [DontEnum] EventListener onerror;
+ attribute [DontEnum] EventListener onfocus;
+ attribute [DontEnum] EventListener oninput;
+ attribute [DontEnum] EventListener onkeydown;
+ attribute [DontEnum] EventListener onkeypress;
+ attribute [DontEnum] EventListener onkeyup;
+ attribute [DontEnum] EventListener onload;
+ attribute [DontEnum] EventListener onmousedown;
+ attribute [DontEnum] EventListener onmousemove;
+ attribute [DontEnum] EventListener onmouseout;
+ attribute [DontEnum] EventListener onmouseover;
+ attribute [DontEnum] EventListener onmouseup;
+ attribute [DontEnum] EventListener onmousewheel;
+ attribute [DontEnum] EventListener onscroll;
+ attribute [DontEnum] EventListener onselect;
+ attribute [DontEnum] EventListener onsubmit;
+
+ // attribute [DontEnum] EventListener oncanplay;
+ // attribute [DontEnum] EventListener oncanplaythrough;
+ // attribute [DontEnum] EventListener ondurationchange;
+ // attribute [DontEnum] EventListener onemptied;
+ // attribute [DontEnum] EventListener onended;
+ // attribute [DontEnum] EventListener onformchange;
+ // attribute [DontEnum] EventListener onforminput;
+ // attribute [DontEnum] EventListener oninvalid;
+ // attribute [DontEnum] EventListener onloadeddata;
+ // attribute [DontEnum] EventListener onloadedmetadata;
+ // attribute [DontEnum] EventListener onloadstart;
+ // attribute [DontEnum] EventListener onpause;
+ // attribute [DontEnum] EventListener onplay;
+ // attribute [DontEnum] EventListener onplaying;
+ // attribute [DontEnum] EventListener onprogress;
+ // attribute [DontEnum] EventListener onratechange;
+ // attribute [DontEnum] EventListener onreadystatechange;
+ // attribute [DontEnum] EventListener onseeked;
+ // attribute [DontEnum] EventListener onseeking;
+ // attribute [DontEnum] EventListener onshow;
+ // attribute [DontEnum] EventListener onstalled;
+ // attribute [DontEnum] EventListener onsuspend;
+ // attribute [DontEnum] EventListener ontimeupdate;
+ // attribute [DontEnum] EventListener onvolumechange;
+ // attribute [DontEnum] EventListener onwaiting;
+
+ // WebKit extensions
+ attribute [DontEnum] EventListener onbeforecut;
+ attribute [DontEnum] EventListener oncut;
+ attribute [DontEnum] EventListener onbeforecopy;
+ attribute [DontEnum] EventListener oncopy;
+ attribute [DontEnum] EventListener onbeforepaste;
+ attribute [DontEnum] EventListener onpaste;
+ attribute [DontEnum] EventListener onreset;
+ attribute [DontEnum] EventListener onsearch;
+ attribute [DontEnum] EventListener onselectstart;
+#endif
+#endif
};
}
diff --git a/src/3rdparty/webkit/WebCore/dom/Element.cpp b/src/3rdparty/webkit/WebCore/dom/Element.cpp
index 4cf49bb..d858888 100644
--- a/src/3rdparty/webkit/WebCore/dom/Element.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/Element.cpp
@@ -1341,4 +1341,15 @@ unsigned Element::childElementCount() const
return count;
}
+KURL Element::getURLAttribute(const QualifiedName& name) const
+{
+#ifndef NDEBUG
+ if (namedAttrMap) {
+ if (Attribute* attribute = namedAttrMap->getAttributeItem(name))
+ ASSERT(isURLAttribute(attribute));
+ }
+#endif
+ return document()->completeURL(getAttribute(name));
+}
+
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/dom/Element.h b/src/3rdparty/webkit/WebCore/dom/Element.h
index 5e95abd..dfa2c0e 100644
--- a/src/3rdparty/webkit/WebCore/dom/Element.h
+++ b/src/3rdparty/webkit/WebCore/dom/Element.h
@@ -61,7 +61,7 @@ public:
void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&);
void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&);
- void scrollIntoView (bool alignToTop = true);
+ void scrollIntoView(bool alignToTop = true);
void scrollIntoViewIfNeeded(bool centerIfNeeded = true);
void scrollByUnits(int units, ScrollGranularity);
@@ -158,6 +158,7 @@ public:
virtual void accessKeyAction(bool /*sendToAnyEvent*/) { }
virtual bool isURLAttribute(Attribute*) const;
+ KURL getURLAttribute(const QualifiedName&) const;
virtual const QualifiedName& imageSourceAttributeName() const;
virtual String target() const { return String(); }
diff --git a/src/3rdparty/webkit/WebCore/dom/Element.idl b/src/3rdparty/webkit/WebCore/dom/Element.idl
index 6e16bfe..53711e9 100644
--- a/src/3rdparty/webkit/WebCore/dom/Element.idl
+++ b/src/3rdparty/webkit/WebCore/dom/Element.idl
@@ -129,6 +129,77 @@ module core {
readonly attribute DOMString innerText;
#endif
+#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
+#if !defined(LANGUAGE_COM) || !LANGUAGE_COM
+ // Event handler DOM attributes
+ attribute [DontEnum] EventListener onabort;
+ attribute [DontEnum] EventListener onblur;
+ attribute [DontEnum] EventListener onchange;
+ attribute [DontEnum] EventListener onclick;
+ attribute [DontEnum] EventListener oncontextmenu;
+ attribute [DontEnum] EventListener ondblclick;
+ attribute [DontEnum] EventListener ondrag;
+ attribute [DontEnum] EventListener ondragend;
+ attribute [DontEnum] EventListener ondragenter;
+ attribute [DontEnum] EventListener ondragleave;
+ attribute [DontEnum] EventListener ondragover;
+ attribute [DontEnum] EventListener ondragstart;
+ attribute [DontEnum] EventListener ondrop;
+ attribute [DontEnum] EventListener onerror;
+ attribute [DontEnum] EventListener onfocus;
+ attribute [DontEnum] EventListener oninput;
+ attribute [DontEnum] EventListener onkeydown;
+ attribute [DontEnum] EventListener onkeypress;
+ attribute [DontEnum] EventListener onkeyup;
+ attribute [DontEnum] EventListener onload;
+ attribute [DontEnum] EventListener onmousedown;
+ attribute [DontEnum] EventListener onmousemove;
+ attribute [DontEnum] EventListener onmouseout;
+ attribute [DontEnum] EventListener onmouseover;
+ attribute [DontEnum] EventListener onmouseup;
+ attribute [DontEnum] EventListener onmousewheel;
+ attribute [DontEnum] EventListener onscroll;
+ attribute [DontEnum] EventListener onselect;
+ attribute [DontEnum] EventListener onsubmit;
+
+ // attribute [DontEnum] EventListener oncanplay;
+ // attribute [DontEnum] EventListener oncanplaythrough;
+ // attribute [DontEnum] EventListener ondurationchange;
+ // attribute [DontEnum] EventListener onemptied;
+ // attribute [DontEnum] EventListener onended;
+ // attribute [DontEnum] EventListener onformchange;
+ // attribute [DontEnum] EventListener onforminput;
+ // attribute [DontEnum] EventListener oninvalid;
+ // attribute [DontEnum] EventListener onloadeddata;
+ // attribute [DontEnum] EventListener onloadedmetadata;
+ // attribute [DontEnum] EventListener onloadstart;
+ // attribute [DontEnum] EventListener onpause;
+ // attribute [DontEnum] EventListener onplay;
+ // attribute [DontEnum] EventListener onplaying;
+ // attribute [DontEnum] EventListener onprogress;
+ // attribute [DontEnum] EventListener onratechange;
+ // attribute [DontEnum] EventListener onreadystatechange;
+ // attribute [DontEnum] EventListener onseeked;
+ // attribute [DontEnum] EventListener onseeking;
+ // attribute [DontEnum] EventListener onshow;
+ // attribute [DontEnum] EventListener onstalled;
+ // attribute [DontEnum] EventListener onsuspend;
+ // attribute [DontEnum] EventListener ontimeupdate;
+ // attribute [DontEnum] EventListener onvolumechange;
+ // attribute [DontEnum] EventListener onwaiting;
+
+ // WebKit extensions
+ attribute [DontEnum] EventListener onbeforecut;
+ attribute [DontEnum] EventListener oncut;
+ attribute [DontEnum] EventListener onbeforecopy;
+ attribute [DontEnum] EventListener oncopy;
+ attribute [DontEnum] EventListener onbeforepaste;
+ attribute [DontEnum] EventListener onpaste;
+ attribute [DontEnum] EventListener onreset;
+ attribute [DontEnum] EventListener onsearch;
+ attribute [DontEnum] EventListener onselectstart;
+#endif
+#endif
};
}
diff --git a/src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp b/src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp
index 3a90913..ac0a4ab 100644
--- a/src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/MessageChannel.cpp
@@ -28,14 +28,15 @@
#include "MessageChannel.h"
#include "MessagePort.h"
+#include "PlatformMessagePortChannel.h"
namespace WebCore {
MessageChannel::MessageChannel(ScriptExecutionContext* context)
- : m_port1(MessagePort::create(context))
- , m_port2(MessagePort::create(context))
+ : m_port1(MessagePort::create(*context))
+ , m_port2(MessagePort::create(*context))
{
- MessagePort::entangle(m_port1.get(), m_port2.get());
+ PlatformMessagePortChannel::createChannel(m_port1.get(), m_port2.get());
}
MessageChannel::~MessageChannel()
diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp b/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp
index efd89e7..9f3e4d2 100644
--- a/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.cpp
@@ -38,89 +38,23 @@
namespace WebCore {
-class MessagePortCloseEventTask : public ScriptExecutionContext::Task {
-public:
- static PassRefPtr<MessagePortCloseEventTask> create(PassRefPtr<MessagePort> port)
- {
- return adoptRef(new MessagePortCloseEventTask(port));
- }
-
-private:
- MessagePortCloseEventTask(PassRefPtr<MessagePort> port)
- : m_port(port)
- {
- ASSERT(m_port);
- }
-
- virtual void performTask(ScriptExecutionContext* unusedContext)
- {
- ASSERT_UNUSED(unusedContext, unusedContext == m_port->scriptExecutionContext());
- ASSERT(!m_port->active());
-
- // Closing may destroy the port, dispatch any remaining messages now.
- if (m_port->queueIsOpen())
- m_port->dispatchMessages();
-
- m_port->dispatchCloseEvent();
- }
-
- RefPtr<MessagePort> m_port;
-};
-
-PassRefPtr<MessagePort::EventData> MessagePort::EventData::create(const String& message, PassRefPtr<MessagePort> port)
-{
- return adoptRef(new EventData(message, port));
-}
-
-MessagePort::EventData::EventData(const String& message, PassRefPtr<MessagePort> messagePort)
- : message(message.copy())
- , messagePort(messagePort)
-{
-}
-
-MessagePort::EventData::~EventData()
+MessagePort::MessagePort(ScriptExecutionContext& scriptExecutionContext)
+ : m_entangledChannel(0)
+ , m_started(false)
+ , m_scriptExecutionContext(&scriptExecutionContext)
{
-}
+ m_scriptExecutionContext->createdMessagePort(this);
-MessagePort::MessagePort(ScriptExecutionContext* scriptExecutionContext)
- : m_entangledPort(0)
- , m_queueIsOpen(false)
- , m_scriptExecutionContext(scriptExecutionContext)
- , m_pendingCloseEvent(false)
-{
- if (scriptExecutionContext)
- scriptExecutionContext->createdMessagePort(this);
+ // Don't need to call processMessagePortMessagesSoon() here, because the port will not be opened until start() is invoked.
}
MessagePort::~MessagePort()
{
- if (m_entangledPort)
- unentangle();
-
+ close();
if (m_scriptExecutionContext)
m_scriptExecutionContext->destroyedMessagePort(this);
}
-PassRefPtr<MessagePort> MessagePort::clone(ExceptionCode& ec)
-{
- if (!m_entangledPort) {
- ec = INVALID_STATE_ERR;
- return 0;
- }
-
- RefPtr<MessagePortProxy> remotePort = m_entangledPort;
- RefPtr<MessagePort> newPort = MessagePort::create(0);
-
- // Move all the events in the port message queue of original port to the port message queue of new port, if any, leaving the new port's port message queue in its initial closed state.
- // If events are posted (e.g. from a worker thread) while this code is executing, there is no guarantee whether they end up in the original or new port's message queue.
- RefPtr<EventData> eventData;
- while (m_messageQueue.tryGetMessage(eventData))
- newPort->m_messageQueue.append(eventData);
-
- entangle(remotePort.get(), newPort.get()); // The port object will be unentangled.
- return newPort;
-}
-
void MessagePort::postMessage(const String& message, ExceptionCode& ec)
{
postMessage(message, 0, ec);
@@ -128,112 +62,86 @@ void MessagePort::postMessage(const String& message, ExceptionCode& ec)
void MessagePort::postMessage(const String& message, MessagePort* dataPort, ExceptionCode& ec)
{
- if (!m_entangledPort || !m_scriptExecutionContext)
+ if (!m_entangledChannel)
return;
+ ASSERT(m_scriptExecutionContext);
- RefPtr<MessagePort> newMessagePort;
+ OwnPtr<MessagePortChannel> channel;
if (dataPort) {
- if (dataPort == this || dataPort == m_entangledPort) {
- ec = INVALID_ACCESS_ERR;
+ if (dataPort == this || m_entangledChannel->isConnectedTo(dataPort)) {
+ ec = INVALID_STATE_ERR;
return;
}
- ec = 0;
- newMessagePort = dataPort->clone(ec);
+ channel = dataPort->disentangle(ec);
if (ec)
return;
}
-
- m_entangledPort->deliverMessage(message, newMessagePort);
+ m_entangledChannel->postMessageToRemote(MessagePortChannel::EventData::create(message, channel.release()));
}
-void MessagePort::deliverMessage(const String& message, PassRefPtr<MessagePort> dataPort)
+PassOwnPtr<MessagePortChannel> MessagePort::disentangle(ExceptionCode& ec)
{
- m_messageQueue.append(EventData::create(message, dataPort));
- if (m_queueIsOpen && m_scriptExecutionContext)
- m_scriptExecutionContext->processMessagePortMessagesSoon();
+ if (!m_entangledChannel)
+ ec = INVALID_STATE_ERR;
+ else {
+ m_entangledChannel->disentangle();
+
+ // We can't receive any messages or generate any events, so remove ourselves from the list of active ports.
+ ASSERT(m_scriptExecutionContext);
+ m_scriptExecutionContext->destroyedMessagePort(this);
+ m_scriptExecutionContext = 0;
+ }
+ return m_entangledChannel.release();
}
-PassRefPtr<MessagePort> MessagePort::startConversation(ScriptExecutionContext* scriptExecutionContext, const String& message)
+// Invoked to notify us that there are messages available for this port.
+// This code may be called from another thread, and so should not call any non-threadsafe APIs (i.e. should not call into the entangled channel or access mutable variables).
+void MessagePort::messageAvailable()
{
- RefPtr<MessagePort> port1 = MessagePort::create(scriptExecutionContext);
- if (!m_entangledPort || !m_scriptExecutionContext)
- return port1;
- RefPtr<MessagePort> port2 = MessagePort::create(0);
-
- entangle(port1.get(), port2.get());
-
- m_entangledPort->deliverMessage(message, port2);
- return port1;
+ ASSERT(m_scriptExecutionContext);
+ m_scriptExecutionContext->processMessagePortMessagesSoon();
}
void MessagePort::start()
{
- if (m_queueIsOpen || !m_scriptExecutionContext)
+ // Do nothing if we've been cloned
+ if (!m_entangledChannel)
+ return;
+
+ ASSERT(m_scriptExecutionContext);
+ if (m_started)
return;
- m_queueIsOpen = true;
+ m_started = true;
m_scriptExecutionContext->processMessagePortMessagesSoon();
}
void MessagePort::close()
{
- if (!m_entangledPort)
+ if (!m_entangledChannel)
return;
-
- MessagePortProxy* otherPort = m_entangledPort;
- unentangle();
-
- queueCloseEvent();
- otherPort->queueCloseEvent();
-}
-
-void MessagePort::entangle(MessagePortProxy* port1, MessagePortProxy* port2)
-{
- port1->entangle(port2);
- port2->entangle(port1);
+ m_entangledChannel->close();
}
-void MessagePort::entangle(MessagePortProxy* remote)
+void MessagePort::entangle(PassOwnPtr<MessagePortChannel> remote)
{
- // Unentangle from our current port first.
- if (m_entangledPort) {
- ASSERT(m_entangledPort != remote);
- unentangle();
- }
- m_entangledPort = remote;
-}
+ // Only invoked to set our initial entanglement.
+ ASSERT(!m_entangledChannel);
+ ASSERT(m_scriptExecutionContext);
-void MessagePort::unentangle()
-{
- // Unentangle our end before unentangling the other end.
- if (m_entangledPort) {
- MessagePortProxy* remote = m_entangledPort;
- m_entangledPort = 0;
- remote->unentangle();
- }
+ // Don't entangle the ports if the channel is closed.
+ if (remote->entangleIfOpen(this))
+ m_entangledChannel = remote;
}
void MessagePort::contextDestroyed()
{
ASSERT(m_scriptExecutionContext);
-
- if (m_entangledPort)
- unentangle();
-
+ // Must close port before blowing away the cached context, to ensure that we get no more calls to messageAvailable().
+ close();
m_scriptExecutionContext = 0;
}
-void MessagePort::attachToContext(ScriptExecutionContext* scriptExecutionContext)
-{
- ASSERT(!m_scriptExecutionContext);
- ASSERT(!m_queueIsOpen);
-
- m_scriptExecutionContext = scriptExecutionContext;
- m_scriptExecutionContext->createdMessagePort(this);
-
- // FIXME: Need to call processMessagePortMessagesSoon()?
-}
-
ScriptExecutionContext* MessagePort::scriptExecutionContext() const
{
return m_scriptExecutionContext;
@@ -242,17 +150,19 @@ ScriptExecutionContext* MessagePort::scriptExecutionContext() const
void MessagePort::dispatchMessages()
{
// Messages for contexts that are not fully active get dispatched too, but JSAbstractEventListener::handleEvent() doesn't call handlers for these.
- // FIXME: Such messages should be dispatched if the document returns from page cache. They are only allowed to be lost if the document is discarded.
- ASSERT(queueIsOpen());
-
- RefPtr<EventData> eventData;
- while (m_messageQueue.tryGetMessage(eventData)) {
-
- ASSERT(!eventData->messagePort || !eventData->messagePort->m_scriptExecutionContext);
- if (eventData->messagePort)
- eventData->messagePort->attachToContext(m_scriptExecutionContext);
-
- RefPtr<Event> evt = MessageEvent::create(eventData->message, "", "", 0, eventData->messagePort);
+ // The HTML5 spec specifies that any messages sent to a document that is not fully active should be dropped, so this behavior is OK.
+ ASSERT(started());
+
+ OwnPtr<MessagePortChannel::EventData> eventData;
+ while (m_entangledChannel && m_entangledChannel->tryGetMessageFromRemote(eventData)) {
+ RefPtr<MessagePort> port;
+ OwnPtr<MessagePortChannel> channel = eventData->channel();
+ if (channel) {
+ // The remote side sent over a MessagePortChannel, so create a MessagePort to wrap it.
+ port = MessagePort::create(*m_scriptExecutionContext);
+ port->entangle(channel.release());
+ }
+ RefPtr<Event> evt = MessageEvent::create(eventData->message(), "", "", 0, port.release());
if (m_onMessageListener) {
evt->setTarget(this);
@@ -266,31 +176,6 @@ void MessagePort::dispatchMessages()
}
}
-void MessagePort::queueCloseEvent()
-{
- ASSERT(!m_pendingCloseEvent);
- m_pendingCloseEvent = true;
-
- m_scriptExecutionContext->postTask(MessagePortCloseEventTask::create(this));
-}
-
-void MessagePort::dispatchCloseEvent()
-{
- ASSERT(m_pendingCloseEvent);
- m_pendingCloseEvent = false;
-
- RefPtr<Event> evt = Event::create(eventNames().closeEvent, false, true);
- if (m_onCloseListener) {
- evt->setTarget(this);
- evt->setCurrentTarget(this);
- m_onCloseListener->handleEvent(evt.get(), false);
- }
-
- ExceptionCode ec = 0;
- dispatchEvent(evt.release(), ec);
- ASSERT(!ec);
-}
-
void MessagePort::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool)
{
EventListenersMap::iterator iter = m_eventListeners.find(eventType);
@@ -342,9 +227,22 @@ bool MessagePort::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
return !event->defaultPrevented();
}
+void MessagePort::setOnmessage(PassRefPtr<EventListener> eventListener)
+{
+ m_onMessageListener = eventListener;
+ start();
+}
+
bool MessagePort::hasPendingActivity()
{
- return m_pendingCloseEvent || (m_queueIsOpen && !m_messageQueue.isEmpty());
+ // The spec says that entangled message ports should always be treated as if they have a strong reference.
+ // We'll also stipulate that the queue needs to be open (if the app drops its reference to the port before start()-ing it, then it's not really entangled as it's unreachable).
+ return m_started && m_entangledChannel && m_entangledChannel->hasPendingActivity();
+}
+
+MessagePort* MessagePort::locallyEntangledPort()
+{
+ return m_entangledChannel ? m_entangledChannel->locallyEntangledPort(m_scriptExecutionContext) : 0;
}
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.h b/src/3rdparty/webkit/WebCore/dom/MessagePort.h
index 054ae41..f416b9b 100644
--- a/src/3rdparty/webkit/WebCore/dom/MessagePort.h
+++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.h
@@ -30,10 +30,11 @@
#include "AtomicStringHash.h"
#include "EventListener.h"
#include "EventTarget.h"
-#include "MessagePortProxy.h"
+#include "MessagePortChannel.h"
#include <wtf/HashMap.h>
-#include <wtf/MessageQueue.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
@@ -45,35 +46,25 @@ namespace WebCore {
class Frame;
class ScriptExecutionContext;
class String;
- class WorkerContext;
- class MessagePort : public MessagePortProxy, public EventTarget {
+ class MessagePort : public RefCounted<MessagePort>, public EventTarget {
public:
- static PassRefPtr<MessagePort> create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); }
+ static PassRefPtr<MessagePort> create(ScriptExecutionContext& scriptExecutionContext) { return adoptRef(new MessagePort(scriptExecutionContext)); }
~MessagePort();
- PassRefPtr<MessagePort> clone(ExceptionCode&); // Returns a port that isn't attached to any context.
-
- bool active() const { return m_entangledPort; }
void postMessage(const String& message, ExceptionCode&);
void postMessage(const String& message, MessagePort*, ExceptionCode&);
- PassRefPtr<MessagePort> startConversation(ScriptExecutionContext*, const String& message);
void start();
void close();
- // Implementations of MessagePortProxy APIs
- virtual void entangle(MessagePortProxy*);
- virtual void unentangle();
- virtual void deliverMessage(const String& message, PassRefPtr<MessagePort>);
- virtual void queueCloseEvent();
-
- bool queueIsOpen() const { return m_queueIsOpen; }
+ void entangle(PassOwnPtr<MessagePortChannel>);
+ PassOwnPtr<MessagePortChannel> disentangle(ExceptionCode&);
- MessagePortProxy* entangledPort() { return m_entangledPort; }
- static void entangle(MessagePortProxy*, MessagePortProxy*);
+ void messageAvailable();
+ bool started() const { return m_started; }
void contextDestroyed();
- void attachToContext(ScriptExecutionContext*);
+
virtual ScriptExecutionContext* scriptExecutionContext() const;
virtual MessagePort* toMessagePort() { return this; }
@@ -88,52 +79,35 @@ namespace WebCore {
typedef HashMap<AtomicString, ListenerVector> EventListenersMap;
EventListenersMap& eventListeners() { return m_eventListeners; }
- using RefCounted<MessagePortProxy>::ref;
- using RefCounted<MessagePortProxy>::deref;
+ using RefCounted<MessagePort>::ref;
+ using RefCounted<MessagePort>::deref;
bool hasPendingActivity();
- // FIXME: Per current spec, setting onmessage should automagically start the port (unlike addEventListener("message", ...)).
- void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onMessageListener = eventListener; }
+ void setOnmessage(PassRefPtr<EventListener>);
EventListener* onmessage() const { return m_onMessageListener.get(); }
- void setOnclose(PassRefPtr<EventListener> eventListener) { m_onCloseListener = eventListener; }
- EventListener* onclose() const { return m_onCloseListener.get(); }
+ // Returns null if there is no entangled port, or if the entangled port is run by a different thread.
+ // Returns null otherwise.
+ // NOTE: This is used solely to enable a GC optimization. Some platforms may not be able to determine ownership of the remote port (since it may live cross-process) - those platforms may always return null.
+ MessagePort* locallyEntangledPort();
+ bool isEntangled() { return m_entangledChannel; }
private:
- friend class MessagePortCloseEventTask;
-
- MessagePort(ScriptExecutionContext*);
+ MessagePort(ScriptExecutionContext&);
virtual void refEventTarget() { ref(); }
virtual void derefEventTarget() { deref(); }
- void dispatchCloseEvent();
+ OwnPtr<MessagePortChannel> m_entangledChannel;
- MessagePortProxy* m_entangledPort;
-
- // FIXME: EventData is necessary to pass messages to other threads. In single threaded case, we can just queue a created event.
- struct EventData : public RefCounted<EventData> {
- static PassRefPtr<EventData> create(const String& message, PassRefPtr<MessagePort>);
- ~EventData();
-
- String message;
- RefPtr<MessagePort> messagePort;
-
- private:
- EventData(const String& message, PassRefPtr<MessagePort>);
- };
- MessageQueue<RefPtr<EventData> > m_messageQueue; // FIXME: No need to use MessageQueue in single threaded case.
- bool m_queueIsOpen;
+ bool m_started;
ScriptExecutionContext* m_scriptExecutionContext;
RefPtr<EventListener> m_onMessageListener;
- RefPtr<EventListener> m_onCloseListener;
EventListenersMap m_eventListeners;
-
- bool m_pendingCloseEvent; // The port is GC protected while waiting for a close event to be dispatched.
};
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePort.idl b/src/3rdparty/webkit/WebCore/dom/MessagePort.idl
index 03c6bab..e5f9ad1 100644
--- a/src/3rdparty/webkit/WebCore/dom/MessagePort.idl
+++ b/src/3rdparty/webkit/WebCore/dom/MessagePort.idl
@@ -34,16 +34,13 @@ module events {
// We need to have something as an ObjC binding, because MessagePort is used in MessageEvent, which already has one,
// but we don't want to actually expose the API while it is in flux.
#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
- readonly attribute boolean active;
void postMessage(in DOMString message, in [Optional] MessagePort messagePort)
raises(DOMException);
- [Custom] MessagePort startConversation(in DOMString message);
void start();
void close();
// event handler attributes
attribute EventListener onmessage;
- attribute EventListener onclose;
// EventTarget interface
[Custom] void addEventListener(in DOMString type,
diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePortProxy.h b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp
index 9e768ce..768d4f4 100644
--- a/src/3rdparty/webkit/WebCore/dom/MessagePortProxy.h
+++ b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.cpp
@@ -27,28 +27,38 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "config.h"
+#include "MessagePortChannel.h"
-#ifndef MessagePortProxy_h
-#define MessagePortProxy_h
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
+#include "PlatformMessagePortChannel.h"
namespace WebCore {
- class MessagePort;
- class String;
+PassOwnPtr<MessagePortChannel> MessagePortChannel::create(PassRefPtr<PlatformMessagePortChannel> channel)
+{
+ return new MessagePortChannel(channel);
+}
- class MessagePortProxy : public RefCounted<MessagePortProxy> {
- public:
- virtual ~MessagePortProxy() { }
+PassOwnPtr<MessagePortChannel::EventData> MessagePortChannel::EventData::create(const String& message, PassOwnPtr<MessagePortChannel> channel)
+{
+ return new EventData(message, channel);
+}
- virtual void entangle(MessagePortProxy*) = 0;
- virtual void unentangle() = 0;
- virtual void deliverMessage(const String& message, PassRefPtr<MessagePort>) = 0;
- virtual void queueCloseEvent() = 0;
- };
+MessagePortChannel::EventData::EventData(const String& message, PassOwnPtr<MessagePortChannel> channel)
+ : m_message(message.copy())
+ , m_channel(channel)
+{
+}
-} // namespace WebCore
+MessagePortChannel::MessagePortChannel(PassRefPtr<PlatformMessagePortChannel> channel)
+ : m_channel(channel)
+{
+}
-#endif // MessagePortProxy_h
+MessagePortChannel::~MessagePortChannel()
+{
+ // Make sure we close our platform channel when the base is freed, to keep the channel objects from leaking.
+ m_channel->close();
+}
+
+} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h
new file mode 100644
index 0000000..15b3d16
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/dom/MessagePortChannel.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2009 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 MessagePortChannel_h
+#define MessagePortChannel_h
+
+#include "PlatformString.h"
+
+#include <wtf/OwnPtr.h>
+#include <wtf/PassOwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class MessagePort;
+ class PlatformMessagePortChannel;
+ class ScriptExecutionContext;
+ class String;
+
+ // 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 : Noncopyable {
+ public:
+ // Creates a new wrapper for the passed channel.
+ static PassOwnPtr<MessagePortChannel> create(PassRefPtr<PlatformMessagePortChannel>);
+
+ // Entangles the channel with a port (called when a port has been cloned, after the clone has been marshalled to its new owning thread and is ready to receive messages).
+ // Returns false if the entanglement failed because the port was closed.
+ bool entangleIfOpen(MessagePort*);
+
+ // Disentangles the channel from a given port so it no longer forwards messages to the port. Called when the port is being cloned and no new owning thread has yet been established.
+ void disentangle();
+
+ // Closes the port (ensures that no further messages can be added to either queue).
+ void close();
+
+ // Used by MessagePort.postMessage() to prevent callers from passing a port's own entangled port.
+ bool isConnectedTo(MessagePort*);
+
+ // Returns true if the proxy currently contains messages for this port.
+ bool hasPendingActivity();
+
+ class EventData {
+ public:
+ static PassOwnPtr<EventData> create(const String&, PassOwnPtr<MessagePortChannel>);
+
+ const String& message() { return m_message; }
+ PassOwnPtr<MessagePortChannel> channel() { return m_channel.release(); }
+
+ private:
+ EventData(const String& message, PassOwnPtr<MessagePortChannel>);
+ String m_message;
+ OwnPtr<MessagePortChannel> m_channel;
+ };
+
+ // Sends a message and optional cloned port to the remote port.
+ void postMessageToRemote(PassOwnPtr<EventData>);
+
+ // Extracts a message from the message queue for this port.
+ bool tryGetMessageFromRemote(OwnPtr<EventData>&);
+
+ // Returns the entangled port if run by the same thread (see MessagePort::locallyEntangledPort() for more details).
+ MessagePort* locallyEntangledPort(const ScriptExecutionContext*);
+
+ ~MessagePortChannel();
+
+ private:
+ MessagePortChannel(PassRefPtr<PlatformMessagePortChannel>);
+ RefPtr<PlatformMessagePortChannel> m_channel;
+ };
+
+} // namespace WebCore
+
+#endif // MessagePortChannel_h
diff --git a/src/3rdparty/webkit/WebCore/dom/Node.cpp b/src/3rdparty/webkit/WebCore/dom/Node.cpp
index cd554df..3ddf4c0 100644
--- a/src/3rdparty/webkit/WebCore/dom/Node.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/Node.cpp
@@ -282,7 +282,7 @@ void Node::stopIgnoringLeaks()
#endif
}
-Node::StyleChange Node::diff( RenderStyle *s1, RenderStyle *s2 )
+Node::StyleChange Node::diff(const RenderStyle* s1, const RenderStyle* s2)
{
// FIXME: The behavior of this function is just totally wrong. It doesn't handle
// explicit inheritance of non-inherited properties and so you end up not re-resolving
@@ -302,6 +302,12 @@ Node::StyleChange Node::diff( RenderStyle *s1, RenderStyle *s2 )
else if (s1->inheritedNotEqual(s2))
ch = Inherit;
+ // For nth-child and other positional rules, treat styles as different if they have
+ // changed positionally in the DOM. This way subsequent sibling resolutions won't be confused
+ // by the wrong child index and evaluate to incorrect results.
+ if (ch == NoChange && s1->childIndex() != s2->childIndex())
+ ch = NoInherit;
+
// If the pseudoStyles have changed, we want any StyleChange that is not NoChange
// because setStyle will do the right thing with anything else.
if (ch == NoChange && s1->hasPseudoStyle(BEFORE)) {
@@ -1353,6 +1359,14 @@ bool Node::canStartSelection() const
{
if (isContentEditable())
return true;
+
+ if (renderer()) {
+ RenderStyle* style = renderer()->style();
+ // We allow selections to begin within an element that has -webkit-user-select: none set,
+ // but if the element is draggable then dragging should take priority over selection.
+ if (style->userDrag() == DRAG_ELEMENT && style->userSelect() == SELECT_NONE)
+ return false;
+ }
return parent() ? parent()->canStartSelection() : true;
}
@@ -2478,7 +2492,7 @@ bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent)
event->setEventPhase(Event::CAPTURING_PHASE);
if (targetForWindowEvents) {
- event->setCurrentTarget(targetForWindowEvents->document()); // FIXME: targetForWindowEvents should be the event target.
+ event->setCurrentTarget(targetForWindowEvents);
targetForWindowEvents->handleEvent(event.get(), true);
if (event->propagationStopped())
goto doneDispatching;
@@ -2516,7 +2530,7 @@ bool Node::dispatchGenericEvent(PassRefPtr<Event> prpEvent)
goto doneDispatching;
}
if (targetForWindowEvents) {
- event->setCurrentTarget(targetForWindowEvents->document()); // FIXME: targetForWindowEvents should be the event target.
+ event->setCurrentTarget(targetForWindowEvents);
targetForWindowEvents->handleEvent(event.get(), false);
if (event->propagationStopped() || event->cancelBubble())
goto doneDispatching;
@@ -2619,7 +2633,7 @@ bool Node::dispatchMouseEvent(const PlatformMouseEvent& event, const AtomicStrin
return dispatchMouseEvent(eventType, button, detail,
contentsPos.x(), contentsPos.y(), event.globalX(), event.globalY(),
event.ctrlKey(), event.altKey(), event.shiftKey(), event.metaKey(),
- false, relatedTarget);
+ false, relatedTarget, 0);
}
void Node::dispatchSimulatedMouseEvent(const AtomicString& eventType,
@@ -3083,66 +3097,6 @@ void Node::setOnmousewheel(PassRefPtr<EventListener> eventListener)
setAttributeEventListener(eventNames().mousewheelEvent, eventListener);
}
-EventListener* Node::onbeforecut() const
-{
- return getAttributeEventListener(eventNames().beforecutEvent);
-}
-
-void Node::setOnbeforecut(PassRefPtr<EventListener> eventListener)
-{
- setAttributeEventListener(eventNames().beforecutEvent, eventListener);
-}
-
-EventListener* Node::oncut() const
-{
- return getAttributeEventListener(eventNames().cutEvent);
-}
-
-void Node::setOncut(PassRefPtr<EventListener> eventListener)
-{
- setAttributeEventListener(eventNames().cutEvent, eventListener);
-}
-
-EventListener* Node::onbeforecopy() const
-{
- return getAttributeEventListener(eventNames().beforecopyEvent);
-}
-
-void Node::setOnbeforecopy(PassRefPtr<EventListener> eventListener)
-{
- setAttributeEventListener(eventNames().beforecopyEvent, eventListener);
-}
-
-EventListener* Node::oncopy() const
-{
- return getAttributeEventListener(eventNames().copyEvent);
-}
-
-void Node::setOncopy(PassRefPtr<EventListener> eventListener)
-{
- setAttributeEventListener(eventNames().copyEvent, eventListener);
-}
-
-EventListener* Node::onbeforepaste() const
-{
- return getAttributeEventListener(eventNames().beforepasteEvent);
-}
-
-void Node::setOnbeforepaste(PassRefPtr<EventListener> eventListener)
-{
- setAttributeEventListener(eventNames().beforepasteEvent, eventListener);
-}
-
-EventListener* Node::onpaste() const
-{
- return getAttributeEventListener(eventNames().pasteEvent);
-}
-
-void Node::setOnpaste(PassRefPtr<EventListener> eventListener)
-{
- setAttributeEventListener(eventNames().pasteEvent, eventListener);
-}
-
EventListener* Node::ondragenter() const
{
return getAttributeEventListener(eventNames().dragenterEvent);
@@ -3213,84 +3167,124 @@ void Node::setOndragend(PassRefPtr<EventListener> eventListener)
setAttributeEventListener(eventNames().dragendEvent, eventListener);
}
-EventListener* Node::onreset() const
+EventListener* Node::onscroll() const
{
- return getAttributeEventListener(eventNames().resetEvent);
+ return getAttributeEventListener(eventNames().scrollEvent);
}
-void Node::setOnreset(PassRefPtr<EventListener> eventListener)
+void Node::setOnscroll(PassRefPtr<EventListener> eventListener)
{
- setAttributeEventListener(eventNames().resetEvent, eventListener);
+ setAttributeEventListener(eventNames().scrollEvent, eventListener);
}
-EventListener* Node::onresize() const
+EventListener* Node::onselect() const
{
- return getAttributeEventListener(eventNames().resizeEvent);
+ return getAttributeEventListener(eventNames().selectEvent);
}
-void Node::setOnresize(PassRefPtr<EventListener> eventListener)
+void Node::setOnselect(PassRefPtr<EventListener> eventListener)
{
- setAttributeEventListener(eventNames().resizeEvent, eventListener);
+ setAttributeEventListener(eventNames().selectEvent, eventListener);
}
-EventListener* Node::onscroll() const
+EventListener* Node::onsubmit() const
{
- return getAttributeEventListener(eventNames().scrollEvent);
+ return getAttributeEventListener(eventNames().submitEvent);
}
-void Node::setOnscroll(PassRefPtr<EventListener> eventListener)
+void Node::setOnsubmit(PassRefPtr<EventListener> eventListener)
{
- setAttributeEventListener(eventNames().scrollEvent, eventListener);
+ setAttributeEventListener(eventNames().submitEvent, eventListener);
}
-EventListener* Node::onsearch() const
+EventListener* Node::onbeforecut() const
{
- return getAttributeEventListener(eventNames().searchEvent);
+ return getAttributeEventListener(eventNames().beforecutEvent);
}
-void Node::setOnsearch(PassRefPtr<EventListener> eventListener)
+void Node::setOnbeforecut(PassRefPtr<EventListener> eventListener)
{
- setAttributeEventListener(eventNames().searchEvent, eventListener);
+ setAttributeEventListener(eventNames().beforecutEvent, eventListener);
}
-EventListener* Node::onselect() const
+EventListener* Node::oncut() const
{
- return getAttributeEventListener(eventNames().selectEvent);
+ return getAttributeEventListener(eventNames().cutEvent);
}
-void Node::setOnselect(PassRefPtr<EventListener> eventListener)
+void Node::setOncut(PassRefPtr<EventListener> eventListener)
{
- setAttributeEventListener(eventNames().selectEvent, eventListener);
+ setAttributeEventListener(eventNames().cutEvent, eventListener);
}
-EventListener* Node::onselectstart() const
+EventListener* Node::onbeforecopy() const
{
- return getAttributeEventListener(eventNames().selectstartEvent);
+ return getAttributeEventListener(eventNames().beforecopyEvent);
}
-void Node::setOnselectstart(PassRefPtr<EventListener> eventListener)
+void Node::setOnbeforecopy(PassRefPtr<EventListener> eventListener)
{
- setAttributeEventListener(eventNames().selectstartEvent, eventListener);
+ setAttributeEventListener(eventNames().beforecopyEvent, eventListener);
}
-EventListener* Node::onsubmit() const
+EventListener* Node::oncopy() const
{
- return getAttributeEventListener(eventNames().submitEvent);
+ return getAttributeEventListener(eventNames().copyEvent);
}
-void Node::setOnsubmit(PassRefPtr<EventListener> eventListener)
+void Node::setOncopy(PassRefPtr<EventListener> eventListener)
{
- setAttributeEventListener(eventNames().submitEvent, eventListener);
+ setAttributeEventListener(eventNames().copyEvent, eventListener);
+}
+
+EventListener* Node::onbeforepaste() const
+{
+ return getAttributeEventListener(eventNames().beforepasteEvent);
+}
+
+void Node::setOnbeforepaste(PassRefPtr<EventListener> eventListener)
+{
+ setAttributeEventListener(eventNames().beforepasteEvent, eventListener);
+}
+
+EventListener* Node::onpaste() const
+{
+ return getAttributeEventListener(eventNames().pasteEvent);
+}
+
+void Node::setOnpaste(PassRefPtr<EventListener> eventListener)
+{
+ setAttributeEventListener(eventNames().pasteEvent, eventListener);
+}
+
+EventListener* Node::onreset() const
+{
+ return getAttributeEventListener(eventNames().resetEvent);
+}
+
+void Node::setOnreset(PassRefPtr<EventListener> eventListener)
+{
+ setAttributeEventListener(eventNames().resetEvent, eventListener);
+}
+
+EventListener* Node::onsearch() const
+{
+ return getAttributeEventListener(eventNames().searchEvent);
+}
+
+void Node::setOnsearch(PassRefPtr<EventListener> eventListener)
+{
+ setAttributeEventListener(eventNames().searchEvent, eventListener);
}
-EventListener* Node::onunload() const
+EventListener* Node::onselectstart() const
{
- return getAttributeEventListener(eventNames().unloadEvent);
+ return getAttributeEventListener(eventNames().selectstartEvent);
}
-void Node::setOnunload(PassRefPtr<EventListener> eventListener)
+void Node::setOnselectstart(PassRefPtr<EventListener> eventListener)
{
- setAttributeEventListener(eventNames().unloadEvent, eventListener);
+ setAttributeEventListener(eventNames().selectstartEvent, eventListener);
}
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/dom/Node.h b/src/3rdparty/webkit/WebCore/dom/Node.h
index 8313ca8..ab743f4 100644
--- a/src/3rdparty/webkit/WebCore/dom/Node.h
+++ b/src/3rdparty/webkit/WebCore/dom/Node.h
@@ -106,7 +106,7 @@ public:
static void dumpStatistics();
enum StyleChange { NoChange, NoInherit, Inherit, Detach, Force };
- static StyleChange diff(RenderStyle*, RenderStyle*);
+ static StyleChange diff(const RenderStyle*, const RenderStyle*);
Node(Document*, bool isElement = false, bool isContainer = false, bool isText = false);
virtual ~Node();
@@ -531,7 +531,7 @@ public:
void removeAllEventListeners() { if (hasRareData()) removeAllEventListenersSlowCase(); }
void dispatchSubtreeModifiedEvent();
- void dispatchUIEvent(const AtomicString& eventType, int detail = 0, PassRefPtr<Event> underlyingEvent = 0);
+ void dispatchUIEvent(const AtomicString& eventType, int detail, PassRefPtr<Event> underlyingEvent);
bool dispatchKeyEvent(const PlatformKeyboardEvent&);
void dispatchWheelEvent(PlatformWheelEvent&);
bool dispatchMouseEvent(const PlatformMouseEvent&, const AtomicString& eventType,
@@ -539,8 +539,8 @@ public:
bool dispatchMouseEvent(const AtomicString& eventType, int button, int clickCount,
int pageX, int pageY, int screenX, int screenY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
- bool isSimulated = false, Node* relatedTarget = 0, PassRefPtr<Event> underlyingEvent = 0);
- void dispatchSimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<Event> underlyingEvent = 0);
+ bool isSimulated, Node* relatedTarget, PassRefPtr<Event> underlyingEvent);
+ void dispatchSimulatedMouseEvent(const AtomicString& eventType, PassRefPtr<Event> underlyingEvent);
void dispatchSimulatedClick(PassRefPtr<Event> underlyingEvent, bool sendMouseEvents = false, bool showPressedLook = true);
void dispatchProgressEvent(const AtomicString& eventType, bool lengthComputableArg, unsigned loadedArg, unsigned totalArg);
void dispatchWebKitAnimationEvent(const AtomicString& eventType, const String& animationName, double elapsedTime);
@@ -567,10 +567,19 @@ public:
const RegisteredEventListenerVector& eventListeners() const;
+ // These 4 attribute event handler attributes are overrided by HTMLBodyElement
+ // and HTMLFrameSetElement to forward to the DOMWindow.
+ virtual EventListener* onblur() const;
+ virtual void setOnblur(PassRefPtr<EventListener>);
+ virtual EventListener* onerror() const;
+ virtual void setOnerror(PassRefPtr<EventListener>);
+ virtual EventListener* onfocus() const;
+ virtual void setOnfocus(PassRefPtr<EventListener>);
+ virtual EventListener* onload() const;
+ virtual void setOnload(PassRefPtr<EventListener>);
+
EventListener* onabort() const;
void setOnabort(PassRefPtr<EventListener>);
- EventListener* onblur() const;
- void setOnblur(PassRefPtr<EventListener>);
EventListener* onchange() const;
void setOnchange(PassRefPtr<EventListener>);
EventListener* onclick() const;
@@ -579,10 +588,6 @@ public:
void setOncontextmenu(PassRefPtr<EventListener>);
EventListener* ondblclick() const;
void setOndblclick(PassRefPtr<EventListener>);
- EventListener* onerror() const;
- void setOnerror(PassRefPtr<EventListener>);
- EventListener* onfocus() const;
- void setOnfocus(PassRefPtr<EventListener>);
EventListener* oninput() const;
void setOninput(PassRefPtr<EventListener>);
EventListener* onkeydown() const;
@@ -591,8 +596,6 @@ public:
void setOnkeypress(PassRefPtr<EventListener>);
EventListener* onkeyup() const;
void setOnkeyup(PassRefPtr<EventListener>);
- EventListener* onload() const;
- void setOnload(PassRefPtr<EventListener>);
EventListener* onmousedown() const;
void setOnmousedown(PassRefPtr<EventListener>);
EventListener* onmousemove() const;
@@ -605,18 +608,6 @@ public:
void setOnmouseup(PassRefPtr<EventListener>);
EventListener* onmousewheel() const;
void setOnmousewheel(PassRefPtr<EventListener>);
- EventListener* onbeforecut() const;
- void setOnbeforecut(PassRefPtr<EventListener>);
- EventListener* oncut() const;
- void setOncut(PassRefPtr<EventListener>);
- EventListener* onbeforecopy() const;
- void setOnbeforecopy(PassRefPtr<EventListener>);
- EventListener* oncopy() const;
- void setOncopy(PassRefPtr<EventListener>);
- EventListener* onbeforepaste() const;
- void setOnbeforepaste(PassRefPtr<EventListener>);
- EventListener* onpaste() const;
- void setOnpaste(PassRefPtr<EventListener>);
EventListener* ondragenter() const;
void setOndragenter(PassRefPtr<EventListener>);
EventListener* ondragover() const;
@@ -631,22 +622,32 @@ public:
void setOndrag(PassRefPtr<EventListener>);
EventListener* ondragend() const;
void setOndragend(PassRefPtr<EventListener>);
- EventListener* onreset() const;
- void setOnreset(PassRefPtr<EventListener>);
- EventListener* onresize() const;
- void setOnresize(PassRefPtr<EventListener>);
EventListener* onscroll() const;
void setOnscroll(PassRefPtr<EventListener>);
- EventListener* onsearch() const;
- void setOnsearch(PassRefPtr<EventListener>);
EventListener* onselect() const;
void setOnselect(PassRefPtr<EventListener>);
- EventListener* onselectstart() const;
- void setOnselectstart(PassRefPtr<EventListener>);
EventListener* onsubmit() const;
void setOnsubmit(PassRefPtr<EventListener>);
- EventListener* onunload() const;
- void setOnunload(PassRefPtr<EventListener>);
+
+ // WebKit extensions
+ EventListener* onbeforecut() const;
+ void setOnbeforecut(PassRefPtr<EventListener>);
+ EventListener* oncut() const;
+ void setOncut(PassRefPtr<EventListener>);
+ EventListener* onbeforecopy() const;
+ void setOnbeforecopy(PassRefPtr<EventListener>);
+ EventListener* oncopy() const;
+ void setOncopy(PassRefPtr<EventListener>);
+ EventListener* onbeforepaste() const;
+ void setOnbeforepaste(PassRefPtr<EventListener>);
+ EventListener* onpaste() const;
+ void setOnpaste(PassRefPtr<EventListener>);
+ EventListener* onreset() const;
+ void setOnreset(PassRefPtr<EventListener>);
+ EventListener* onsearch() const;
+ void setOnsearch(PassRefPtr<EventListener>);
+ EventListener* onselectstart() const;
+ void setOnselectstart(PassRefPtr<EventListener>);
using TreeShared<Node>::ref;
using TreeShared<Node>::deref;
diff --git a/src/3rdparty/webkit/WebCore/dom/Node.idl b/src/3rdparty/webkit/WebCore/dom/Node.idl
index 45d325a..bcfb226 100644
--- a/src/3rdparty/webkit/WebCore/dom/Node.idl
+++ b/src/3rdparty/webkit/WebCore/dom/Node.idl
@@ -135,47 +135,6 @@ module core {
#if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
#if !defined(LANGUAGE_COM) || !LANGUAGE_COM
- attribute [DontEnum] EventListener onabort;
- attribute [DontEnum] EventListener onblur;
- attribute [DontEnum] EventListener onchange;
- attribute [DontEnum] EventListener onclick;
- attribute [DontEnum] EventListener oncontextmenu;
- attribute [DontEnum] EventListener ondblclick;
- attribute [DontEnum] EventListener onerror;
- attribute [DontEnum] EventListener onfocus;
- attribute [DontEnum] EventListener oninput;
- attribute [DontEnum] EventListener onkeydown;
- attribute [DontEnum] EventListener onkeypress;
- attribute [DontEnum] EventListener onkeyup;
- attribute [DontEnum] EventListener onload;
- attribute [DontEnum] EventListener onmousedown;
- attribute [DontEnum] EventListener onmousemove;
- attribute [DontEnum] EventListener onmouseout;
- attribute [DontEnum] EventListener onmouseover;
- attribute [DontEnum] EventListener onmouseup;
- attribute [DontEnum] EventListener onmousewheel;
- attribute [DontEnum] EventListener onbeforecut;
- attribute [DontEnum] EventListener oncut;
- attribute [DontEnum] EventListener onbeforecopy;
- attribute [DontEnum] EventListener oncopy;
- attribute [DontEnum] EventListener onbeforepaste;
- attribute [DontEnum] EventListener onpaste;
- attribute [DontEnum] EventListener ondragenter;
- attribute [DontEnum] EventListener ondragover;
- attribute [DontEnum] EventListener ondragleave;
- attribute [DontEnum] EventListener ondrop;
- attribute [DontEnum] EventListener ondragstart;
- attribute [DontEnum] EventListener ondrag;
- attribute [DontEnum] EventListener ondragend;
- attribute [DontEnum] EventListener onreset;
- attribute [DontEnum] EventListener onresize;
- attribute [DontEnum] EventListener onscroll;
- attribute [DontEnum] EventListener onsearch;
- attribute [DontEnum] EventListener onselect;
- attribute [DontEnum] EventListener onselectstart;
- attribute [DontEnum] EventListener onsubmit;
- attribute [DontEnum] EventListener onunload;
-
[Custom] void addEventListener(in DOMString type,
in EventListener listener,
in boolean useCapture);
diff --git a/src/3rdparty/webkit/WebCore/dom/Position.cpp b/src/3rdparty/webkit/WebCore/dom/Position.cpp
index 0dd48d4..3b4c3e8 100644
--- a/src/3rdparty/webkit/WebCore/dom/Position.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/Position.cpp
@@ -922,18 +922,18 @@ static bool isNonTextLeafChild(RenderObject* object)
static InlineTextBox* searchAheadForBetterMatch(RenderObject* renderer)
{
- InlineTextBox* match = 0;
- int minOffset = INT_MAX;
RenderBlock* container = renderer->containingBlock();
RenderObject* next = renderer;
while ((next = next->nextInPreOrder(container))) {
if (next->isRenderBlock())
- break;
+ return 0;
if (next->isBR())
- break;
+ return 0;
if (isNonTextLeafChild(next))
- break;
+ return 0;
if (next->isText()) {
+ InlineTextBox* match = 0;
+ int minOffset = INT_MAX;
for (InlineTextBox* box = toRenderText(next)->firstTextBox(); box; box = box->nextTextBox()) {
int caretMinOffset = box->caretMinOffset();
if (caretMinOffset < minOffset) {
@@ -941,9 +941,11 @@ static InlineTextBox* searchAheadForBetterMatch(RenderObject* renderer)
minOffset = caretMinOffset;
}
}
+ if (match)
+ return match;
}
}
- return match;
+ return 0;
}
void Position::getInlineBoxAndOffset(EAffinity affinity, TextDirection primaryDirection, InlineBox*& inlineBox, int& caretOffset) const
diff --git a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp
index 906902a..879bf62 100644
--- a/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/ProcessingInstruction.cpp
@@ -258,8 +258,7 @@ void ProcessingInstruction::removedFromDocument()
{
ContainerNode::removedFromDocument();
- if (document()->renderer())
- document()->removeStyleSheetCandidateNode(this);
+ document()->removeStyleSheetCandidateNode(this);
// FIXME: It's terrible to do a synchronous update of the style selector just because a <style> or <link> element got removed.
if (m_cachedSheet)
diff --git a/src/3rdparty/webkit/WebCore/dom/Range.cpp b/src/3rdparty/webkit/WebCore/dom/Range.cpp
index 8a3ca8f..4fb1164 100644
--- a/src/3rdparty/webkit/WebCore/dom/Range.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/Range.cpp
@@ -95,8 +95,8 @@ PassRefPtr<Range> Range::create(PassRefPtr<Document> ownerDocument, const Positi
Range::~Range()
{
- if (m_start.container())
- m_ownerDocument->detachRange(this);
+ // Always detach (even if we've already detached) to fix https://bugs.webkit.org/show_bug.cgi?id=26044
+ m_ownerDocument->detachRange(this);
#ifndef NDEBUG
rangeCounter.decrement();
@@ -379,7 +379,6 @@ Range::CompareResults Range::compareNode(Node* refNode, ExceptionCode& ec)
}
}
-
short Range::compareBoundaryPoints(CompareHow how, const Range* sourceRange, ExceptionCode& ec) const
{
if (!m_start.container()) {
@@ -1070,6 +1069,7 @@ PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& marku
void Range::detach(ExceptionCode& ec)
{
+ // Check first to see if we've already detached:
if (!m_start.container()) {
ec = INVALID_STATE_ERR;
return;
diff --git a/src/3rdparty/webkit/WebCore/dom/RangeBoundaryPoint.h b/src/3rdparty/webkit/WebCore/dom/RangeBoundaryPoint.h
index 2fda51f..1bbbe1a 100644
--- a/src/3rdparty/webkit/WebCore/dom/RangeBoundaryPoint.h
+++ b/src/3rdparty/webkit/WebCore/dom/RangeBoundaryPoint.h
@@ -33,7 +33,6 @@ namespace WebCore {
class RangeBoundaryPoint {
public:
- RangeBoundaryPoint();
explicit RangeBoundaryPoint(PassRefPtr<Node> container);
const Position toPosition() const;
@@ -63,17 +62,12 @@ private:
Node* m_childBeforeBoundary;
};
-inline RangeBoundaryPoint::RangeBoundaryPoint()
- : m_offsetInContainer(0)
- , m_childBeforeBoundary(0)
-{
-}
-
inline RangeBoundaryPoint::RangeBoundaryPoint(PassRefPtr<Node> container)
: m_containerNode(container)
, m_offsetInContainer(0)
, m_childBeforeBoundary(0)
{
+ ASSERT(m_containerNode);
}
inline Node* RangeBoundaryPoint::container() const
@@ -116,6 +110,7 @@ inline void RangeBoundaryPoint::clear()
inline void RangeBoundaryPoint::set(PassRefPtr<Node> container, int offset, Node* childBefore)
{
+ ASSERT(container);
ASSERT(offset >= 0);
ASSERT(childBefore == (offset ? container->childNode(offset - 1) : 0));
m_containerNode = container;
diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp b/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp
index 55b15e5..fe38b46 100644
--- a/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/ScriptElement.cpp
@@ -201,13 +201,14 @@ void ScriptElementData::execute(CachedScript* cachedScript)
evaluateScript(ScriptSourceCode(cachedScript));
m_scriptElement->dispatchLoadEvent();
}
+ cachedScript->removeClient(this);
}
void ScriptElementData::notifyFinished(CachedResource* o)
{
ASSERT_UNUSED(o, o == m_cachedScript);
m_element->document()->executeScriptSoon(this, m_cachedScript);
- stopLoadRequest();
+ m_cachedScript = 0;
}
bool ScriptElementData::ignoresLoadRequest() const
diff --git a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp
index c518734..45d4e23 100644
--- a/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/ScriptExecutionContext.cpp
@@ -88,7 +88,7 @@ void ScriptExecutionContext::dispatchMessagePortEvents()
MessagePort* port = ports[i];
// The port may be destroyed, and another one created at the same address, but this is safe, as the worst that can happen
// as a result is that dispatchMessages() will be called needlessly.
- if (m_messagePorts.contains(port) && port->queueIsOpen())
+ if (m_messagePorts.contains(port) && port->started())
port->dispatchMessages();
}
}
diff --git a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp
index ff8f1c3..1831f3a 100644
--- a/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp
+++ b/src/3rdparty/webkit/WebCore/dom/SelectElement.cpp
@@ -198,8 +198,9 @@ void SelectElement::menuListOnChange(SelectElementData& data, Element* element)
ASSERT(data.usesMenuList());
int selected = selectedIndex(data, element);
- if (data.lastOnChangeIndex() != selected) {
+ if (data.lastOnChangeIndex() != selected && data.userDrivenChange()) {
data.setLastOnChangeIndex(selected);
+ data.setUserDrivenChange(false);
element->dispatchFormControlChangeEvent();
}
}
@@ -309,7 +310,7 @@ int SelectElement::selectedIndex(const SelectElementData& data, const Element* e
return -1;
}
-void SelectElement::setSelectedIndex(SelectElementData& data, Element* element, int optionIndex, bool deselect, bool fireOnChange)
+void SelectElement::setSelectedIndex(SelectElementData& data, Element* element, int optionIndex, bool deselect, bool fireOnChangeNow, bool userDrivenChange)
{
const Vector<Element*>& items = data.listItems(element);
int listIndex = optionToListIndex(data, element, optionIndex);
@@ -335,9 +336,12 @@ void SelectElement::setSelectedIndex(SelectElementData& data, Element* element,
scrollToSelection(data, element);
- // This only gets called with fireOnChange for menu lists.
- if (fireOnChange && data.usesMenuList())
- menuListOnChange(data, element);
+ // This only gets called with fireOnChangeNow for menu lists.
+ if (data.usesMenuList()) {
+ data.setUserDrivenChange(userDrivenChange);
+ if (fireOnChangeNow)
+ menuListOnChange(data, element);
+ }
if (Frame* frame = element->document()->frame())
frame->page()->chrome()->client()->formStateDidChange(element);
diff --git a/src/3rdparty/webkit/WebCore/dom/SelectElement.h b/src/3rdparty/webkit/WebCore/dom/SelectElement.h
index bad9b79..29187ae 100644
--- a/src/3rdparty/webkit/WebCore/dom/SelectElement.h
+++ b/src/3rdparty/webkit/WebCore/dom/SelectElement.h
@@ -57,7 +57,8 @@ public:
virtual int optionToListIndex(int optionIndex) const = 0;
virtual int selectedIndex() const = 0;
- virtual void setSelectedIndex(int index, bool deselect = true, bool fireOnChange = false) = 0;
+ virtual void setSelectedIndex(int index, bool deselect = true) = 0;
+ virtual void setSelectedIndexByUser(int index, bool deselect = true, bool fireOnChangeNow = false) = 0;
protected:
virtual ~SelectElement() { }
@@ -78,7 +79,7 @@ protected:
static void setRecalcListItems(SelectElementData&, Element*);
static void recalcListItems(SelectElementData&, const Element*, bool updateSelectedStates = true);
static int selectedIndex(const SelectElementData&, const Element*);
- static void setSelectedIndex(SelectElementData&, Element*, int optionIndex, bool deselect = true, bool fireOnChange = false);
+ static void setSelectedIndex(SelectElementData&, Element*, int optionIndex, bool deselect = true, bool fireOnChangeNow = false, bool userDrivenChange = true);
static int optionToListIndex(const SelectElementData&, const Element*, int optionIndex);
static int listToOptionIndex(const SelectElementData&, const Element*, int listIndex);
static void dispatchFocusEvent(SelectElementData&, Element*);
@@ -117,6 +118,9 @@ public:
int lastOnChangeIndex() const { return m_lastOnChangeIndex; }
void setLastOnChangeIndex(int value) { m_lastOnChangeIndex = value; }
+ bool userDrivenChange() const { return m_userDrivenChange; }
+ void setUserDrivenChange(bool value) { m_userDrivenChange = value; }
+
Vector<bool>& lastOnChangeSelection() { return m_lastOnChangeSelection; }
bool activeSelectionState() const { return m_activeSelectionState; }
@@ -154,6 +158,7 @@ private:
int m_lastOnChangeIndex;
Vector<bool> m_lastOnChangeSelection;
+ bool m_userDrivenChange;
bool m_activeSelectionState;
int m_activeSelectionAnchorIndex;
diff --git a/src/3rdparty/webkit/WebCore/dom/StaticStringList.cpp b/src/3rdparty/webkit/WebCore/dom/StaticStringList.cpp
deleted file mode 100644
index a6de92a..0000000
--- a/src/3rdparty/webkit/WebCore/dom/StaticStringList.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2009 Apple 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 COMPUTER, 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 COMPUTER, 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.
- *
- */
-
-#include "config.h"
-#include "StaticStringList.h"
-
-namespace WebCore {
-
-StaticStringList::StaticStringList(const Vector<String>& strings)
- : m_strings(strings)
-{
-}
-
-StaticStringList::StaticStringList()
-{
-}
-
-StaticStringList::~StaticStringList()
-{
-}
-
-unsigned StaticStringList::length() const
-{
- return m_strings.size();
-}
-
-String StaticStringList::item(unsigned index) const
-{
- if (index >= m_strings.size())
- return "";
- return m_strings[index];
-}
-
-bool StaticStringList::contains(const String& str) const
-{
- size_t count = m_strings.size();
- for (size_t i = 0; i < count; ++i) {
- if (m_strings[i] == str)
- return true;
- }
- return false;
-}
-
-} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/dom/StaticStringList.h b/src/3rdparty/webkit/WebCore/dom/StaticStringList.h
deleted file mode 100644
index 5b13e87..0000000
--- a/src/3rdparty/webkit/WebCore/dom/StaticStringList.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2009 Apple 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 COMPUTER, 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 COMPUTER, 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 StaticStringList_h
-#define StaticStringList_h
-
-#include "DOMStringList.h"
-
-namespace WebCore {
-
- class StaticStringList : public DOMStringList {
- public:
- static PassRefPtr<StaticStringList> create(const Vector<String>& strings)
- {
- return adoptRef(new StaticStringList(strings));
- }
- static PassRefPtr<StaticStringList> adopt(Vector<String>& strings)
- {
- StaticStringList* newList = new StaticStringList;
- newList->m_strings.swap(strings);
- return adoptRef(newList);
- }
- virtual ~StaticStringList();
-
- virtual unsigned length() const;
- virtual String item(unsigned) const;
- virtual bool contains(const String&) const;
-
- private:
- StaticStringList(const Vector<String>&);
- StaticStringList();
-
- Vector<String> m_strings;
- };
-
-} // namespace WebCore
-
-#endif // StaticStringList
diff --git a/src/3rdparty/webkit/WebCore/dom/Tokenizer.h b/src/3rdparty/webkit/WebCore/dom/Tokenizer.h
index f9c6dc4..ea303f9 100644
--- a/src/3rdparty/webkit/WebCore/dom/Tokenizer.h
+++ b/src/3rdparty/webkit/WebCore/dom/Tokenizer.h
@@ -28,6 +28,7 @@
namespace WebCore {
class SegmentedString;
+ class XSSAuditor;
class Tokenizer {
public:
@@ -58,11 +59,15 @@ namespace WebCore {
virtual void executeScriptsWaitingForStylesheets() {}
virtual bool isHTMLTokenizer() const { return false; }
+
+ XSSAuditor* xssAuditor() const { return m_XSSAuditor; }
+ void setXSSAuditor(XSSAuditor* auditor) { m_XSSAuditor = auditor; }
protected:
Tokenizer(bool viewSourceMode = false)
: m_parserStopped(false)
, m_inViewSourceMode(viewSourceMode)
+ , m_XSSAuditor(0)
{
}
@@ -71,6 +76,9 @@ namespace WebCore {
// even when it has buffered data.
bool m_parserStopped;
bool m_inViewSourceMode;
+
+ // The XSSAuditor associated with this tokenizer.
+ XSSAuditor* m_XSSAuditor;
};
} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.cpp b/src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.cpp
new file mode 100644
index 0000000..80ab7c8
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.cpp
@@ -0,0 +1,222 @@
+/*
+ * Copyright (C) 2009 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.
+ */
+
+#include "config.h"
+#include "PlatformMessagePortChannel.h"
+
+#include "MessagePort.h"
+#include "ScriptExecutionContext.h"
+
+namespace WebCore {
+
+// MessagePortChannel implementations - just delegate to the PlatformMessagePortChannel.
+bool MessagePortChannel::entangleIfOpen(MessagePort* port)
+{
+ return m_channel->entangleIfOpen(port);
+}
+
+void MessagePortChannel::disentangle()
+{
+ m_channel->disentangle();
+}
+
+void MessagePortChannel::postMessageToRemote(PassOwnPtr<MessagePortChannel::EventData> message)
+{
+ m_channel->postMessageToRemote(message);
+}
+
+bool MessagePortChannel::tryGetMessageFromRemote(OwnPtr<MessagePortChannel::EventData>& result)
+{
+ return m_channel->tryGetMessageFromRemote(result);
+}
+
+void MessagePortChannel::close()
+{
+ m_channel->close();
+}
+
+bool MessagePortChannel::isConnectedTo(MessagePort* port)
+{
+ return m_channel->isConnectedTo(port);
+}
+
+bool MessagePortChannel::hasPendingActivity()
+{
+ return m_channel->hasPendingActivity();
+}
+
+MessagePort* MessagePortChannel::locallyEntangledPort(const ScriptExecutionContext* context)
+{
+ return m_channel->locallyEntangledPort(context);
+}
+
+PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::create(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing)
+{
+ return adoptRef(new PlatformMessagePortChannel(incoming, outgoing));
+}
+
+PlatformMessagePortChannel::PlatformMessagePortChannel(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing)
+ : m_entangledChannel(0)
+ , m_incomingQueue(incoming)
+ , m_outgoingQueue(outgoing)
+ , m_remotePort(0)
+{
+}
+
+PlatformMessagePortChannel::~PlatformMessagePortChannel()
+{
+}
+
+void PlatformMessagePortChannel::createChannel(PassRefPtr<MessagePort> port1, PassRefPtr<MessagePort> port2)
+{
+ // Create incoming/outgoing queues.
+ RefPtr<PlatformMessagePortChannel::MessagePortQueue> queue1 = PlatformMessagePortChannel::MessagePortQueue::create();
+ RefPtr<PlatformMessagePortChannel::MessagePortQueue> queue2 = PlatformMessagePortChannel::MessagePortQueue::create();
+
+ // Create proxies for each endpoint.
+ RefPtr<PlatformMessagePortChannel> channel1 = PlatformMessagePortChannel::create(queue1, queue2);
+ RefPtr<PlatformMessagePortChannel> channel2 = PlatformMessagePortChannel::create(queue2, queue1);
+
+ // Entangle the two endpoints.
+ channel1->setEntangledChannel(channel2);
+ channel2->setEntangledChannel(channel1);
+
+ // Now entangle the proxies with the appropriate local ports.
+ port1->entangle(MessagePortChannel::create(channel2));
+ port2->entangle(MessagePortChannel::create(channel1));
+}
+
+bool PlatformMessagePortChannel::entangleIfOpen(MessagePort* port)
+{
+ // We can't call member functions on our remote pair while holding our mutex or we'll deadlock, but we need to guard against the remote port getting closed/freed, so create a standalone reference.
+ RefPtr<PlatformMessagePortChannel> remote = entangledChannel();
+ if (!remote)
+ return false;
+ remote->setRemotePort(port);
+ return true;
+}
+
+void PlatformMessagePortChannel::disentangle()
+{
+ RefPtr<PlatformMessagePortChannel> remote = entangledChannel();
+ if (remote)
+ remote->setRemotePort(0);
+}
+
+void PlatformMessagePortChannel::setRemotePort(MessagePort* port)
+{
+ MutexLocker lock(m_mutex);
+ // Should never set port if it is already set.
+ ASSERT(!port || !m_remotePort);
+ m_remotePort = port;
+}
+
+MessagePort* PlatformMessagePortChannel::remotePort()
+{
+ MutexLocker lock(m_mutex);
+ return m_remotePort;
+}
+
+PassRefPtr<PlatformMessagePortChannel> PlatformMessagePortChannel::entangledChannel()
+{
+ MutexLocker lock(m_mutex);
+ return m_entangledChannel;
+}
+
+void PlatformMessagePortChannel::setEntangledChannel(PassRefPtr<PlatformMessagePortChannel> remote)
+{
+ MutexLocker lock(m_mutex);
+ // Should only be set as part of initial creation/entanglement.
+ if (remote)
+ ASSERT(!m_entangledChannel.get());
+ m_entangledChannel = remote;
+}
+
+void PlatformMessagePortChannel::postMessageToRemote(PassOwnPtr<MessagePortChannel::EventData> message)
+{
+ MutexLocker lock(m_mutex);
+ if (!m_outgoingQueue)
+ return;
+ bool wasEmpty = m_outgoingQueue->appendAndCheckEmpty(message);
+ if (wasEmpty && m_remotePort)
+ m_remotePort->messageAvailable();
+}
+
+bool PlatformMessagePortChannel::tryGetMessageFromRemote(OwnPtr<MessagePortChannel::EventData>& result)
+{
+ MutexLocker lock(m_mutex);
+ return m_incomingQueue->tryGetMessage(result);
+}
+
+bool PlatformMessagePortChannel::isConnectedTo(MessagePort* port)
+{
+ MutexLocker lock(m_mutex);
+ return m_remotePort == port;
+}
+
+// Closes the port so no further messages can be sent from either end.
+void PlatformMessagePortChannel::close()
+{
+ RefPtr<PlatformMessagePortChannel> remote = entangledChannel();
+ if (!remote)
+ return;
+ closeInternal();
+ remote->closeInternal();
+}
+
+void PlatformMessagePortChannel::closeInternal()
+{
+ MutexLocker lock(m_mutex);
+ // Disentangle ourselves from the other end. We still maintain a reference to our incoming queue, since previously-existing messages should still be delivered.
+ m_remotePort = 0;
+ m_entangledChannel = 0;
+ m_outgoingQueue = 0;
+}
+
+bool PlatformMessagePortChannel::hasPendingActivity()
+{
+ MutexLocker lock(m_mutex);
+ return !m_incomingQueue->isEmpty();
+}
+
+MessagePort* PlatformMessagePortChannel::locallyEntangledPort(const ScriptExecutionContext* context)
+{
+ MutexLocker lock(m_mutex);
+ // See if both contexts are run by the same thread (are the same context, or are both documents).
+ if (m_remotePort) {
+ // The remote port's ScriptExecutionContext is guaranteed not to change here - MessagePort::contextDestroyed() will close the port before the context goes away, and close() will block because we are holding the mutex.
+ ScriptExecutionContext* remoteContext = m_remotePort->scriptExecutionContext();
+ if (remoteContext == context || (remoteContext && remoteContext->isDocument() && context->isDocument()))
+ return m_remotePort;
+ }
+ return 0;
+}
+
+} // namespace WebCore
diff --git a/src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.h b/src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.h
new file mode 100644
index 0000000..0ce2d13
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/dom/default/PlatformMessagePortChannel.h
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2009 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 PlatformMessagePortChannel_h
+#define PlatformMessagePortChannel_h
+
+#include "MessagePortChannel.h"
+
+#include <wtf/MessageQueue.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/Threading.h>
+
+namespace WebCore {
+
+ class MessagePort;
+
+ // PlatformMessagePortChannel is a platform-dependent interface to the remote side of a message channel.
+ // This default implementation supports multiple threads running within a single process. Implementations for multi-process platforms should define these public APIs in their own platform-specific PlatformMessagePortChannel file.
+ // The goal of this implementation is to eliminate contention except when cloning or closing the port, so each side of the channel has its own separate mutex.
+ class PlatformMessagePortChannel : public ThreadSafeShared<PlatformMessagePortChannel> {
+ public:
+ static void createChannel(PassRefPtr<MessagePort>, PassRefPtr<MessagePort>);
+
+ // APIs delegated from MessagePortChannel.h
+ bool entangleIfOpen(MessagePort*);
+ void disentangle();
+ void postMessageToRemote(PassOwnPtr<MessagePortChannel::EventData>);
+ bool tryGetMessageFromRemote(OwnPtr<MessagePortChannel::EventData>&);
+ void close();
+ bool isConnectedTo(MessagePort*);
+ bool hasPendingActivity();
+ MessagePort* locallyEntangledPort(const ScriptExecutionContext*);
+
+ // Wrapper for MessageQueue that allows us to do thread safe sharing by two proxies.
+ class MessagePortQueue : public ThreadSafeShared<MessagePortQueue> {
+ public:
+ static PassRefPtr<MessagePortQueue> create() { return adoptRef(new MessagePortQueue()); }
+
+ bool tryGetMessage(OwnPtr<MessagePortChannel::EventData>& message)
+ {
+ MessagePortChannel::EventData* holder = 0;
+ bool messageAvailable = m_queue.tryGetMessage(holder);
+ if (messageAvailable)
+ message.set(holder);
+ return messageAvailable;
+ }
+
+ bool appendAndCheckEmpty(PassOwnPtr<MessagePortChannel::EventData> message)
+ {
+ return m_queue.appendAndCheckEmpty(message.release());
+ }
+
+ bool isEmpty()
+ {
+ return m_queue.isEmpty();
+ }
+
+ ~MessagePortQueue()
+ {
+ // Manually free any items left in the queue, since we can't use OwnPtr internally.
+ MessagePortChannel::EventData* data = 0;
+ while (m_queue.tryGetMessage(data))
+ delete data;
+ }
+ private:
+ MessagePortQueue() { }
+
+ // OwnPtr is Noncopyable, so we can't use it as the template type in a MessageQueue. So we just store a pointer to EventData and manually free it in the destructor.
+ // FIXME: Use a lock-free queue implementation to completely eliminate contention when sending/receiving messages.
+ MessageQueue<MessagePortChannel::EventData*> m_queue;
+ };
+
+ ~PlatformMessagePortChannel();
+
+ private:
+ static PassRefPtr<PlatformMessagePortChannel> create(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing);
+ PlatformMessagePortChannel(PassRefPtr<MessagePortQueue> incoming, PassRefPtr<MessagePortQueue> outgoing);
+
+ PassRefPtr<PlatformMessagePortChannel> entangledChannel();
+ void setEntangledChannel(PassRefPtr<PlatformMessagePortChannel>);
+
+ void setRemotePort(MessagePort*);
+ MessagePort* remotePort();
+ void closeInternal();
+
+ // Mutex used to ensure exclusive access to the object internals.
+ Mutex m_mutex;
+
+ // Pointer to our entangled pair - cleared when close() is called.
+ RefPtr<PlatformMessagePortChannel> m_entangledChannel;
+
+ // Reference to the message queue for the (local) entangled port.
+ RefPtr<MessagePortQueue> m_incomingQueue;
+ RefPtr<MessagePortQueue> m_outgoingQueue;
+
+ // The port we are connected to (the remote port) - this is the port that is notified when new messages arrive.
+ MessagePort* m_remotePort;
+ };
+
+} // namespace WebCore
+
+#endif // PlatformMessagePortChannel_h