summaryrefslogtreecommitdiffstats
path: root/WebCore/dom
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/dom')
-rw-r--r--WebCore/dom/ActiveDOMObject.cpp6
-rw-r--r--WebCore/dom/CustomEvent.h2
-rw-r--r--WebCore/dom/Document.cpp14
-rw-r--r--WebCore/dom/Document.h9
-rw-r--r--WebCore/dom/DocumentFragment.cpp3
-rw-r--r--WebCore/dom/DocumentParser.h4
-rw-r--r--WebCore/dom/Element.cpp10
-rw-r--r--WebCore/dom/Element.h2
-rw-r--r--WebCore/dom/Event.cpp2
-rw-r--r--WebCore/dom/Event.h2
-rw-r--r--WebCore/dom/EventNames.h2
-rw-r--r--WebCore/dom/EventTarget.h2
-rw-r--r--WebCore/dom/InputElement.h5
-rw-r--r--WebCore/dom/MessagePort.cpp17
-rw-r--r--WebCore/dom/MessagePort.h2
-rw-r--r--WebCore/dom/NameNodeList.h2
-rw-r--r--WebCore/dom/Node.cpp5
-rw-r--r--WebCore/dom/Node.h21
-rw-r--r--WebCore/dom/Node.idl3
-rw-r--r--WebCore/dom/NodeRareData.h2
-rw-r--r--WebCore/dom/OverflowEvent.h4
-rw-r--r--WebCore/dom/OverflowEvent.idl3
-rw-r--r--WebCore/dom/PendingScript.h25
-rw-r--r--WebCore/dom/QualifiedName.h2
-rw-r--r--WebCore/dom/Range.cpp5
-rw-r--r--WebCore/dom/ScriptElement.cpp2
-rw-r--r--WebCore/dom/ScriptExecutionContext.cpp57
-rw-r--r--WebCore/dom/ScriptExecutionContext.h24
-rw-r--r--WebCore/dom/SpaceSplitString.h2
-rw-r--r--WebCore/dom/TagNodeList.h2
-rw-r--r--WebCore/dom/TextEvent.cpp42
-rw-r--r--WebCore/dom/TextEvent.h34
-rw-r--r--WebCore/dom/XMLDocumentParser.h2
-rw-r--r--WebCore/dom/XMLDocumentParserLibxml2.cpp2
-rw-r--r--WebCore/dom/XMLDocumentParserQt.cpp2
-rwxr-xr-xWebCore/dom/make_names.pl8
36 files changed, 229 insertions, 102 deletions
diff --git a/WebCore/dom/ActiveDOMObject.cpp b/WebCore/dom/ActiveDOMObject.cpp
index 31afe98..98c9761 100644
--- a/WebCore/dom/ActiveDOMObject.cpp
+++ b/WebCore/dom/ActiveDOMObject.cpp
@@ -37,8 +37,10 @@ ActiveDOMObject::ActiveDOMObject(ScriptExecutionContext* scriptExecutionContext,
: m_scriptExecutionContext(scriptExecutionContext)
, m_pendingActivityCount(0)
{
- ASSERT(m_scriptExecutionContext->isContextThread());
- m_scriptExecutionContext->createdActiveDOMObject(this, upcastPointer);
+ if (m_scriptExecutionContext) {
+ ASSERT(m_scriptExecutionContext->isContextThread());
+ m_scriptExecutionContext->createdActiveDOMObject(this, upcastPointer);
+ }
}
ActiveDOMObject::~ActiveDOMObject()
diff --git a/WebCore/dom/CustomEvent.h b/WebCore/dom/CustomEvent.h
index d287a65..8372af2 100644
--- a/WebCore/dom/CustomEvent.h
+++ b/WebCore/dom/CustomEvent.h
@@ -26,9 +26,9 @@
#ifndef CustomEvent_h
#define CustomEvent_h
-#include "AtomicString.h"
#include "Event.h"
#include "ScriptValue.h"
+#include <wtf/text/AtomicString.h>
namespace WebCore {
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 539d43f..20c6b16 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -89,7 +89,6 @@
#include "InspectorController.h"
#include "InspectorTimelineAgent.h"
#include "KeyboardEvent.h"
-#include "LegacyHTMLDocumentParser.h"
#include "LegacyHTMLTreeBuilder.h"
#include "Logging.h"
#include "MessageEvent.h"
@@ -122,7 +121,6 @@
#include "SelectionController.h"
#include "Settings.h"
#include "StaticHashSetNodeList.h"
-#include "StringBuffer.h"
#include "StyleSheetList.h"
#include "TextEvent.h"
#include "TextIterator.h"
@@ -146,6 +144,7 @@
#include <wtf/MainThread.h>
#include <wtf/PassRefPtr.h>
#include <wtf/StdLibExtras.h>
+#include <wtf/text/StringBuffer.h>
#if ENABLE(SHARED_WORKERS)
#include "SharedWorkerRepository.h"
@@ -431,7 +430,8 @@ Document::Document(Frame* frame, const KURL& url, bool isXHTML, bool isHTML)
m_pageGroupUserSheetCacheValid = false;
m_printing = false;
-
+ m_paginatedForScreen = false;
+
m_ignoreAutofocus = false;
m_frame = frame;
@@ -860,7 +860,7 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
}
default:
if (source->hasTagName(iframeTag))
- static_cast<HTMLIFrameElement*>(source.get())->setRemainsAliveOnRemovalFromTree(attached());
+ static_cast<HTMLIFrameElement*>(source.get())->setRemainsAliveOnRemovalFromTree(attached() && source->attached());
if (source->parentNode())
source->parentNode()->removeChild(source.get(), ec);
@@ -2271,7 +2271,7 @@ const Vector<RefPtr<CSSStyleSheet> >* Document::pageGroupUserSheets() const
if (!UserContentURLPattern::matchesPatterns(url(), sheet->whitelist(), sheet->blacklist()))
continue;
RefPtr<CSSStyleSheet> parsedSheet = CSSStyleSheet::createInline(const_cast<Document*>(this), sheet->url());
- parsedSheet->setIsUserStyleSheet(true);
+ parsedSheet->setIsUserStyleSheet(sheet->level() == UserStyleSheet::UserLevel);
parsedSheet->parseString(sheet->source(), !inCompatMode());
if (!m_pageGroupUserSheets)
m_pageGroupUserSheets.set(new Vector<RefPtr<CSSStyleSheet> >);
@@ -3707,8 +3707,8 @@ HTMLMapElement* Document::getImageMap(const String& url) const
{
if (url.isNull())
return 0;
- int hashPos = url.find('#');
- String name = (hashPos < 0 ? url : url.substring(hashPos + 1)).impl();
+ size_t hashPos = url.find('#');
+ String name = (hashPos == notFound ? url : url.substring(hashPos + 1)).impl();
AtomicString mapName = isHTMLDocument() ? name.lower() : name;
m_imageMapsByName.checkConsistency();
return m_imageMapsByName.get(mapName.impl());
diff --git a/WebCore/dom/Document.h b/WebCore/dom/Document.h
index ebe22cb..fc57ddb 100644
--- a/WebCore/dom/Document.h
+++ b/WebCore/dom/Document.h
@@ -32,7 +32,6 @@
#include "CollectionType.h"
#include "Color.h"
#include "ContainerNode.h"
-#include "Document.h"
#include "DocumentMarker.h"
#include "QualifiedName.h"
#include "ScriptExecutionContext.h"
@@ -571,6 +570,11 @@ public:
bool printing() const { return m_printing; }
void setPrinting(bool p) { m_printing = p; }
+ bool paginatedForScreen() const { return m_paginatedForScreen; }
+ void setPaginatedForScreen(bool p) { m_paginatedForScreen = p; }
+
+ bool paginated() const { return printing() || paginatedForScreen(); }
+
enum ParseMode { Compat, AlmostStrict, Strict };
void setParseMode(ParseMode m) { m_parseMode = m; }
@@ -1121,7 +1125,8 @@ private:
mutable bool m_pageGroupUserSheetCacheValid;
bool m_printing;
-
+ bool m_paginatedForScreen;
+
bool m_ignoreAutofocus;
ParseMode m_parseMode;
diff --git a/WebCore/dom/DocumentFragment.cpp b/WebCore/dom/DocumentFragment.cpp
index 47485b7..70e57b9 100644
--- a/WebCore/dom/DocumentFragment.cpp
+++ b/WebCore/dom/DocumentFragment.cpp
@@ -25,7 +25,6 @@
#include "Document.h"
#include "HTMLDocumentParser.h"
-#include "LegacyHTMLDocumentParser.h"
#include "Page.h"
#include "Settings.h"
#include "XMLDocumentParser.h"
@@ -84,8 +83,6 @@ bool DocumentFragment::shouldUseLegacyHTMLParser() const
void DocumentFragment::parseHTML(const String& source, Element* contextElement, FragmentScriptingPermission scriptingPermission)
{
- if (shouldUseLegacyHTMLParser())
- return LegacyHTMLDocumentParser::parseDocumentFragment(source, this, scriptingPermission);
HTMLDocumentParser::parseDocumentFragment(source, this, contextElement, scriptingPermission);
}
diff --git a/WebCore/dom/DocumentParser.h b/WebCore/dom/DocumentParser.h
index a3545b6..e942d1f 100644
--- a/WebCore/dom/DocumentParser.h
+++ b/WebCore/dom/DocumentParser.h
@@ -58,8 +58,8 @@ public:
virtual void stopParsing() { m_parserStopped = true; }
// FIXME: processingData() is only used by DocumentLoader::isLoadingInAPISense
- // and is very unclear as to what it actually means. Only LegacyHTMLDocumentParser
- // actually implements it.
+ // and is very unclear as to what it actually means. The LegacyHTMLDocumentParser
+ // used to implements it.
virtual bool processingData() const { return false; }
// FIXME: Exposed for HTMLFormControlElement::removedFromTree. HTML DOM
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index 0e89e93..849b900 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -50,6 +50,7 @@
#include "RenderLayer.h"
#include "RenderView.h"
#include "RenderWidget.h"
+#include "Settings.h"
#include "TextIterator.h"
#include "XMLNames.h"
#include <wtf/text/CString.h>
@@ -90,7 +91,7 @@ NodeRareData* Element::createRareData()
return new ElementRareData;
}
-PassRefPtr<DocumentFragment> Element::createContextualFragment(const String& markup, FragmentScriptingPermission scriptingPermission)
+PassRefPtr<DocumentFragment> Element::deprecatedCreateContextualFragment(const String& markup, FragmentScriptingPermission scriptingPermission)
{
RefPtr<DocumentFragment> fragment = document()->createDocumentFragment();
@@ -101,14 +102,14 @@ PassRefPtr<DocumentFragment> Element::createContextualFragment(const String& mar
// FIXME: We should propagate a syntax error exception out here.
return 0;
}
-
+
// Exceptions are ignored because none ought to happen here.
ExceptionCode ignoredExceptionCode;
-
+
// We need to pop <html> and <body> elements and remove <head> to
// accommodate folks passing complete HTML documents to make the
// child of an element.
-
+
RefPtr<Node> nextNode;
for (RefPtr<Node> node = fragment->firstChild(); node; node = nextNode) {
nextNode = node->nextSibling();
@@ -131,7 +132,6 @@ PassRefPtr<DocumentFragment> Element::createContextualFragment(const String& mar
ASSERT(!ignoredExceptionCode);
}
}
-
return fragment.release();
}
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index a66809a..694db98 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -95,7 +95,7 @@ public:
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
#endif
- virtual PassRefPtr<DocumentFragment> createContextualFragment(const String&, FragmentScriptingPermission = FragmentScriptingAllowed);
+ virtual PassRefPtr<DocumentFragment> deprecatedCreateContextualFragment(const String&, FragmentScriptingPermission = FragmentScriptingAllowed);
bool hasAttribute(const QualifiedName&) const;
const AtomicString& getAttribute(const QualifiedName&) const;
diff --git a/WebCore/dom/Event.cpp b/WebCore/dom/Event.cpp
index 1aab5c7..c76f951 100644
--- a/WebCore/dom/Event.cpp
+++ b/WebCore/dom/Event.cpp
@@ -23,9 +23,9 @@
#include "config.h"
#include "Event.h"
-#include "AtomicString.h"
#include "UserGestureIndicator.h"
#include <wtf/CurrentTime.h>
+#include <wtf/text/AtomicString.h>
namespace WebCore {
diff --git a/WebCore/dom/Event.h b/WebCore/dom/Event.h
index e18258c..b992237 100644
--- a/WebCore/dom/Event.h
+++ b/WebCore/dom/Event.h
@@ -24,9 +24,9 @@
#ifndef Event_h
#define Event_h
-#include "AtomicString.h"
#include "EventTarget.h"
#include <wtf/RefCounted.h>
+#include <wtf/text/AtomicString.h>
namespace WebCore {
diff --git a/WebCore/dom/EventNames.h b/WebCore/dom/EventNames.h
index 6c67b9f..4c5a08a 100644
--- a/WebCore/dom/EventNames.h
+++ b/WebCore/dom/EventNames.h
@@ -22,8 +22,8 @@
#ifndef EventNames_h
#define EventNames_h
-#include "AtomicString.h"
#include "ThreadGlobalData.h"
+#include <wtf/text/AtomicString.h>
namespace WebCore {
diff --git a/WebCore/dom/EventTarget.h b/WebCore/dom/EventTarget.h
index 406c2fd..b4aa542 100644
--- a/WebCore/dom/EventTarget.h
+++ b/WebCore/dom/EventTarget.h
@@ -32,11 +32,11 @@
#ifndef EventTarget_h
#define EventTarget_h
-#include "AtomicStringHash.h"
#include "EventNames.h"
#include "RegisteredEventListener.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
+#include <wtf/text/AtomicStringHash.h>
namespace WebCore {
diff --git a/WebCore/dom/InputElement.h b/WebCore/dom/InputElement.h
index dc87b3d..56fc99d 100644
--- a/WebCore/dom/InputElement.h
+++ b/WebCore/dom/InputElement.h
@@ -21,8 +21,8 @@
#ifndef InputElement_h
#define InputElement_h
-#include "AtomicString.h"
#include "PlatformString.h"
+#include <wtf/text/AtomicString.h>
namespace WebCore {
@@ -43,6 +43,9 @@ public:
virtual bool isPasswordField() const = 0;
virtual bool isSearchField() const = 0;
virtual bool isTextField() const = 0;
+ virtual bool isRadioButton() const = 0;
+ virtual bool isCheckbox() const = 0;
+
virtual bool supportsMaxLength() const = 0;
virtual bool hasSpinButton() const { return false; }
#if ENABLE(INPUT_SPEECH)
diff --git a/WebCore/dom/MessagePort.cpp b/WebCore/dom/MessagePort.cpp
index 1051920..1b7aea7 100644
--- a/WebCore/dom/MessagePort.cpp
+++ b/WebCore/dom/MessagePort.cpp
@@ -20,14 +20,13 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "config.h"
#include "MessagePort.h"
-#include "AtomicString.h"
#include "DOMWindow.h"
#include "Document.h"
#include "EventException.h"
@@ -35,6 +34,7 @@
#include "MessageEvent.h"
#include "SecurityOrigin.h"
#include "Timer.h"
+#include <wtf/text/AtomicString.h>
namespace WebCore {
@@ -72,7 +72,7 @@ void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, Excepti
void MessagePort::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionCode& ec)
{
- if (!m_entangledChannel)
+ if (!isEntangled())
return;
ASSERT(m_scriptExecutionContext);
@@ -118,8 +118,8 @@ void MessagePort::messageAvailable()
void MessagePort::start()
{
- // Do nothing if we've been cloned
- if (!m_entangledChannel)
+ // Do nothing if we've been cloned or closed.
+ if (!isEntangled())
return;
ASSERT(m_scriptExecutionContext);
@@ -133,7 +133,7 @@ void MessagePort::start()
void MessagePort::close()
{
m_closed = true;
- if (!m_entangledChannel)
+ if (!isEntangled())
return;
m_entangledChannel->close();
}
@@ -152,8 +152,9 @@ void MessagePort::entangle(PassOwnPtr<MessagePortChannel> remote)
void MessagePort::contextDestroyed()
{
ASSERT(m_scriptExecutionContext);
- // Must close port before blowing away the cached context, to ensure that we get no more calls to messageAvailable().
- close();
+ // Must be closed before blowing away the cached context, to ensure that we get no more calls to messageAvailable().
+ // ScriptExecutionContext::closeMessagePorts() takes care of that.
+ ASSERT(m_closed);
m_scriptExecutionContext = 0;
}
diff --git a/WebCore/dom/MessagePort.h b/WebCore/dom/MessagePort.h
index 10426e5..1287834 100644
--- a/WebCore/dom/MessagePort.h
+++ b/WebCore/dom/MessagePort.h
@@ -27,7 +27,6 @@
#ifndef MessagePort_h
#define MessagePort_h
-#include "AtomicStringHash.h"
#include "EventListener.h"
#include "EventTarget.h"
#include "MessagePortChannel.h"
@@ -37,6 +36,7 @@
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
+#include <wtf/text/AtomicStringHash.h>
namespace WebCore {
diff --git a/WebCore/dom/NameNodeList.h b/WebCore/dom/NameNodeList.h
index b7f5bfc..6a1b22e 100644
--- a/WebCore/dom/NameNodeList.h
+++ b/WebCore/dom/NameNodeList.h
@@ -24,9 +24,9 @@
#ifndef NameNodeList_h
#define NameNodeList_h
-#include "AtomicString.h"
#include "DynamicNodeList.h"
#include <wtf/Forward.h>
+#include <wtf/text/AtomicString.h>
namespace WebCore {
diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp
index 6e1bd13..98fb2e5 100644
--- a/WebCore/dom/Node.cpp
+++ b/WebCore/dom/Node.cpp
@@ -784,11 +784,6 @@ void Node::lazyAttach()
}
}
-bool Node::canLazyAttach()
-{
- return shadowAncestorNode() == this;
-}
-
void Node::setFocus(bool b)
{
if (b || hasRareData())
diff --git a/WebCore/dom/Node.h b/WebCore/dom/Node.h
index b407ac4..a1a8878 100644
--- a/WebCore/dom/Node.h
+++ b/WebCore/dom/Node.h
@@ -86,14 +86,6 @@ enum StyleChangeType {
SyntheticStyleChange = 3 << nodeStyleChangeShift
};
-const unsigned short DOCUMENT_POSITION_EQUIVALENT = 0x00;
-const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01;
-const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02;
-const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04;
-const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08;
-const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10;
-const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
-
// this class implements nodes, which can have a parent but no children:
class Node : public EventTarget, public TreeShared<Node>, public ScriptWrappable {
friend class Document;
@@ -113,7 +105,16 @@ public:
NOTATION_NODE = 12,
XPATH_NAMESPACE_NODE = 13
};
-
+ enum DocumentPosition {
+ DOCUMENT_POSITION_EQUIVALENT = 0x00,
+ DOCUMENT_POSITION_DISCONNECTED = 0x01,
+ DOCUMENT_POSITION_PRECEDING = 0x02,
+ DOCUMENT_POSITION_FOLLOWING = 0x04,
+ DOCUMENT_POSITION_CONTAINS = 0x08,
+ DOCUMENT_POSITION_CONTAINED_BY = 0x10,
+ DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20,
+ };
+
static bool isSupported(const String& feature, const String& version);
static void startIgnoringLeaks();
@@ -316,7 +317,7 @@ public:
void clearIsLink() { clearFlag(IsLinkFlag); }
void lazyAttach();
- virtual bool canLazyAttach();
+ virtual bool canLazyAttach() { return true; }
virtual void setFocus(bool b = true);
virtual void setActive(bool f = true, bool /*pause*/ = false) { setFlag(f, IsActiveFlag); }
diff --git a/WebCore/dom/Node.idl b/WebCore/dom/Node.idl
index e15b210..07046d1 100644
--- a/WebCore/dom/Node.idl
+++ b/WebCore/dom/Node.idl
@@ -28,8 +28,7 @@ module core {
EventTarget,
GenerateNativeConverter,
InlineGetOwnPropertySlot,
- Polymorphic,
- DontCheckEnums
+ Polymorphic
] Node
#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
: Object, EventTarget
diff --git a/WebCore/dom/NodeRareData.h b/WebCore/dom/NodeRareData.h
index 531fc57..ab208d2 100644
--- a/WebCore/dom/NodeRareData.h
+++ b/WebCore/dom/NodeRareData.h
@@ -26,11 +26,11 @@
#include "DynamicNodeList.h"
#include "NameNodeList.h"
#include "QualifiedName.h"
-#include "StringHash.h"
#include "TagNodeList.h"
#include <wtf/HashSet.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
+#include <wtf/text/StringHash.h>
namespace WebCore {
diff --git a/WebCore/dom/OverflowEvent.h b/WebCore/dom/OverflowEvent.h
index 9fd0ea1..f1cd2f3 100644
--- a/WebCore/dom/OverflowEvent.h
+++ b/WebCore/dom/OverflowEvent.h
@@ -33,8 +33,8 @@ namespace WebCore {
class OverflowEvent : public Event {
public:
enum orientType {
- VERTICAL = 0,
- HORIZONTAL = 1,
+ HORIZONTAL = 0,
+ VERTICAL = 1,
BOTH = 2
};
diff --git a/WebCore/dom/OverflowEvent.idl b/WebCore/dom/OverflowEvent.idl
index 74cf56b..0c1fd50 100644
--- a/WebCore/dom/OverflowEvent.idl
+++ b/WebCore/dom/OverflowEvent.idl
@@ -23,8 +23,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
module events {
- // FIXME: Converge these consts and OverflowEvent::orientType values and remove DontCheckEnums attribute.
- interface [DontCheckEnums] OverflowEvent : Event {
+ interface OverflowEvent : Event {
const unsigned short HORIZONTAL = 0;
const unsigned short VERTICAL = 1;
const unsigned short BOTH = 2;
diff --git a/WebCore/dom/PendingScript.h b/WebCore/dom/PendingScript.h
index 805f7ff..44e1e49 100644
--- a/WebCore/dom/PendingScript.h
+++ b/WebCore/dom/PendingScript.h
@@ -28,7 +28,6 @@
#include "CachedResourceClient.h"
#include "CachedResourceHandle.h"
-#include <wtf/Noncopyable.h>
#include <wtf/PassRefPtr.h>
namespace WebCore {
@@ -41,7 +40,7 @@ class Element;
// A CachedResourceHandle alone does not prevent the underlying CachedResource
// from purging its data buffer. This class holds a dummy client open for its
// lifetime in order to guarantee that the data buffer will not be purged.
-class PendingScript : public Noncopyable, CachedResourceClient {
+class PendingScript : public CachedResourceClient {
public:
PendingScript()
: m_startingLineNumber(0)
@@ -49,8 +48,30 @@ public:
{
}
+ PendingScript(const PendingScript& other)
+ : CachedResourceClient(other)
+ , m_startingLineNumber(other.m_startingLineNumber)
+ , m_watchingForLoad(other.m_watchingForLoad)
+ , m_element(other.m_element)
+ {
+ setCachedScript(other.cachedScript());
+ }
+
~PendingScript();
+ PendingScript& operator=(const PendingScript& other)
+ {
+ if (this == &other)
+ return *this;
+
+ m_startingLineNumber = other.m_startingLineNumber;
+ m_watchingForLoad = other.m_watchingForLoad;
+ m_element = other.m_element;
+ setCachedScript(other.cachedScript());
+
+ return *this;
+ }
+
// FIXME: No setter means this is never set to anything other than 0.
// This is either unnecessary or incorrect.
int startingLineNumber() const { return m_startingLineNumber; }
diff --git a/WebCore/dom/QualifiedName.h b/WebCore/dom/QualifiedName.h
index 4391570..ee90408 100644
--- a/WebCore/dom/QualifiedName.h
+++ b/WebCore/dom/QualifiedName.h
@@ -21,8 +21,8 @@
#ifndef QualifiedName_h
#define QualifiedName_h
-#include "AtomicString.h"
#include <wtf/HashTraits.h>
+#include <wtf/text/AtomicString.h>
namespace WebCore {
diff --git a/WebCore/dom/Range.cpp b/WebCore/dom/Range.cpp
index 33a21bb..d93a58e 100644
--- a/WebCore/dom/Range.cpp
+++ b/WebCore/dom/Range.cpp
@@ -1061,7 +1061,10 @@ PassRefPtr<DocumentFragment> Range::createContextualFragment(const String& marku
return 0;
}
- RefPtr<DocumentFragment> fragment = static_cast<HTMLElement*>(element)->createContextualFragment(markup);
+ // Logic from deprecatedCreateContextualFragment should just be moved into
+ // this function. Range::createContextualFragment semantics do not make
+ // sense for the rest of the DOM implementation to use.
+ RefPtr<DocumentFragment> fragment = static_cast<HTMLElement*>(element)->deprecatedCreateContextualFragment(markup);
if (!fragment) {
ec = NOT_SUPPORTED_ERR;
return 0;
diff --git a/WebCore/dom/ScriptElement.cpp b/WebCore/dom/ScriptElement.cpp
index 0262e48..8626bb4 100644
--- a/WebCore/dom/ScriptElement.cpp
+++ b/WebCore/dom/ScriptElement.cpp
@@ -39,9 +39,9 @@
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "Settings.h"
-#include "StringHash.h"
#include "Text.h"
#include <wtf/StdLibExtras.h>
+#include <wtf/text/StringHash.h>
#if ENABLE(SVG)
#include "SVGNames.h"
diff --git a/WebCore/dom/ScriptExecutionContext.cpp b/WebCore/dom/ScriptExecutionContext.cpp
index f7ac603..d014d47 100644
--- a/WebCore/dom/ScriptExecutionContext.cpp
+++ b/WebCore/dom/ScriptExecutionContext.cpp
@@ -20,7 +20,7 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
@@ -28,14 +28,15 @@
#include "ScriptExecutionContext.h"
#include "ActiveDOMObject.h"
+#include "Blob.h"
+#include "BlobURL.h"
#include "Database.h"
#include "DatabaseTask.h"
#include "DatabaseThread.h"
-#if ENABLE(BLOB) || ENABLE(FILE_WRITER)
#include "FileThread.h"
-#endif
#include "MessagePort.h"
#include "SecurityOrigin.h"
+#include "ThreadableBlobRegistry.h"
#include "WorkerContext.h"
#include "WorkerThread.h"
#include <wtf/MainThread.h>
@@ -92,6 +93,15 @@ ScriptExecutionContext::~ScriptExecutionContext()
m_fileThread = 0;
}
#endif
+
+ HashSet<Blob*>::iterator blobsEnd = m_blobs.end();
+ for (HashSet<Blob*>::iterator iter = m_blobs.begin(); iter != blobsEnd; ++iter)
+ (*iter)->contextDestroyed();
+#if ENABLE(BLOB)
+ HashSet<String>::iterator publicBlobURLsEnd = m_publicBlobURLs.end();
+ for (HashSet<String>::iterator iter = m_publicBlobURLs.begin(); iter != publicBlobURLsEnd; ++iter)
+ ThreadableBlobRegistry::unregisterBlobURL(this, KURL(ParsedURLString, *iter));
+#endif
}
#if ENABLE(DATABASE)
@@ -165,6 +175,18 @@ void ScriptExecutionContext::destroyedMessagePort(MessagePort* port)
m_messagePorts.remove(port);
}
+void ScriptExecutionContext::addBlob(Blob* blob)
+{
+ ASSERT(blob);
+ m_blobs.add(blob);
+}
+
+void ScriptExecutionContext::removeBlob(Blob* blob)
+{
+ ASSERT(blob);
+ m_blobs.remove(blob);
+}
+
bool ScriptExecutionContext::canSuspendActiveDOMObjects()
{
// No protection against m_activeDOMObjects changing during iteration: canSuspend() shouldn't execute arbitrary JS.
@@ -205,6 +227,9 @@ void ScriptExecutionContext::stopActiveDOMObjects()
ASSERT(iter->first->scriptExecutionContext() == this);
iter->first->stop();
}
+
+ // Also close MessagePorts. If they were ActiveDOMObjects (they could be) then they could be stopped instead.
+ closeMessagePorts();
}
void ScriptExecutionContext::createdActiveDOMObject(ActiveDOMObject* object, void* upcastPointer)
@@ -220,6 +245,14 @@ void ScriptExecutionContext::destroyedActiveDOMObject(ActiveDOMObject* object)
m_activeDOMObjects.remove(object);
}
+void ScriptExecutionContext::closeMessagePorts() {
+ HashSet<MessagePort*>::iterator messagePortsEnd = m_messagePorts.end();
+ for (HashSet<MessagePort*>::iterator iter = m_messagePorts.begin(); iter != messagePortsEnd; ++iter) {
+ ASSERT((*iter)->scriptExecutionContext() == this);
+ (*iter)->close();
+ }
+}
+
void ScriptExecutionContext::setSecurityOrigin(PassRefPtr<SecurityOrigin> securityOrigin)
{
m_securityOrigin = securityOrigin;
@@ -241,6 +274,24 @@ DOMTimer* ScriptExecutionContext::findTimeout(int timeoutId)
return m_timeouts.get(timeoutId);
}
+#if ENABLE(BLOB)
+KURL ScriptExecutionContext::createPublicBlobURL(Blob* blob)
+{
+ KURL publicURL = BlobURL::createURL(this);
+ ThreadableBlobRegistry::registerBlobURL(this, publicURL, blob->url());
+ m_publicBlobURLs.add(publicURL.string());
+ return publicURL;
+}
+
+void ScriptExecutionContext::revokePublicBlobURL(const KURL& url)
+{
+ if (m_publicBlobURLs.contains(url.string())) {
+ ThreadableBlobRegistry::unregisterBlobURL(this, url);
+ m_publicBlobURLs.remove(url.string());
+ }
+}
+#endif
+
#if ENABLE(BLOB) || ENABLE(FILE_WRITER)
FileThread* ScriptExecutionContext::fileThread()
{
diff --git a/WebCore/dom/ScriptExecutionContext.h b/WebCore/dom/ScriptExecutionContext.h
index d2da307..30c12e5 100644
--- a/WebCore/dom/ScriptExecutionContext.h
+++ b/WebCore/dom/ScriptExecutionContext.h
@@ -20,7 +20,7 @@
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
@@ -36,10 +36,16 @@
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Threading.h>
+#include <wtf/text/StringHash.h>
+
+#if USE(JSC)
+#include <runtime/JSGlobalData.h>
+#endif
namespace WebCore {
class ActiveDOMObject;
+ class Blob;
#if ENABLE(DATABASE)
class Database;
class DatabaseTaskSynchronizer;
@@ -88,7 +94,7 @@ namespace WebCore {
virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL) = 0;
-
+
// Active objects are not garbage collected even if inaccessible, e.g. because their activity may result in callbacks being invoked.
bool canSuspendActiveDOMObjects();
// Active objects can be asked to suspend even if canSuspendActiveDOMObjects() returns 'false' -
@@ -125,6 +131,13 @@ namespace WebCore {
void removeTimeout(int timeoutId);
DOMTimer* findTimeout(int timeoutId);
+ void addBlob(Blob*);
+ void removeBlob(Blob*);
+#if ENABLE(BLOB)
+ KURL createPublicBlobURL(Blob*);
+ void revokePublicBlobURL(const KURL&);
+#endif
+
#if USE(JSC)
JSC::JSGlobalData* globalData();
#endif
@@ -144,6 +157,8 @@ namespace WebCore {
virtual const KURL& virtualURL() const = 0;
virtual KURL virtualCompleteURL(const String&) const = 0;
+ void closeMessagePorts();
+
RefPtr<SecurityOrigin> m_securityOrigin;
HashSet<MessagePort*> m_messagePorts;
@@ -152,6 +167,11 @@ namespace WebCore {
HashMap<int, DOMTimer*> m_timeouts;
+ HashSet<Blob*> m_blobs;
+#if ENABLE(BLOB)
+ HashSet<String> m_publicBlobURLs;
+#endif
+
virtual void refScriptExecutionContext() = 0;
virtual void derefScriptExecutionContext() = 0;
diff --git a/WebCore/dom/SpaceSplitString.h b/WebCore/dom/SpaceSplitString.h
index 9fd1832..f49670b 100644
--- a/WebCore/dom/SpaceSplitString.h
+++ b/WebCore/dom/SpaceSplitString.h
@@ -21,10 +21,10 @@
#ifndef SpaceSplitString_h
#define SpaceSplitString_h
-#include "AtomicString.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
+#include <wtf/text/AtomicString.h>
namespace WebCore {
diff --git a/WebCore/dom/TagNodeList.h b/WebCore/dom/TagNodeList.h
index 1b1a038..9053b53 100644
--- a/WebCore/dom/TagNodeList.h
+++ b/WebCore/dom/TagNodeList.h
@@ -24,8 +24,8 @@
#ifndef TagNodeList_h
#define TagNodeList_h
-#include "AtomicString.h"
#include "DynamicNodeList.h"
+#include <wtf/text/AtomicString.h>
namespace WebCore {
diff --git a/WebCore/dom/TextEvent.cpp b/WebCore/dom/TextEvent.cpp
index 5dc39e3..68ed4b2 100644
--- a/WebCore/dom/TextEvent.cpp
+++ b/WebCore/dom/TextEvent.cpp
@@ -31,43 +31,63 @@
namespace WebCore {
+TextEvent::InputType TextEvent::selectInputType(bool isLineBreak, bool isBackTab)
+{
+ if (isLineBreak)
+ return TextEvent::InputTypeLineBreak;
+ if (isBackTab)
+ return TextEvent::InputTypeBackTab;
+ return TextEvent::InputTypeKeyboard;
+}
+
PassRefPtr<TextEvent> TextEvent::create()
{
return adoptRef(new TextEvent);
}
-PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data)
+PassRefPtr<TextEvent> TextEvent::create(PassRefPtr<AbstractView> view, const String& data, TextEvent::InputType inputType)
{
- return adoptRef(new TextEvent(view, data));
+ return adoptRef(new TextEvent(view, data, inputType));
}
PassRefPtr<TextEvent> TextEvent::createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace)
{
- return adoptRef(new TextEvent(view, data, 0, true, shouldSmartReplace));
+ return adoptRef(new TextEvent(view, data, 0, shouldSmartReplace, false));
}
PassRefPtr<TextEvent> TextEvent::createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle)
{
- return adoptRef(new TextEvent(view, "", data, true, shouldSmartReplace, shouldMatchStyle));
+ return adoptRef(new TextEvent(view, "", data, shouldSmartReplace, shouldMatchStyle));
+}
+
+PassRefPtr<TextEvent> TextEvent::createForDrop(PassRefPtr<AbstractView> view, const String& data)
+{
+ return adoptRef(new TextEvent(view, data, TextEvent::InputTypeDrop));
}
TextEvent::TextEvent()
- : m_isLineBreak(false)
- , m_isBackTab(false)
- , m_isPaste(false)
+ : m_inputType(TextEvent::InputTypeKeyboard)
+ , m_shouldSmartReplace(false)
+ , m_shouldMatchStyle(false)
+{
+}
+
+TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, InputType inputType)
+ : UIEvent(eventNames().textInputEvent, true, true, view, 0)
+ , m_inputType(inputType)
+ , m_data(data)
+ , m_pastingFragment(0)
, m_shouldSmartReplace(false)
, m_shouldMatchStyle(false)
{
}
TextEvent::TextEvent(PassRefPtr<AbstractView> view, const String& data, PassRefPtr<DocumentFragment> pastingFragment,
- bool isPaste, bool shouldSmartReplace, bool shouldMatchStyle)
+ bool shouldSmartReplace, bool shouldMatchStyle)
: UIEvent(eventNames().textInputEvent, true, true, view, 0)
+ , m_inputType(TextEvent::InputTypePaste)
, m_data(data)
- , m_isLineBreak(false)
- , m_isBackTab(false)
, m_pastingFragment(pastingFragment)
- , m_isPaste(isPaste)
, m_shouldSmartReplace(shouldSmartReplace)
, m_shouldMatchStyle(shouldMatchStyle)
{
diff --git a/WebCore/dom/TextEvent.h b/WebCore/dom/TextEvent.h
index 2e2eb95..f1d24e9 100644
--- a/WebCore/dom/TextEvent.h
+++ b/WebCore/dom/TextEvent.h
@@ -34,10 +34,20 @@ namespace WebCore {
class TextEvent : public UIEvent {
public:
+ enum InputType {
+ InputTypeKeyboard, // any newline characters in the text are line breaks only, not paragraph separators.
+ InputTypeLineBreak, // any tab characters in the text are backtabs.
+ InputTypeBackTab,
+ InputTypePaste,
+ InputTypeDrop,
+ };
+
+ static InputType selectInputType(bool isLineBreak, bool isBackTab);
static PassRefPtr<TextEvent> create();
- static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView> view, const String& data);
+ static PassRefPtr<TextEvent> create(PassRefPtr<AbstractView> view, const String& data, InputType = InputTypeKeyboard);
static PassRefPtr<TextEvent> createForPlainTextPaste(PassRefPtr<AbstractView> view, const String& data, bool shouldSmartReplace);
static PassRefPtr<TextEvent> createForFragmentPaste(PassRefPtr<AbstractView> view, PassRefPtr<DocumentFragment> data, bool shouldSmartReplace, bool shouldMatchStyle);
+ static PassRefPtr<TextEvent> createForDrop(PassRefPtr<AbstractView> view, const String& data);
virtual ~TextEvent();
@@ -47,30 +57,26 @@ namespace WebCore {
virtual bool isTextEvent() const;
- // If true, any newline characters in the text are line breaks only, not paragraph separators.
- bool isLineBreak() const { return m_isLineBreak; }
- void setIsLineBreak(bool isLineBreak) { m_isLineBreak = isLineBreak; }
-
- // If true, any tab characters in the text are backtabs.
- bool isBackTab() const { return m_isBackTab; }
- void setIsBackTab(bool isBackTab) { m_isBackTab = isBackTab; }
+ bool isLineBreak() const { return m_inputType == InputTypeLineBreak; }
+ bool isBackTab() const { return m_inputType == InputTypeBackTab; }
+ bool isPaste() const { return m_inputType == InputTypePaste; }
+ bool isDrop() const { return m_inputType == InputTypeDrop; }
- bool isPaste() const { return m_isPaste; }
bool shouldSmartReplace() const { return m_shouldSmartReplace; }
bool shouldMatchStyle() const { return m_shouldMatchStyle; }
DocumentFragment* pastingFragment() const { return m_pastingFragment.get(); }
private:
TextEvent();
- TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment> = 0,
- bool isPaste = false, bool shouldSmartReplace = false, bool shouldMatchStyle = false);
+ TextEvent(PassRefPtr<AbstractView>, const String& data, InputType = InputTypeKeyboard);
+ TextEvent(PassRefPtr<AbstractView>, const String& data, PassRefPtr<DocumentFragment>,
+ bool shouldSmartReplace, bool shouldMatchStyle);
+
+ InputType m_inputType;
String m_data;
- bool m_isLineBreak;
- bool m_isBackTab;
RefPtr<DocumentFragment> m_pastingFragment;
- bool m_isPaste; // FIXME: Should use inputMode after it be available: http://webkit.org/b/42805
bool m_shouldSmartReplace;
bool m_shouldMatchStyle;
};
diff --git a/WebCore/dom/XMLDocumentParser.h b/WebCore/dom/XMLDocumentParser.h
index e7e209a..141adf7 100644
--- a/WebCore/dom/XMLDocumentParser.h
+++ b/WebCore/dom/XMLDocumentParser.h
@@ -139,9 +139,9 @@ bool parseXMLDocumentFragment(const String&, DocumentFragment*, Element* parent
#include "FragmentScriptingPermission.h"
#include "ScriptableDocumentParser.h"
#include "SegmentedString.h"
-#include "StringHash.h"
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
+#include <wtf/text/StringHash.h>
#if USE(QXMLSTREAM)
#include <qxmlstream.h>
diff --git a/WebCore/dom/XMLDocumentParserLibxml2.cpp b/WebCore/dom/XMLDocumentParserLibxml2.cpp
index a6e9cd0..1309827 100644
--- a/WebCore/dom/XMLDocumentParserLibxml2.cpp
+++ b/WebCore/dom/XMLDocumentParserLibxml2.cpp
@@ -36,9 +36,9 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameView.h"
+#include "HTMLEntityParser.h"
#include "HTMLLinkElement.h"
#include "HTMLStyleElement.h"
-#include "LegacyHTMLDocumentParser.h" // for decodeNamedEntity
#include "ProcessingInstruction.h"
#include "ResourceError.h"
#include "ResourceHandle.h"
diff --git a/WebCore/dom/XMLDocumentParserQt.cpp b/WebCore/dom/XMLDocumentParserQt.cpp
index 678d141..715856c 100644
--- a/WebCore/dom/XMLDocumentParserQt.cpp
+++ b/WebCore/dom/XMLDocumentParserQt.cpp
@@ -36,9 +36,9 @@
#include "Frame.h"
#include "FrameLoader.h"
#include "FrameView.h"
+#include "HTMLEntityParser.h"
#include "HTMLLinkElement.h"
#include "HTMLStyleElement.h"
-#include "LegacyHTMLDocumentParser.h"
#include "ProcessingInstruction.h"
#include "ResourceError.h"
#include "ResourceHandle.h"
diff --git a/WebCore/dom/make_names.pl b/WebCore/dom/make_names.pl
index 4b4c7e3..e111eb7 100755
--- a/WebCore/dom/make_names.pl
+++ b/WebCore/dom/make_names.pl
@@ -647,13 +647,17 @@ printLicenseHeader($F);
print F <<END
#include "config.h"
-#include "$parameters{namespace}ElementFactory.h"
-#include "$parameters{namespace}Names.h"
END
;
print F "\n#if $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryWith};
+print F <<END
+#include "$parameters{namespace}ElementFactory.h"
+#include "$parameters{namespace}Names.h"
+END
+;
+
printElementIncludes($F);
print F <<END